/* ════════════════════════════════════════════════════════════════
   Turismo Los Ángeles — Ecosistema Web
   Paleta: azul medianoche navy + plateado celeste TLA
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg-black:       #102E52;   /* azul medianoche principal */
  --bg-header:      #0A2444;   /* header azul oscuro */
  --bg-card:        #163A64;   /* card azul medio */
  --bg-card-2:      #1A4272;   /* card destacada */
  --bg-input:       #0A2444;   /* input fondo oscuro */
  --stroke:         #1E4E88;   /* borde azul */
  --brand-blue:     #4A90D9;   /* azul claro accent */
  --brand-blue-dark:#2A5FAA;   /* azul oscuro */
  --brand-blue-dim: rgba(74, 144, 217, 0.35);
  --brand-blue-soft:rgba(74, 144, 217, 0.12);
  --brand-accent:   #9BBCDA;   /* plateado-celeste TLA */
  --brand-silver:   #E8EFF8;   /* plateado claro */
  --green:          #1db954;
  --red:            #e43d30;
  --text-primary:   #E8EFF8;
  --text-secondary: #9BBCDA;
  --text-hint:      #5A7FAA;
  --shadow:         0 10px 30px rgba(0, 0, 0, 0.55);
  /* alias heredados para no romper JS que los referencia */
  --brand-gold:     #9BBCDA;
  --brand-gold-dim: rgba(155, 188, 218, 0.35);
  --brand-gold-soft:rgba(74, 144, 217, 0.12);
  --brand-red:      #4A90D9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg-black);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LOGIN ─────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #0A2444 0%, #102E52 55%, #163A64 100%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--brand-blue-dim);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
  filter: drop-shadow(0 4px 20px rgba(74, 144, 217, 0.4));
}

/* Fallback: ring usado si no hay imagen */
.login-logo .ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--brand-blue-soft);
  border: 2px solid var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 42px;
  color: var(--brand-accent);
}

.login-logo h1 {
  font-size: 22px;
  color: var(--text-primary);
  letter-spacing: 0.14em;
  font-weight: 700;
}

.login-logo .subtitle {
  font-size: 11px;
  color: var(--brand-accent);
  letter-spacing: 0.22em;
  margin-top: 6px;
  font-weight: 600;
}

/* ── LOGO SIDEBAR ───────────────────────────────────────────────── */
.sidebar-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(74, 144, 217, 0.35));
}

.sidebar-brand h2 {
  font-size: 15px;
  color: var(--brand-silver);
  letter-spacing: 0.06em;
  font-weight: 800;
  line-height: 1.2;
}

/* ── INPUTS ────────────────────────────────────────────────────── */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: 11px;
  color: var(--brand-accent);
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 8px;
}

.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  min-height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.input-group textarea { padding: 12px 16px; resize: vertical; min-height: 80px; }

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus { border-color: var(--brand-blue); }

.input-group input::placeholder,
.input-group textarea::placeholder { color: var(--text-hint); }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: 12px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.2s, background 0.15s;
}

.btn:hover { background: #3A7BC8; box-shadow: 0 6px 18px rgba(74, 144, 217, 0.45); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-block { width: 100%; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--brand-blue-dim);
  color: var(--brand-accent);
}
.btn-outline:hover { background: var(--brand-blue-soft); box-shadow: none; }

.btn-green { background: var(--green); }
.btn-green:hover { box-shadow: 0 6px 18px rgba(29, 185, 84, 0.4); }

