:root {
  --gm-navy: #07111f;
  --gm-ink: #0e1a2e;
  --gm-gold: #d4a24c;
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --ring-color: #bae6fd;
  --btn-primary-bg: #2563eb;
  --btn-primary-hover: #1d4ed8;
  --btn-secondary-bg: #e2e8f0;
  --btn-secondary-hover: #cbd5e1;
  --btn-secondary-fg: #334155;
  --btn-danger-bg: #dc2626;
  --btn-danger-hover: #b91c1c;
  --btn-success-bg: #16a34a;
  --btn-success-hover: #15803d;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
  color-scheme: light;
}

html[data-theme='dark'] {
  --bg-primary: #0b1220;
  --bg-surface: #111827;
  --bg-muted: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --card-bg: #111827;
  --input-bg: #0f172a;
  --ring-color: #0c4a6e;
  --btn-primary-bg: #3b82f6;
  --btn-primary-hover: #2563eb;
  --btn-secondary-bg: #1e293b;
  --btn-secondary-hover: #334155;
  --btn-secondary-fg: #e2e8f0;
  --btn-danger-bg: #ef4444;
  --btn-danger-hover: #dc2626;
  --btn-success-bg: #22c55e;
  --btn-success-hover: #16a34a;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.app-shell {
  min-height: 100vh;
}

/* Contenedores estándar light/dark (usar en paneles nuevos; bg-white se remapea vía tema) */
.app-card,
.app-filter-panel {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
}

.app-filter-panel {
  background: var(--bg-muted);
  padding: 1rem 1.25rem;
}

.pc-sim-header,
.pc-sim-params {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.preop-allok-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: #047857;
  border-radius: 0.55rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.sidebar {
  width: 18rem;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: #cbd5e1;
  transition: transform 0.2s ease-out;
  background:
    radial-gradient(circle at top left, rgba(212, 162, 76, 0.14), transparent 42%),
    linear-gradient(180deg, #07111f 0%, #0b1729 55%, #0a1322 100%);
}

.sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding: 1.15rem 1rem 1.75rem;
  text-align: center;
}

.sidebar-brand::after {
  content: '';
  position: absolute;
  left: -18%;
  right: -18%;
  bottom: -14px;
  height: 28px;
  border-radius: 50%;
  background: #07111f;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.sidebar-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
}

.sidebar-avatar {
  position: relative;
  z-index: 1;
  display: flex;
  height: 4.5rem;
  width: 4.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid var(--gm-gold);
  background: linear-gradient(180deg, #1a2b45 0%, #0e1a2e 100%);
  color: var(--gm-gold);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow:
    0 0 0 4px rgba(212, 162, 76, 0.16),
    inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

/*
 * Identidad visual Superadmin (--sgt-logo-url desde <head> / localStorage).
 * Placa clara de contraste + logo en ::after (contain). Sin blend modes que apaguen el asset.
 */
html.sgt-has-brand-logo .sgt-brand-mark {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: transparent !important;
  color: transparent !important;
  background-image: none !important;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}
html.sgt-has-brand-logo .sgt-brand-fallback {
  display: none !important;
}
html.sgt-has-brand-logo .sgt-brand-mark::after {
  content: '';
  position: absolute;
  inset: 0.4rem;
  z-index: 1;
  border-radius: 0.65rem;
  background-color: transparent;
  background-image: var(--sgt-logo-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}
/* Sidebar: placa blanca para contraste sobre navy */
html.sgt-has-brand-logo .sidebar-avatar.sgt-brand-mark {
  width: 5.35rem;
  height: 5.35rem;
  border-radius: 1.1rem;
  border: none !important;
  background: #ffffff !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(0, 0, 0, 0.28) !important;
}
/* Splash (oscuro): misma placa clara */
html.sgt-has-brand-logo .auth-splash-mark.sgt-brand-mark {
  width: 4.85rem;
  height: 4.85rem;
  border-radius: 1.1rem;
  border: none !important;
  background: #ffffff !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.35) !important;
}
/* Login (tarjeta clara): placa neutra con borde suave */
html.sgt-has-brand-logo #auth-login-panel .sgt-brand-mark {
  width: 4.85rem;
  height: 4.85rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  background: #f8fafc !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
}

.sidebar-user-name,
.sidebar-user-meta {
  position: relative;
  z-index: 1;
}

.sidebar-user-name {
  margin-top: 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-user-meta {
  margin-top: 0.1rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gm-gold);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem 0.65rem 0.65rem;
}

.sidebar-kicker {
  margin: 0.15rem 0.65rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar .nav-link.hidden,
.sidebar .nav-group-toggle.hidden,
.sidebar .nav-group.hidden {
  display: none;
}

.sidebar .nav-link,
.sidebar .nav-group-toggle {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.28rem;
  padding: 0.38rem 0.72rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar .nav-ico,
.sidebar .nav-chevron {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
}

.sidebar .nav-ico {
  color: #94a3b8;
}

.sidebar .nav-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .nav-chevron {
  margin-left: auto;
  color: #64748b;
  transition: transform 0.15s ease;
}

.nav-group-toggle[aria-expanded='false'] .nav-chevron {
  transform: rotate(-90deg);
}

.nav-group-body.is-collapsed {
  display: none;
}

.nav-group-body {
  margin: 0.1rem 0 0.28rem 1.22rem;
  padding: 0.1rem 0 0.15rem 0.45rem;
  border-left: 1px solid rgba(148, 163, 184, 0.16);
}

.sidebar .nav-link.nav-sub,
.sidebar .nav-group-toggle.nav-sub {
  min-height: 2.05rem;
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
}

.sidebar .nav-link.nav-sub-deep {
  padding-left: 0.7rem;
}

.nav-link[aria-current='page'] {
  background: rgba(212, 162, 76, 0.14);
  color: #fff;
}

.nav-link[aria-current='page'] .nav-ico {
  color: var(--gm-gold);
}

.nav-link[aria-current='page']::before,
.nav-group.is-current > .nav-group-toggle::before {
  content: '';
  position: absolute;
  top: 0.35rem;
  right: 0;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--gm-gold);
}

.nav-link[aria-current='page']::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 8px;
  border-color: transparent transparent transparent var(--gm-gold);
  transform: translate(1px, -50%);
  pointer-events: none;
}

.nav-group.is-current > .nav-group-toggle {
  color: #fff;
}

.nav-group.is-current > .nav-group-toggle .nav-ico {
  color: var(--gm-gold);
}

.sidebar-card {
  margin: 0.35rem 0.75rem 0.5rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-card p:first-child {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.sidebar-card p:last-child {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #94a3b8;
}

.sidebar-version {
  flex-shrink: 0;
  margin: 0 0.75rem 0.35rem;
  display: flex;
  justify-content: center;
}

.sidebar-version-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  color: #cbd5e1;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse {
  display: none;
  flex-shrink: 0;
  width: calc(100% - 1.3rem);
  margin: 0.35rem 0.65rem 0.85rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.2rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

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

.sidebar-collapse-marks {
  font-size: 0.95rem;
  line-height: 1;
}

@media (min-width: 1024px) {
  .app-shell {
    padding-left: 18rem;
    transition: padding-left 0.2s ease;
  }

  .app-shell.is-sidebar-collapsed {
    padding-left: 4.75rem;
  }

  .sidebar {
    transition: width 0.2s ease, transform 0.2s ease-out;
  }

  .sidebar-collapse {
    display: flex;
  }

  .sidebar.is-collapsed {
    width: 4.75rem;
  }

  .sidebar.is-collapsed .sidebar-brand {
    padding: 0.9rem 0.45rem 1.15rem;
  }

  .sidebar.is-collapsed .sidebar-avatar {
    height: 2.35rem;
    width: 2.35rem;
    font-size: 0.68rem;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(212, 162, 76, 0.16);
  }

  html.sgt-has-brand-logo .sidebar.is-collapsed .sidebar-avatar.sgt-brand-mark {
    height: 2.6rem;
    width: 2.6rem;
    border-radius: 0.7rem;
    border: none !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  }
  html.sgt-has-brand-logo .sidebar.is-collapsed .sidebar-avatar.sgt-brand-mark::after {
    inset: 0.22rem;
    border-radius: 0.45rem;
  }

  .sidebar.is-collapsed .nav-label,
  .sidebar.is-collapsed .nav-chevron,
  .sidebar.is-collapsed .sidebar-kicker,
  .sidebar.is-collapsed .sidebar-card,
  .sidebar.is-collapsed .sidebar-version,
  .sidebar.is-collapsed .sidebar-user-name,
  .sidebar.is-collapsed .sidebar-user-meta {
    display: none;
  }

  .sidebar.is-collapsed .sidebar-nav {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  .sidebar.is-collapsed .nav-link,
  .sidebar.is-collapsed .nav-group-toggle {
    justify-content: center;
    gap: 0;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .sidebar.is-collapsed .nav-group-body {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .sidebar.is-collapsed .sidebar-collapse {
    width: calc(100% - 0.9rem);
    margin-left: 0.45rem;
    margin-right: 0.45rem;
  }
}

.table-wrap {
  overflow: auto;
}

.table-wrap table {
  min-width: 980px;
}

.table-wrap td {
  vertical-align: middle;
}

#view-reportes .table-wrap table {
  min-width: 1280px;
}

#view-reportes .table-wrap td {
  vertical-align: top;
}

#view-reportes .table-wrap-wide {
  overflow-x: auto;
}

#view-reportes .table-wrap-wide table {
  min-width: 1760px;
}

#view-reportes .table-wrap-wide th,
#view-reportes .table-wrap-wide td {
  white-space: nowrap;
}

#view-reportes .table-wrap-wide td[colspan] {
  white-space: normal;
}

#view-reportes .table-wrap-wide th:first-child,
#view-reportes .table-wrap-wide td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 1px 0 0 #e2e8f0;
}

#view-reportes .table-wrap-wide thead th:first-child {
  background: #f8fafc;
  z-index: 2;
}

#view-reportes tr.report-row-no-plates {
  background: #fffbeb;
}

#view-reportes tr.report-row-no-plates td {
  box-shadow: inset 0 1px 0 rgba(212, 162, 76, 0.08);
}

#view-reportes td.report-cell-no-plates {
  background: #fffbeb;
  box-shadow: inset 0 -1px 0 rgba(212, 162, 76, 0.35);
  color: #78350f;
}

#view-reportes td.report-cell-in-range {
  background: #fef9c3;
  box-shadow: inset 0 -1px 0 rgba(161, 98, 7, 0.28);
  color: #854d0e;
}

#view-reportes tr.report-row-cartera-blue {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 #3b82f6;
}

#view-reportes tr.report-row-cartera-yellow {
  background: #fefce8;
  box-shadow: inset 3px 0 0 #ca8a04;
}

#view-reportes tr.report-row-cartera-red {
  background: #fef2f2;
  box-shadow: inset 3px 0 0 #b91c1c;
}

#view-reportes tr.report-row-cartera-blue td,
#view-reportes .table-wrap-wide tr.report-row-cartera-blue td:first-child {
  background: #eff6ff;
}

#view-reportes tr.report-row-cartera-yellow td,
#view-reportes .table-wrap-wide tr.report-row-cartera-yellow td:first-child {
  background: #fefce8;
}

#view-reportes tr.report-row-cartera-red td,
#view-reportes .table-wrap-wide tr.report-row-cartera-red td:first-child {
  background: #fef2f2;
}

.badge-cartera-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-cartera-yellow {
  background: #fef9c3;
  color: #854d0e;
}

.badge-cartera-red {
  background: #fee2e2;
  color: #991b1b;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

#view-contratos .table-wrap table {
  min-width: 980px;
}

#view-contratos .col-acciones {
  min-width: 13rem;
  width: 13rem;
}

.acciones {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.125rem;
  white-space: nowrap;
}

.lucide-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.row-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  border-radius: 0.5rem;
  color: #64748b;
  background: transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.row-icon-btn:hover {
  background: #f1f5f9;
}

.row-icon-btn:focus-visible,
.row-renew-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.row-icon-edit {
  color: #475569;
}

.row-icon-edit:hover {
  color: #2563eb;
}

.row-icon-delete {
  color: #94a3b8;
}

.row-icon-delete:hover {
  color: #dc2626;
  background: #fef2f2;
}

.row-icon-btn.is-disabled {
  color: #cbd5e1;
  cursor: default;
}

.row-icon-btn.is-disabled:hover {
  background: transparent;
}

.row-renew-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.75rem;
  margin-right: 0.35rem;
  padding: 0 0.6rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  color: #2563eb;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.row-renew-btn .lucide-icon {
  width: 0.8rem;
  height: 0.8rem;
}

.row-renew-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.row-renew-btn.is-due {
  border-color: #93c5fd;
  background: #eff6ff;
}

/* A la izquierda del botón: arriba o abajo lo recortaría el scroll horizontal de la tabla. */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  right: calc(100% + 0.4rem);
  z-index: 30;
  padding: 0.3rem 0.55rem;
  border-radius: 0.375rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(0.25rem, -50%);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.btn-primary-corp {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.12);
  transition: background-color 0.15s ease;
}

.btn-primary-corp:hover {
  background: #1e293b;
}

.btn-primary-corp:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.badge-fuec {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #64748b;
}

.fleet-section .table-wrap table {
  min-width: 860px;
}

