/* estilos.css — IngresoPorterias | Light theme | Paleta Andesmar */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --primary:      #004D93;
  --accent:       #00B7E2;
  --accent-hover: #00A5CC;
  --text:         #434343;
  --text-muted:   #6B7280;
  --border:       #E0E0E0;
  --bg:           #FFFFFF;
  --bg-subtle:    #F8F9FA;

  /* Colores semánticos de estado */
  --ingreso:    #16A34A;
  --egreso:     #DC2626;
  --viaje:      #0284C7;
  --warn:       #D97706;

  /* Aliases legacy — usados en estilos inline de los HTMLs */
  --surface:      var(--bg);
  --surface2:     var(--bg-subtle);
  --brand:        var(--accent);
  --brand-dark:   var(--primary);
  --brand-darker: var(--primary);

  --radius:     12px;
  --radius-sm:  8px;
  --nav-h:      64px;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100dvh;
  padding-bottom: var(--nav-h);
  overflow-x: hidden;
}

h1, h2, h3, .label-code {
  font-family: 'Roboto', 'Inter', sans-serif;
  letter-spacing: .01em;
}

code, pre, .font-code { font-family: 'Fira Code', monospace; }

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ── Contenedor principal ───────────────────────────────────── */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 880px) { .container { max-width: 880px; } }

/* ── Vistas (SPA router) ────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  font-family: 'Roboto', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.topbar-predio {
  font-size: .78rem;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
  line-height: 1.3;
}
.topbar-user { font-size: .8rem; color: var(--primary); font-weight: 600; }

/* ── Bottom Nav ─────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 6px rgba(0,0,0,.06);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}
#bottom-nav.hidden { display: none; }

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  transition: color .15s;
  min-height: 58px;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item.active, .nav-item:hover { color: var(--accent); }
.nav-item[data-rol-min="supervisor"] { display: none; }
body[data-rol="supervisor"] .nav-item[data-rol-min="supervisor"],
body[data-rol="admin"]      .nav-item[data-rol-min="supervisor"] { display: flex; }

/* data-rol-min="admin" quedó con ese nombre por compatibilidad, pero hoy solo gatea
   "Unidades QR" — pantalla de solo lectura para imprimir QR, por eso la ven también
   supervisor y los roles del Turnero (admin_deposito/operaciones/distribucion). */
.nav-item[data-rol-min="admin"] { display: none; }
body[data-rol="admin"]           .nav-item[data-rol-min="admin"],
body[data-rol="supervisor"]      .nav-item[data-rol-min="admin"],
body[data-rol="admin_deposito"]  .nav-item[data-rol-min="admin"],
body[data-rol="operaciones"]     .nav-item[data-rol-min="admin"],
body[data-rol="distribucion"]    .nav-item[data-rol-min="admin"] { display: flex; }

/* Roles enfocados en el Turnero: sin ingreso/egreso de Portería (Distribución,
   Tráfico, Personal) ni el dashboard operativo del home — solo Unidades QR y Turnero. */
body[data-rol="admin_deposito"] [data-rol-oculto="porteria-restringida"],
body[data-rol="operaciones"]    [data-rol-oculto="porteria-restringida"],
body[data-rol="distribucion"]   [data-rol-oculto="porteria-restringida"] { display: none !important; }

/* Vigilador y supervisor: el rol no tiene acceso al Turnero en absoluto
   (guardSesionTurnero los redirige si entran por URL directa) — no tiene sentido
   mostrarles la card del home. */
body[data-rol="vigilador"]  [data-rol-oculto="sin-turnero"],
body[data-rol="supervisor"] [data-rol-oculto="sin-turnero"] { display: none !important; }

/* ── Cards de tipo (home) ───────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px 0;
}
@media (min-width: 880px) { .home-grid { grid-template-columns: repeat(3, 1fr); } }

.type-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  text-align: center;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.type-card:active { transform: scale(.97); }
.type-card:hover  { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,183,226,.12); }
.type-card svg    { width: 32px; height: 32px; }
.type-card.dist   { border-top: 3px solid var(--ingreso); }
.type-card.traf   { border-top: 3px solid var(--viaje);  }
.type-card.pers   { border-top: 3px solid var(--warn);   }
.type-card .card-title {
  font-family: 'Roboto', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}
.type-card .badge-count {
  background: #EFF6FF;
  color: var(--primary);
  border: 1px solid #BFDBFE;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: .72rem;
  font-weight: 700;
}

/* ── Formularios ────────────────────────────────────────────── */
.form-section { padding: 16px 0 24px; }

.form-title {
  font-family: 'Roboto', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 46px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,183,226,.12);
}
.field textarea { resize: vertical; min-height: 80px; }

