/* Taxi Admin — CSS propio, mobile-first, sin frameworks. Tokens en :root; modo oscuro por prefers-color-scheme. */
:root {
  --amarillo: #f5c400;
  --amarillo-fuerte: #d9ab00;
  --sobre-amarillo: #1b1d21;
  --bg: #f4f3ee;
  --card: #ffffff;
  --texto: #1b1d21;
  --muted: #646b75;
  --borde: #e2e0d8;
  --campo: #ffffff;
  --ok: #17753f;      --ok-bg: #e0f4e8;
  --warn: #925300;    --warn-bg: #fff0cf;
  --bad: #b3261e;     --bad-bg: #fde7e5;
  --info: #0b57b0;    --info-bg: #e1edfc;
  --gris: #555c66;    --gris-bg: #e9ebee;
  --sombra: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --r: 14px;
  --r-sm: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --tap: 48px;
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --amarillo: #f5c400; --amarillo-fuerte: #ffd633; --sobre-amarillo: #14161a;
    --bg: #101216; --card: #1a1d23; --texto: #eceff3; --muted: #a0a8b3; --borde: #2c313a; --campo: #14171c;
    --ok: #62d08d;   --ok-bg: #12301f;
    --warn: #ffbf47; --warn-bg: #3a2a08;
    --bad: #ff8a80;  --bad-bg: #3d1614;
    --info: #7db7ff; --info-bg: #11284a;
    --gris: #b4bcc7; --gris-bg: #262b33;
    --sombra: 0 1px 2px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--fuente); font-size: 16px; line-height: 1.45; color: var(--texto); background: var(--bg);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1 { font-size: 1.45rem; margin: 0 0 var(--s4); line-height: 1.2; }
h2 { font-size: 1.15rem; margin: var(--s5) 0 var(--s3); }
h3 { font-size: 1rem; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s3); }
a { color: var(--info); }
small, .muted { color: var(--muted); }
.derecha { text-align: right; }
.centro { text-align: center; }
.nowrap { white-space: nowrap; }
.oculto, [hidden] { display: none !important; }
[x-cloak] { display: none !important; }
.fila { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.fila.entre { justify-content: space-between; }
.mt { margin-top: var(--s4); }

/* ---------- cabecera y navegación */
.app-header {
  position: sticky; top: 0; z-index: 20; background: var(--amarillo); color: var(--sobre-amarillo);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s2) var(--s4); padding-top: calc(var(--s2) + env(safe-area-inset-top)); min-height: 56px;
}
.marca { font-weight: 800; letter-spacing: .2px; text-decoration: none; color: inherit; }
.quien { display: flex; align-items: center; gap: var(--s2); font-size: .9rem; }
.quien .rol { background: rgba(0,0,0,.14); border-radius: 99px; padding: 2px 10px; font-size: .75rem; font-weight: 700; }
.quien button { min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-sm); border: 1.5px solid rgba(0,0,0,.35);
  background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--borde);
  display: flex; overflow-x: auto; padding-bottom: env(safe-area-inset-bottom); scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 1 0 auto; min-width: 72px; min-height: 56px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 6px 10px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.nav a .ico { font-size: 1.3rem; line-height: 1; }
.nav a.activo { color: var(--texto); box-shadow: inset 0 3px 0 var(--amarillo); }
.nav a .contador { background: var(--bad); color: #fff; border-radius: 99px; font-size: .68rem; padding: 0 6px; margin-left: 2px; }
main.contenedor { max-width: 760px; margin: 0 auto; padding: var(--s4); }
main.ancho { max-width: 1100px; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .nav { position: sticky; top: 56px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--borde); justify-content: center; }
  .nav a { flex-direction: row; min-height: 48px; font-size: .88rem; gap: 6px; }
}

/* ---------- tarjetas y bloques */
.tarjeta { background: var(--card); border: 1px solid var(--borde); border-radius: var(--r); box-shadow: var(--sombra);
  padding: var(--s4); margin-bottom: var(--s4); }