.pagos-section .table-wrap table {
  min-width: 1080px;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-header span {
  font-size: 0.65rem;
  color: #94a3b8;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--text-primary);
}

.list-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/*
 * Shell de modales complejos (vehículo / conductor):
 * - display:flex SOLO con [open] (si va en el selector base, los <dialog> cerrados
 *   rompen el UA stylesheet y aparecen al pie de todas las páginas).
 * - Sin overflow:hidden en el shell; form acotado a 85vh; scroll en .sgt-modal-body.
 */
.modal-wide,
.driver-modal {
  max-height: 90vh;
  height: fit-content;
  margin: 1.75rem auto;
  flex-direction: column;
  overflow: visible;
  padding: 0;
  background: var(--card-bg, #fff);
}

.modal-wide[open],
.driver-modal[open] {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
}

.modal-wide > form,
.driver-modal > form {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 85vh;
  width: 100%;
  overflow: visible;
}

.modal-wide .modal-header,
.driver-modal .modal-header {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: var(--card-bg, #fff);
}

.sgt-modal-body {
  /* Crece con el contenido hasta el tope; luego scrollea (sin hueco fantasma) */
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(85vh - 7.5rem);
  max-height: calc(85dvh - 7.5rem);
  overflow-x: hidden;
  overflow-y: auto !important;
  overflow-anchor: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Gana a utilidades Tailwind py-* para dejar aire al final sin recortar campos */
  padding-bottom: 2rem !important;
}

.sgt-modal-footer {
  flex-shrink: 0;
  background: var(--card-bg, #fff);
}

[data-vehicle-panel],
[data-driver-panel] {
  height: auto;
  min-height: 0;
}

[data-vehicle-panel].hidden,
[data-driver-panel].hidden {
  display: none !important;
}

/* Cabecera de diálogos + botón X de cierre (esquina superior derecha) */
.modal-header {
  position: relative;
}
.sgt-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  margin: -0.25rem -0.35rem 0 0;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.sgt-modal-close:hover {
  background: #f1f5f9;
  color: #334155;
}
.sgt-modal-close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
html[data-theme='dark'] .sgt-modal-close {
  color: #94a3b8;
}
html[data-theme='dark'] .sgt-modal-close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

/* Jerarquía de secciones del modal afiliado / vehículo */
.vehicle-section-legend {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gm-gold, #c9a227);
}
.vehicle-section + .vehicle-section {
  margin-top: 1.5rem;
}

/* Errores inline en modales (política global zero-data-loss) */
.modal-error-banner {
  margin-top: 0.75rem;
}
.modal-error-banner.hidden {
  display: none !important;
}
dialog .is-invalid,
dialog .vehicle-field-error {
  border-color: #ef4444 !important;
}

.vehicle-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
}

.vehicle-tab {
  flex: 1 1 auto;
  border: 0;
  border-radius: 0.7rem;
  padding: 0.5rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  white-space: nowrap;
}

.vehicle-tab[aria-selected='true'] {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

.archive-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.archive-tab {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--card-bg);
}

.archive-tab[aria-selected='true'] {
  border-color: var(--btn-primary-bg);
  background: var(--btn-primary-bg);
  color: #fff;
}

.bill-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.6rem;
}

.bill-kpi {
  display: grid;
  gap: 0.1rem;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
  border-radius: 0.85rem;
  padding: 0.6rem 0.8rem;
  text-align: left;
  background: #fff;
}

.bill-kpi span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.bill-kpi strong {
  font-size: 1.35rem;
  color: #0f172a;
}

.bill-kpi small {
  font-size: 0.78rem;
  color: #475569;
}

.bill-kpi.is-active {
  box-shadow: 0 0 0 2px #0f172a;
}

.bill-kpi.is-pendiente_liquidacion { border-left-color: #f59e0b; }
.bill-kpi.is-con_oc { border-left-color: #0ea5e9; }
.bill-kpi.is-facturado { border-left-color: #6366f1; }
.bill-kpi.is-pagado { border-left-color: #10b981; }

.bill-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #bae6fd;
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #f0f9ff;
}

.bill-bulk.is-client-mix {
  border-color: #fecaca;
  background: #fff1f2;
}

.bill-bulk-client-mix {
  margin: 0;
  padding: 0.35rem 0;
}

.bill-table th {
  padding: 0.6rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f8fafc;
  white-space: nowrap;
}

.bill-table td {
  padding: 0.6rem 0.75rem;
  border-top: 1px solid #f1f5f9;
  vertical-align: top;
  color: #334155;
}

.bill-table tbody tr:hover {
  background: #f8fafc;
}

.bill-status {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.bill-status.is-pendiente_liquidacion { background: #fef3c7; color: #92400e; }
.bill-status.is-con_oc { background: #e0f2fe; color: #075985; }
.bill-status.is-facturado { background: #e0e7ff; color: #3730a3; }
.bill-status.is-pagado { background: #d1fae5; color: #065f46; }

.cargue-wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cargue-step {
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
}

.cargue-step.is-active {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}

.cargue-step.is-done {
  border-color: #86efac;
  background: #ecfdf5;
  color: #166534;
}

.cargue-step:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cargue-row-ok {
  background: #ecfdf5;
}

.cargue-row-ok td {
  color: #166534;
}

.cargue-row-warn {
  background: #fff7ed;
}

.cargue-row-warn td {
  color: #c2410c;
}

.cargue-row-err {
  background: #fef2f2;
}

.cargue-row-err td {
  color: #9f1239;
}

.cargue-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  display: inline-block;
}

.cargue-dot-ok {
  background: #16a34a;
}

.cargue-dot-warn {
  background: #f97316;
}

.cargue-dot-err {
  background: #e11d48;
}

.cargue-spinner {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 3px solid #e2e8f0;
  border-top-color: #0f172a;
  animation: cargue-spin 0.8s linear infinite;
}

#btn-siguiente-cargue.btn-secondary {
  background: #e2e8f0;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

#btn-siguiente-cargue.btn-primary {
  background: #0f172a;
  color: #fff;
  border: 1px solid #0f172a;
}

#btn-siguiente-cargue.btn-primary:hover:not(:disabled) {
  background: #1e293b;
}

#cargue-ack-wrap:not(.hidden) {
  display: flex;
}

.vales-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}

.vale-media img {
  max-height: 10rem;
  width: 100%;
  object-fit: contain;
}

/* Cumplido / Vale: header + body scrolleable + footer fijo (sin desborde). */
#vale-cumplido-modal.modal-wide[open] {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

#vale-cumplido-modal > form {
  overflow: visible;
  min-height: 0;
}

#vale-cumplido-modal .sgt-modal-body {
  flex: 1 1 auto;
  max-height: none;
}

#vale-cumplido-modal #vale-admin-override {
  margin-bottom: 0.25rem;
}

.vale-tab-btn.active {
  background: #0f172a;
  color: #fff;
}

.empresa-tab-btn {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  border-radius: 0.75rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.empresa-tab-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.empresa-tab-btn.active {
  background: var(--btn-primary-bg);
  color: #fff;
  border-color: var(--btn-primary-bg);
}

.vale-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vale-timeline-item {
  position: relative;
  padding: 0 0 1.25rem 1.5rem;
  border-left: 2px solid #e2e8f0;
}

.vale-timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.vale-timeline-dot {
  position: absolute;
  left: -0.4rem;
  top: 0.2rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #0f172a;
  box-shadow: 0 0 0 3px #fff;
}

.vale-timeline-item.is-finalizado .vale-timeline-dot { background: #0369a1; }
.vale-timeline-item.is-cumplido .vale-timeline-dot { background: #7c3aed; }
.vale-timeline-item.is-aprobado .vale-timeline-dot { background: #047857; }
.vale-timeline-item.is-inconsistente .vale-timeline-dot { background: #b45309; }
.vale-timeline-item.is-pending .vale-timeline-dot { background: #d97706; }
.vale-timeline-item.is-creado .vale-timeline-dot { background: #0284c7; }
.vale-timeline-item.is-asignado .vale-timeline-dot { background: #2563eb; }
.vale-timeline-item.is-modificado .vale-timeline-dot { background: #ca8a04; }
.vale-timeline-item.is-estado .vale-timeline-dot { background: #475569; }

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

.doc-card {
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  color: var(--text-primary);
}

.doc-badge {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
}

.doc-attach {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px dashed var(--border-color);
  border-radius: 0.85rem;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
}

/* El file input queda anclado al label (no al modal): evita saltos de scroll al adjuntar. */
.doc-attach input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  overflow: hidden;
}

.doc-attach-enabled:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
  color: #0369a1;
}

.notify-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.notify-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 40;
  width: min(24rem, calc(100vw - 2rem));
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

/* Badge estático de marca / grupo (no es selector). */
.tenant-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 14rem;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.01em;
}
.tenant-brand-badge.is-global {
  background: #0f172a;
  color: #f8fafc;
  border-color: #1e293b;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 40;
  min-width: 15.5rem;
  padding: 0.35rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.user-menu-item:hover {
  background: var(--bg-muted);
}

.notify-filter {
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.notify-filter.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.notify-item {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 0.85rem;
  padding: 0.7rem 0.75rem;
  color: #0f172a;
}

.notify-item:hover {
  background: #f8fafc;
}

.notify-item + .notify-item {
  margin-top: 0.15rem;
}

.notify-ver-detalle {
  margin-top: 0.45rem;
  display: inline-flex;
  border-radius: 0.65rem;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  padding: 0.28rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
}

.notify-ver-detalle:hover {
  background: #e0f2fe;
}

.photo-card {
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 0.9rem;
  background: var(--card-bg);
  color: var(--text-primary);
}

.photo-thumb {
  position: relative;
  margin-top: 0.65rem;
  height: 9.5rem;
  overflow: hidden;
  border-radius: 0.85rem;
  background: var(--bg-muted);
  border: 1px dashed var(--border-color);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.photo-action {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  border-radius: 0.7rem;
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
}

.photo-action:hover {
  background: var(--btn-secondary-hover);
}

.photo-action input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

dialog {
  border: 0;
}

/* Estado base: TODO <dialog> cerrado queda fuera del layout (anti DOM leakage). */
dialog:not([open]) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Capas de modales abiertos: primario 1050, anidados (confirm/prompt) 1060+. */
dialog[open] {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 1050;
  /* display/max-height/overflow: ver bloque iOS Safari más abajo */
}
dialog[open][data-modal-nested],
dialog[open][data-modal-layer='nested'],
#confirm-modal[open],
#prompt-modal[open] {
  z-index: 1060;
}

dialog::backdrop {
  background: rgba(7, 17, 31, 0.62);
  backdrop-filter: blur(8px);
}

/*
 * iOS Safari / WebKit — modales, scroll táctil, dropdowns y reset de apariencia.
 * Unifica el comportamiento con Android/Chrome: shell flex + max-h, scroll en body,
 * listas flotantes sin recorte por overflow del padre.
 */
dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
  margin-block: auto;
  overflow: visible;
  -webkit-overflow-scrolling: touch;
}

/* Diálogos sin .modal-wide: el form interno hace de área scrolleable. */
dialog[open]:not(.modal-wide):not(.driver-modal) > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(90vh, 90dvh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sgt-modal-body,
.sgt-modal-scroll,
dialog[open] .overflow-y-auto,
dialog[open] .overflow-auto {
  -webkit-overflow-scrolling: touch;
}

/* Dropdown abierto: el scroll padre no debe recortar la lista absoluta (bug típico iOS). */
.sgt-modal-body:has(.combobox-list:not(.hidden)),
.sgt-modal-scroll:has(.combobox-list:not(.hidden)),
dialog[open]:has(.combobox-list:not(.hidden)) > form,
dialog[open] .overflow-y-auto:has(.combobox-list:not(.hidden)),
dialog[open] .overflow-auto:has(.combobox-list:not(.hidden)),
[data-sgt-dropdown-open='1'] {
  overflow: visible !important;
}

.combobox,
.places-combobox,
[data-prog-contract],
[data-passenger-contractor],
.prog-rate-combobox,
.quote-muni-box,
.passenger-contractor-combobox {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

.combobox:has(.combobox-list:not(.hidden)),
.places-combobox:has(.combobox-list:not(.hidden)),
.prog-rate-combobox:has(.combobox-list:not(.hidden)),
.quote-muni-box:has(.combobox-list:not(.hidden)),
.passenger-contractor-combobox:has(.combobox-list:not(.hidden)),
[data-sgt-dropdown-open='1'] .combobox:has(.combobox-list:not(.hidden)) {
  z-index: 80;
}

/* Reset WebKit: evita cajas/bordes nativos raros en iOS Safari. */
button,
input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']):not([type='color']):not([type='image']),
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
}

input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
}

input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

#company-select option {
  color: #0f172a;
  background: #fff;
}

.badge-ok,
.badge-info,
.badge-warn,
.badge-danger,
.badge-neutral {
  border: 1px solid transparent;
}

.badge-ok {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}

.badge-info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.badge-warn {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

.badge-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.badge-neutral {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.kpi-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.45);
}

.kpi-sgt {
  background:
    radial-gradient(circle at top right, rgba(212, 162, 76, 0.22), transparent 46%),
    linear-gradient(180deg, #07111f 0%, #0e1a2e 100%);
  border: 1px solid rgba(212, 162, 76, 0.28);
  box-shadow: 0 12px 28px -20px rgba(7, 17, 31, 0.9);
}

.badge-rut {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-rut.is-ok {
  background: #ecfdf5;
  color: #047857;
}

.badge-rut.is-missing {
  background: #fef3c7;
  color: #92400e;
}

.badge-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-status.is-vigente {
  background: #ecfdf5;
  color: #047857;
}

.badge-status.is-por-vencer {
  background: #fef3c7;
  color: #92400e;
}

.badge-status.is-vencido {
  background: #fef2f2;
  color: #b91c1c;
}

.badge-status.is-por-iniciar {
  background: #eef2ff;
  color: #4338ca;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 2.55rem;
  height: 1.4rem;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-ui {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.15s ease;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-ui {
  background: #0f172a;
}

.switch input:checked + .switch-ui::after {
  transform: translateX(1.15rem);
}

.switch input:focus-visible + .switch-ui {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.resume-annex {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
  padding: 0.7rem 0.8rem;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
}

.resume-annex:hover {
  border-color: #d4a24c;
}

.resume-annex input {
  margin-top: 0.15rem;
}

.resume-annex.is-disabled {
  cursor: not-allowed;
  background: var(--bg-muted);
  opacity: 0.75;
}

.resume-annex.is-disabled:hover {
  border-color: #e2e8f0;
}

.input-icon {
  position: relative;
  display: block;
  margin-top: 0.375rem;
}

.input-icon svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  color: #94a3b8;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-icon input {
  padding-left: 2.45rem;
}

.combobox {
  position: relative;
}

.combobox .input-icon input {
  padding-right: 2.15rem;
}

.combobox-list {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% - 0.15rem);
  margin: 0;
  max-height: min(14rem, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 0.25rem;
  /* Evita que Safari “aplane” el stacking del menú dentro del modal. */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.combobox-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0.55rem;
  padding: 0.5rem 0.7rem;
  background: transparent;
  font-size: 0.875rem;
  color: #0f172a;
  cursor: pointer;
}

.combobox-option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: #94a3b8;
}

.combobox-option.is-disabled:hover {
  background: transparent;
}

.combobox-option:hover,
.combobox-option.is-active {
  background: #f0f9ff;
  color: #0369a1;
}

.combobox-option-none {
  color: #64748b;
}

.combobox-option-title {
  display: block;
  font-weight: 600;
}

.combobox-option-sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: #64748b;
}

.combobox-option:hover .combobox-option-sub,
.combobox-option.is-active .combobox-option-sub {
  color: #0284c7;
}

.combobox-empty {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  color: #64748b;
}

.passenger-contractor-combobox .combobox-list {
  z-index: 80;
  max-height: 12.5rem;
}

.prog-rate-combobox .combobox-list {
  z-index: 70;
  max-height: 16rem;
}

.prog-rate-combobox .combobox-option-title {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

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

.rate-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  background: var(--card-bg);
  color: var(--text-primary);
}

.rate-mode-card input {
  margin-top: 0.2rem;
}

.rate-mode-card:has(input:checked) {
  border-color: var(--btn-primary-bg);
  background: color-mix(in srgb, var(--btn-primary-bg) 16%, var(--card-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn-primary-bg) 22%, transparent);
}

.prog-rate-badge {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 0.9rem;
  padding: 0.7rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.prog-rate-badge.is-idle {
  border: 1px solid color-mix(in srgb, var(--btn-primary-bg) 35%, var(--border-color));
  background: color-mix(in srgb, var(--btn-primary-bg) 12%, var(--bg-muted));
  color: var(--text-primary);
  font-weight: 600;
}

.prog-rate-badge.is-ok {
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: #166534;
}

.prog-rate-badge.is-warn {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.rate-details-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
}

.rate-details-wrap table input,
.rate-details-wrap table select {
  width: 100%;
  min-width: 0;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  padding: 0.45rem 0.6rem;
  background: #fff;
}

.quote-chip-editor-shell {
  position: relative;
}

.quote-chip-editor {
  min-height: 12.5rem;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #fff;
  padding: 0.7rem 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  overflow-y: auto;
}

.quote-chip-editor--sm {
  min-height: 6.5rem;
}

.quote-chip-editor:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

#quote-config-client .quote-chip-editor:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.quote-chip-editor[aria-disabled='true'],
.quote-chip-editor[contenteditable='false'] {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

.quote-chip-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  white-space: pre-wrap;
  pointer-events: none;
}

.quote-inline-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 0.12rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 0.05rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #0f172a;
  line-height: 1.45;
  vertical-align: baseline;
  user-select: none;
  cursor: default;
}

#quote-config-global .quote-inline-chip {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

#quote-config-client .quote-inline-chip {
  border-color: #7dd3fc;
  background: #f0f9ff;
  color: #075985;
}

.quote-chip-source {
  display: none !important;
}

.quote-var-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.quote-var-toolbar-hint {
  margin-right: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.quote-var-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.quote-var-pill:hover {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
  transform: translateY(-1px);
}

.quote-var-pill:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.quote-var-pill:active {
  transform: translateY(0);
  background: #fef3c7;
}

#quote-config-client .quote-var-pill:hover {
  border-color: #38bdf8;
  background: #f0f9ff;
  color: #075985;
}

#quote-config-client .quote-var-pill:focus-visible {
  outline-color: #38bdf8;
}

#quote-config-client .quote-var-pill:active {
  background: #e0f2fe;
}

.quote-items-wrap {
  overflow: visible;
}

.quote-items-wrap table {
  min-width: 72rem;
}

/* Carga: sin columna Día / Fecha — más espacio a origen, destino, descripción y valor */
.quote-items-wrap table.quote-items-freight {
  min-width: 56rem;
  table-layout: fixed;
}

.quote-items-freight th:nth-child(2),
.quote-items-freight td:nth-child(2),
.quote-items-freight th:nth-child(3),
.quote-items-freight td:nth-child(3) {
  width: 18%;
}

.quote-items-freight th:nth-child(4),
.quote-items-freight td:nth-child(4) {
  width: 28%;
}

.quote-items-freight th:nth-child(5),
.quote-items-freight td:nth-child(5) {
  width: 16%;
}

.quote-items-freight th:nth-child(6),
.quote-items-freight td:nth-child(6) {
  width: 14%;
}

.quote-items-freight th:nth-child(7),
.quote-items-freight td:nth-child(7) {
  width: 3.5rem;
}

.quote-day-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 9.5rem;
}

.quote-day-cell [data-quote-day],
.quote-day-cell [data-quote-date] {
  width: 100%;
  min-width: 0;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.55rem;
  background: #fff;
  font-size: 0.8125rem;
}

.quote-day-cell [data-quote-date] {
  color: #334155;
}

.quote-muni-box {
  position: relative;
  min-width: 10.5rem;
}

.quote-muni-box [data-quote-muni-search] {
  width: 100%;
}

.quote-muni-box .combobox-list {
  z-index: 80;
}

.quote-row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.65rem;
  background: #fef2f2;
  color: #b91c1c;
}

.quote-row-delete:hover {
  background: #fee2e2;
}

.quote-group-row td {
  background: var(--bg-muted);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quote-items-wrap [data-quote-route-desc] {
  width: 100%;
  min-width: 12rem;
}

.quote-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

@media (max-width: 720px) {
  .rate-mode-grid {
    grid-template-columns: 1fr;
  }
}

.combobox-hint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.combobox-hint:empty,
.combobox-hint.hidden {
  display: none;
}

.combobox-clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  z-index: 2;
  width: 1.4rem;
  height: 1.4rem;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}

.combobox-clear:hover {
  background: #cbd5e1;
}

.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 0.28rem 0.35rem 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
}

.picker-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-chip button {
  display: inline-flex;
  height: 1.25rem;
  width: 1.25rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  cursor: pointer;
}

.picker-chip button:hover {
  background: #fecaca;
  color: #b91c1c;
}

.btn-primary-blue {
  background: var(--btn-primary-bg);
  color: #fff;
}

.btn-primary-blue:hover {
  background: var(--btn-primary-hover);
}

.btn-secondary-gray {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
}

.btn-secondary-gray:hover {
  background: var(--btn-secondary-hover);
}

.btn-nuevo,
.btn-action-green {
  background: var(--btn-success-bg);
  color: #fff;
}

.btn-nuevo:hover,
.btn-action-green:hover {
  background: var(--btn-success-hover);
}

.btn-action-red {
  background: var(--btn-danger-bg);
  color: #fff;
}

.btn-action-red:hover {
  background: var(--btn-danger-hover);
}

.btn-action-sky {
  background: #0284c7;
  color: #fff;
}

.btn-action-sky:hover {
  background: #0369a1;
}

.btn-action-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-action-icon svg {
  height: 0.85rem;
  width: 0.85rem;
}

.tariff-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .tariff-layout {
    grid-template-columns: 16.5rem minmax(0, 1fr);
    align-items: start;
  }
}

.tariff-class-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tariff-class-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0.8rem;
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
}

.tariff-class-item:hover {
  background: var(--bg-muted);
}

.tariff-class-item[aria-current='true'] {
  background: var(--btn-primary-bg);
  color: #fff;
  font-weight: 600;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

.preop-config-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1100px) {
  .preop-config-layout {
    grid-template-columns: minmax(14rem, 1fr) minmax(16rem, 1fr) minmax(20rem, 1.3fr);
  }
}

.preop-pick {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: transparent;
  color: var(--text-primary);
}

.preop-pick:hover,
.preop-pick.is-active {
  background: var(--bg-muted);
}

.preop-pick.is-active {
  background: var(--btn-primary-bg);
  color: #fff;
}

.preop-group-card {
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--card-bg);
  color: var(--text-primary);
}

.preop-group-card.is-complete {
  border-color: #a7f3d0;
}

.preop-group-card.is-complete .preop-group-summary {
  background: #ecfdf5;
}

.preop-group-card.has-fails {
  border-color: #fecaca;
}

.preop-group-card.has-fails .preop-group-summary {
  background: #fef2f2;
}

.preop-group-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.preop-group-card.is-complete .preop-group-index {
  background: #059669;
}

.preop-group-card.has-fails .preop-group-index {
  background: #dc2626;
}

.preop-group-summary {
  background: var(--bg-muted);
  color: var(--text-primary);
  display: block;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2.25rem;
}

.preop-group-summary::-webkit-details-marker {
  display: none;
}

.preop-group-summary::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-70%) rotate(45deg);
}