/* Segmented control */
.segmented {
  display: flex;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented input[type="radio"] { display: none; }
.segmented label {
  flex: 1;
  text-align: center;
  padding: 11px 8px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  user-select: none;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.segmented input:checked + label { color: #fff; }
.segmented input[value="ingreso"]:checked   + label,
.segmented input[value="con_carga"]:checked + label { background: var(--ingreso); }
.segmented input[value="egreso"]:checked    + label,
.segmented input[value="sin_carga"]:checked + label { background: var(--text-muted); }
.segmented input[value="con_vehiculo"]:checked + label { background: var(--warn);   }
.segmented input[value="sin_vehiculo"]:checked + label { background: var(--accent); }

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
  width: 100%;
}
.btn:active   { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #003D7A; box-shadow: 0 4px 12px rgba(0,77,147,.25); }

.btn-ingreso { background: var(--ingreso); color: #fff; }
.btn-ingreso:hover:not(:disabled) { opacity: .88; }

.btn-egreso  { background: var(--egreso); color: #fff; }
.btn-egreso:hover:not(:disabled)  { opacity: .88; }

.btn-viaje   { background: var(--viaje); color: #fff; }
.btn-viaje:hover:not(:disabled)   { opacity: .88; }

.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--primary);
  background: rgba(0,183,226,.05);
}

.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .82rem; width: auto; }

.btn-back {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  transition: color .15s;
  width: auto;
}
.btn-back:hover { color: var(--accent); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ── Lista de "adentro" ─────────────────────────────────────── */
.list-section { padding: 0 0 20px; }
.list-title {
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 16px 0 10px;
}

.mov-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mov-card.ingreso-border { border-left: 4px solid var(--ingreso); }
.mov-card.egreso-border  { border-left: 4px solid var(--egreso);  }
.mov-card.viaje-border   { border-left: 4px solid var(--viaje);   }
.mov-card.pers-border    { border-left: 4px solid var(--warn);    }

.mov-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mov-card-id {
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .04em;
}
.mov-card-tiempo {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.mov-card-detail {
  font-size: .83rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.mov-card-detail strong { color: var(--text); }

/* Tags de estado */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tag-ingreso  { background: rgba(22,163,74,.1);    color: var(--ingreso); }
.tag-egreso   { background: rgba(220,38,38,.1);    color: var(--egreso);  }
.tag-enruta   { background: rgba(2,132,199,.1);    color: var(--viaje);   }
.tag-abierto  { background: rgba(217,119,6,.1);    color: var(--warn);    }
.tag-cerrado  { background: rgba(107,114,128,.1);  color: var(--text-muted); }

/* ── Indicadores / KPIs ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
@media (min-width: 880px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

.kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
}
.kpi-value {
  font-family: 'Roboto', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}
.kpi-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}
.kpi-card.verde .kpi-value { color: var(--ingreso); }
.kpi-card.rojo  .kpi-value { color: var(--egreso);  }
.kpi-card.azul  .kpi-value { color: var(--viaje);   }
.kpi-card.ambar .kpi-value { color: var(--warn);    }

/* ── Login ──────────────────────────────────────────────────── */
#view-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg-subtle);
}
#view-login.active { display: flex; }

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 4px 24px rgba(0,77,147,.08);
}
.login-logo {
  font-family: 'Roboto', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.login-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.login-tab.active { color: var(--primary); border-color: var(--primary); }
.login-panel      { display: none; }
.login-panel.active { display: block; }

/* ── QR scanner ─────────────────────────────────────────────── */
#qr-reader {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
#qr-reader video { border-radius: var(--radius-sm); }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  animation: toast-in .2s ease, toast-out .3s ease 2.7s forwards;
}
.toast.ok   { border-color: var(--ingreso); color: var(--ingreso); }
.toast.err  { border-color: var(--egreso);  color: var(--egreso);  }
.toast.warn { border-color: var(--warn);    color: var(--warn);    }
.toast.info { border-color: var(--accent);  color: var(--accent);  }
@keyframes toast-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ── Filtros ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: .85rem;
  flex: 1;
  min-width: 100px;
}
.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,183,226,.12);
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: .9rem;
}
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; opacity: .3; }

/* ── Accesibilidad ───────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Helpers de color ────────────────────────────────────────── */
.text-ingreso { color: var(--ingreso); }
.text-egreso  { color: var(--egreso);  }
.text-viaje   { color: var(--viaje);   }
.text-warn    { color: var(--warn);    }
.text-brand   { color: var(--accent);  }
.text-muted   { color: var(--text-muted); }