.tarjeta > :last-child { margin-bottom: 0; }
.tarjeta.sinmargen { margin-bottom: 0; }
.grid { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid.g2 { grid-template-columns: 1fr 1fr; } .grid.g3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 560px) { .grid.g4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid.g4 { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--borde); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--sombra); }
.kpi .valor { font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.kpi .titulo { color: var(--muted); font-size: .85rem; }
.kpi.verde .valor { color: var(--ok); } .kpi.rojo .valor { color: var(--bad); }
.deuda { text-align: center; padding: var(--s5) var(--s4); }
.deuda .valor { font-size: 2.6rem; font-weight: 900; line-height: 1.1; }
.deuda .etiqueta { color: var(--muted); font-size: 1rem; }
.deuda.aldia { background: var(--ok-bg); border-color: transparent; }
.deuda.aldia .valor { color: var(--ok); font-size: 1.8rem; }

/* ---------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1.5px solid var(--borde); background: var(--card); color: var(--texto);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--muted); }
.btn.primario { background: var(--amarillo); color: var(--sobre-amarillo); border-color: var(--amarillo-fuerte); }
.btn.primario:hover { background: var(--amarillo-fuerte); }
.btn.peligro { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.btn.chico { min-height: 44px; padding: 0 var(--s3); font-size: .92rem; }
.btn.grande { min-height: 64px; font-size: 1.15rem; width: 100%; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--info); outline-offset: 2px;
}
.acciones { display: flex; gap: var(--s2); flex-wrap: wrap; }
.acciones form { display: contents; }

/* ---------- formularios */
.campo { display: block; margin-bottom: var(--s4); }
.campo > span.etiqueta, label.etiqueta { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.ayuda { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=search],
input[type=tel], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--texto); background: var(--campo);
  border: 1.5px solid var(--borde); border-radius: var(--r-sm);
}
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--amarillo-fuerte); flex: none; }
input[type=file] { width: 100%; font: inherit; }
.campo.revisar input, .campo.revisar select { border-color: var(--warn); background: var(--warn-bg); }
.campo .aviso-revisar { display: none; color: var(--warn); font-weight: 700; font-size: .85rem; margin-top: 4px; }
.campo.revisar .aviso-revisar { display: block; }
.check { display: flex; gap: var(--s3); align-items: center; min-height: var(--tap); }
.check.caja { padding: 8px 12px; border: 1.5px solid var(--borde); border-radius: var(--r-sm); background: var(--campo); margin-bottom: var(--s2); }
.check.caja input:checked + span { font-weight: 700; }
.dos { display: grid; gap: var(--s3); grid-template-columns: 1fr 1fr; }
.tres { display: grid; gap: var(--s3); grid-template-columns: repeat(3, 1fr); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); }
legend { font-weight: 700; padding: 0; margin-bottom: var(--s2); }
.msg-error { background: var(--bad-bg); color: var(--bad); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); font-weight: 600; }
.msg-ok { background: var(--ok-bg); color: var(--ok); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); font-weight: 600; }
.msg-aviso { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); font-weight: 600; }
.msg-info { background: var(--info-bg); color: var(--info); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); }

/* chips de revisión (radios estilizados) */
.chips { display: flex; gap: var(--s2); }
.chip { position: relative; flex: 1; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: var(--r-sm);
  border: 1.5px solid var(--borde); background: var(--campo); font-weight: 700; font-size: .9rem; padding: 0 6px; }
.chip input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.chip.ok input:checked + span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.chip.atencion input:checked + span { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.chip.mal input:checked + span { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.item-rev { padding: var(--s3) 0; border-bottom: 1px solid var(--borde); }
.item-rev:last-child { border-bottom: 0; }
.item-rev .nombre { font-weight: 700; margin-bottom: 6px; }
.item-rev input[type=text] { margin-top: var(--s2); min-height: 40px; font-size: .92rem; }

/* ---------- badges, alertas, tabs */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.b-pendiente { background: var(--warn-bg); color: var(--warn); }
.b-validado { background: var(--ok-bg); color: var(--ok); }
.b-rechazado { background: var(--bad-bg); color: var(--bad); }
.b-en_validacion { background: var(--info-bg); color: var(--info); }
.b-exento { background: var(--gris-bg); color: var(--gris); }
.alerta { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-sm); margin-bottom: var(--s2);
  text-decoration: none; color: var(--texto); border-left: 6px solid var(--gris); background: var(--card); box-shadow: var(--sombra); }
.alerta.danger { border-left-color: var(--bad); background: var(--bad-bg); }
.alerta.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.alerta.info { border-left-color: var(--info); background: var(--info-bg); }
.tabs { display: flex; gap: var(--s2); margin-bottom: var(--s4); overflow-x: auto; }
.tabs a { flex: none; min-height: 44px; padding: 0 var(--s4); display: inline-flex; align-items: center; gap: 6px; border-radius: 99px;
  border: 1.5px solid var(--borde); text-decoration: none; color: var(--texto); font-weight: 700; background: var(--card); }
.tabs a.activo { background: var(--amarillo); border-color: var(--amarillo-fuerte); color: var(--sobre-amarillo); }
.tabs .n { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .75rem; }

/* ---------- listas y tablas */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--borde); }
.lista li:last-child { border-bottom: 0; }
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.sutil td { color: var(--muted); }
.vacio { color: var(--muted); text-align: center; padding: var(--s5) var(--s4); }