.btn-danger { background: #c62828; }
.btn-danger:hover { box-shadow: 0 6px 18px rgba(198, 40, 40, 0.4); }

.btn-sm { height: 34px; padding: 0 14px; font-size: 11px; border-radius: 8px; }

/* ── ACCIONES DE CADA VIAJE (torre): "editar" agrupado y acciones principales aparte ── */
.acciones { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 300px; }
input[type="date"], input[type="time"] { color-scheme: dark; }
.acciones-fila { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.acciones-etiqueta { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-hint); width: 100%; text-align: right; }
.btn-soft {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--brand-silver);
  background: var(--brand-blue-soft); transition: background .15s, border-color .15s;
}
.btn-soft:hover { background: rgba(74, 144, 217, 0.26); border-color: var(--brand-blue-dim); }
.btn-soft:focus-visible, .btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.btn-soft.aviso { background: rgba(255, 183, 77, 0.16); color: #ffcf8a; }
.btn-soft.aviso:hover { background: rgba(255, 183, 77, 0.28); border-color: rgba(255, 183, 77, 0.5); }
.btn-soft.pendiente { background: rgba(255, 138, 130, 0.16); color: #ffb3ad; }
.btn-soft.pendiente:hover { background: rgba(255, 138, 130, 0.28); border-color: rgba(255, 138, 130, 0.5); }
.btn-ghost-danger { background: transparent; border: 1px solid rgba(228, 61, 48, 0.45); color: #ff8a82; }
.btn-ghost-danger:hover { background: rgba(228, 61, 48, 0.14); box-shadow: none; }

/* Ventanas de corrección: campos con punto de color y ayuda amable */
.campo-punto { display: flex; align-items: center; gap: 10px; }
.campo-punto .punto { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.campo-punto .punto.origen { background: var(--green); }
.campo-punto .punto.parada { background: var(--brand-accent); }
.campo-punto .punto.destino { background: #ff8a82; }
.campo-punto input, .campo-punto textarea { flex: 1; }
.ayuda-suave { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--brand-blue-soft); font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.modal .sub { margin: -8px 0 16px; font-size: 13px; color: var(--text-secondary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } .acciones { min-width: 0; } }

/* ── ALERTS ────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-error   { background: rgba(198, 40, 40, 0.12); border: 1px solid #c62828; color: #ff8a82; }
.alert-success { background: rgba(29, 185, 84, 0.12); border: 1px solid var(--green); color: #5dffa6; }
.alert-info    { background: var(--brand-blue-soft); border: 1px solid var(--brand-blue-dim); color: var(--brand-accent); }

/* ── DASHBOARD LAYOUT ──────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-header);
  border-right: 1px solid var(--stroke);
  padding: 28px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 24px 20px;
  border-bottom: 1px solid var(--brand-blue-dim);
  margin-bottom: 16px;
}

.sidebar-brand .tag {
  font-size: 9px;
  color: var(--brand-accent);
  letter-spacing: 0.22em;
  margin-top: 4px;
  font-weight: 700;
}

.nav-section {
  padding: 8px 24px 4px;
  font-size: 9px;
  color: var(--text-hint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

.nav-item, .nav-accion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 24px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.nav-item:hover, .nav-accion:hover { background: rgba(74, 144, 217, 0.10); color: var(--text-primary); }
.nav-item.active {
  background: rgba(74, 144, 217, 0.18);
  color: var(--brand-silver);
  border-left-color: var(--brand-blue);
}
.nav-item .icon, .nav-accion .icon { width: 20px; text-align: center; opacity: 0.85; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.nav-badge[hidden] { display: none; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--stroke);
  font-size: 12px;
  color: var(--text-hint);
}

.sidebar-footer .user-email { color: var(--brand-accent); font-weight: 600; margin-bottom: 8px; font-size: 13px; }

.logout-btn {
  background: transparent;
  border: 1px solid #c62828;
  color: #ff8a82;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.08em;
  font-family: inherit;
}
.logout-btn:hover { background: rgba(198, 40, 40, 0.12); }

/* ── MAIN AREA ─────────────────────────────────────────────────── */
main { padding: 32px 40px; overflow-y: auto; }

.page-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.page-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--brand-blue);
  border-radius: 2px;
  margin-top: 10px;
}

/* ── CARDS / TABLES ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5);
  border: 1px solid var(--stroke);
}

.card-title {
  font-size: 11px;
  color: var(--brand-accent);
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--stroke);
}
.stat-card.blue { border-color: var(--brand-blue-dim); }
.stat-card .label {
  font-size: 10px;
  color: var(--text-hint);
  letter-spacing: 0.16em;
  font-weight: 700;
  text-transform: uppercase;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--text-primary);
}
.stat-card.blue .value { color: var(--brand-accent); }
.stat-card .sub { font-size: 11px; color: var(--text-hint); margin-top: 4px; }

/* ── DATA TABLE ────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--brand-accent);
  padding: 12px 14px;
  border-bottom: 1px solid var(--brand-blue-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.data-table tbody tr { background: var(--bg-card); transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--bg-card-2); }

.data-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--stroke);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ── BADGES ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.badge-blue  { background: var(--brand-blue-soft); color: var(--brand-accent); border: 1px solid var(--brand-blue-dim); }
.badge-gold  { background: var(--brand-blue-soft); color: var(--brand-accent); border: 1px solid var(--brand-blue-dim); }
.badge-green { background: rgba(29,185,84,0.16); color: var(--green); border: 1px solid var(--green); }
.badge-red   { background: rgba(198,40,40,0.14); color: #ff8a82; border: 1px solid #c62828; }
.badge-gray  { background: rgba(255,255,255,0.07); color: var(--text-secondary); border: 1px solid var(--stroke); }
.badge-orange{ background: rgba(245,124,0,0.16); color: #ffb74d; border: 1px solid #f57c00; }

/* ── EMPTY / LOADING ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

.spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--stroke);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TAB CONTENT ───────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.chip {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: inherit;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--brand-blue-dim); color: var(--text-primary); }
.chip.active { background: var(--brand-blue-soft); border-color: var(--brand-blue); color: var(--brand-accent); }

/* ── FORM CONFIG ───────────────────────────────────────────────── */
.config-form { max-width: 560px; }

.actions-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── MODAL / OVERLAY ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--brand-blue-dim);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  /* Una ventana más alta que la pantalla se desplaza en vez de quedar fija y cortada (las que ya traen su propio alto no cambian) */
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--brand-accent);
}

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    padding: 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--stroke);
  }
  .sidebar-brand, .sidebar-footer, .nav-section { display: none; }
  .nav-item, .nav-accion { padding: 10px 14px; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: var(--brand-blue); border-left-color: transparent; }
  main { padding: 20px; }
}