/* ── Chip groups (checkboxes multi-selección como botones) ──── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-group input[type="checkbox"] { display: none; }
.chip-group label {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
  min-height: 40px;
  display: flex;
  align-items: center;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
}
.chip-group input:checked + label {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.chip-group.danos input:checked + label {
  background: var(--egreso);
  border-color: var(--egreso);
}

/* Colores segmented para estado operativo, SITRACK y limpieza */
.segmented input[value="operativo"]:checked    + label { background: var(--ingreso); }
.segmented input[value="observacion"]:checked  + label { background: var(--warn); }
.segmented input[value="no-operativo"]:checked + label { background: var(--egreso); }
.segmented input[value="sitrack-ok"]:checked   + label { background: var(--ingreso); }
.segmented input[value="falla"]:checked        + label { background: var(--warn); }
.segmented input[value="sin-reporte"]:checked  + label { background: var(--egreso); }
.segmented input[value="limpio"]:checked       + label { background: var(--ingreso); }
.segmented input[value="sucio"]:checked        + label { background: var(--warn); }

/* Mensaje de advertencia inline (no bloqueante) */
.warn-inline {
  background: rgba(217,119,6,.08);
  border: 1px solid rgba(217,119,6,.28);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-size: .82rem;
  font-weight: 500;
  padding: 10px 14px;
  margin-top: 6px;
  display: none;
  line-height: 1.4;
}
.warn-inline.visible { display: block; }

/* Inputs de foto */
.foto-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.foto-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, color .15s;
  min-height: 46px;
  white-space: nowrap;
}
.foto-btn:hover       { border-color: var(--accent); color: var(--primary); }
.foto-btn.tiene-foto  { border-color: var(--ingreso); color: var(--ingreso); }
.foto-preview {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: none;
}
.foto-preview.visible { display: block; }

