:root {
  --bg: #edf2f7;
  --bg-strong: #dbe7f2;
  --surface: rgba(255, 250, 242, 0.88);
  --surface-strong: #fffdf9;
  --ink: #233127;
  --muted: #607065;
  --line: rgba(116, 90, 54, 0.18);
  --green: #196b52;
  --green-dark: #115540;
  --gold: #d39b39;
  --red: #b14e41;
  --blue: #0b5aa8;
  --blue-soft: #d9e8f7;
  --shadow: 0 20px 50px rgba(69, 47, 19, 0.12);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(11, 90, 168, 0.18), transparent 25%),
    radial-gradient(circle at 80% 12%, rgba(211, 155, 57, 0.18), transparent 18%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

body::before {
  content: "LC TRANSPORTES";
  position: fixed;
  inset: auto -120px 40px auto;
  font-size: clamp(4.5rem, 14vw, 10rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(11, 90, 168, 0.05);
  transform: rotate(-12deg);
  pointer-events: none;
  z-index: 0;
}

button,
input,
a {
  font: inherit;
}

select {
  font: inherit;
}

img {
  max-width: 100%;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(48px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.hero,
.panel,
.card {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

.update-banner {
  display: none !important;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 20px;
  background:
    linear-gradient(135deg, rgba(11, 90, 168, 0.16), rgba(25, 107, 82, 0.14)),
    rgba(255, 253, 249, 0.98);
  border: 1px solid rgba(11, 90, 168, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.update-banner h3 {
  margin-bottom: 6px;
}

.update-banner .muted {
  margin-bottom: 0;
}

.update-banner a.ghost {
  margin-top: 12px;
}

.auth-panel {
  display: grid;
  justify-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding-top: 28px;
}

.card {
  padding: 20px;
}

.auth-card {
  width: min(100%, 920px);
  padding: 30px;
  background:
    linear-gradient(145deg, rgba(11, 90, 168, 0.08), rgba(211, 155, 57, 0.08)),
    rgba(255, 253, 249, 0.96);
}

.auth-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.auth-copy {
  max-width: 560px;
}

.auth-title {
  margin-bottom: 12px;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 0.96;
}

.auth-lead {
  margin-bottom: 18px;
}

.auth-form-block {
  margin-bottom: 16px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--blue);
}

.eyebrow.small {
  margin-bottom: 6px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 0.98;
}

.lead,
.muted,
.record-meta,
.feedback,
.empty-row {
  color: var(--muted);
}

.hero-status,
.status {
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  font-weight: 600;
}

.hero-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.brand-circle {
  width: min(100%, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
}

.hero-brand-circle {
  width: 190px;
  overflow: hidden;
  border: 4px solid #0b5aa8;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(11, 90, 168, 0.14);
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-caption {
  margin: 0;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 50px;
  background: rgba(255, 255, 255, 0.95);
}

select {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 50px;
  background: rgba(255, 255, 255, 0.95);
}

input:focus {
  outline: 2px solid rgba(25, 107, 82, 0.18);
  border-color: var(--green);
}

select:focus {
  outline: 2px solid rgba(25, 107, 82, 0.18);
  border-color: var(--green);
}

button,
.ghost {
  border-radius: 18px;
  padding: 14px 16px;
  min-height: 50px;
  text-decoration: none;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover,
.ghost:hover {
  transform: translateY(-1px);
}

button:disabled,
.ghost:disabled,
.ghost[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary,
.secondary,
.danger,
.lunch {
  border: none;
  color: #fff;
  font-weight: 700;
}

.primary {
  background: var(--green);
}

.secondary {
  background: #2a7b63;
}

.lunch {
  background: var(--gold);
}

.danger {
  background: var(--red);
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 252, 245, 0.85);
  border: 1px solid var(--line);
  color: var(--ink);
}

.topbar,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.app-brand-center {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}

.app-brand-image {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #0b5aa8;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(11, 90, 168, 0.12);
}

.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.employee-tools {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.employee-vehicle-status {
  margin: 0;
  font-weight: 700;
}

.employee-tool-button {
  width: 100%;
}

.action-button {
  min-height: 76px;
}

.records {
  display: grid;
  gap: 12px;
}

.filter-panel {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.filter-label {
  display: grid;
  gap: 8px;
  max-width: none;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.filter-label select {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.95);
  font: inherit;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 20px;
  width: 100%;
}

.admin-block {
  width: 100%;
  max-width: 100%;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.admin-block-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.manager-feedback {
  margin: 0 0 14px;
}

.admin-search-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.employee-table-wrap {
  margin-bottom: 16px;
}

.employees-table {
  min-width: 680px;
}

.employee-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action {
  padding: 10px 12px;
  border-radius: 14px;
}

.employee-row-active td {
  background: rgba(11, 90, 168, 0.07);
}

.employee-editor {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(245, 249, 255, 0.72);
}

.employee-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.employee-password-form {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.employee-danger-zone {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.record-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.record-card-aside {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.record-title {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.record-vehicle {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-map-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.record-map-link:hover {
  text-decoration: underline;
}

.record-action {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(25, 107, 82, 0.1);
  color: var(--green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.record-edit-button {
  min-width: 148px;
}

.feedback {
  min-height: 24px;
  margin: 14px 6px 0;
  font-weight: 600;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table {
  min-width: 760px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  white-space: nowrap;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.92);
}

th {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-group-row th {
  background: rgba(255, 250, 242, 0.98);
}

.summary-cycles-cell {
  display: none;
}

.summary-table th {
  background: linear-gradient(180deg, rgba(255, 250, 242, 1), rgba(247, 242, 232, 0.98));
  color: #415246;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-table tbody tr:hover td {
  background: rgba(11, 90, 168, 0.04);
}

.summary-row-overtime {
  box-shadow: inset 4px 0 0 rgba(177, 78, 65, 0.9);
}

.overtime-cell {
  color: var(--red);
  font-weight: 800;
}

.summary-main {
  font-weight: 800;
  color: var(--ink);
}

.summary-date,
.summary-vehicle {
  display: inline-flex;
  color: #4d5d52;
  font-weight: 700;
}

.summary-total {
  font-size: 1rem;
  font-weight: 800;
  color: var(--green-dark);
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
}

.summary-badge.overtime {
  background: rgba(177, 78, 65, 0.14);
  color: var(--red);
}

.summary-badge.interval {
  background: rgba(211, 155, 57, 0.16);
  color: #8a6220;
}

.summary-badge.km {
  background: rgba(11, 90, 168, 0.14);
  color: var(--blue);
}

.summary-badge.neutral {
  background: rgba(96, 112, 101, 0.12);
  color: #55665b;
}

.empty-row {
  text-align: center;
}

.hidden {
  display: none;
}

.apk-update-dialog {
  width: min(92vw, 480px);
  padding: 0;
  border: none;
  border-radius: 30px;
  background: transparent;
}

.apk-update-dialog::backdrop {
  background: rgba(18, 34, 28, 0.52);
}

.apk-update-card {
  display: grid;
  gap: 16px;
  padding: 26px;
  border-radius: 30px;
  border: 1px solid rgba(11, 90, 168, 0.16);
  background:
    linear-gradient(145deg, rgba(11, 90, 168, 0.12), rgba(25, 107, 82, 0.08)),
    rgba(255, 253, 249, 0.99);
  box-shadow: 0 26px 60px rgba(12, 34, 57, 0.2);
}

.apk-update-meta,
.apk-update-required {
  margin: 0;
  font-weight: 600;
}

.apk-update-meta {
  color: var(--blue);
}

.apk-update-required {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(177, 78, 65, 0.12);
  color: var(--red);
}

.apk-update-notes {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-weight: 600;
}

.apk-update-notes li {
  line-height: 1.45;
}

.vehicle-dialog {
  width: min(92vw, 460px);
  padding: 0;
  border: none;
  border-radius: 28px;
  background: transparent;
}

.vehicle-dialog::backdrop {
  background: rgba(18, 34, 28, 0.45);
}

.vehicle-form {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.vehicle-feedback {
  min-height: 20px;
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

@media (max-width: 980px) {
  .auth-card-head {
    grid-template-columns: 1fr;
  }

  .admin-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .grid-two,
  .button-grid,
  .admin-filter-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .update-banner,
  .record-card,
  .admin-block-head,
  .employee-editor-head {
    flex-direction: column;
    align-items: stretch;
  }

  .export-actions {
    width: 100%;
  }

  .record-action {
    width: fit-content;
  }

  .record-card-aside {
    justify-items: stretch;
  }

  .auth-card {
    padding: 22px;
  }

  .auth-card-head {
    grid-template-columns: 1fr;
  }

  .hero-brand-circle {
    width: 130px;
  }

  .dialog-actions {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  body::before {
    display: none;
  }

  .shell {
    width: 100%;
    max-width: 100%;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .panel,
  .card,
  .auth-card,
  .admin-block,
  .apk-update-card,
  .vehicle-form {
    border-radius: 22px;
    padding: 16px;
  }

  .topbar > *,
  .section-head > *,
  .admin-block-head > *,
  .employee-editor-head > * {
    min-width: 0;
  }

  .auth-panel {
    padding-top: 12px;
  }

  .auth-title {
    font-size: clamp(1.7rem, 8vw, 2.4rem);
    line-height: 1.02;
  }

  .hero-status,
  .status,
  .ghost,
  .primary,
  .secondary,
  .danger,
  .lunch {
    width: 100%;
  }

  .topbar {
    align-items: stretch;
  }

  .app-brand-center {
    order: -1;
    align-self: center;
  }

  .app-brand-image {
    width: 72px;
    height: 72px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .dialog-actions {
    flex-direction: column;
  }

  .action-button,
  .filter-actions > *,
  .dialog-actions > *,
  .employee-actions > * {
    width: 100%;
  }

  .record-card {
    align-items: stretch;
  }

  .record-card-aside {
    justify-items: stretch;
  }

  .record-action {
    width: 100%;
    text-align: center;
  }

  .table-wrap {
    overflow-x: hidden;
    border: none;
    background: transparent;
  }

  .employees-table,
  .summary-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tbody tr {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(69, 47, 19, 0.08);
    background: rgba(255, 253, 249, 0.96);
  }

  td {
    display: grid;
    grid-template-columns: minmax(88px, 40%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 12px 14px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  td.empty-row {
    display: block;
    text-align: center;
  }

  td.empty-row::before {
    content: none;
  }

  .summary-row-overtime {
    box-shadow:
      inset 4px 0 0 rgba(177, 78, 65, 0.9),
      0 10px 22px rgba(69, 47, 19, 0.08);
  }

  .vehicle-dialog {
    width: min(100vw - 20px, 460px);
  }
}