/* ---------- depósitos */
.tarjeta-dep .cab { display: flex; gap: var(--s3); align-items: flex-start; }
.miniatura { width: 84px; height: 112px; flex: none; border-radius: var(--r-sm); object-fit: cover; background: var(--gris-bg); border: 1px solid var(--borde); }
.miniatura.mini { width: 64px; height: 64px; }
.franja-alerta { background: var(--bad-bg); color: var(--bad); font-weight: 700; padding: var(--s2) var(--s3); border-radius: var(--r-sm); margin: var(--s3) 0; }
.motivos { margin: var(--s2) 0; padding-left: 1.1rem; color: var(--warn); font-size: .9rem; }
.dato { font-size: .9rem; color: var(--muted); }
.dato b { color: var(--texto); }
.monto-grande { font-size: 1.35rem; font-weight: 800; }
.form-inline { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--borde); }
.reparto { background: var(--info-bg); border-radius: var(--r-sm); padding: var(--s3) var(--s4); margin: var(--s3) 0; }
.reparto ul { margin: 0 0 var(--s2); padding-left: 1.1rem; }
.espera { text-align: center; padding: var(--s6) var(--s4); font-size: 1.1rem; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--borde); border-top-color: var(--amarillo-fuerte);
  border-radius: 50%; animation: gira 0.9s linear infinite; vertical-align: -5px; margin-right: 8px; }
@keyframes gira { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.fuente-foto { display: grid; gap: var(--s3); }
.fuente-foto label.btn { cursor: pointer; }
.fuente-foto input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.listo { text-align: center; padding: var(--s6) var(--s4); }
.listo .grande { font-size: 3rem; }

/* ---------- calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .cab { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal .dia { min-height: 64px; border-radius: 8px; border: 1px solid var(--borde); background: var(--card); padding: 4px; font-size: .72rem;
  text-decoration: none; color: var(--texto); display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.cal .dia .n { font-weight: 800; font-size: .85rem; }
.cal .dia.hoy { outline: 2px solid var(--amarillo-fuerte); }
.cal .dia.libre { background: var(--gris-bg); color: var(--muted); }
.cal .dia.exento { background: var(--gris-bg); border-style: dashed; }
.cal .dia.pagado { background: var(--ok-bg); }
.cal .dia.en_validacion { background: var(--info-bg); }
.cal .dia.pendiente, .cal .dia.parcial { background: var(--warn-bg); }
.cal .dia.proyectado { opacity: .8; }
.cal .dia.sel { outline: 3px solid var(--info); }
.cal .vacio-dia { min-height: 0; }
.cal .cond { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
@media (min-width: 700px) { .cal .dia { min-height: 84px; font-size: .8rem; } }

/* ---------- línea de tiempo y galería */
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--s4); border-left: 3px solid var(--borde); }
.timeline > li { position: relative; margin-bottom: var(--s4); }
.timeline > li::before { content: ""; position: absolute; left: calc(-1 * var(--s4) - 9px); top: 14px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--amarillo); border: 2px solid var(--bg); }
.timeline .tipo-man::before { background: var(--info); }
.chips-rev { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s2) 0; }
.galeria { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
.galeria a { display: block; }
.galeria img, .galeria video { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--borde); background: var(--gris-bg); }
.galeria .video { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm);
  background: var(--gris-bg); font-size: 1.6rem; text-decoration: none; border: 1px solid var(--borde); }
.grupo-foto { margin-bottom: var(--s4); }
.rep-fila { display: grid; grid-template-columns: 1fr 70px 90px 44px; gap: var(--s2); margin-bottom: var(--s2); align-items: center; }
.rep-fila .btn { padding: 0; }
.json { background: var(--gris-bg); border-radius: var(--r-sm); padding: var(--s2) var(--s3); font-size: .78rem; overflow-x: auto; max-height: 240px; white-space: pre-wrap; word-break: break-word; }
details summary { cursor: pointer; min-height: 32px; font-weight: 600; }

/* ---------- gráfico y reportes */
.grafico { position: relative; height: 280px; }
.neto-pos { color: var(--ok); } .neto-neg { color: var(--bad); }
.atajos { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.atajos a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 var(--s3); border-radius: 99px; background: var(--gris-bg); text-decoration: none; color: var(--texto); font-weight: 600; font-size: .9rem; }
.paginacion { display: flex; gap: var(--s3); align-items: center; justify-content: center; margin-top: var(--s4); }

/* ---------- toast */
.toast { position: fixed; left: var(--s4); right: var(--s4); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 50; pointer-events: none; display: flex; justify-content: center; }
.toast-item { pointer-events: auto; max-width: 560px; width: 100%; padding: var(--s3) var(--s4); border-radius: var(--r-sm); font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  background: var(--ok); color: #fff; }
.toast-item.error { background: var(--bad); }
.toast-item.ok { background: var(--ok); }
@media (min-width: 900px) { .toast { bottom: var(--s5); } }

/* ---------- login */
.login { max-width: 420px; margin: 8vh auto 0; padding: var(--s4); }
.login .logo { text-align: center; font-size: 3rem; }
.login h1 { text-align: center; }
@media print { .app-header, .nav, .acciones, .toast { display: none !important; } body { background: #fff; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