.foto-preview-cont {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.foto-preview-cont .foto-preview {
  display: block;
  flex-shrink: 0;
}

/* ── Aviso SITRACK en el formulario ──────────────────────── */
.warn-sitrack {
  background: rgba(230, 81, 0, .10);
  border: 1px solid rgba(230, 81, 0, .35);
  color: #BF360C;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: .88rem;
  line-height: 1.5;
  margin-top: 8px;
}

/* ── Modal gestión SITRACK ───────────────────────────────── */
.sitrack-info-block {
  background: var(--surface-alt, #f4f4f6);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: .9rem;
  line-height: 1.7;
}

.sitrack-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.btn-wa-verde {
  flex: 1;
  background: #25D366;
  color: #fff;
  border-color: #25D366;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
}

.btn-wa-azul {
  flex: 1;
  background: #1565C0;
  color: #fff;
  border-color: #1565C0;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
}

.btn-confirm-accion.accion-confirmada {
  background: #2E7D32;
  color: #fff;
  border-color: #2E7D32;
}

.sitrack-historial {
  max-height: 130px;
  overflow-y: auto;
  font-size: .82rem;
  color: var(--text-muted, #888);
  margin-top: 4px;
}

.historial-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.historial-entry {
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.historial-entry:last-child { border-bottom: none; }

/* ── Tarjeta pendiente SITRACK ───────────────────────────── */
.pendiente-card { border-left: 4px solid #E65100; }

.tag-pendiente {
  background: rgba(230, 81, 0, .12);
  color: #BF360C;
  border: 1px solid rgba(230, 81, 0, .30);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 600;
}

.pending-header {
  font-weight: 700;
  font-size: .88rem;
  color: #E65100;
  margin: 10px 0 6px;
  padding: 6px 4px 6px 8px;
  border-left: 3px solid #E65100;
  background: rgba(230, 81, 0, .06);
  border-radius: 0 4px 4px 0;
}

/* Nota/hint bajo campo */
.field-note {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Combobox (select con búsqueda predictiva) ──────────────── */
.combobox-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
.combobox-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 36px 11px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 46px;
}
.combobox-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,183,226,.12);
}
.combobox-input::placeholder { color: var(--text-muted); }
.combobox-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .72rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  user-select: none;
}
.combobox-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
}
.combobox-option {
  padding: 11px 14px;
  cursor: pointer;
  font-size: .92rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  line-height: 1.4;
}
.combobox-option:last-child { border-bottom: none; }
.combobox-option:hover { background: #EFF6FF; color: var(--primary); }
.combobox-option mark {
  background: rgba(0,183,226,.18);
  color: var(--primary);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}
.combobox-empty {
  padding: 11px 14px;
  font-size: .9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Panel de alertas pendientes SITRACK (en vista tráfico) ─── */
.panel-pendientes {
  background: rgba(230,81,0,.04);
  border: 1.5px solid #E65100;
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-pendientes-header {
  background: #E65100;
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.panel-pendientes-count {
  background: rgba(255,255,255,.22);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.panel-pendientes-body {
  padding: 8px 12px 12px;
}
.panel-pendientes-body .mov-card { margin-bottom: 8px; }
.panel-pendientes-body .mov-card:last-child { margin-bottom: 0; }

/* ── Dashboard home ─────────────────────────────────────────── */
.dash-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  padding: 4px 0 12px;
}

.dash-section {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.dash-section--warn  { border-color: #FCD34D; }
.dash-section--viaje { border-color: #BFDBFE; }

.dash-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: .9rem;
}
.dash-section--warn  .dash-section-header { background: #FFFBEB; }
.dash-section--viaje .dash-section-header { background: #EFF6FF; }
.dash-section-header:active { opacity: .8; }

.dash-section-title {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.dash-section--warn .dash-section-title { color: #92400E; }

.dash-badge-count {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 9px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 26px;
  text-align: center;
}
.dash-section--warn .dash-badge-count { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }

.dash-chevron {
  font-size: .75rem;
  color: var(--text-muted);
  transition: transform .2s;
  min-width: 12px;
  display: inline-block;
}
.dash-chevron.open { transform: rotate(180deg); }

.dash-body { border-top: 1px solid var(--border); }

.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  gap: 10px;
  border-bottom: 1px solid var(--bg-subtle);
  font-size: .83rem;
}
.dash-row:last-child { border-bottom: none; }

.dash-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.dash-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.dash-main-text {
  font-weight: 600;
  color: var(--text);
  font-size: .84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-sub-text {
  font-size: .75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-hora {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: 'Fira Code', monospace;
  white-space: nowrap;
}
.dash-hora--em {
  font-size: .8rem;
  font-weight: 700;
  color: var(--viaje);
  font-family: 'Fira Code', monospace;
}

.dash-tipo-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.tipo-ingreso { background: #DCFCE7; color: #166534; }
.tipo-egreso  { background: #FEE2E2; color: #991B1B; }

.dash-empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: .82rem;
  text-align: center;
}

.dash-sub-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 8px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.dash-day-date {
  font-family: 'Fira Code', monospace;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: .78rem;
}

/* ── Unidades / Exportar QR (admin) ────────────────────────────── */
.qr-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.qr-toolbar input[type="text"] { flex: 1; min-width: 160px; }
.qr-hint { font-size: .72rem; color: var(--text-muted); margin: -8px 0 14px; }
.qr-label-size-field { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); }
.qr-label-size-field input[type="number"] { width: 64px; }
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.qr-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  background: var(--bg);
}
.qr-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.qr-select { position: absolute; top: 6px; left: 6px; z-index: 1; }
.qr-select input { width: 18px; height: 18px; cursor: pointer; }
.qr-card .qr-img { width: 100%; max-width: 130px; height: auto; cursor: pointer; }
.qr-card .qr-dominio { font-weight: 700; font-size: .85rem; margin-top: 6px; }
.qr-card .qr-interno { font-size: .72rem; color: var(--text-muted); }
.qr-card .qr-flota   { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

/* Tamaño de etiqueta (mm) — el valor real lo inyecta js/unidades.js en #qr-label-size,
   según lo que se cargue en los campos de Ancho/Alto. Esto son los defaults de respaldo. */
@media print {
  header.topbar, #bottom-nav, .qr-toolbar, .qr-hint, .btn-back, #toast-container,
  #view-unidades .form-title, #view-unidades .form-subtitle { display: none !important; }
  body, main { background: #fff; margin: 0; padding: 0; }

  .qr-grid { display: block; }
  .qr-grid.has-selection .qr-card:not(.selected) { display: none !important; }
  .qr-select, .qr-interno, .qr-flota { display: none !important; }

  /* Una etiqueta por hoja: cada .qr-card ocupa una página entera */
  .qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin: 0 auto;
    box-sizing: border-box;
    break-inside: avoid;
    page-break-after: always;
    width: 100mm;
    height: 150mm;
  }
  .qr-card:last-child { page-break-after: auto; }
  .qr-card .qr-img { width: 60%; max-width: none; height: auto; }
  .qr-card .qr-dominio { font-size: 1.6rem; margin-top: 6mm; }

  /* Impresión de un solo QR desde el modal individual */
  body.qr-print-single main,
  body.qr-print-single header.topbar,
  body.qr-print-single #bottom-nav { display: none !important; }
  body.qr-print-single #modal-qr-individual {
    display: flex !important;
    position: static !important;
    background: none !important;
    padding: 0;
  }
  body.qr-print-single #modal-qr-individual > div {
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100mm;
    height: 150mm;
    max-width: none;
    margin: 0 auto;
  }
  body.qr-print-single #qr-modal-img { width: 60%; max-width: none; height: auto; }
  body.qr-print-single #btn-cerrar-qr-modal,
  body.qr-print-single #btn-imprimir-qr-modal { display: none !important; }
}
