:root {
  --aw-navy: #1a2b45;
  --aw-navy-deep: #121e33;
  --aw-navy-mid: #243954;
  --aw-yellow: #ffcc00;
  --aw-yellow-ink: #1a1a1a;
  --aw-charcoal: #222222;
  --bg: #f0f3f7;
  --surface: #ffffff;
  --ink: #222222;
  --heading: #1a2b45;
  --muted: #5c6b7a;
  --primary: #1a2b45;
  --primary-dark: #121e33;
  --accent: #ffcc00;
  --accent-ink: #1a1a1a;
  --danger: #a11919;
  --success: #1b6b3a;
  --warning: #b86e00;
  --border: #d5dce5;
  --focus: #ffcc00;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(26, 43, 69, 0.08);
  --shadow-lg: 0 12px 40px rgba(26, 43, 69, 0.14);
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 78px;
  --topbar-h: 64px;
  --font: "Segoe UI", system-ui, -apple-system, "Candara", "Trebuchet MS", sans-serif;
  --font-display: "Segoe UI", system-ui, sans-serif;
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --table-head: #eef2f6;
  --alert-error-bg: #fdecec;
  --alert-error-ink: #6d1212;
  --alert-error-border: #f3c4c4;
  --alert-success-bg: #e8f7ee;
  --alert-success-ink: #14532d;
  --alert-success-border: #b7e4c7;
  --alert-info-bg: #eef3f9;
  --alert-info-ink: #1a2b45;
  --alert-info-border: #c9d6e8;
  --alert-warning-bg: #fff6e0;
  --alert-warning-ink: #7a4d00;
  --alert-warning-border: #ffe08a;
  --badge-in-bg: #d7f0e0;
  --badge-in-ink: #14532d;
  --badge-out-bg: #e8eef3;
  --badge-out-ink: #334155;
  --badge-off-bg: #f8d7d7;
  --badge-off-ink: #6d1212;
  --badge-entry-bg: #e8f7ee;
  --badge-entry-ink: #14532d;
  --badge-exit-bg: #fff1cc;
  --badge-exit-ink: #7a4d00;
  --badge-adjust-bg: #fdecec;
  --badge-adjust-ink: #6d1212;
  --loc-in-bg: #e8f7ee;
  --loc-in-border: #b7e4c7;
  --loc-in-ink: #14532d;
  --loc-out-bg: #fdecec;
  --loc-out-border: #f3c4c4;
  --loc-out-ink: #6d1212;
  color-scheme: light;
}

/* Apariencia resuelta (claro/oscuro). data-theme guarda la preferencia del usuario. */
html[data-resolved="dark"] {
  color-scheme: dark;
  --bg: #0f1724;
  --surface: #1a2738;
  --ink: #eef3fa;
  --heading: #f4f7fb;
  --muted: #a8b6c7;
  --primary: #ffcc00;
  --primary-dark: #e6b800;
  --border: #334861;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(26, 39, 56, 0.92);
  --table-head: #223247;
  --alert-error-bg: #3a1a1a;
  --alert-error-ink: #ffb4b4;
  --alert-error-border: #6d2a2a;
  --alert-success-bg: #143224;
  --alert-success-ink: #b7e4c7;
  --alert-success-border: #1f5a38;
  --alert-info-bg: #1a2b45;
  --alert-info-ink: #d7e4f5;
  --alert-info-border: #2d4566;
  --alert-warning-bg: #3a2c10;
  --alert-warning-ink: #ffd88a;
  --alert-warning-border: #6b5218;
  --badge-in-bg: #1a3d2a;
  --badge-in-ink: #9be4b8;
  --badge-out-bg: #2a3648;
  --badge-out-ink: #c5d0dc;
  --badge-off-bg: #4a2222;
  --badge-off-ink: #ffb4b4;
  --badge-entry-bg: #1a3d2a;
  --badge-entry-ink: #9be4b8;
  --badge-exit-bg: #3d3214;
  --badge-exit-ink: #ffd88a;
  --badge-adjust-bg: #4a2222;
  --badge-adjust-ink: #ffb4b4;
  --loc-in-bg: #1a3d2a;
  --loc-in-border: #2f6b48;
  --loc-in-ink: #9be4b8;
  --loc-out-bg: #4a2222;
  --loc-out-border: #7a3a3a;
  --loc-out-ink: #ffb4b4;
}