.preop-group-card[open] .preop-group-summary::after {
  transform: translateY(-30%) rotate(225deg);
}

.preop-item-row {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-primary);
}

@media (min-width: 720px) {
  .preop-item-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

.preop-nok-box {
  grid-column: 1 / -1;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
}

.preop-item-row.is-nok-missing {
  background: #fff1f2;
  box-shadow: inset 3px 0 0 #ef4444;
}

#preop-signature-wrap.is-signature-missing {
  border-color: #ef4444;
  background: #fff1f2;
}

.preop-choice {
  display: inline-flex;
  gap: 0.4rem;
}

.preop-choice label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--text-primary);
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.preop-choice input:checked + span,
.preop-choice label:has(input:checked) {
  border-color: var(--btn-primary-bg);
  background: color-mix(in srgb, var(--btn-primary-bg) 22%, transparent);
  color: #fff;
}

.preop-choice input {
  accent-color: #0f172a;
}

.preop-item-media {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.preop-attach {
  border-radius: 999px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
}

.preop-media-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.preop-media-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.preop-media-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preop-media-thumb.is-video {
  width: auto;
  min-width: 7.5rem;
  height: auto;
  min-height: 56px;
  padding: 0.4rem 1.4rem 0.4rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
}

.preop-media-icon {
  font-size: 0.7rem;
  color: #0369a1;
}

.preop-media-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 600;
  color: #0f172a;
}

.preop-media-duration {
  font-size: 0.62rem;
  color: #64748b;
}

.preop-media-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1rem;
  text-align: center;
}

.preop-media-hint {
  width: 100%;
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.preop-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.preop-badge-BORRADOR { background: #f1f5f9; color: #475569; }
.preop-badge-ENVIADO { background: #e0f2fe; color: #0369a1; }
.preop-badge-APROBADO { background: #dcfce7; color: #15803d; }
.preop-badge-RECHAZADO { background: #fee2e2; color: #b91c1c; }

.preop-last-km {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
}

.preop-last-km.is-empty {
  background: #f1f5f9;
  color: #64748b;
}

.preop-last-km.hidden {
  display: none;
}

.fuec-hist-filters,
.filter-panel,
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--text-primary);
}

.fuec-hist-filters label,
.fuec-hist-filters legend,
.filter-panel label,
.filter-panel legend,
.search-box label {
  color: var(--text-primary);
}

.fuec-hist-mode {
  min-width: 16rem;
}

.fuec-hist-period {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
}

.fuec-hist-period label {
  min-width: 9.5rem;
}

.fuec-hist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.fuec-print-btn {
  padding: 0.45rem;
}

.fuec-print-btn svg {
  height: 1rem;
  width: 1rem;
}

/* Destino intermedio del FUEC manual: el atributo hidden manda sobre utilidades Tailwind. */
#fuec-intermediate-wrap[hidden] {
  display: none !important;
}

.fuec-route-block {
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
  padding: 1rem 1.1rem 1.15rem;
}

.fuec-passengers-panel {
  border: 1px solid color-mix(in srgb, var(--gm-gold) 45%, #e2e8f0);
  border-radius: 1rem;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 72%);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: inset 0 1px 0 rgba(212, 162, 76, 0.18);
}

.fuec-trayecto {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.fuec-trayecto label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--card-bg);
}

.fuec-trayecto label:has(input:checked) {
  border-color: var(--gm-gold);
  background: color-mix(in srgb, var(--gm-gold) 18%, var(--card-bg));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--gm-gold);
}

.fuec-trayecto input {
  accent-color: #d4a24c;
}

.fuec-trayecto-seg {
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-muted);
}

.fuec-trayecto-seg label {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fuec-trayecto-seg label:hover {
  background: var(--card-bg);
  color: var(--text-primary);
}

.fuec-trayecto-seg label:has(input:checked) {
  border-color: var(--gm-ink);
  background: var(--gm-ink);
  color: #fff;
  box-shadow: none;
}

.fuec-trayecto-seg label:has(input:checked):hover {
  background: var(--gm-navy);
  color: #fff;
}

.fuec-trayecto-seg input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fuec-trayecto-seg label:focus-within {
  outline: 2px solid var(--gm-ink);
  outline-offset: 1px;
}

.fuec-drivers {
  display: grid;
  gap: 0.5rem;
}

.fuec-drivers li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
  padding: 0.7rem 0.85rem;
}

.fuec-drivers input {
  margin-top: 0.15rem;
  accent-color: #d4a24c;
}

.fuec-recent-list {
  max-height: min(70vh, 38rem);
  overflow: auto;
}

.fuec-recent-item {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #f1f5f9;
}

.fuec-recent-item:first-child {
  border-top: 0;
}

.fuec-recent-num {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0f172a;
}

.fuec-recent-meta {
  margin-top: 0.28rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #64748b;
}

.fuec-recent-meta span {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.fuec-recent-actions {
  display: flex;
  gap: 0.4rem;
}

.fuec-recent-copy,
.fuec-recent-reprint {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
}

.fuec-recent-copy:hover,
.fuec-recent-reprint:hover {
  border-color: #d4a24c;
  background: #fffbeb;
}

.fuec-recent-empty {
  padding: 1.75rem 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
}

.fuec-passengers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  background: var(--bg-muted);
}

.fuec-passengers-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.4rem;
  margin: 0;
  border: 1px solid var(--border-color);
  border-radius: 0.65rem;
  padding: 0 0.9rem;
  background: var(--card-bg);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fuec-passengers-btn:hover {
  background: var(--btn-secondary-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.fuec-passengers-btn:focus-visible,
.fuec-passengers-file:focus-within {
  outline: 2px solid var(--gm-ink);
  outline-offset: 1px;
}

.fuec-passengers-btn svg {
  height: 0.95rem;
  width: 0.95rem;
  color: #64748b;
}

.fuec-passengers-file {
  flex: 1 1 12rem;
  justify-content: flex-start;
  cursor: pointer;
}

.fuec-passengers-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.fuec-passengers-file-icon svg {
  height: 0.95rem;
  width: 0.95rem;
}

.fuec-passengers-file-label {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  white-space: nowrap;
}

.fuec-passengers-status {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.fuec-passengers-rows {
  display: grid;
  gap: 0.6rem;
  max-height: 22rem;
  overflow: auto;
}

.fuec-passengers-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: end;
}

@media (max-width: 640px) {
  .fuec-passengers-row {
    grid-template-columns: 1fr;
  }
}

.fuec-passengers-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
}

.fuec-passengers-row input {
  margin-top: 0.3rem;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
}

.report-pdf-wrap {
  min-height: 22rem;
  background: var(--bg-muted);
}

.report-pdf-empty {
  margin: 1.25rem;
  padding: 4.5rem 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--card-bg) 70%, transparent);
}

.report-pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
}

.report-pdf-frame {
  display: block;
  width: 100%;
  height: min(72vh, 52rem);
  border: 0;
  background: var(--card-bg);
}

/* Vista previa HTML nativa del Paz y Salvo: hoja carta blanca encapsulada */
.paz-salvo-preview-frame {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.25rem 1rem 1.5rem;
  background: #e2e8f0;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(70vh, 46rem);
  box-sizing: border-box;
}

.paz-salvo-sheet {
  box-sizing: border-box;
  width: min(100%, 46rem);
  flex: 0 0 auto;
  display: block;
  margin: 0 auto;
  padding: 1.75rem 2rem 2rem;
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  color-scheme: light;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.paz-salvo-sheet-body {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  background: #ffffff !important;
  color: #0f172a !important;
}

.paz-salvo-letterhead {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 0.9rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid #1f2937;
}

.paz-salvo-logo {
  width: 4.75rem;
  height: 4.75rem;
  object-fit: contain;
  flex-shrink: 0;
  background: #f8fafc;
  border-radius: 0.4rem;
}

.paz-salvo-logo-empty {
  border: 1px dashed #cbd5e1;
}

.paz-salvo-doc-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0f172a !important;
}

.paz-salvo-company {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a !important;
}

.paz-salvo-nit {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #475569 !important;
}

.paz-salvo-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  text-align: justify;
  color: #0f172a !important;
}

.paz-salvo-section {
  margin: 1.25rem 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a !important;
}