/* ── CONSTRUCTOR DE RUTAS B2B ───────────────────────────────────── */
.route-card {
  background: var(--bg-card-2);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}

.route-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(74, 144, 217, 0.10);
  border-bottom: 1px solid var(--stroke);
}

.route-card-body {
  padding: 6px 0;
}

.route-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.20);
  border-top: 1px solid var(--stroke);
  flex-wrap: wrap;
}

.pasajero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(30,78,136,0.4);
  transition: background 0.15s;
}
.pasajero-row:last-child { border-bottom: none; }
.pasajero-row:hover { background: rgba(74,144,217,0.07); }

.pasajero-order {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-blue-soft);
  border: 1px solid var(--brand-blue-dim);
  color: var(--brand-accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pasajero-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pasajero-info strong {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pasajero-dir {
  font-size: 11px;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pasajero-coord { font-size: 10px; color: var(--text-hint); }

.pasajero-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Conductor select inside route card footer */
.cond-select {
  flex: 1;
  min-width: 160px;
  height: 34px;
  background: var(--bg-input);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.cond-select:focus { border-color: var(--brand-blue); }

/* ── PROGRAMADOS: alerta permanente y agrupación por día ───────── */
.alerta-prog {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.alerta-prog.urgente { background: rgba(198, 40, 40, 0.14); border: 1px solid #c62828; color: #ff8a82; }
.alerta-sos {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 14px;
  border-radius: 12px; font-size: 14px; line-height: 1.5; background: rgba(198, 40, 40, 0.22);
  border: 2px solid #e43d30; color: #ffd4d0; animation: latidoSos 1.6s ease-in-out infinite;
}
.alerta-sos .texto { flex: 1 1 280px; }
.alerta-sos strong { color: #fff; }
.alerta-sos.atendida { animation: none; background: rgba(245, 124, 0, 0.14); border-color: #f57c00; color: #ffcf8a; }
@keyframes latidoSos { 50% { box-shadow: 0 0 0 6px rgba(228, 61, 48, 0.25); } }
@media (prefers-reduced-motion: reduce) { .alerta-sos { animation: none; } }
.sos-contacto { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--stroke); }
.sos-contacto:first-child { border-top: 0; }
.sos-contacto .quien { flex: 1 1 160px; font-size: 13px; }
.sos-contacto .quien small { display: block; color: var(--text-hint); }
.sos-contacto a { text-decoration: none; }
.alerta-prog.atencion { background: rgba(245, 124, 0, 0.14); border: 1px solid #f57c00; color: #ffb74d; }
.alerta-prog .texto { flex: 1 1 280px; }
.alerta-prog .texto div + div { margin-top: 4px; }
.alerta-prog strong { color: inherit; }
.data-table tr.fila-grupo td {
  background: var(--brand-blue-soft);
  color: var(--brand-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
}
.data-table tr.fila-urgente td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* ── CAMPANA DE MOVIMIENTOS ────────────────────────────────────── */
.campana {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--bg-card-2);
  color: var(--text-primary);
  font-size: 19px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.campana:hover { border-color: var(--brand-blue); }
.campana:focus-visible, .panel-eventos button:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.campana-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.campana-badge[hidden], .panel-eventos[hidden] { display: none; }
.panel-eventos {
  position: fixed;
  top: 66px;
  right: 18px;
  z-index: 60;
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-eventos-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  font-size: 13px;
}
#listaEventos { overflow-y: auto; }
.evento {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 4px 12px;
  align-items: start;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--stroke);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.evento:hover { background: var(--brand-blue-soft); }
.evento.nuevo { background: rgba(74, 144, 217, 0.10); }
.evento .punto { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--brand-blue); }
.evento.ok .punto { background: var(--green); }
.evento.alerta .punto { background: var(--red); }
.evento .titulo { font-size: 13px; font-weight: 600; }
.evento .detalle { grid-column: 2; font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.evento .hora { font-size: 11px; color: var(--text-hint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.toast-eventos {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast-evento {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--brand-blue-dim);
  background: var(--bg-card-2);
  color: var(--text-primary);
  font-size: 12px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.toast-evento.alerta { border-color: #c62828; }
.toast-evento.ok { border-color: var(--green); }
.toast-evento strong { display: block; font-size: 13px; margin-bottom: 2px; }
@media (max-width: 900px) {
  .campana { top: auto; bottom: 18px; right: 16px; }
  .panel-eventos { top: auto; bottom: 72px; right: 16px; }
  .toast-eventos { top: 14px; right: 16px; }
}

/* ── Documentos del conductor (torre) ── */
.doc-datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; margin-bottom: 6px; }
.doc-dato { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.doc-dato span { font-size: 11px; color: var(--text-hint); text-transform: uppercase; letter-spacing: .06em; }
.doc-dato strong { color: var(--text-primary); font-weight: 600; word-break: break-word; }
.doc-seccion { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc-card { display: flex; flex-direction: column; border: 1px solid var(--stroke); border-radius: 10px; overflow: hidden; background: var(--bg-card-2); text-decoration: none; color: var(--text-primary); }
.doc-card:hover { border-color: var(--brand-blue); }
.doc-card img { width: 100%; height: 120px; object-fit: cover; display: block; background: #000; }
.doc-vacio { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-secondary); text-align: center; padding: 6px; }
.doc-card.falta { border-style: dashed; }
.doc-card.falta .doc-vacio { color: #E57373; font-weight: 700; }
.doc-nombre { padding: 8px 10px; font-size: 12px; font-weight: 600; }
.doc-pie { margin-top: 16px; font-size: 12px; color: var(--text-secondary); }

/* ── Quién pide el servicio: etiqueta Empresa / Persona ── */
.tag-cliente { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; margin-bottom: 3px; }
.tag-cliente.empresa { background: rgba(95, 131, 180, .25); color: #A9C4EA; }
.tag-cliente.persona { background: rgba(255, 255, 255, .09); color: var(--text-secondary); }

/* Tarifas: precio por tipo de vehículo */
.veh-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.veh-chip { background: transparent; border: 1px solid var(--stroke); color: var(--text-secondary); border-radius: 20px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.veh-chip:hover { border-color: var(--brand-blue); color: var(--text-primary); }
.veh-chip.on { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.veh-chip:focus-visible { outline: 2px solid var(--brand-silver); outline-offset: 2px; }
.veh-punto { font-size: 8px; vertical-align: middle; margin-left: 2px; }
.veh-panel { background: var(--bg-black); border: 1px solid var(--stroke); border-radius: 12px; padding: 16px; }
.veh-titulo { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-hint); margin-bottom: 12px; }

/* Zona delicada (limpiar historial) */
.zona-delicada { border-color: rgba(228, 61, 48, .45); }
.zona-delicada > summary { cursor: pointer; color: #ff8a82; }

/* Lista de viajes compacta */
.toggle-vista { margin-left: auto; display: inline-flex; border: 1px solid var(--stroke); border-radius: 20px; overflow: hidden; }
.toggle-vista button { background: transparent; border: 0; color: var(--text-secondary); font: inherit; font-size: 12px; padding: 7px 14px; cursor: pointer; }
.toggle-vista button.on { background: var(--brand-blue); color: #fff; font-weight: 600; }
.toggle-vista button:focus-visible { outline: 2px solid var(--brand-silver); outline-offset: -2px; }
.tabla-compacta td { vertical-align: middle; }
.tabla-compacta .sub, .det-grid .sub, .det-grid small { color: var(--text-hint); font-size: 11px; }
.fila-compacta { cursor: pointer; }
.fila-compacta:hover td { background: rgba(74, 144, 217, 0.08); }
.fila-compacta.abierta td { background: rgba(74, 144, 217, 0.12); }
.hora-grande { font-size: 14px; }
.ruta-compacta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.35; max-width: 420px; }
.chip-atipico { font-size: 10px; font-weight: 700; color: #ffb74d; border: 1px solid rgba(255, 183, 77, .5); border-radius: 6px; padding: 1px 6px; }
.celda-accion { white-space: nowrap; text-align: right; }
.btn-mas { margin-left: 6px; background: transparent; border: 1px solid var(--stroke); color: var(--text-secondary); border-radius: 8px; padding: 5px 10px; font-size: 15px; line-height: 1; cursor: pointer; }
.btn-mas:hover, .fila-compacta.abierta .btn-mas { border-color: var(--brand-blue); color: var(--text-primary); }
.btn-mas:focus-visible { outline: 2px solid var(--brand-silver); outline-offset: 2px; }
.btn-precio-falta { background: transparent; border: 1px solid #c98a1f; color: #ffc66b; }
.btn-ghost-sutil { background: transparent; border: 1px solid var(--stroke); color: var(--text-primary); }
.fila-detalle { display: none; }
.fila-detalle.abierta { display: table-row; }
.fila-detalle > td { background: rgba(10, 36, 68, 0.55); padding: 14px 16px 16px; }
.det-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; text-align: left; }
.det-grid h5 { margin: 0 0 6px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-hint); }
.det-grid .per { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--stroke); font-size: 12.5px; }
.det-grid .per:last-child { border-bottom: 0; }
.det-grid .per-ic a { text-decoration: none; background: var(--bg-input); border: 1px solid var(--stroke); border-radius: 6px; padding: 3px 8px; }
.det-grid .par { padding: 3px 0; font-size: 12.5px; color: var(--text-primary); }
.det-grid .aviso-orden { margin-top: 6px; color: #ffb74d; font-weight: 600; font-size: 12px; }
.det-botones { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.det-botones .g { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-hint); }
.det-cancelar { margin-left: auto; }
@media (max-width: 900px) { .det-grid { grid-template-columns: 1fr; } }

/* Opciones de ruta del servicio (solo el tiempo) */
.ruta-opciones { grid-column: 1 / -1; }
.ruta-opciones h5 { margin: 0 0 6px; }
.btn-soft.on { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; font-weight: 700; }
.btn-soft:disabled { opacity: .55; cursor: not-allowed; }

/* Lugares frecuentes */
.lugar-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); font-size: 13px; }
.lugar-fila:last-child { border-bottom: 0; }
@media (max-width: 720px) { #lugaresCard, .card [style*="grid-template-columns:1fr 2fr auto"] { grid-template-columns: 1fr !important; } }

/* ── Personal por empresa / tablero de móviles ── */
.per-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg-card-2); color: var(--text-secondary); border: 1px solid var(--stroke); white-space: nowrap; }
.per-chip-ok { color: #4cc38a; border-color: rgba(76, 195, 138, .4); }
.per-chip-aviso { color: #f0b429; border-color: rgba(240, 180, 41, .45); }
.per-tablero { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.per-sin { background: var(--bg-card); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.per-sin .per-zona { overflow: auto; flex: 1; min-height: 120px; }
.per-moviles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.per-movil { background: var(--bg-card); border: 1px solid var(--stroke); border-radius: 12px; padding: 10px; }
.per-movil-cab { display: flex; gap: 6px; align-items: center; }
.per-movil-nombre, .per-movil-hora { height: 36px; background: var(--bg-input); border: 1px solid var(--stroke); border-radius: 8px; color: var(--text-primary); padding: 0 8px; font-family: inherit; font-size: 13px; font-weight: 700; }
.per-movil-nombre { flex: 1; min-width: 0; }
.per-movil-hora { width: 92px; font-weight: 400; }
.per-movil-cuenta { margin: 6px 2px; font-size: 12px; color: var(--text-hint); }
.per-zona { display: grid; gap: 8px; align-content: start; min-height: 70px; padding: 6px; border: 1px dashed var(--stroke); border-radius: 10px; transition: background .15s, border-color .15s; }
.per-zona.sobre { background: rgba(76, 140, 255, .12); border-color: var(--brand-accent); }
.per-tarjeta { background: var(--bg-card-2); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; cursor: grab; }
.per-tarjeta.arrastrando { opacity: .45; }
.per-tarjeta-nombre { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.per-tarjeta-dir { font-size: 12px; color: var(--text-secondary); margin: 2px 0 6px; overflow-wrap: anywhere; }
.per-mover { width: 100%; height: 30px; background: var(--bg-input); border: 1px solid var(--stroke); border-radius: 7px; color: var(--text-secondary); font-family: inherit; font-size: 12px; }
.per-vacio-zona { font-size: 12px; color: var(--text-hint); text-align: center; padding: 14px 6px; }
@media (max-width: 900px) {
  .per-tablero { grid-template-columns: 1fr; }
  .per-sin { position: static; max-height: none; }
}

/* ── Paradas con dirección, comuna, nombre y teléfono (Crear viaje / Corregir direcciones) ── */
.par-fila { background: var(--bg-card-2); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; }
.par-titulo { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-gold); }
.par-linea { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.par-fila .par-linea input { width: auto; flex: 1 1 150px; min-width: 0; height: 38px; font-size: 13px; }
.par-fila .par-dir { flex: 2 1 220px; }
.par-botones { display: flex; gap: 4px; margin-left: auto; }
.par-botones .btn[disabled] { opacity: .35; cursor: default; }


/* Ficha y lista de conductores: letras grandes y de buen contraste, para leerse sin esfuerzo */
#drvFicha { font-size: 16px; }
#drvFicha .drv-nombre { font-size: 26px; font-weight: 700; color: var(--text-primary); }
#drvFicha .drv-contacto { font-size: 16px; color: var(--text-primary); margin-top: 4px; }
#drvFicha .drv-vehiculo { font-size: 16px; color: var(--text-primary); margin-left: 4px; }
#drvFicha .drv-titulo { font-size: 20px; font-weight: 700; }
#drvFicha .drv-kpi-txt { font-size: 15px; color: var(--text-secondary); }
#drvFicha .drv-kpi-val { font-size: 28px; font-weight: 700; color: var(--text-primary); }
#drvFicha .badge { font-size: 14px; padding: 6px 14px; }
#drvFicha .btn-sm { font-size: 14px; padding: 9px 14px; }
#drvFicha .data-table th { font-size: 13px; }
#drvFicha .data-table td { font-size: 15px; padding: 12px 10px; }
#drvFicha select, #drvFicha input { font-size: 15px; }
#drvSugerencias { font-size: 16px; }
#drvBuscar { font-size: 17px; padding: 13px 16px; }
#driversList .data-table td { font-size: 15px; }
#driversList .btn-sm { font-size: 13px; }

/* Botones de cada conductor: dos filas parejas (Ficha, Editar, Documentos / Aprobar o Rechazar, Eliminar) */
.drv-acciones { display: grid; grid-template-columns: repeat(3, max-content); gap: 6px; justify-content: end; }
.drv-acciones .btn { width: 100%; min-height: 36px; white-space: nowrap; text-align: center; margin: 0; padding-left: 12px; padding-right: 12px; box-sizing: border-box; }
.drv-acciones .nota { grid-column: 1 / -1; text-align: right; font-size: 14px; color: var(--text-secondary); }

/* Data de vehículos */
#tab-vehiculos .data-table td { font-size: 15px; padding: 12px 10px; }
#vehBuscarFlota { font-size: 17px; padding: 13px 16px; }

/* Listas largas (conductores, viajes de una ficha, vehículos): recuadro con su propio desplazamiento vertical y horizontal,
   barras gruesas y siempre a la vista, y el encabezado fijo. La página ya no se alarga cuando se inscriben más conductores. */
.caja-scroll { max-height: 65vh; overflow: auto; border: 1px solid var(--stroke); border-radius: 12px; scrollbar-width: auto; scrollbar-color: var(--brand-blue) rgba(255,255,255,0.08); }
.caja-scroll-corta { max-height: 380px; }
.caja-scroll table { min-width: 980px; margin: 0; }
.caja-scroll thead th { position: sticky; top: 0; z-index: 2; background: #12365f; box-shadow: 0 1px 0 var(--stroke); }
.caja-scroll::-webkit-scrollbar { width: 16px; height: 16px; }
.caja-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.08); border-radius: 8px; }
.caja-scroll::-webkit-scrollbar-thumb { background: var(--brand-blue); border-radius: 8px; border: 3px solid #12365f; }
.caja-scroll::-webkit-scrollbar-thumb:hover { background: var(--brand-accent); }
.caja-scroll::-webkit-scrollbar-corner { background: #12365f; }