html[data-resolved="light"] {
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.sidebar-open {
  overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

html[data-resolved="dark"] a:hover {
  color: #ffe066;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ========== App shell ========== */
.aw-app {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(255, 204, 0, 0.08) 0%, transparent 55%),
    radial-gradient(800px 400px at 0% 100%, rgba(26, 43, 69, 0.06) 0%, transparent 50%),
    var(--bg);
}

.aw-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--aw-navy-deep) 0%, var(--aw-navy) 55%, #152338 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(18, 30, 51, 0.25);
  transition: transform 0.22s ease, width 0.22s ease;
}

html.sidebar-collapsed .aw-sidebar {
  width: var(--sidebar-w-collapsed);
}

html.sidebar-collapsed .aw-shell {
  margin-left: var(--sidebar-w-collapsed);
}

html.sidebar-collapsed .aw-brand-text,
html.sidebar-collapsed .aw-nav-label,
html.sidebar-collapsed .aw-nav-text,
html.sidebar-collapsed .aw-logo-full,
html.sidebar-collapsed .aw-nav-group-toggle,
html.sidebar-collapsed .aw-nav-chevron {
  display: none;
}

html.sidebar-collapsed .aw-nav-group-body {
  display: flex !important;
}

html.sidebar-collapsed .aw-logo-mark-img {
  display: block;
}

html.sidebar-collapsed .aw-sidebar-brand {
  justify-content: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

html.sidebar-collapsed .aw-nav-link {
  justify-content: center;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

html.sidebar-collapsed .aw-nav-link.is-active {
  box-shadow: inset 0 0 0 1px rgba(255, 204, 0, 0.35);
}

html.sidebar-collapsed .aw-sidebar-collapse {
  justify-content: center;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

html.sidebar-collapsed .aw-collapse-icon-in { display: none; }
html.sidebar-collapsed .aw-collapse-icon-out { display: inline-flex; }
html:not(.sidebar-collapsed) .aw-collapse-icon-out { display: none; }

.aw-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.aw-logo-full {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 120px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.aw-logo-mark-img {
  display: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.aw-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--aw-yellow);
  color: var(--aw-yellow-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.aw-brand-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.aw-brand-text strong {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aw-brand-text span {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.aw-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.aw-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.aw-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.aw-nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
}

.aw-nav-group-toggle .aw-nav-label {
  margin: 0;
}

.aw-nav-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.18s ease;
}

.aw-nav-group.is-open .aw-nav-chevron {
  transform: rotate(180deg);
}

.aw-nav-group-body {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
}

.aw-nav-group.is-open > .aw-nav-group-body {
  display: flex;
}

.aw-nav-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
}

.aw-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.aw-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.aw-nav-link.is-active {
  background: rgba(255, 204, 0, 0.16);
  color: var(--aw-yellow);
  box-shadow: inset 3px 0 0 var(--aw-yellow);
}

.aw-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.9;
}

.aw-sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.aw-sidebar-collapse {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.aw-sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.aw-collapse-icon {
  display: inline-flex;
  align-items: center;
}

.aw-shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.aw-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.aw-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  justify-self: start;
}

.aw-topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.aw-topbar-clock {
  font-size: clamp(1.55rem, 3.2vw, 2.45rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--heading);
  line-height: 1;
  white-space: nowrap;
}

.aw-topbar .aw-user-chip {
  justify-self: end;
}

.aw-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--ink);
}

.aw-user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.aw-bell {
  position: relative;
}

.aw-bell-btn {
  position: relative;
}

.aw-bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #a11919;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 18px;
  text-align: center;
}

.aw-bell-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  width: min(320px, 80vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  padding: 0.4rem 0;
}

.aw-bell-menu[hidden] { display: none; }

.aw-bell-menu strong {
  display: block;
  padding: 0.45rem 0.85rem 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.aw-bell-menu a,
.aw-bell-empty {
  display: block;
  padding: 0.55rem 0.85rem;
  color: var(--ink);
  text-decoration: none;
}

.aw-bell-menu a:hover {
  background: var(--table-head);
  text-decoration: none;
  color: var(--ink);
}

.aw-bell-menu a span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.aw-bell-empty {
  color: var(--muted);
}

.aw-theme-control {
  position: relative;
}

.aw-theme-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.aw-theme-btn:hover {
  border-color: var(--aw-navy-mid);
}

.aw-theme-icon { display: none; }
.aw-theme-control[data-mode="light"] .aw-theme-icon-light,
.aw-theme-control[data-mode="dark"] .aw-theme-icon-dark,
.aw-theme-control[data-mode="system"] .aw-theme-icon-system {
  display: block;
}

.aw-theme-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  z-index: 50;
  display: grid;
  gap: 0.15rem;
}

.aw-theme-menu[hidden] { display: none; }