.paz-salvo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.paz-salvo-table th,
.paz-salvo-table td {
  border: 1px solid #1f2937;
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: middle;
  color: #0f172a !important;
}

.paz-salvo-table th {
  width: 10.5rem;
  background: #f3f4f6 !important;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.paz-salvo-closing {
  margin-top: 1.35rem;
  padding: 0 0 0.25rem;
  width: 100%;
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
}

.paz-salvo-issued {
  margin: 0;
  font-size: 0.9rem;
  color: #0f172a !important;
}

.paz-salvo-sign {
  margin-top: 1.25rem;
  width: min(100%, 18rem);
  text-align: center;
  overflow: hidden;
  background: #ffffff !important;
}

.paz-salvo-signature {
  display: block;
  max-width: 11rem;
  max-height: 3.5rem;
  width: auto;
  height: auto;
  margin: 0 auto 0.35rem;
  object-fit: contain;
}

.paz-salvo-sign-line {
  border-top: 1px solid #1f2937;
  margin-top: 0.35rem;
}

.paz-salvo-sign-name {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a !important;
  word-break: break-word;
}

.paz-salvo-sign-role {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: #475569 !important;
}

.paz-salvo-footer {
  margin-top: 1.25rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.72rem;
  color: #64748b !important;
  text-align: center;
  word-break: break-word;
}

/* Modo oscuro: marco elevado; la hoja permanece papel blanco con tinta negra */
html[data-theme='dark'] .paz-salvo-preview-frame,
html[data-theme='dark'] #app-shell .paz-salvo-preview-frame {
  background: #0f172a !important;
  color: inherit !important;
}

html[data-theme='dark'] #app-shell .paz-salvo-sheet,
html[data-theme='dark'] .paz-salvo-sheet,
html[data-theme='dark'] #app-shell .paz-salvo-sheet-body,
html[data-theme='dark'] #app-shell .paz-salvo-closing {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #64748b;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.55);
}

html[data-theme='dark'] #app-shell .paz-salvo-sheet-body,
html[data-theme='dark'] #app-shell .paz-salvo-closing {
  box-shadow: none;
  border-color: transparent;
}

html[data-theme='dark'] #app-shell .paz-salvo-sheet,
html[data-theme='dark'] #app-shell .paz-salvo-sheet *,
html[data-theme='dark'] #app-shell .paz-salvo-sheet p,
html[data-theme='dark'] #app-shell .paz-salvo-sheet strong,
html[data-theme='dark'] #app-shell .paz-salvo-sheet h4,
html[data-theme='dark'] #app-shell .paz-salvo-sheet th,
html[data-theme='dark'] #app-shell .paz-salvo-sheet td,
html[data-theme='dark'] #app-shell .paz-salvo-sheet span,
html[data-theme='dark'] #app-shell .paz-salvo-doc-title,
html[data-theme='dark'] #app-shell .paz-salvo-company,
html[data-theme='dark'] #app-shell .paz-salvo-body,
html[data-theme='dark'] #app-shell .paz-salvo-section,
html[data-theme='dark'] #app-shell .paz-salvo-issued,
html[data-theme='dark'] #app-shell .paz-salvo-sign-name {
  color: #0f172a !important;
}

html[data-theme='dark'] #app-shell .paz-salvo-nit,
html[data-theme='dark'] #app-shell .paz-salvo-sign-role,
html[data-theme='dark'] #app-shell .paz-salvo-footer {
  color: #475569 !important;
}

html[data-theme='dark'] #app-shell .paz-salvo-table th {
  background: #f3f4f6 !important;
  color: #0f172a !important;
}

.d-none {
  display: none !important;
}

.dashboard-tabs-container {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 0.2rem;
  border: 1px solid var(--border-color);
  border-radius: 0.7rem;
  background: var(--bg-muted);
}

.dashboard-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.55rem 1.15rem;
  border-radius: 0.5rem;
  cursor: pointer;
  line-height: 1.2;
}

.dashboard-tab:hover {
  color: var(--text-primary);
  background: var(--card-bg);
}

.dashboard-tab.active {
  background: var(--btn-primary-bg);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.op-dash-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-start;
  margin-bottom: 1.1rem;
}

.op-dash-period {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.op-dash-period select {
  min-width: 14rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  color: #0f172a;
  outline: none;
}

.op-dash-period select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.op-kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .op-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .op-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Tarjeta de métrica unificada de todos los dashboards: acento superior según la naturaleza del dato. */
.metric-card {
  --metric-accent: #2563eb;
  --metric-value: #1d4ed8;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--metric-accent);
  background: var(--card-bg);
  color: var(--text-primary);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow-soft);
}

.metric-card-label {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.metric-card-value {
  margin-top: 0.45rem;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--metric-value);
  overflow-wrap: anywhere;
}

.metric-card-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.metric-card-hint {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--text-secondary);
}

.metric-card-compact {
  padding: 0.7rem 0.9rem 0.65rem;
}

.metric-card-compact .metric-card-label {
  font-size: 0.6875rem;
}