.aw-theme-menu button {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.aw-theme-menu button:hover,
.aw-theme-menu button[aria-selected="true"] {
  background: var(--bg);
}

.catalog-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: var(--bg);
}

.catalog-thumb-lg {
  width: 160px;
  height: auto;
  max-height: 160px;
}

.table-trailers .col-photo {
  width: 64px;
}

.table-trailers .col-number {
  width: 8rem;
}

.table-trailers .col-company {
  min-width: 15ch;
  width: 22%;
  white-space: normal;
  word-break: break-word;
}

.table-trailers .col-status {
  width: 6.5rem;
}

/* Acciones: última columna, compacta y alineada (patrón Cajas) */
.table th.col-actions,
.table td.col-actions {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
}

.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.row-actions .btn,
.row-actions .inline,
.row-actions form {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.row-actions .btn {
  justify-content: center;
  white-space: nowrap;
}

.aw-user-meta {
  display: grid;
  text-align: right;
  line-height: 1.2;
}

.aw-user-meta strong {
  font-size: 0.9rem;
  color: var(--ink);
}

.aw-user-meta span {
  font-size: 0.75rem;
  color: var(--muted);
}

.aw-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--aw-navy);
  color: var(--aw-yellow);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8rem;
}

.aw-main {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem 1.25rem 2rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, calc(1.25rem + env(safe-area-inset-bottom)));
  box-sizing: border-box;
  min-width: 0;
}

.aw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 30, 51, 0.45);
  z-index: 35;
}

body.sidebar-open .aw-overlay { display: block; }

/* Legacy class aliases kept for existing views */
.topbar { display: none; }
.nav { display: none; }
.container { max-width: none; margin: 0; padding: 0; }
.brand { font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 0.75rem; }
.user-name { font-size: 0.95rem; }

/* ========== Page structure ========== */
.aw-main > h2,
.page-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.aw-main > h2 + .muted,
.page-subtitle {
  margin: 0 0 1.25rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.page-header .muted { margin: 0.25rem 0 0; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.85rem;
}

.section-title h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--heading);
}

/* ========== Guest / Auth ========== */
.guest {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  background-color: var(--aw-navy-deep);
  background-image:
    linear-gradient(180deg, rgba(18, 30, 51, 0.28) 0%, rgba(18, 30, 51, 0.42) 100%),
    url("../img/login-bg.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--ink);
  box-sizing: border-box;
}

.guest-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  color: var(--ink);
}

.guest-card label {
  color: var(--heading);
}

.guest-card p {
  color: var(--ink);
}

.guest-brand {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  margin-bottom: 1.35rem;
  text-align: center;
}

.guest-logo {
  display: block;
  width: min(220px, 72%);
  height: auto;
  object-fit: contain;
}

.guest-logo-blanco {
  display: none;
}

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--heading);
  font-weight: 800;
}

.guest-hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

html[data-resolved="light"] .guest-card {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(255, 255, 255, 0.4);
}

html[data-resolved="dark"] .guest-card {
  background: color-mix(in srgb, var(--surface) 94%, #000);
  border-color: var(--border);
}

html[data-resolved="dark"] .guest-logo-azul {
  display: none;
}

html[data-resolved="dark"] .guest-logo-blanco {
  display: block;
}

/* ========== Forms ========== */
.form { display: grid; gap: 0.9rem; }

.field-with-check {
  display: grid;
  gap: 0.35rem;
}

.field-with-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.field-with-check-row .input-lg {
  flex: 1 1 220px;
  min-width: 0;
  width: auto;
}

.inline-check {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  grid-template-columns: none !important;
}

.inline-check input {
  width: auto;
  margin: 0;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.driver-panel {
  display: grid;
  gap: 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--ink);
}

label.checkbox-row,
label:has(> input[type="checkbox"]) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  font-weight: 600;
  width: fit-content;
  max-width: 100%;
}

input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--aw-navy);
}

input:hover, select:hover, textarea:hover {
  border-color: color-mix(in srgb, var(--border) 40%, var(--muted));
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--aw-navy);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35);
}

.input-lg { min-height: 48px; font-size: 1.05rem; }
textarea { min-height: 90px; resize: vertical; }

/* Select con búsqueda (combobox) */
.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.searchable-select-control {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

.searchable-select-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font-size: 1.05rem;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.searchable-select-toggle {
  flex: 0 0 48px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.searchable-select-toggle:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.searchable-select.is-open .searchable-select-input,
.searchable-select.is-open .searchable-select-toggle {
  border-color: var(--aw-navy);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35);
}

.searchable-select.is-disabled {
  opacity: 0.65;
  pointer-events: none;
}

.searchable-select-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.searchable-select-list[hidden] {
  display: none !important;
}

.searchable-select-option {
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: color-mix(in srgb, var(--accent) 28%, var(--surface));
  color: var(--heading);
}

.searchable-select-option.is-selected {
  background: color-mix(in srgb, var(--aw-navy) 10%, var(--surface));
}

.searchable-select-empty {
  padding: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #e8eef4;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(0.97);
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.35);
}

.btn-primary:hover {
  background: #ffd633;
  filter: none;
}

.btn-secondary {
  background: var(--aw-navy);
  color: #fff;
}

.btn-secondary:hover { background: var(--aw-navy-mid); filter: none; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--heading);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0.85rem 1.2rem; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }

/* ========== Alerts ========== */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.alert-error { background: var(--alert-error-bg); color: var(--alert-error-ink); border-color: var(--alert-error-border); }
.alert-success { background: var(--alert-success-bg); color: var(--alert-success-ink); border-color: var(--alert-success-border); }
.alert-info { background: var(--alert-info-bg); color: var(--alert-info-ink); border-color: var(--alert-info-border); }
.alert-warning { background: var(--alert-warning-bg); color: var(--alert-warning-ink); border-color: var(--alert-warning-border); }

.alert-pulse {
  margin-top: 1rem;
  animation: aw-alert-pulse 1.4s ease-in-out infinite;
}

.alert-ops-location {
  text-align: center;
  line-height: 1.45;
}

@keyframes aw-alert-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(196, 140, 0, 0.35);
  }
  50% {
    opacity: 0.82;
    box-shadow: 0 0 0 6px rgba(196, 140, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert-pulse { animation: none; }
}

/* ========== KPI / Stats ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.5rem;
}

.stats.stats-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  display: grid;
  gap: 0.35rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
}

.stat span:last-child {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* ========== Cards / panels ========== */
.card-panel,
.aw-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.aw-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.aw-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--heading);
}

.ops-hero {
  background:
    linear-gradient(135deg, rgba(26, 43, 69, 0.96) 0%, #243954 100%);
  color: #fff;
  border: 0;
  position: relative;
  overflow: hidden;
}

.ops-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 204, 0, 0.12);
  pointer-events: none;
}

.ops-hero p {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 1rem;
}

.ops-hero label { color: #fff; }
.ops-hero .muted { color: rgba(255, 255, 255, 0.55); }

.ops-scan-actions {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0 1rem;
}

.ops-hero .ops-scan-actions .btn-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.72);
  color: #fff;
}

.ops-hero .ops-scan-actions .btn-outline:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
  color: #fff;
  filter: none;
}

.ops-hero .ops-scan-actions .btn-ops-manual {
  background: #fff;
  border-color: #fff;
  color: #1a2b45;
  box-shadow: none;
}

.ops-hero .ops-scan-actions .btn-ops-manual:hover {
  background: #ffcc00;
  border-color: #ffcc00;
  color: #1a1a1a;
  filter: none;
}