.metric-card-compact .metric-card-value {
  margin-top: 0.2rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.metric-blue { --metric-accent: #2563eb; --metric-value: #1d4ed8; }
.metric-green { --metric-accent: #16a34a; --metric-value: #15803d; }
.metric-orange { --metric-accent: #ea580c; --metric-value: #c2410c; }
.metric-red { --metric-accent: #dc2626; --metric-value: #b91c1c; }

.op-kpi-download,
.metric-card-action {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--btn-secondary-fg);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.6rem;
  padding: 0.38rem 0.7rem;
  cursor: pointer;
}

.op-kpi-download:hover,
.metric-card-action:hover {
  border-color: var(--border-color);
  background: var(--btn-secondary-hover);
}

.op-dash-grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1280px) {
  .op-dash-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.op-dash-panel {
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: var(--card-bg);
  color: var(--text-primary);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.op-dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.op-dash-heading {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-primary);
}

.op-trend-chart {
  min-height: 16rem;
}

.op-trend-chart svg {
  display: block;
  width: 100%;
  height: 16rem;
}

.op-contracts-table {
  width: 100%;
  text-align: left;
  font-size: 0.8rem;
}

.op-contracts-table thead {
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.op-contracts-table th,
.op-contracts-table td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

.sgt-switch {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
}

.sgt-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sgt-switch-ui {
  position: relative;
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.35rem;
  margin-top: 0.15rem;
  border-radius: 999px;
  background: #e2e8f0;
  transition: background 0.15s ease;
}

.sgt-switch-ui::after {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease;
}

.sgt-switch-input:checked + .sgt-switch-ui {
  background: #0284c7;
}

.sgt-switch-input:checked + .sgt-switch-ui::after {
  transform: translateX(1.05rem);
}

.sgt-switch-input:focus-visible + .sgt-switch-ui {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.badge-op-servicios,
.badge-solo-afiliado {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-op-servicios {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-solo-afiliado {
  background: #f1f5f9;
  color: #64748b;
}

.programacion-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .programacion-layout {
    grid-template-columns: 1fr;
  }
}

.programacion-left,
.programacion-right {
  min-width: 0;
}

.prog-swap {
  height: 2.6rem;
  width: 2.6rem;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 700;
}

.places-combobox .combobox-list {
  z-index: 80;
  max-height: 16rem;
}

.places-attribution {
  margin: 0.2rem 0 0;
  padding: 0.3rem 0.7rem 0.15rem;
  border-top: 1px solid #f1f5f9;
  text-align: right;
  font-size: 0.68rem;
  color: #94a3b8;
}

.places-attribution b {
  color: #475569;
  font-weight: 600;
}

.prog-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  background: var(--bg-muted);
}

.prog-segmented.is-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.prog-segmented label {
  cursor: pointer;
}

.prog-segmented input,
.prog-dow input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.prog-segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 2.25rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  color: var(--text-secondary);
}

.prog-segmented input:checked + span {
  background: var(--btn-primary-bg);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.prog-segmented input:focus-visible + span,
.prog-dow input:focus-visible + span {
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

.prog-dow {
  cursor: pointer;
}

.prog-dow span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: #fff;
}

.prog-dow input:checked + span {
  border-color: #0284c7;
  background: #0284c7;
  color: #fff;
}

.prog-dow-preset {
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px dashed #94a3b8;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0369a1;
  background: #fff;
}

.prog-dow-preset:hover {
  background: #f0f9ff;
}

.prog-notes {
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.6rem 0.85rem;
}

.prog-notes summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.prog-day-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.95rem;
  padding: 0.9rem 1rem;
  background: #f8fafc;
}

.prog-day-card-title {
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.prog-day-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.prog-day-obs-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
}

.prog-day-obs-toggle input {
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.prog-day-obs {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition: grid-template-rows 0.28s ease, opacity 0.22s ease, margin-top 0.22s ease;
}

.prog-day-obs.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0.75rem;
}

.prog-day-obs-inner {
  overflow: hidden;
  min-height: 0;
}

.prog-day-obs textarea {
  resize: vertical;
  min-height: 5.5rem;
}

#prog-trip-type.is-off {
  display: none !important;
}

#prog-service-time-wrap.is-off {
  display: none !important;
}

.prog-passenger-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.prog-new-passenger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 2.65rem;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 0.85rem;
  background: #16a34a;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.prog-new-passenger svg {
  width: 1rem;
  height: 1rem;
}

.prog-passenger-check {
  width: 1rem;
  height: 1rem;
  accent-color: #0284c7;
  cursor: pointer;
}

.prog-passenger-leader {
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.prog-new-passenger:hover {
  background: #15803d;
}

.prog-doc-status {
  margin-top: 0.15rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.prog-doc-status-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.prog-doc-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.prog-doc-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.prog-doc-chip strong {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.prog-doc-chip.is-ok {
  background: #dcfce7;
  color: #166534;
}

.prog-doc-chip.is-bad {
  background: #fee2e2;
  color: #b91c1c;
}

.prog-doc-status-note {
  margin: 0.55rem 0 0;
  font-size: 0.7rem;
  color: #64748b;
}

.prog-margin-box {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
  background: var(--bg-muted);
  color: var(--text-primary);
}

.prog-margin-box.is-ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.prog-margin-box.is-neg {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.prog-margin-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

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

.prog-margin-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .prog-margin-grid-3 {
    grid-template-columns: 1fr;
  }
}

.prog-margin-grid span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.prog-margin-grid strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.prog-margin-box.is-neg .prog-margin-grid strong {
  color: #b91c1c;
}

.prog-margin-note {
  margin: 0.6rem 0 0;
  font-size: 0.7rem;
  color: #64748b;
}

[data-passenger-contractor].is-locked .input-icon input {
  background: #f8fafc;
  color: #334155;
  cursor: not-allowed;
}

[data-passenger-contractor].is-locked .combobox-clear {
  display: none !important;
}

[data-passenger-contractor].is-locked .combobox-list {
  display: none !important;
}

.prog-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.prog-cal-title {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text-primary);
  text-transform: capitalize;
}

.prog-cal-nav,
.prog-cal-view {
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-radius: 0.7rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.prog-cal-views {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.prog-cal-view.is-active {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: #fff;
}

.sol-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #475569;
}
.sol-badge.is-pending { background: #fff7ed; color: #c2410c; }
.sol-badge.is-ok { background: #ecfdf5; color: #047857; }
.sol-badge.is-bad { background: #fef2f2; color: #b91c1c; }

.sol-detail-section {
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
}
.sol-detail-heading {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.sol-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}
.sol-detail-grid-full {
  grid-template-columns: 1fr;
}
.sol-detail-field {
  min-width: 0;
}
@media (max-width: 640px) {
  .sol-detail-grid {
    grid-template-columns: 1fr;
  }
}

.prog-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
}

.prog-cal-dow {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.2rem 0;
}

.prog-cal-day {
  min-height: 2.7rem;
  border-radius: 0.7rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 0.15rem 0.1rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.prog-cal-day-num {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.2;
  padding: 0.05rem 0;
  cursor: pointer;
}

.prog-cal-day.is-muted {
  color: var(--text-muted);
}

.prog-cal-day.is-today {
  border-color: color-mix(in srgb, var(--btn-primary-bg) 55%, transparent);
  background: color-mix(in srgb, var(--btn-primary-bg) 14%, var(--card-bg));
}

.prog-cal-day.is-selected {
  border-color: var(--btn-primary-bg);
  background: var(--btn-primary-bg);
  color: #fff;
  font-weight: 700;
}

.prog-cal-day.has-events {
  background: var(--bg-muted);
}

.prog-cal-day.is-today.has-events {
  background: color-mix(in srgb, var(--btn-primary-bg) 18%, var(--card-bg));
}

.prog-cal-day.is-selected .prog-cal-day-num,
.prog-cal-day.is-selected .prog-cal-count {
  color: #fff;
}

.prog-cal-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-height: 8px;
  margin-top: 0.08rem;
}

.prog-cal-dot,
.prog-cal-event {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  margin: 2px auto;
  display: inline-block;
  background: #94a3b8;
  color: transparent;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.prog-cal-event.is-programado,
.prog-cal-dot.is-programado { background: #2563eb; }
.prog-cal-event.is-missing-assignment,
.prog-cal-dot.is-missing-assignment { background: #ea580c; box-shadow: 0 0 0 2px #ffedd5; }
.prog-cal-event.is-finalizado,
.prog-cal-dot.is-finalizado { background: #059669; }
.prog-cal-event.is-fallido,
.prog-cal-dot.is-fallido { background: #d97706; }
.prog-cal-event.is-cancelado,
.prog-cal-dot.is-cancelado { background: #e11d48; }

.prog-cal-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.95rem;
  height: 0.85rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.prog-cal-popover {
  position: fixed;
  z-index: 80;
  max-width: 16.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  pointer-events: none;
}

.prog-cal-popover-client {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.prog-cal-popover-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.prog-cal-popover-meta span {
  display: block;
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prog-day-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.prog-day-list-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0 0.15rem;
}

.prog-assignment-alert {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.8rem;
  line-height: 1.4;
}

.prog-assignment-alert strong { font-weight: 700; }

.prog-missing-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.prog-day-item {
  text-align: left;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.55rem 0.7rem;
  background: #fff;
}

.prog-day-item.is-missing-assignment {
  border-color: #fb923c;
  background: #fff7ed;
}

.prog-day-item:hover,
.prog-day-item.is-active {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.prog-day-item.is-missing-assignment:hover,
.prog-day-item.is-missing-assignment.is-active {
  border-color: #ea580c;
  background: #ffedd5;
}

.prog-overdue-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #fff;
}

.prog-overdue-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.prog-overdue-card-meta {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: #64748b;
}

.prog-overdue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.prog-overdue-dismiss {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: #92400e;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.prog-overdue-dismiss:hover {
  background: #fef3c7;
  color: #78350f;
}

.prog-overdue-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #9a3412;
}

.prog-overdue-section + .prog-overdue-section {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px dashed #fed7aa;
}

.prog-overdue-card.is-tomorrow {
  border-color: #fdba74;
  background: #fff7ed;
}

.prog-day-item-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  color: #0f172a;
}

.prog-day-item-sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  color: #64748b;
}

.prog-day-item-row {
  display: grid;
  grid-template-columns: 6.4rem 1fr;
  gap: 0.35rem;
  margin-top: 0.22rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.prog-day-item-row span {
  color: #64748b;
  font-weight: 650;
}

.prog-day-item-row strong {
  color: #0f172a;
  font-weight: 650;
}

.prog-day-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.prog-day-action {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  border-radius: 0.7rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.prog-day-action.is-edit {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
}

.prog-day-action.is-view {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.prog-day-action.is-pdf {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.prog-day-action.is-share {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.prog-fiscal-lock {
  margin-top: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #fecaca;
  border-radius: 0.6rem;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.8rem;
  font-weight: 600;
}

.prog-fiscal-lock.hidden {
  display: none;
}

.prog-os-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.prog-cal-popover-os {
  display: inline-flex;
  margin-bottom: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.prog-day-item-os {
  display: inline-flex;
  margin-bottom: 0.28rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.prog-detail-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
}

.prog-detail-row span {
  color: #64748b;
  font-weight: 600;
}

.prog-detail-row strong {
  color: #0f172a;
  font-weight: 650;
}

.prog-detail-block {
  margin-top: 0.85rem;
}

.prog-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.prog-detail-note {
  font-size: 0.82rem;
  color: #334155;
  margin-bottom: 0.25rem;
}

.prog-detail-fuec-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e2e8f0;
}

.prog-detail-fuec-row:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* ── Diagrama 2D de llantas ───────────────────────────── */
.tire-canvas {
  position: relative;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  min-height: 12rem;
}
.tire-canvas-empty {
  padding: 4rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}
.tire-stage {
  position: relative;
  width: 100%;
}
.tire-stage > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.tire-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  border-radius: 0.45rem;
  border: 3px solid #cbd5e1;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 3px, transparent 3px 7px),
    #1e293b;
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease, outline-color 0.12s ease;
  outline: 3px solid transparent;
  outline-offset: 2px;
  touch-action: manipulation;
}
.tire-node:hover,
.tire-node:focus-visible {
  transform: translate(-50%, -50%) scale(1.07);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.35);
  z-index: 3;
}
.tire-node:focus-visible { outline-color: #0ea5e9; }
.tire-node .tire-node-pos {
  font-size: clamp(0.5rem, 1.9vw, 0.66rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}
.tire-node .tire-node-mm {
  font-size: clamp(0.48rem, 1.7vw, 0.6rem);
  font-weight: 600;
  line-height: 1;
  opacity: 0.9;
}
.tire-node.tire-health-ok { border-color: #16a34a; }
.tire-node.tire-health-warn { border-color: #eab308; }
.tire-node.tire-health-bad { border-color: #dc2626; }
.tire-node.tire-health-unknown { border-color: #94a3b8; }
.tire-node.tire-health-ok .tire-node-mm { color: #86efac; }
.tire-node.tire-health-warn .tire-node-mm { color: #fde047; }
.tire-node.tire-health-bad .tire-node-mm { color: #fca5a5; }
.tire-node.tire-health-bad { animation: tire-pulse 1.8s ease-in-out infinite; }
.tire-node.tire-empty {
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed #94a3b8;
  color: #64748b;
  box-shadow: none;
}
.tire-node.tire-spare { border-radius: 999px; }
.tire-node.is-selected {
  outline-color: #0ea5e9;
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 4;
}
.tire-node.is-drop-target {
  outline: 3px dashed #0ea5e9;
  background-color: #0c4a6e;
}
.tire-node.tire-empty.is-drop-target { background: #e0f2fe; }
.tire-node.is-dragging { opacity: 0.45; }
.tire-canvas.is-rotating .tire-node { cursor: crosshair; }
@keyframes tire-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.tire-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 10.5rem;
  max-width: 14rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.6rem;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
}
.tire-tooltip strong { color: #fff; }
.tire-tooltip dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.5rem;
  margin-top: 0.3rem;
}
.tire-tooltip dt { color: #94a3b8; }
.tire-tooltip dd { margin: 0; text-align: right; font-weight: 600; }
.tire-legend {
  display: inline-block;
  width: 0.9rem;
  height: 1.2rem;
  border-radius: 0.25rem;
  border: 3px solid #cbd5e1;
  background: #1e293b;
}
.tire-legend.tire-health-ok { border-color: #16a34a; }
.tire-legend.tire-health-warn { border-color: #eab308; }
.tire-legend.tire-health-bad { border-color: #dc2626; }
.tire-legend.tire-health-empty { border: 2px dashed #94a3b8; background: #fff; }
.tire-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
}
.tire-chip.tire-health-ok { background: #dcfce7; color: #166534; }
.tire-chip.tire-health-warn { background: #fef9c3; color: #854d0e; }
.tire-chip.tire-health-bad { background: #fee2e2; color: #991b1b; }

/* Inspección por diagrama: posición activa y posiciones ya capturadas en la sesión */
.tire-node.is-insp-active {
  outline-color: #2563eb;
  transform: translate(-50%, -50%) scale(1.12);
  z-index: 4;
}
.tire-node.is-captured::after {
  content: '✓';
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}
.tire-canvas.is-inspection .tire-node.tire-empty { cursor: not-allowed; opacity: 0.55; }

/* Plantillas de diagrama (vista previa no interactiva) */
.tire-canvas.is-mini {
  max-width: 9.5rem;
  min-height: 0;
}
.tire-canvas.is-mini .tire-node {
  pointer-events: none;
  border-width: 2px;
  animation: none;
}
.tire-canvas.is-mini .tire-node .tire-node-mm { display: none; }
.tire-canvas.is-mini .tire-node .tire-node-pos { font-size: 0.42rem; }
.tire-canvas.is-preview { max-width: 15rem; min-height: 0; }
.tire-canvas.is-preview .tire-node { pointer-events: none; animation: none; }
.tire-canvas.is-preview .tire-node .tire-node-mm { display: none; }

/* Odómetro unificado bajo cada campo de km */
.odo-hint {
  display: block;
  margin-top: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.5rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
}
.odo-hint.is-empty { color: #64748b; font-weight: 600; background: #f8fafc; border-color: #e2e8f0; }
.odo-hint.is-error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
input.odo-invalid {
  border-color: #f87171 !important;
  background-color: #fef2f2;
}

/* Checklists · Factor humano: botones de selección rápida (táctiles). */
.hf-choice {
  min-height: 2.75rem;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-muted);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.hf-choice:hover { border-color: #0ea5e9; }
.hf-choice.is-selected { border-color: #0284c7; background: #0284c7; color: #fff; }
.hf-q.is-missing { border-color: #f87171; background: #fef2f2; }
.hf-choice.hf-inv-ok.is-selected { border-color: #059669; background: #059669; }
.hf-choice.hf-inv-nok.is-selected { border-color: #dc2626; background: #dc2626; }
.hf-choice.hf-inv-na.is-selected { border-color: #64748b; background: #64748b; }
.hf-choice.hf-inv-faltante.is-selected { border-color: #ea580c; background: #ea580c; }

/* Diseñador de plantillas: interruptores por respuesta */
.cd-switch {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid #e2e8f0; border-radius: 9999px; background: #fff;
  padding: 0.2rem 0.65rem 0.2rem 0.3rem;
  font-size: 0.72rem; font-weight: 600; color: #475569;
  cursor: pointer; user-select: none;
}
.cd-switch input {
  appearance: none; position: relative; flex-shrink: 0;
  width: 1.9rem; height: 1.1rem; margin: 0; border-radius: 9999px;
  background: #cbd5e1; cursor: pointer; transition: background 0.15s;
}
.cd-switch input::after {
  content: ''; position: absolute; top: 0.15rem; left: 0.15rem;
  width: 0.8rem; height: 0.8rem; border-radius: 9999px; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.15s;
}
.cd-switch input:checked::after { transform: translateX(0.8rem); }
.cd-switch:has(input:checked) { color: #0f172a; border-color: #cbd5e1; background: #f8fafc; }
.cd-switch[data-tone='photo'] input:checked { background: #0284c7; }
.cd-switch[data-tone='maintenance'] input:checked { background: #ea580c; }
.cd-switch[data-tone='supply'] input:checked { background: #7c3aed; }
.cd-switch[data-tone='hseq'] input:checked { background: #f59e0b; }
.cd-switch[data-tone='block'] input:checked { background: #dc2626; }
.cd-switch.is-disabled { opacity: 0.45; cursor: not-allowed; }
.cd-switch.is-disabled input { cursor: not-allowed; }
@keyframes hf-row-in { from { background-color: #e0f2fe; } to { background-color: transparent; } }
.hf-row-new { animation: hf-row-in 2.5s ease-out; }

/* Plantillas de Checklists: drawer de creación/edición */
.ct-drawer {
  position: fixed;
  inset: 0;
  z-index: 45;
}
.ct-drawer.hidden {
  display: none;
}
.ct-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.ct-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(72rem, 100vw);
  background: #fff;
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.18);
  animation: ct-drawer-in 0.18s ease-out;
}
.ct-drawer-body {
  flex: 1;
  overflow-y: auto;
}
@keyframes ct-drawer-in {
  from { transform: translateX(2rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}
/* Panel HSEQ del dashboard */
.hd-map {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: 22rem;
  background: #f1f5f9;
}

/* Skeleton de carga del dashboard (hasta resolver el rol) */
.sk-block {
  border-radius: 1rem;
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.3s ease infinite;
}
@keyframes sk-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* Mapas Leaflet / OpenStreetMap */
.hf-detail-map {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: 15rem;
  background: #f1f5f9;
}
.map-pin {
  background: transparent;
  border: 0;
}
.map-pin-body {
  position: absolute;
  left: 3px;
  top: 0;
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.45);
}
.map-popup {
  min-width: 12rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #0f172a;
}
.map-popup p {
  margin: 0 0 0.2rem;
}
.map-popup-title {
  font-weight: 700;
  font-size: 0.875rem;
}
.map-popup-label {
  color: #64748b;
  font-weight: 600;
}
.map-popup-meta {
  color: #64748b;
  font-size: 0.72rem;
}
.map-popup-badge {
  display: inline-block;
  margin-top: 0.25rem;
  border-radius: 9999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.map-popup-link {
  display: block;
  margin-top: 0.4rem;
  border: 0;
  background: none;
  padding: 0;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* Columna de acciones de flota: acceso directo a documentos + menú «Acciones ▾». */
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.row-action-icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  background: #fff;
  color: #334155;
  transition: background-color 0.15s, border-color 0.15s;
}

.row-action-docs svg {
  width: 1.05rem;
  height: 1.05rem;
  color: #b45309;
}

.row-action-menu span {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.row-action-docs:hover,
.row-action-menu:hover,
.row-action-menu[aria-expanded="true"] {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.row-action-link {
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
}

.row-action-link:hover {
  color: #0c4a6e;
  text-decoration: underline;
}

.row-menu {
  position: fixed;
  z-index: 60;
  min-width: 15.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #fff;
  padding: 0.35rem;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.06);
}

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

.row-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.55rem;
  padding: 0.5rem 0.65rem;
  color: #1e293b;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
}

.row-menu-item svg {
  width: 1rem;
  height: 1rem;
  flex: none;
  color: #64748b;
}

.row-menu-item:hover,
.row-menu-item:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.row-menu-chip {
  margin-left: auto;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.row-menu-separator {
  margin: 0.3rem 0.4rem;
  border-top: 1px solid #e2e8f0;
}

.row-menu-danger,
.row-menu-danger svg {
  color: #dc2626;
}

.row-menu-danger:hover,
.row-menu-danger:focus-visible {
  background: #fef2f2;
}

.driver-link-list {
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.3rem;
}

.driver-link-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.55rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.8125rem;
  text-align: left;
}

.driver-link-option:hover:not(:disabled),
.driver-link-option:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.driver-link-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Barras de los paneles del Dashboard (Administración, Mantenimiento). */
.dash-bar { height: 0.5rem; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.dash-bar > span { display: block; height: 100%; border-radius: 9999px; }
.dash-split { display: flex; height: 0.625rem; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.dash-split > span { display: block; height: 100%; }

/* RBAC: módulos sin permiso de lectura salen del menú; matriz de permisos. */
.rbac-hidden { display: none !important; }
.owner-scoped #qs-open { display: none !important; }
/* Portal afiliado: sin altas de vehículos/afiliados ni filtros de flota ajena.
   Conductores sí se gestionan (crear / editar / documentos de los propios). */
.owner-scoped #open-vehicle-modal { display: none !important; }
.owner-scoped label:has(#vehicle-filter-company),
.owner-scoped label:has(#driver-filter-company) { display: none !important; }
/* Portal afiliado/conductor: sin emisión/anulación administrativa de contratos. */
.owner-scoped [data-afi-admin-filter],
.owner-scoped [data-afi-admin-action] { display: none !important; }
.owner-scoped #afi-kpis { display: none !important; }
/* Afiliado: el botón Nuevo conductor permanece visible aunque la vista sea solo-lectura en otros CRUDs. */
.owner-scoped.view-readonly #open-driver-modal[data-write] { display: inline-flex !important; }

/* Portal afiliado: datos generales del vehículo en solo lectura; docs/fotos siguen activos. */
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="datos"] input,
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="datos"] select,
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="datos"] textarea,
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="documentos"] input:not([type="file"]),
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="documentos"] select,
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-vehicle-panel="documentos"] textarea {
  pointer-events: none;
  background-color: #f8fafc;
  color: #64748b;
  cursor: default;
}
.owner-scoped #vehicle-form.owner-vehicle-readonly [data-owner-vehicle-submit] {
  display: none !important;
}

/* Vista en solo lectura (la matriz efectiva no da Crear / Editar / Eliminar): se ocultan sus controles de escritura. */
.view-readonly [data-write],
.view-readonly [data-row-menu-trigger],
.view-readonly .row-action-docs,
.view-readonly [data-pagos-delete],
.view-readonly [data-afi-void],
.view-readonly [data-afi-open] { display: none !important; }

.portal-access-box {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-muted);
  padding: 0.75rem 0.875rem;
  color: var(--text-primary);
}
.portal-access-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}
.portal-access-options {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-left: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.portal-access-options.hidden { display: none; }
.portal-access-options label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.portal-access-summary {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  row-gap: 0.25rem;
  font-size: 0.875rem;
}
.portal-access-summary dt { color: var(--text-muted); }
.portal-access-summary dd { color: var(--text-primary); font-weight: 500; overflow-wrap: anywhere; }
.row-menu-chip.portal-chip-on { background: #ecfdf5; color: #047857; }
.row-menu-chip.portal-chip-off { background: #f1f5f9; color: #64748b; }
/* Zero-flash: shell oculto hasta auth+RBAC; Login nunca visible durante sgt-booting. */
body.auth-only > :not(#auth-screen):not(script) { display: none !important; }
html.sgt-booting #app-shell,
html.sgt-boot-login #app-shell { visibility: hidden; }
html.sgt-booting #auth-login-panel,
html.sgt-ready #auth-login-panel { display: none !important; }
html.sgt-ready #auth-screen { display: none !important; }
/* ── Login enterprise (atmósfera + tarjeta + footer) ───────────────── */
.auth-screen {
  --auth-navy: #07111f;
  --auth-navy-mid: #0b1a2e;
  --auth-gold: #d4a24c;
  --auth-gold-soft: rgba(212, 162, 76, 0.45);
  overflow: hidden;
  background: var(--auth-navy);
  color: #e2e8f0;
}
.auth-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.auth-atmosphere-mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(30, 64, 120, 0.55), transparent 62%),
    radial-gradient(ellipse 50% 40% at 82% 18%, rgba(212, 162, 76, 0.14), transparent 58%),
    radial-gradient(ellipse 60% 50% at 70% 78%, rgba(14, 90, 140, 0.28), transparent 65%),
    radial-gradient(ellipse 45% 35% at 28% 88%, rgba(212, 162, 76, 0.08), transparent 60%),
    linear-gradient(155deg, #050b14 0%, #0a1628 42%, #07111f 72%, #0c1c33 100%);
  animation: auth-mesh-drift 28s ease-in-out infinite alternate;
}
.auth-atmosphere-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 78%);
}
.auth-atmosphere-glow {
  position: absolute;
  border-radius: 9999px;
  filter: blur(64px);
  opacity: 0.55;
}
.auth-atmosphere-glow--a {
  width: 28rem;
  height: 28rem;
  left: -8%;
  top: 12%;
  background: rgba(37, 99, 160, 0.35);
  animation: auth-glow-a 16s ease-in-out infinite alternate;
}
.auth-atmosphere-glow--b {
  width: 22rem;
  height: 22rem;
  right: -6%;
  bottom: 8%;
  background: rgba(212, 162, 76, 0.18);
  animation: auth-glow-b 20s ease-in-out infinite alternate;
}
@keyframes auth-mesh-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-1.5%, 1.2%, 0) scale(1.03); }
}
@keyframes auth-glow-a {
  from { transform: translate3d(0, 0, 0); opacity: 0.4; }
  to { transform: translate3d(6%, 4%, 0); opacity: 0.65; }
}
@keyframes auth-glow-b {
  from { transform: translate3d(0, 0, 0); opacity: 0.28; }
  to { transform: translate3d(-5%, -3%, 0); opacity: 0.5; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-atmosphere-mesh,
  .auth-atmosphere-glow { animation: none !important; }
}

.auth-splash-brand { letter-spacing: 0.22em; }
.auth-stage { width: 100%; max-width: 28rem; }

.auth-login-panel {
  width: 100%;
  animation: auth-card-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.auth-login-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  background: #ffffff;
  color: #0f172a;
  padding: 2rem 1.75rem 1.75rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 18px 50px rgba(2, 8, 23, 0.38),
    0 4px 14px rgba(2, 8, 23, 0.18);
}
.auth-login-accent {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #0b1729 0%, var(--auth-gold) 48%, #1e4a7a 100%);
}
.auth-login-head {
  margin-bottom: 1.6rem;
  text-align: center;
}
.auth-login-title {
  margin-top: 0.85rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0b1729;
}
.auth-login-subtitle {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #64748b;
}
.auth-login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-field {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #334155;
}
.auth-input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: #0f172a;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}
.auth-input--password {
  padding-right: 2.75rem;
}
.auth-input::placeholder {
  color: #94a3b8;
}
.auth-input:hover {
  border-color: #cbd5e1;
  background: #fff;
}
.auth-input:focus {
  border-color: rgba(212, 162, 76, 0.85);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(212, 162, 76, 0.18);
}
.auth-error {
  border-radius: 0.85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.65rem 0.85rem;
  font-size: 0.8125rem;
  color: #b91c1c;
}
.auth-submit {
  margin-top: 0.25rem;
  width: 100%;
  border: 0;
  border-radius: 0.85rem;
  padding: 0.78rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #15263f 0%, #0b1729 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 8px 18px rgba(11, 23, 41, 0.28);
  transition: transform 140ms ease, box-shadow 160ms ease, filter 160ms ease;
}
.auth-submit:hover {
  filter: brightness(1.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 10px 22px rgba(11, 23, 41, 0.34);
}
.auth-submit:active {
  transform: translateY(1px);
}
.auth-submit:focus-visible {
  outline: 2px solid var(--auth-gold);
  outline-offset: 2px;
}
.auth-footer {
  width: min(40rem, 100%);
  padding: 0 1rem 1.25rem;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: rgba(148, 163, 184, 0.72);
}

html.sgt-boot-login #auth-splash { display: none !important; }
@keyframes sgt-splash-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
html.sgt-booting #auth-checking { animation: sgt-splash-pulse 1.2s ease-in-out infinite; }
.table-wrap table.rbac-matrix { min-width: 40rem; }
.rbac-matrix thead th { background: #f8fafc; }
.rbac-matrix tbody tr:hover { background: #f8fafc; }
.rbac-matrix input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: #0f172a; cursor: pointer; }
.rbac-col-head { display: inline-flex; flex-direction: column; align-items: center; gap: 0.25rem; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; cursor: pointer; }
.rbac-chip { display: inline-flex; align-items: center; border-radius: 9999px; border: 1px solid #e2e8f0; background: #f8fafc; padding: 0.0625rem 0.5rem; font-size: 11px; font-weight: 500; color: #475569; }
.rbac-chip.is-full { border-color: #0f172a; background: #0f172a; color: #fff; }
.rbac-chip.is-custom { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.rbac-chip.is-partial { border-style: dashed; }
.rbac-module-row { border-top: 1px solid #e2e8f0; background: #f8fafc; }
.rbac-matrix tbody tr.rbac-module-row:hover { background: #f1f5f9; }
.rbac-module-toggle { display: inline-flex; align-items: center; gap: 0.375rem; font-weight: 600; color: #0f172a; }
.rbac-chevron { width: 0.875rem; height: 0.875rem; color: #64748b; transition: transform 0.15s ease; }
.rbac-module-row.is-open .rbac-chevron { transform: rotate(90deg); }
.rbac-module-count { margin-left: 0.25rem; border-radius: 9999px; background: #e0f2fe; padding: 0 0.5rem; font-size: 11px; font-weight: 500; color: #0369a1; }
.rbac-module-count.is-off { background: #f1f5f9; color: #94a3b8; }
.rbac-sub-row { border-top: 1px solid #f1f5f9; }
.rbac-status { display: inline-flex; border-radius: 9999px; padding: 0.125rem 0.5rem; font-size: 11px; font-weight: 600; }
.rbac-status.is-on { background: #dcfce7; color: #166534; }
.rbac-status.is-off { background: #f1f5f9; color: #64748b; }

/* Administración · Usuarios: tipografía, vínculo y acciones */
.rbac-user-row td { vertical-align: middle; }
.rbac-user-name {
  font-size: 0.9375rem;
  font-weight: 650;
  color: #1e293b;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.rbac-user-meta {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #94a3b8;
}
.rbac-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 16rem;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.rbac-link-chip .lucide-icon {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  opacity: 0.9;
}
.rbac-link-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rbac-link-chip.is-conductor {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.rbac-link-chip.is-afiliado {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.rbac-link-chip.is-cliente {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.rbac-link-chip.is-staff {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}
.rbac-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.rbac-access-btn {
  margin-right: 0.15rem;
}
.row-icon-btn.is-activate {
  color: #059669;
}
.row-icon-btn.is-activate:hover {
  color: #047857;
  background: #ecfdf5;
}

/* Administración SaaS: filtros de grupos (chips) */
.saas-chip {
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  background: #fff;
  transition: background-color 120ms, color 120ms, border-color 120ms;
}
.saas-chip:hover { border-color: #cbd5e1; color: #0f172a; }
.saas-chip[aria-pressed="true"] { background: #0f172a; border-color: #0f172a; color: #fff; }

.bill-sealed {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
}

.bill-vale-pending {
  color: #b45309;
  font-weight: 600;
}

/* Subcopias dinámicas vacías no ocupan espacio */
#prog-form-copy:empty,
#inf-ops-copy:empty,
#ops-report-copy:empty,
#report-copy:empty,
#document-settings-copy:empty,
#pagos-cartera-copy:empty {
  display: none;
}

/* —— Tema claro / oscuro: tipografía + superficies —— */
html[data-theme='dark'] body,
html[data-theme='dark'] #app-shell,
html[data-theme='dark'] main {
  color: var(--text-primary) !important;
}

html[data-theme='dark'] #app-shell label,
html[data-theme='dark'] #app-shell legend,
html[data-theme='dark'] #app-shell h1,
html[data-theme='dark'] #app-shell h2,
html[data-theme='dark'] #app-shell h3,
html[data-theme='dark'] #app-shell h4,
html[data-theme='dark'] #app-shell p,
html[data-theme='dark'] #app-shell dt,
html[data-theme='dark'] #app-shell dd,
html[data-theme='dark'] #app-shell th,
html[data-theme='dark'] #app-shell td,
html[data-theme='dark'] #app-shell li,
html[data-theme='dark'] #app-shell summary,
html[data-theme='dark'] dialog label,
html[data-theme='dark'] dialog legend,
html[data-theme='dark'] dialog h1,
html[data-theme='dark'] dialog h2,
html[data-theme='dark'] dialog h3,
html[data-theme='dark'] dialog h4,
html[data-theme='dark'] dialog p,
html[data-theme='dark'] dialog li,
html[data-theme='dark'] dialog summary {
  color: var(--text-primary);
}

html[data-theme='dark'] #app-shell .text-black,
html[data-theme='dark'] #app-shell .text-gray-900,
html[data-theme='dark'] #app-shell .text-gray-800,
html[data-theme='dark'] #app-shell .text-gray-700,
html[data-theme='dark'] #app-shell .text-zinc-900,
html[data-theme='dark'] #app-shell .text-zinc-800,
html[data-theme='dark'] #app-shell .text-zinc-700,
html[data-theme='dark'] #app-shell .text-neutral-900,
html[data-theme='dark'] #app-shell .text-neutral-800,
html[data-theme='dark'] #app-shell .text-slate-900,
html[data-theme='dark'] #app-shell .text-slate-800,
html[data-theme='dark'] #app-shell .text-slate-700,
html[data-theme='dark'] dialog .text-black,
html[data-theme='dark'] dialog .text-gray-900,
html[data-theme='dark'] dialog .text-gray-800,
html[data-theme='dark'] dialog .text-gray-700,
html[data-theme='dark'] dialog .text-zinc-900,
html[data-theme='dark'] dialog .text-zinc-800,
html[data-theme='dark'] dialog .text-zinc-700,
html[data-theme='dark'] dialog .text-neutral-900,
html[data-theme='dark'] dialog .text-neutral-800,
html[data-theme='dark'] dialog .text-slate-900,
html[data-theme='dark'] dialog .text-slate-800,
html[data-theme='dark'] dialog .text-slate-700,
html[data-theme='dark'] body.text-slate-800,
html[data-theme='dark'] body.text-slate-900 {
  color: var(--text-primary) !important;
}

html[data-theme='dark'] #app-shell .text-gray-600,
html[data-theme='dark'] #app-shell .text-gray-500,
html[data-theme='dark'] #app-shell .text-gray-400,
html[data-theme='dark'] #app-shell .text-zinc-600,
html[data-theme='dark'] #app-shell .text-zinc-500,
html[data-theme='dark'] #app-shell .text-slate-600,
html[data-theme='dark'] #app-shell .text-slate-500,
html[data-theme='dark'] #app-shell .text-slate-400,
html[data-theme='dark'] dialog .text-gray-600,
html[data-theme='dark'] dialog .text-gray-500,
html[data-theme='dark'] dialog .text-gray-400,
html[data-theme='dark'] dialog .text-zinc-600,
html[data-theme='dark'] dialog .text-zinc-500,
html[data-theme='dark'] dialog .text-slate-600,
html[data-theme='dark'] dialog .text-slate-500,
html[data-theme='dark'] dialog .text-slate-400 {
  color: var(--text-secondary) !important;
}

html[data-theme='dark'] .bg-white,
html[data-theme='dark'] .bg-white\/90,
html[data-theme='dark'] .bg-white\/80,
html[data-theme='dark'] .bg-white\/95,
html[data-theme='dark'] .bg-slate-50,
html[data-theme='dark'] .bg-gray-50,
html[data-theme='dark'] .bg-gm-mist {
  background-color: var(--card-bg) !important;
}

html[data-theme='dark'] .bg-slate-100,
html[data-theme='dark'] .bg-gray-100,
html[data-theme='dark'] .bg-slate-50\/80 {
  background-color: var(--bg-muted) !important;
}

html[data-theme='dark'] .border-slate-100,
html[data-theme='dark'] .border-slate-200,
html[data-theme='dark'] .border-slate-300,
html[data-theme='dark'] .border-gray-200,
html[data-theme='dark'] .border-gray-300 {
  border-color: var(--border-color) !important;
}

/* Tarjetas KPI / paneles / switch / tablas estructurales */
html[data-theme='dark'] .metric-card,
html[data-theme='dark'] .op-dash-panel,
html[data-theme='dark'] .sgt-switch,
html[data-theme='dark'] .notify-panel,
html[data-theme='dark'] .notify-filter,
html[data-theme='dark'] .fleet-section,
html[data-theme='dark'] .convenios-section,
html[data-theme='dark'] .programacion-left,
html[data-theme='dark'] .programacion-right,
html[data-theme='dark'] .ct-drawer,
html[data-theme='dark'] .mnt-kanban-card {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

html[data-theme='dark'] .metric-blue { --metric-accent: #3b82f6; --metric-value: #93c5fd; }
html[data-theme='dark'] .metric-green { --metric-accent: #22c55e; --metric-value: #86efac; }
html[data-theme='dark'] .metric-orange { --metric-accent: #f97316; --metric-value: #fdba74; }
html[data-theme='dark'] .metric-red { --metric-accent: #ef4444; --metric-value: #fca5a5; }

html[data-theme='dark'] .metric-card-value {
  color: var(--metric-value) !important;
}

html[data-theme='dark'] .metric-card-label,
html[data-theme='dark'] .metric-card-hint {
  color: var(--text-secondary) !important;
}

html[data-theme='dark'] .op-kpi-download,
html[data-theme='dark'] .metric-card-action {
  background: var(--bg-muted) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html[data-theme='dark'] table thead,
html[data-theme='dark'] .op-contracts-table thead,
html[data-theme='dark'] .rbac-matrix thead th,
html[data-theme='dark'] .rbac-module-row,
html[data-theme='dark'] thead.bg-slate-50,
html[data-theme='dark'] .bg-slate-50 {
  background: var(--bg-muted) !important;
  color: var(--text-secondary) !important;
}

/* Pills / tabs: activa elevada, nunca blanco puro */
html[data-theme='dark'] .vehicle-tab[aria-selected='true'],
html[data-theme='dark'] .dashboard-tab.active,
html[data-theme='dark'] .prog-cal-view.is-active,
html[data-theme='dark'] .empresa-tab-btn.active,
html[data-theme='dark'] .vale-tab-btn.active,
html[data-theme='dark'] .archive-tab[aria-selected='true'] {
  background: var(--btn-primary-bg) !important;
  border-color: var(--btn-primary-bg) !important;
  color: #fff !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .vehicle-tabs,
html[data-theme='dark'] .dashboard-tabs-container,
html[data-theme='dark'] .prog-segmented,
html[data-theme='dark'] .list-toolbar {
  background: #1e293b !important;
  border-color: var(--border-color) !important;
}

html[data-theme='dark'] .vehicle-tab,
html[data-theme='dark'] .dashboard-tab,
html[data-theme='dark'] .prog-cal-nav,
html[data-theme='dark'] .prog-cal-view,
html[data-theme='dark'] .empresa-tab-btn,
html[data-theme='dark'] .archive-tab,
html[data-theme='dark'] .prog-segmented span {
  color: #cbd5e1 !important;
  background: transparent;
}

html[data-theme='dark'] .prog-segmented input:checked + span {
  background: var(--btn-primary-bg) !important;
  color: #fff !important;
  box-shadow: none !important;
}

html[data-theme='dark'] .tariff-class-item {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .tariff-class-item:hover {
  background: #334155 !important;
}

html[data-theme='dark'] .tariff-class-item[aria-current='true'] {
  background: var(--btn-primary-bg) !important;
  color: #fff !important;
}

/* Calendario: días legibles; selección = acento ERP (no blanco) */
html[data-theme='dark'] .prog-calendar,
html[data-theme='dark'] .prog-cal-toolbar {
  color: #e2e8f0;
}

html[data-theme='dark'] .prog-cal-dow {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .prog-cal-title {
  color: #f8fafc !important;
}

html[data-theme='dark'] .prog-cal-day {
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .prog-cal-day.is-muted {
  color: #64748b !important;
}

html[data-theme='dark'] .prog-cal-day.has-events {
  background: #1e293b !important;
}

html[data-theme='dark'] .prog-cal-day.is-today {
  border-color: #3b82f6 !important;
  background: #1e3a5f !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .prog-cal-day.is-selected {
  border-color: #2563eb !important;
  background: #2563eb !important;
  color: #fff !important;
}

html[data-theme='dark'] .prog-cal-count {
  background: #0f172a;
  color: #fff;
}

html[data-theme='dark'] .prog-cal-day.is-selected .prog-cal-count {
  background: rgba(255, 255, 255, 0.2);
}

html[data-theme='dark'] .prog-cal-popover {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme='dark'] #view-reportes .table-wrap-wide th:first-child,
html[data-theme='dark'] #view-reportes .table-wrap-wide td:first-child {
  background: var(--card-bg) !important;
  box-shadow: 1px 0 0 var(--border-color);
}

html[data-theme='dark'] #view-reportes .table-wrap-wide thead th:first-child {
  background: var(--bg-muted) !important;
}

html[data-theme='dark'] .list-toolbar label,
html[data-theme='dark'] .list-pager,
html[data-theme='dark'] .list-pager button {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .list-pager button {
  background: var(--bg-muted) !important;
  border-color: var(--border-color) !important;
}

html[data-theme='dark'] #app-shell .shadow-sm,
html[data-theme='dark'] #app-shell .shadow,
html[data-theme='dark'] #app-shell .shadow-md {
  box-shadow: var(--shadow-soft) !important;
}

/* Buscador en vivo / listas flotantes */
html[data-theme='dark'] .combobox-list,
html[data-theme='dark'] .combobox-empty,
html[data-theme='dark'] .combobox-option,
html[data-theme='dark'] .combobox-option-title {
  background-color: transparent;
  color: var(--text-primary);
}

html[data-theme='dark'] .combobox-option:hover,
html[data-theme='dark'] .combobox-option.is-active {
  background: var(--bg-muted) !important;
}

html[data-theme='dark'] #app-shell input:not([type='checkbox']):not([type='radio']):not([type='range']),
html[data-theme='dark'] #app-shell select,
html[data-theme='dark'] #app-shell textarea,
html[data-theme='dark'] #app-shell .input-icon input,
html[data-theme='dark'] dialog input:not([type='checkbox']):not([type='radio']):not([type='range']),
html[data-theme='dark'] dialog select,
html[data-theme='dark'] dialog textarea {
  background-color: var(--input-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary);
}

html[data-theme='dark'] #app-shell input::placeholder,
html[data-theme='dark'] #app-shell textarea::placeholder,
html[data-theme='dark'] #app-shell select::placeholder,
html[data-theme='dark'] dialog input::placeholder,
html[data-theme='dark'] dialog textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 1;
  -webkit-text-fill-color: var(--text-muted);
}

html[data-theme='dark'] #app-shell option,
html[data-theme='dark'] dialog option {
  background-color: var(--input-bg);
  color: var(--text-primary);
}

html[data-theme='dark'] .rounded-2xl.border,
html[data-theme='dark'] .rounded-xl.border,
html[data-theme='dark'] article.rounded-2xl,
html[data-theme='dark'] aside.rounded-2xl,
html[data-theme='dark'] section.rounded-2xl {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  box-shadow: var(--shadow-soft);
  color: var(--text-primary);
}

html[data-theme='dark'] dialog {
  background: #111827 !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
}

html[data-theme='dark'] dialog::backdrop {
  background: rgba(2, 6, 23, 0.78);
}

/* Modales: tarjetas internas, headers, footers, adjuntos */
html[data-theme='dark'] dialog .bg-white,
html[data-theme='dark'] dialog .bg-white\/90,
html[data-theme='dark'] dialog .bg-slate-50,
html[data-theme='dark'] dialog .bg-gray-50,
html[data-theme='dark'] dialog .bg-slate-100,
html[data-theme='dark'] dialog .doc-card,
html[data-theme='dark'] dialog .photo-card,
html[data-theme='dark'] dialog .portal-access-box,
html[data-theme='dark'] dialog .resume-annex,
html[data-theme='dark'] dialog .rounded-2xl.border,
html[data-theme='dark'] dialog .rounded-xl.border,
html[data-theme='dark'] dialog article {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] dialog .border-b,
html[data-theme='dark'] dialog .border-t,
html[data-theme='dark'] dialog .border-slate-100,
html[data-theme='dark'] dialog .border-slate-200 {
  border-color: #334155 !important;
}

html[data-theme='dark'] dialog .doc-attach,
html[data-theme='dark'] dialog .photo-thumb,
html[data-theme='dark'] dialog .doc-badge {
  background: #0f172a !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
}

html[data-theme='dark'] dialog .doc-attach-enabled:hover {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: #38bdf8 !important;
  color: #7dd3fc !important;
}

/* Botones Subir / reemplazar / Adjuntar PDF */
html[data-theme='dark'] dialog .photo-action,
html[data-theme='dark'] dialog label.photo-action,
html[data-theme='dark'] dialog button.btn-secondary-gray,
html[data-theme='dark'] dialog .btn-secondary-gray {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #fff !important;
}

html[data-theme='dark'] dialog .photo-action:hover,
html[data-theme='dark'] dialog button.btn-secondary-gray:hover,
html[data-theme='dark'] dialog .btn-secondary-gray:hover {
  background: #475569 !important;
}

html[data-theme='dark'] dialog .photo-empty,
html[data-theme='dark'] .report-pdf-empty {
  color: #94a3b8 !important;
  background: rgba(30, 41, 59, 0.55) !important;
  border: 1px dashed #475569 !important;
}

html[data-theme='dark'] .report-pdf-wrap,
html[data-theme='dark'] .report-pdf-toolbar,
html[data-theme='dark'] .report-pdf-frame {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .report-pdf-toolbar .text-slate-600,
html[data-theme='dark'] #report-pdf-caption {
  color: #cbd5e1 !important;
}

html[data-theme='dark'] dialog .vehicle-tabs,
html[data-theme='dark'] dialog .driver-tabs {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] dialog .vehicle-tab,
html[data-theme='dark'] dialog .driver-tab {
  color: #94a3b8 !important;
}

html[data-theme='dark'] dialog .vehicle-tab[aria-selected='true'],
html[data-theme='dark'] dialog .driver-tab[aria-selected='true'] {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #475569 !important;
}

html[data-theme='dark'] dialog .doc-card .font-semibold,
html[data-theme='dark'] dialog .doc-card label,
html[data-theme='dark'] dialog .photo-card .font-semibold,
html[data-theme='dark'] dialog .photo-card p {
  color: #f1f5f9 !important;
}

html[data-theme='dark'] dialog .doc-card .text-slate-500,
html[data-theme='dark'] dialog .doc-card .text-slate-400,
html[data-theme='dark'] dialog .photo-card .text-slate-500,
html[data-theme='dark'] dialog .photo-card .text-slate-400 {
  color: #94a3b8 !important;
}

html[data-theme='dark'] dialog .sgt-switch,
html[data-theme='dark'] dialog .rate-mode-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] dialog footer,
html[data-theme='dark'] dialog .border-t.bg-white,
html[data-theme='dark'] dialog [class*='border-t'][class*='bg-'] {
  background-color: #111827 !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] .user-menu-panel {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

html[data-theme='dark'] .user-menu-item {
  color: var(--text-primary);
}

html[data-theme='dark'] .user-menu-item:hover {
  background: var(--bg-muted);
}

html[data-theme='dark'] header.sticky,
html[data-theme='dark'] .app-topbar,
html[data-theme='dark'] #app-shell > header {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary);
}

html[data-theme='dark'] table thead th {
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

html[data-theme='dark'] table tbody td {
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html[data-theme='dark'] .fuec-route-block,
html[data-theme='dark'] .combobox,
html[data-theme='dark'] .combobox span:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']) {
  color: var(--text-primary);
}

html[data-theme='dark'] .fuec-route-block {
  background: var(--bg-muted);
  border-color: var(--border-color);
}

html[data-theme='dark'] .fuec-passengers-panel {
  background: linear-gradient(180deg, #1e293b 0%, var(--card-bg) 72%);
  border-color: color-mix(in srgb, var(--gm-gold) 35%, var(--border-color));
  color: var(--text-primary);
}

/* Filtros de reportes / historial FUEC */
html[data-theme='dark'] .fuec-hist-filters,
html[data-theme='dark'] .filter-panel,
html[data-theme='dark'] .search-box,
html[data-theme='dark'] .list-toolbar,
html[data-theme='dark'] .vales-filters {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .fuec-hist-filters label,
html[data-theme='dark'] .fuec-hist-filters legend,
html[data-theme='dark'] .fuec-hist-filters span,
html[data-theme='dark'] .filter-panel label,
html[data-theme='dark'] .filter-panel legend,
html[data-theme='dark'] .list-toolbar label,
html[data-theme='dark'] .list-toolbar legend,
html[data-theme='dark'] #view-reportes .fuec-hist-filters .text-slate-700,
html[data-theme='dark'] #view-reportes .fuec-hist-filters .text-slate-800 {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .fuec-trayecto label {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .fuec-trayecto label:has(input:checked) {
  background: rgba(212, 162, 76, 0.2) !important;
  border-color: var(--gm-gold) !important;
  color: #fef3c7 !important;
}

html[data-theme='dark'] .fuec-trayecto-seg {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] .fuec-trayecto-seg label {
  background: transparent !important;
  color: #cbd5e1 !important;
}

html[data-theme='dark'] .fuec-trayecto-seg label:has(input:checked) {
  background: var(--btn-primary-bg) !important;
  border-color: var(--btn-primary-bg) !important;
  color: #fff !important;
}

/* Programación: modo tarifa + resumen financiero */
html[data-theme='dark'] .rate-mode-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .rate-mode-card:has(input:checked) {
  background: rgba(59, 130, 246, 0.16) !important;
  border-color: #3b82f6 !important;
}

html[data-theme='dark'] .rate-mode-card .text-slate-900,
html[data-theme='dark'] .rate-mode-card .text-slate-500,
html[data-theme='dark'] .rate-mode-card .font-semibold {
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .rate-mode-card .text-xs {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .prog-margin-box {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] .prog-margin-title,
html[data-theme='dark'] .prog-margin-grid span,
html[data-theme='dark'] .prog-margin-note {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .prog-margin-grid strong {
  color: #f8fafc !important;
}

html[data-theme='dark'] .prog-rate-badge.is-idle {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #93c5fd !important;
}

html[data-theme='dark'] .prog-rate-badge.is-ok {
  color: #6ee7b7 !important;
}

html[data-theme='dark'] .prog-rate-badge.is-warn {
  color: #fbbf24 !important;
}

/* Simulador de costos */
html[data-theme='dark'] .pc-sim-header,
html[data-theme='dark'] .pc-sim-params,
html[data-theme='dark'] .from-slate-50,
html[data-theme='dark'] .to-white,
html[data-theme='dark'] #view-pronostico-costos .bg-slate-50,
html[data-theme='dark'] #prog-cost-calc {
  background: #1e293b !important;
  background-image: none !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

/* Inputs file + anexo pasajeros */
html[data-theme='dark'] #app-shell input[type='file'],
html[data-theme='dark'] dialog input[type='file'] {
  color: #e2e8f0 !important;
  background: #334155 !important;
  border: 1px solid #475569 !important;
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
}

html[data-theme='dark'] #app-shell input[type='file']::file-selector-button,
html[data-theme='dark'] dialog input[type='file']::file-selector-button,
html[data-theme='dark'] .file\:bg-slate-100,
html[data-theme='dark'] .file\:bg-white,
html[data-theme='dark'] .file\:bg-slate-900 {
  background: #475569 !important;
  color: #f8fafc !important;
  border: 0;
  margin-right: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}

html[data-theme='dark'] .fuec-passengers-toolbar {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html[data-theme='dark'] .fuec-passengers-btn,
html[data-theme='dark'] .fuec-passengers-file {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .fuec-passengers-btn:hover,
html[data-theme='dark'] .fuec-passengers-file:hover {
  background: #475569 !important;
  color: #fff !important;
}

html[data-theme='dark'] .fuec-passengers-btn svg,
html[data-theme='dark'] .fuec-passengers-file-icon,
html[data-theme='dark'] .fuec-passengers-status {
  color: #cbd5e1 !important;
}

/* Preop / checklist: marcar pendientes OK */
html[data-theme='dark'] .preop-allok-btn,
html[data-theme='dark'] [data-preop-group-allok],
html[data-theme='dark'] [data-hf-inv-all-ok] {
  background: rgba(51, 65, 85, 0.55) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: #34d399 !important;
  border-radius: 0.55rem;
  padding: 0.35rem 0.7rem;
  text-decoration: none !important;
}

html[data-theme='dark'] .preop-allok-btn:hover,
html[data-theme='dark'] [data-preop-group-allok]:hover,
html[data-theme='dark'] [data-hf-inv-all-ok]:hover {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #6ee7b7 !important;
}

html[data-theme='dark'] .combobox-hint {
  color: var(--text-secondary) !important;
}

html[data-theme='dark'] .combobox-clear {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

html[data-theme='dark'] .combobox-list,
html[data-theme='dark'] .combobox-empty {
  background: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Estilos custom del ERP con tinta fija (#0f172a / navy) → texto claro en dark */
html[data-theme='dark'] #app-shell .font-medium:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']),
html[data-theme='dark'] #app-shell .font-semibold:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']),
html[data-theme='dark'] #app-shell .font-bold:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']),
html[data-theme='dark'] dialog .font-medium:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']),
html[data-theme='dark'] dialog .font-semibold:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']),
html[data-theme='dark'] dialog .font-bold:not([class*='text-emerald']):not([class*='text-rose']):not([class*='text-amber']):not([class*='text-sky']):not([class*='text-red']):not([class*='text-green']):not([class*='text-orange']):not([class*='text-white']):not([class*='text-gm']) {
  color: var(--text-primary);
}

/* —— Motor dark: pills / badges / tintas Tailwind / preop / tablas —— */
html[data-theme='dark'] .badge-ok,
html[data-theme='dark'] .badge-rut.is-ok,
html[data-theme='dark'] .badge-status.is-vigente,
html[data-theme='dark'] .row-menu-chip.portal-chip-on {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.28) !important;
}

html[data-theme='dark'] .badge-info {
  background: rgba(59, 130, 246, 0.14) !important;
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.28) !important;
}

html[data-theme='dark'] .badge-warn,
html[data-theme='dark'] .badge-rut.is-missing,
html[data-theme='dark'] .badge-status.is-por-vencer {
  background: rgba(245, 158, 11, 0.14) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

html[data-theme='dark'] .badge-danger,
html[data-theme='dark'] .badge-status.is-vencido {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
}

html[data-theme='dark'] .badge-neutral,
html[data-theme='dark'] .row-menu-chip.portal-chip-off {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme='dark'] .badge-status.is-por-iniciar {
  background: rgba(99, 102, 241, 0.16) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* Pills Tailwind pastel → tintas translúcidas B2B */
html[data-theme='dark'] .bg-emerald-50,
html[data-theme='dark'] .bg-emerald-100,
html[data-theme='dark'] .bg-green-50,
html[data-theme='dark'] .bg-green-100 {
  background-color: rgba(16, 185, 129, 0.14) !important;
}
html[data-theme='dark'] .text-emerald-700,
html[data-theme='dark'] .text-emerald-800,
html[data-theme='dark'] .text-emerald-900,
html[data-theme='dark'] .text-green-700,
html[data-theme='dark'] .text-green-800,
html[data-theme='dark'] .text-green-900 {
  color: #6ee7b7 !important;
}
html[data-theme='dark'] .border-emerald-200,
html[data-theme='dark'] .border-emerald-300,
html[data-theme='dark'] .ring-emerald-200 {
  border-color: rgba(16, 185, 129, 0.3) !important;
  --tw-ring-color: rgba(16, 185, 129, 0.3);
}

html[data-theme='dark'] .bg-amber-50,
html[data-theme='dark'] .bg-amber-100,
html[data-theme='dark'] .bg-yellow-50,
html[data-theme='dark'] .bg-yellow-100,
html[data-theme='dark'] .bg-orange-50,
html[data-theme='dark'] .bg-orange-100 {
  background-color: rgba(245, 158, 11, 0.14) !important;
}
html[data-theme='dark'] .text-amber-700,
html[data-theme='dark'] .text-amber-800,
html[data-theme='dark'] .text-amber-900,
html[data-theme='dark'] .text-yellow-700,
html[data-theme='dark'] .text-yellow-800,
html[data-theme='dark'] .text-orange-700,
html[data-theme='dark'] .text-orange-800,
html[data-theme='dark'] .text-orange-900 {
  color: #fbbf24 !important;
}
html[data-theme='dark'] .border-amber-200,
html[data-theme='dark'] .border-amber-300,
html[data-theme='dark'] .ring-amber-200 {
  border-color: rgba(245, 158, 11, 0.3) !important;
}

html[data-theme='dark'] .bg-red-50,
html[data-theme='dark'] .bg-red-100,
html[data-theme='dark'] .bg-rose-50,
html[data-theme='dark'] .bg-rose-100 {
  background-color: rgba(239, 68, 68, 0.14) !important;
}
html[data-theme='dark'] .text-red-600,
html[data-theme='dark'] .text-red-700,
html[data-theme='dark'] .text-red-800,
html[data-theme='dark'] .text-red-900,
html[data-theme='dark'] .text-rose-700,
html[data-theme='dark'] .text-rose-800 {
  color: #fca5a5 !important;
}
html[data-theme='dark'] .border-red-200,
html[data-theme='dark'] .border-red-300,
html[data-theme='dark'] .ring-red-200 {
  border-color: rgba(239, 68, 68, 0.3) !important;
}

html[data-theme='dark'] .bg-sky-50,
html[data-theme='dark'] .bg-sky-100,
html[data-theme='dark'] .bg-blue-50,
html[data-theme='dark'] .bg-blue-100,
html[data-theme='dark'] .bg-indigo-50,
html[data-theme='dark'] .bg-indigo-100,
html[data-theme='dark'] .bg-violet-50,
html[data-theme='dark'] .bg-violet-100 {
  background-color: rgba(59, 130, 246, 0.14) !important;
}
html[data-theme='dark'] .text-sky-700,
html[data-theme='dark'] .text-sky-800,
html[data-theme='dark'] .text-sky-900,
html[data-theme='dark'] .text-blue-700,
html[data-theme='dark'] .text-blue-800,
html[data-theme='dark'] .text-indigo-700,
html[data-theme='dark'] .text-indigo-800,
html[data-theme='dark'] .text-violet-700,
html[data-theme='dark'] .text-violet-800 {
  color: #93c5fd !important;
}
html[data-theme='dark'] .border-sky-200,
html[data-theme='dark'] .border-sky-300,
html[data-theme='dark'] .ring-sky-200,
html[data-theme='dark'] .border-blue-200,
html[data-theme='dark'] .border-violet-200 {
  border-color: rgba(59, 130, 246, 0.3) !important;
}

html[data-theme='dark'] .quote-group-row td {
  background: rgba(30, 41, 59, 0.92) !important;
  color: #e2e8f0 !important;
  border-color: var(--border-color) !important;
}

html[data-theme='dark'] .preop-group-card,
html[data-theme='dark'] .hf-q,
html[data-theme='dark'] .ct-drawer {
  background: #1e293b !important;
  border-color: var(--border-color) !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .preop-group-summary,
html[data-theme='dark'] .preop-item-row,
html[data-theme='dark'] .preop-pick {
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .preop-group-card.is-complete .preop-group-summary {
  background: rgba(16, 185, 129, 0.12) !important;
}

html[data-theme='dark'] .preop-group-card.has-fails .preop-group-summary,
html[data-theme='dark'] .preop-item-row.is-nok-missing,
html[data-theme='dark'] .hf-q.is-missing {
  background: rgba(239, 68, 68, 0.12) !important;
}

html[data-theme='dark'] .preop-choice label,
html[data-theme='dark'] .hf-choice:not(.is-selected),
html[data-theme='dark'] .cd-switch {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .hf-choice.is-selected {
  color: #fff !important;
}

html[data-theme='dark'] .rbac-chip {
  background: rgba(148, 163, 184, 0.12) !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html[data-theme='dark'] .rbac-chip.is-full {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

html[data-theme='dark'] .rbac-chip.is-custom {
  background: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #93c5fd !important;
}

html[data-theme='dark'] .rbac-module-row,
html[data-theme='dark'] .rbac-matrix thead th,
html[data-theme='dark'] .rbac-matrix tbody tr:hover,
html[data-theme='dark'] .rbac-matrix tbody tr.rbac-module-row:hover {
  background: #1e293b !important;
}

html[data-theme='dark'] .rbac-module-toggle,
html[data-theme='dark'] .portal-access-summary dd,
html[data-theme='dark'] .portal-access-options {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .portal-access-box,
html[data-theme='dark'] dialog .portal-access-box {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .portal-access-toggle,
html[data-theme='dark'] dialog .portal-access-toggle {
  color: #f1f5f9 !important;
}

html[data-theme='dark'] .portal-access-toggle .text-slate-500,
html[data-theme='dark'] dialog .portal-access-toggle .text-slate-500 {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .sgt-switch-ui {
  background: #475569 !important;
}

html[data-theme='dark'] .sgt-switch-input:checked + .sgt-switch-ui {
  background: #0284c7 !important;
}

html[data-theme='dark'] .rbac-module-count {
  background: rgba(59, 130, 246, 0.16) !important;
  color: #93c5fd !important;
}

html[data-theme='dark'] .preop-badge-BORRADOR { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
html[data-theme='dark'] .preop-badge-ENVIADO { background: rgba(14, 165, 233, 0.16); color: #7dd3fc; }
html[data-theme='dark'] .preop-badge-APROBADO { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }

html[data-theme='dark'] .app-card,
html[data-theme='dark'] .app-filter-panel {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme='dark'] .app-filter-panel {
  background: #1e293b;
}

/* Auth: tarjeta siempre clara (independiente del theme de la app) */
html[data-theme='dark'] #auth-screen {
  color: #e2e8f0;
}
html[data-theme='dark'] #auth-login-panel .auth-login-card,
html[data-theme='dark'] #auth-login-panel {
  background-color: transparent !important;
  color: inherit !important;
}
html[data-theme='dark'] .auth-login-card {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
html[data-theme='dark'] .auth-login-title { color: #0b1729 !important; }
html[data-theme='dark'] .auth-login-subtitle,
html[data-theme='dark'] .auth-field { color: #64748b !important; }
html[data-theme='dark'] .auth-field { color: #334155 !important; }
html[data-theme='dark'] .auth-input {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
  -webkit-text-fill-color: #0f172a;
  caret-color: #0f172a;
}
html[data-theme='dark'] .auth-input:focus {
  background-color: #ffffff !important;
  border-color: rgba(212, 162, 76, 0.85) !important;
}

.auth-password-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 0.75rem;
  transition: color 140ms ease;
}
.auth-password-toggle:focus-visible {
  outline: 2px solid var(--auth-gold, #d4a24c);
  outline-offset: 1px;
}
html[data-theme='dark'] #auth-login-panel .auth-password-toggle {
  color: #64748b !important;
}
html[data-theme='dark'] #auth-login-panel .auth-password-toggle:hover {
  color: #0f172a !important;
}

/* Mapa de Operaciones (Leaflet) */
.op-map-canvas,
#op-map-canvas,
#fleet-map-container {
  display: block;
  width: 100%;
  height: 650px;
  min-height: 650px;
  background: #e2e8f0;
  z-index: 0;
}
/* Tailwind preflight (img max-width/height:auto) rompe las baldosas OSM. */
.op-map-canvas img.leaflet-tile,
#op-map-canvas img.leaflet-tile,
#fleet-map-container img.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  width: 256px !important;
  height: 256px !important;
}
.op-map-pin-wrap { background: transparent !important; border: none !important; }
.op-map-pin,
.op-map-legend {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25);
  vertical-align: -2px;
}
.op-map-pin { width: 18px; height: 18px; }
.op-map-pin-ok { background: #16a34a; }
.op-map-pin-alert { background: #dc2626; }
.op-map-pin-stopped { background: #ca8a04; }
@keyframes op-map-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}
.op-map-pin-pulse { animation: op-map-pulse 1.4s ease-out infinite; }
.op-map-popup { min-width: 180px; }
.op-dash-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; }

#sgt-debug { display: none; position: fixed; right: 1rem; bottom: 1rem; z-index: 70; flex-direction: column; align-items: flex-end; gap: 0.75rem; width: min(26rem, calc(100vw - 2rem)); max-width: calc(100vw - 2rem); }
#sgt-debug.is-active.is-superadmin { display: flex; flex-direction: column-reverse; }
#sgt-debug:not(.is-superadmin),
html.sgt-booting #sgt-debug,
html.sgt-boot-login #sgt-debug,
body.auth-only #sgt-debug { display: none !important; }
.sgt-debug-fab { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid #d4a24c; border-radius: 999px; background: #0e1a2e; color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em; padding: 0.55rem 0.9rem; box-shadow: 0 10px 24px rgba(7, 17, 31, 0.28); cursor: pointer; }
.sgt-debug-fab:hover { background: #16263d; }
.sgt-debug-count { min-width: 1.15rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.65rem; line-height: 1.15rem; text-align: center; padding: 0 0.3rem; }
.sgt-debug-panel { display: none; width: 100%; max-height: min(32rem, calc(100vh - 5.5rem)); overflow: auto; border: 1px solid var(--border-color); border-radius: 1rem; background: var(--card-bg); color: var(--text-primary); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22); }
.sgt-debug-panel.is-open { display: block; }
.sgt-debug-head, .sgt-debug-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sgt-debug-head { padding: 0.85rem 1rem 0.4rem; }
.sgt-debug-kicker { margin: 0; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #b45309; }
.sgt-debug-head h2 { margin: 0.1rem 0 0; font-size: 0.95rem; }
.sgt-debug-icon { border: 0; background: transparent; color: var(--text-secondary); font-size: 1.35rem; line-height: 1; cursor: pointer; }
.sgt-debug-actions { padding: 0 1rem 0.75rem; }
.sgt-debug-actions button { border: 1px solid var(--border-color); border-radius: 0.6rem; background: var(--bg-muted); color: var(--text-primary); font-size: 0.72rem; font-weight: 700; padding: 0.4rem 0.6rem; cursor: pointer; }
.sgt-debug-actions button:hover { border-color: #94a3b8; }
.sgt-debug-empty { margin: 0; padding: 0 1rem 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.sgt-debug-list { display: flex; flex-direction: column; gap: 0.55rem; padding: 0 1rem 1rem; }
.sgt-debug-item { border: 1px solid var(--border-color); border-left-width: 3px; border-radius: 0.75rem; padding: 0.55rem 0.7rem; background: var(--bg-muted); }
.sgt-debug-item--http, .sgt-debug-item--network { border-left-color: #dc2626; }
.sgt-debug-item--js { border-left-color: #7c3aed; }
.sgt-debug-item--warning { border-left-color: #d97706; }
.sgt-debug-item header { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.68rem; color: var(--text-secondary); }
.sgt-debug-kind { font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.sgt-debug-origin, .sgt-debug-message, .sgt-debug-detail { margin: 0.2rem 0 0; font-size: 0.78rem; }
.sgt-debug-origin { font-weight: 700; }
.sgt-debug-detail { color: var(--text-secondary); }
.sgt-debug-stack { margin: 0.35rem 0 0; max-height: 7rem; overflow: auto; white-space: pre-wrap; font-size: 0.68rem; line-height: 1.35; color: var(--text-secondary); }
.sgt-debug-manual { display: block; width: calc(100% - 2rem); height: 7rem; margin: 0 1rem 0.75rem; border: 1px solid var(--border-color); border-radius: 0.6rem; background: var(--bg-surface); color: var(--text-primary); font: 0.68rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 0.45rem 0.55rem; resize: vertical; }
.sgt-debug-manual[hidden] { display: none; }