.ops-qr-reader {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 0.75rem;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.ops-qr-reader:empty {
  display: none;
}

.ops-qr-reader video {
  width: 100% !important;
  border-radius: 8px;
}

.ops-qr-status {
  min-height: 1.4em;
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.ops-qr-status.is-error {
  color: #ffb4b4;
}

.ops-qr-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(13, 42, 58, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ops-qr-loading[hidden] {
  display: none !important;
}

body.ops-qr-loading-open {
  overflow: hidden;
}

.ops-qr-loading-card {
  width: min(100%, 320px);
  text-align: center;
  background: #fff;
  border-radius: 14px;
  padding: 1.6rem 1.35rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.ops-qr-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border: 4px solid #d7e7f2;
  border-top-color: var(--aw-navy, #0d2a3a);
  border-radius: 50%;
  animation: ops-qr-spin 0.75s linear infinite;
}

@keyframes ops-qr-spin {
  to { transform: rotate(360deg); }
}

.ops-qr-loading-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--heading, #0d2a3a);
}

.ops-qr-loading-sub {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

.ops-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: 1rem 0 1.1rem;
}

.ops-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ========== Tables ========== */
.table-wrap {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.table-wrap-fit {
  overflow-x: hidden;
}

.table td.col-detail,
.table th.col-detail {
  white-space: normal;
  word-break: break-word;
  min-width: 12rem;
  max-width: 28rem;
}

.table td.col-detail {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  line-height: 1.35;
  max-height: calc(1.35em * 4);
}

.th-sort {
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.th-sort:hover,
.th-sort.is-active {
  color: var(--heading);
  text-decoration: none;
}

.table-pager {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  text-align: center;
  margin: 1rem 0 0.25rem;
  color: var(--ink);
  font-size: 0.92rem;
}

.table-pager-perpage label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  margin: 0;
  color: var(--heading);
}

.table-pager-perpage select {
  width: auto;
  min-width: 4.5rem;
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  border-color: var(--border);
  color: var(--heading);
  background: var(--surface);
}

.table-pager-perpage select:focus {
  border-color: var(--aw-navy);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35);
}

.table-pager-meta,
.table-pager-page {
  color: var(--ink);
}

.table-pager-meta strong,
.table-pager-page strong {
  color: var(--heading);
  font-weight: 800;
}

.table-pager-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.table-pager-nav .btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--heading);
}

.table-pager-nav .btn-outline:hover {
  border-color: var(--aw-navy);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  color: var(--heading);
  filter: none;
}

.table-pager-nav .btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-wrap .table,
.aw-card > .table,
.card-panel > .table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

.aw-card > .table,
.card-panel > .table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.table th, .table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.table td.wrap,
.table th.wrap,
.adjust-reason {
  white-space: normal;
  word-break: break-word;
}

.table th {
  background: var(--table-head);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 750;
}

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.muted { color: var(--muted); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.catalog-import {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
}

.catalog-import-head {
  margin-bottom: 0.65rem;
}

.catalog-import-head strong {
  display: block;
  color: var(--heading);
}

.catalog-import-head .muted {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}

.catalog-import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.catalog-import-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.catalog-import-form input[type="file"] {
  width: auto;
  max-width: min(100%, 280px);
  padding: 0.45rem 0.55rem;
  min-height: 42px;
}

.catalog-import-errors {
  margin-top: 0.75rem;
}

.catalog-import-errors ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.toolbar .inline {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  min-height: 42px;
  width: auto;
  min-width: 140px;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state strong {
  display: block;
  color: var(--heading);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.badge-in { background: var(--badge-in-bg); color: var(--badge-in-ink); }
.badge-out { background: var(--badge-out-bg); color: var(--badge-out-ink); }
.badge-off { background: var(--badge-off-bg); color: var(--badge-off-ink); }
.badge-entry { background: var(--badge-entry-bg); color: var(--badge-entry-ink); }
.badge-exit { background: var(--badge-exit-bg); color: var(--badge-exit-ink); }
.badge-adjust { background: var(--badge-adjust-bg); color: var(--badge-adjust-ink); }
.badge-normal { background: var(--badge-entry-bg); color: var(--badge-entry-ink); }
.badge-manual { background: var(--badge-off-bg); color: var(--badge-off-ink); }

.adjust-change {
  color: var(--badge-adjust-ink);
  font-weight: 700;
  white-space: nowrap;
}

.adjust-reason {
  max-width: 28rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.aw-section-gap { margin-top: 1.25rem; }

.ops-actions { display: grid; gap: 0.75rem; margin-top: 1rem; }
.ops-actions .btn { min-height: 64px; font-size: 1.15rem; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.meta-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.meta-item-location {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.meta-item-location.is-inside {
  background: var(--loc-in-bg);
  border: 1px solid var(--loc-in-border);
}

.meta-item-location.is-outside {
  background: var(--loc-out-bg);
  border: 1px solid var(--loc-out-border);
}

.meta-item-location span {
  font-size: 0.68rem;
  white-space: nowrap;
  margin-bottom: 0.15rem;
}

.meta-item-location.is-inside span,
.meta-item-location.is-inside strong {
  color: var(--loc-in-ink);
}

.meta-item-location.is-outside span,
.meta-item-location.is-outside strong {
  color: var(--loc-out-ink);
}

.meta-item-location strong {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.meta-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 0.2rem;
}

.meta-item strong {
  font-size: 0.95rem;
  color: var(--heading);
}

.table td {
  color: var(--ink);
}

.confirm-bar {
  position: sticky;
  bottom: 0.75rem;
  margin-top: 1rem;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

/* ========== Responsive (plataforma completa) ========== */
@media (max-width: 1200px) {
  .stats.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .aw-main {
    padding: 1.1rem 1rem 1.75rem;
  }

  .report-builder-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .aw-sidebar {
    transform: translateX(-105%);
    width: min(var(--sidebar-w), 88vw);
    max-width: 320px;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  body.sidebar-open .aw-sidebar {
    transform: translateX(0);
  }

  html.sidebar-collapsed .aw-shell,
  .aw-shell { margin-left: 0; }

  html.sidebar-collapsed .aw-brand-text,
  html.sidebar-collapsed .aw-nav-label,
  html.sidebar-collapsed .aw-nav-text {
    display: initial;
  }

  html.sidebar-collapsed .aw-nav-label {
    display: block;
  }

  html.sidebar-collapsed .aw-nav-group-toggle {
    display: flex;
  }

  html.sidebar-collapsed .aw-nav-chevron {
    display: block;
  }

  html.sidebar-collapsed .aw-nav-group-body {
    display: none !important;
  }

  html.sidebar-collapsed .aw-nav-group.is-open > .aw-nav-group-body {
    display: flex !important;
  }

  html.sidebar-collapsed .aw-logo-full {
    display: block;
  }

  html.sidebar-collapsed .aw-logo-mark-img {
    display: none;
  }

  html.sidebar-collapsed .aw-nav-link,
  html.sidebar-collapsed .aw-sidebar-collapse {
    justify-content: flex-start;
  }

  .aw-menu-toggle {
    display: inline-flex;
    width: 44px;
    height: 44px;
  }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aw-user-meta { display: none; }
  .aw-sidebar-collapse { display: none; }

  .aw-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .aw-topbar-clock {
    font-size: clamp(1.25rem, 5.5vw, 1.85rem);
  }

  .aw-user-chip {
    gap: 0.45rem;
  }

  .aw-user-chip .btn-sm {
    min-height: 40px;
  }

  .aw-shell {
    min-width: 0;
  }

  .aw-overlay {
    z-index: 35;
  }

  .aw-sidebar {
    z-index: 40;
  }

  .page-header {
    gap: 0.75rem;
  }

  .page-header h2 {
    font-size: clamp(1.25rem, 3.5vw, 1.45rem);
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .searchable-select {
    flex: 1 1 160px;
    min-width: 0;
    width: 100%;
  }

  .toolbar .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .report-history-filters .searchable-select {
    flex: 1 1 180px;
    min-width: 0;
  }

  .table th,
  .table td {
    padding: 0.65rem 0.7rem;
    font-size: 0.9rem;
  }

  .row-actions {
    gap: 0.3rem;
  }

  .row-actions .btn {
    min-height: 36px;
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
  }

  .card-panel,
  .aw-card {
    padding: 1rem;
  }

  .form label,
  .form .input-lg,
  .form select,
  .form input,
  .form textarea {
    font-size: 1rem;
  }

  .searchable-select-input,
  .searchable-select-toggle {
    min-height: 48px;
  }

  .table-pager {
    gap: 0.75rem;
  }

  .guest-card {
    width: min(420px, 100%);
    padding: 1.35rem 1.15rem;
  }
}

@media (max-width: 700px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .stat {
    padding: 0.9rem 0.85rem;
  }

  .stat-num {
    font-size: 1.45rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header > .btn,
  .page-header > a.btn,
  .page-header .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .aw-card-header {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .toolbar .btn,
  .toolbar a.btn {
    grid-column: span 1;
    width: 100%;
  }

  .report-history-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .report-history-filters .searchable-select,
  .report-history-filters input,
  .report-history-filters select,
  .report-history-filters .btn,
  .report-history-filters a.btn {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .report-builder-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .table-wrap {
    margin-left: -0.15rem;
    margin-right: -0.15rem;
    border-radius: 10px;
  }

  .table th.col-actions,
  .table td.col-actions {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -6px 0 10px rgba(18, 30, 51, 0.06);
    z-index: 1;
  }

  .table thead th.col-actions {
    background: var(--table-head);
  }

  .confirm-bar {
    position: sticky;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .aw-main {
    padding: 0.85rem 0.75rem 1.5rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-bottom: max(1.5rem, calc(1rem + env(safe-area-inset-bottom)));
  }

  .aw-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .aw-topbar-clock {
    font-size: clamp(1.1rem, 5.5vw, 1.55rem);
  }

  .aw-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
  }

  .aw-theme-btn {
    width: 40px;
    height: 40px;
  }

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

  .page-header h2 {
    font-size: 1.25rem;
  }

  input, select, textarea,
  .input-lg,
  .searchable-select-input {
    font-size: 16px; /* evita zoom iOS */
  }

  .btn-lg {
    min-height: 52px;
    width: 100%;
  }

  .guest-logo {
    width: min(200px, 78%);
  }

  .guest-card .btn,
  .guest-card .btn-block {
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .report-history-filters,
  .report-builder-filters {
    grid-template-columns: 1fr;
  }

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

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

  .aw-user-chip .btn-outline {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .aw-user-chip .aw-btn-cambiar-vista {
    font-size: 0.72rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    letter-spacing: 0;
  }

  .table-pager-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .table-pager-nav .btn {
    min-height: 40px;
  }

  .row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 11rem;
  }

  .page-header .btn + .btn,
  .page-header a.btn + a.btn {
    margin-top: 0;
  }

  .empty-state {
    padding: 1.25rem 0.85rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .aw-topbar {
    min-height: 0;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }

  .aw-topbar-clock {
    font-size: 1.2rem;
  }

  .aw-main {
    padding-top: 0.75rem;
  }

  .guest {
    align-items: flex-start;
    padding-top: 0.75rem;
  }
}

/* ========== Guardia: vista enfocada caseta ========== */
.aw-ops-focus {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}

.aw-ops-focus-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: calc(var(--topbar-h) + 0.75rem);
  padding: 0.75rem 1.25rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  background: linear-gradient(180deg, var(--aw-navy-deep) 0%, var(--aw-navy) 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.aw-ops-focus-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  justify-self: start;
}

.aw-ops-focus-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.aw-ops-focus-tag {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.aw-ops-focus-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.aw-ops-focus-clock {
  font-size: clamp(1.85rem, 4.2vw, 3rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.aw-ops-focus-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
}

.aw-ops-focus-user {
  text-align: right;
}

.aw-ops-focus-user strong {
  color: #fff;
}

.aw-ops-focus-user span {
  color: rgba(255, 255, 255, 0.65);
}

.aw-btn-cambiar-vista {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  white-space: nowrap;
}

.aw-ops-focus-main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom)));
  box-sizing: border-box;
}

.aw-ops-focus .page-header {
  margin-bottom: 1rem;
}

/* Controles táctiles en caseta */
.aw-ops-focus .input-lg,
.aw-ops-focus .searchable-select-input,
.aw-ops-focus .searchable-select-toggle,
.aw-ops-focus select,
.aw-ops-focus input[type="text"],
.aw-ops-focus input[type="file"],
.aw-ops-focus textarea {
  min-height: 52px;
  font-size: 1.05rem;
}

.aw-ops-focus .searchable-select-toggle {
  flex-basis: 52px;
  min-width: 52px;
}

.aw-ops-focus .searchable-select-option {
  padding: 0.85rem 0.9rem;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.aw-ops-focus .searchable-select-list {
  max-height: min(280px, 42vh);
  z-index: 60;
}

.aw-ops-focus .aw-theme-btn {
  width: 44px;
  height: 44px;
}

.aw-ops-focus .card-panel {
  overflow: visible;
}

.aw-ops-focus .btn-lg,
.aw-ops-focus .ops-scan-actions .btn {
  min-height: 56px;
  font-size: 1.1rem;
  padding: 0.9rem 1.1rem;
}

.aw-ops-focus .confirm-bar {
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 20;
}

.aw-ops-focus .confirm-bar .btn {
  min-height: 58px;
  font-size: 1.12rem;
}

.aw-ops-focus .ops-qr-reader {
  max-width: min(520px, 100%);
}

.aw-ops-focus .meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.aw-ops-focus .meta-item-location strong {
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
}

/* Tablet (caseta típica) */
@media (max-width: 1024px) {
  .aw-ops-focus-main {
    width: min(860px, 100%);
    padding-top: 1.15rem;
  }

  .aw-ops-focus-logo {
    height: 40px;
    max-width: 150px;
  }

  .aw-ops-focus-clock {
    font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  }

  .aw-ops-focus .page-header h2 {
    font-size: clamp(1.25rem, 3vw, 1.55rem);
  }

  .aw-ops-focus .ops-hero {
    padding: 1.15rem;
  }
}

@media (max-width: 900px) {
  .aw-ops-focus-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem 0.65rem;
    padding: 0.65rem 0.9rem;
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .aw-ops-focus-clock {
    font-size: clamp(1.35rem, 5vw, 2.1rem);
  }

  .aw-ops-focus-actions {
    gap: 0.45rem;
  }

  .aw-ops-focus-actions .btn-sm {
    min-height: 42px;
    padding: 0.45rem 0.7rem;
  }

  .aw-ops-focus .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }
}

/* Celular / tablet estrecha */
@media (max-width: 700px) {
  .aw-ops-focus-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "clock clock";
    gap: 0.55rem 0.5rem;
    padding: 0.6rem 0.75rem;
    padding-top: max(0.6rem, env(safe-area-inset-top));
    min-height: 0;
  }

  .aw-ops-focus-brand { grid-area: brand; }
  .aw-ops-focus-center {
    grid-area: clock;
    justify-content: flex-start;
  }
  .aw-ops-focus-actions {
    grid-area: actions;
    justify-self: end;
  }

  .aw-ops-focus-user,
  .aw-ops-focus-tag,
  .aw-ops-focus-actions .aw-avatar {
    display: none;
  }

  .aw-ops-focus-logo {
    height: 34px;
    max-width: 120px;
  }

  .aw-ops-focus-clock {
    font-size: clamp(1.35rem, 7vw, 1.9rem);
  }

  .aw-ops-focus-main {
    width: 100%;
    padding: 0.9rem 0.75rem 2rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, calc(1.25rem + env(safe-area-inset-bottom)));
  }

  .aw-ops-focus .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .aw-ops-focus .page-header .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .aw-ops-focus .page-header h2 {
    font-size: 1.25rem;
  }

  .aw-ops-focus .meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .aw-ops-focus .meta-item {
    padding: 0.7rem 0.75rem;
  }

  .aw-ops-focus .ops-scan-actions {
    gap: 0.7rem;
  }

  .aw-ops-focus .ops-qr-reader {
    max-width: 100%;
  }

  .aw-ops-focus .btn-outline {
    color: inherit;
  }

  .aw-ops-focus-bar .btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
  }

  .aw-ops-focus-bar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .aw-btn-cambiar-vista {
    letter-spacing: 0.02em;
    font-size: 0.78rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
}

@media (max-width: 480px) {
  .aw-ops-focus .meta-grid {
    grid-template-columns: 1fr;
  }

  .aw-ops-focus-actions .aw-theme-control {
    order: -1;
  }

  .aw-ops-focus .input-lg,
  .aw-ops-focus .searchable-select-input,
  .aw-ops-focus .searchable-select-toggle,
  .aw-ops-focus select,
  .aw-ops-focus input[type="text"],
  .aw-ops-focus input[type="file"],
  .aw-ops-focus textarea {
    min-height: 50px;
    font-size: 16px; /* evita zoom automático en iOS */
  }

  .aw-ops-focus textarea {
    min-height: 110px;
  }

  .aw-ops-focus .confirm-bar {
    margin-left: -0.15rem;
    margin-right: -0.15rem;
    border-radius: 12px;
  }
}

/* Landscape tablet / teléfono ancho */
@media (max-height: 520px) and (orientation: landscape) {
  .aw-ops-focus-bar {
    min-height: 0;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .aw-ops-focus-logo {
    height: 30px;
  }

  .aw-ops-focus-clock {
    font-size: 1.35rem;
  }

  .aw-ops-focus-main {
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
  }

  .aw-ops-focus .ops-qr-reader {
    max-width: min(360px, 55vw);
  }
}

/* ========== Report builder ========== */
.report-history-filters .searchable-select {
  min-width: 200px;
  flex: 1 1 200px;
}

.report-history-filters .searchable-select-input {
  min-height: 42px;
  font-size: 0.95rem;
}

.report-builder-type {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.report-builder-desc {
  margin: 0;
  font-size: 0.9rem;
}

.report-builder {
  overflow: visible;
  min-width: 0;
}

.report-builder-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
  align-items: end;
  margin: 0 0 1rem;
  min-width: 0;
}

@media (max-width: 1100px) {
  .report-builder-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .report-builder-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .report-builder-filters {
    grid-template-columns: 1fr;
  }
}

.report-filter-field {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.report-filter-field.is-searchable {
  min-width: 0;
}

.report-filter-field > .report-filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-builder-filters .searchable-select {
  width: 100%;
  min-width: 0;
}

.report-builder-filters .searchable-select-input {
  min-height: 42px;
  font-size: 0.95rem;
  width: 100%;
}

.report-builder-filters input[type="date"],
.report-builder-filters input[type="text"],
.report-builder-filters select {
  width: 100%;
  min-width: 0;
}

.report-columns-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.report-columns-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.55rem 0.75rem;
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  min-width: 0;
}

.report-col-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  min-width: 0;
}

.report-col-check input {
  width: auto;
  min-width: 1rem;
  margin: 0;
  flex-shrink: 0;
}

.report-col-check span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-builder-actions {
  margin-top: 0.25rem;
}

.report-limit-note {
  margin: 0.85rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--aw-yellow) 45%, var(--border));
  background: color-mix(in srgb, var(--aw-yellow) 14%, var(--surface));
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--heading);
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
}
