/* Camionada — móvil primero; en pantalla ancha se convierte en panel de casa. */
/* Colores y letra de la marca Camionada (azul noche + ámbar faro). Guía: marca/LEEME.txt */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fuentes/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fuentes/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("../fuentes/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fuentes/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fuentes/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --letra-titulo: "Barlow Condensed", "Arial Narrow", sans-serif;
  --letra-texto: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fondo: #eef1f6;
  --tarjeta: #ffffff;
  --tarjeta-2: #f5f7fa;
  --borde: #dce2ec;
  --texto: #121b30;
  --texto-2: #4a5670;
  --texto-3: #5e6983;
  --marca: #16233f;          /* azul noche: iconos, menú activo, foco */
  --acento: #f5b700;         /* ámbar faro: botón principal */
  --acento-texto: #16233f;
  --acento-suave: #fff3cc;
  --bien: #1c7c3c;
  --bien-suave: #dcf2e3;
  --aviso: #8a5a00;
  --aviso-suave: #fff3cc;
  --mal: #c23b22;
  --mal-suave: #fbe3de;
  --info: #1f5fb4;
  --info-suave: #e1ecfb;
  --serie-1: #16233f;
  --rejilla: #e3e8f0;
  --sombra: 0 1px 2px rgba(22, 35, 63, .06), 0 2px 8px rgba(22, 35, 63, .06);
  --radio: 14px;
  --nav-alto: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fondo: #0d1526; --tarjeta: #16233f; --tarjeta-2: #1d2c4d; --borde: #2a3a5e;
    --texto: #f2f4f8; --texto-2: #c3ccdd; --texto-3: #9aa6bf;
    --marca: #f5b700; --acento: #f5b700; --acento-texto: #16233f; --acento-suave: #3a3216;
    --bien: #4cc27a; --bien-suave: #173322; --aviso: #f2b544; --aviso-suave: #3a2d12;
    --mal: #ff7a66; --mal-suave: #3d1f1b; --info: #7fb0f5; --info-suave: #1a2940;
    --serie-1: #f5b700; --rejilla: #243352; --sombra: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fondo: #0d1526; --tarjeta: #16233f; --tarjeta-2: #1d2c4d; --borde: #2a3a5e;
  --texto: #f2f4f8; --texto-2: #c3ccdd; --texto-3: #9aa6bf;
  --marca: #f5b700; --acento: #f5b700; --acento-texto: #16233f; --acento-suave: #3a3216;
  --bien: #4cc27a; --bien-suave: #173322; --aviso: #f2b544; --aviso-suave: #3a2d12;
  --mal: #ff7a66; --mal-suave: #3d1f1b; --info: #7fb0f5; --info-suave: #1a2940;
  --serie-1: #f5b700; --rejilla: #243352; --sombra: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.45 var(--letra-texto);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; font-family: var(--letra-titulo); font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 1.9rem; text-transform: uppercase; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
a { color: var(--info); }
.oculto { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.suave { color: var(--texto-2); }
.muy-suave { color: var(--texto-3); font-size: .88rem; }

/* ---------- estructura ---------- */
#app { min-height: 100vh; }
.lateral { display: none; }
main { padding: 16px 16px calc(var(--nav-alto) + 24px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.cabecera { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cabecera h1 { flex: 1; margin: 0; }
.nav-abajo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-alto) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--tarjeta); border-top: 1px solid var(--borde);
}
.nav-abajo a, .lateral a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--texto-2); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.nav-abajo a svg, .lateral a svg { width: 24px; height: 24px; }
.nav-abajo a.activo, .lateral a.activo { color: var(--marca); }

/* ---------- panel de casa (pantalla ancha) ---------- */
@media (min-width: 1000px) {
  .nav-abajo { display: none; }
  .lateral {
    display: flex; flex-direction: column; gap: 2px; position: fixed; top: 0; bottom: 0; left: 0; width: 220px;
    background: var(--tarjeta); border-right: 1px solid var(--borde); padding: 18px 12px;
  }
  .lateral .marca { padding: 4px 10px 22px; display: flex; gap: 10px; align-items: center; font-family: var(--letra-titulo); font-weight: 700; font-size: 1.55rem; letter-spacing: .02em; text-transform: uppercase; color: var(--marca); }
  .lateral .marca img { width: 36px; height: 36px; }
  .lateral a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 10px 12px; border-radius: 10px; }
  .lateral a:hover { background: var(--tarjeta-2); }
  .lateral a.activo { background: var(--acento-suave); }
  .lateral .pie { margin-top: auto; font-size: .8rem; color: var(--texto-3); padding: 8px 12px; }
  main { margin-left: 220px; max-width: 1180px; padding: 28px 36px 40px; }
  .solo-movil { display: none !important; }
}
@media (max-width: 999px) { .solo-pc { display: none !important; } }

/* ---------- tarjetas y rejillas ---------- */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); margin-bottom: 14px; }
.tarjeta > h2:first-child, .tarjeta > h3:first-child { margin-top: 0; }
.rejilla { display: grid; gap: 14px; }
.rejilla-kpi { grid-template-columns: 1fr 1fr; }
@media (min-width: 1000px) {
  .rejilla-2 { grid-template-columns: 1fr 1fr; }
  .rejilla-3 { grid-template-columns: 2fr 1fr; }
  .rejilla-kpi { grid-template-columns: repeat(4, 1fr); }
}
.kpi { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; }
.kpi .etq { font-size: .82rem; color: var(--texto-2); font-weight: 600; }
.kpi .valor { font-family: var(--letra-titulo); font-size: 2.1rem; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.kpi .sub { font-size: .8rem; color: var(--texto-3); }

/* ---------- los 5 botones grandes ---------- */
.botonera { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.boton-grande {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 112px; padding: 16px; border-radius: 18px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font: inherit; font-family: var(--letra-titulo); font-weight: 700; font-size: 1.3rem; letter-spacing: .01em; text-align: left;
  cursor: pointer; box-shadow: var(--sombra);
}
.boton-grande svg { width: 34px; height: 34px; color: var(--marca); }
.boton-grande small { display: block; font-family: var(--letra-texto); letter-spacing: 0; font-weight: 500; font-size: .8rem; color: var(--texto-3); margin-top: 2px; }
.boton-grande.principal { grid-column: 1 / -1; background: var(--acento); color: var(--acento-texto); border-color: transparent; min-height: 96px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; font-size: 1.55rem; text-transform: uppercase; }
.boton-grande.principal svg { color: var(--acento-texto); width: 40px; height: 40px; }
.boton-grande.principal small { color: inherit; opacity: .85; text-transform: none; }
.boton-grande.espera-abierta { grid-column: 1 / -1; background: var(--aviso-suave); border-color: var(--aviso); }
.boton-grande[disabled] { opacity: .5; cursor: default; }
@media (max-width: 999px) {
  .boton-grande[disabled] { min-height: 64px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; font-size: .9rem; padding: 10px 12px; }
  .boton-grande[disabled] svg { width: 24px; height: 24px; flex: none; }
  .boton-grande[disabled] small { display: none; }
}
.boton-grande:active:not([disabled]) { transform: scale(.98); }
@media (min-width: 1000px) {
  .botonera { grid-template-columns: repeat(5, 1fr); }
  .boton-grande { min-height: 96px; font-size: 1.2rem; }
  .boton-grande.principal, .boton-grande.espera-abierta { grid-column: auto; flex-direction: column; align-items: flex-start; font-size: 1.2rem; min-height: 96px; }
  .boton-grande.principal svg { width: 34px; height: 34px; }
}
.pronto { font-size: .7rem; font-weight: 700; background: var(--tarjeta-2); color: var(--texto-3); border-radius: 99px; padding: 1px 8px; }

/* ---------- espera en curso ---------- */
.espera-grande { text-align: center; padding: 18px 12px; }
.espera-grande .reloj { font-family: var(--letra-titulo); font-size: 4rem; font-weight: 700; line-height: 1; }
.espera-grande .importe { font-family: var(--letra-titulo); font-size: 1.8rem; font-weight: 700; color: var(--bien); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn.prim { background: var(--acento); color: var(--acento-texto); border-color: transparent; }
.btn.peligro { color: var(--mal); border-color: var(--mal); background: transparent; }
.btn.bien { background: var(--bien); color: #fff; border-color: transparent; }
.btn.enorme { width: 100%; min-height: 64px; font-family: var(--letra-titulo); font-size: 1.5rem; letter-spacing: .03em; text-transform: uppercase; border-radius: 16px; }
.btn.peq { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.fila-btn { display: flex; gap: 10px; flex-wrap: wrap; }
.fila-btn > .btn { flex: 1 1 auto; }
.btn-icono { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icono svg { width: 22px; height: 22px; }

/* ---------- formularios ---------- */
label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: .85rem; font-weight: 600; color: var(--texto-2); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font: inherit; font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marca); outline-offset: 0; border-color: transparent; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-weight: 600; }
.check input { width: 24px; height: 24px; min-height: 0; }
.ayuda { font-size: .82rem; color: var(--texto-3); margin: -6px 0 12px; }
.segmentos { display: flex; gap: 6px; background: var(--tarjeta-2); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.segmentos button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; color: var(--texto-2); cursor: pointer; }
.segmentos button.activo { background: var(--tarjeta); color: var(--texto); box-shadow: var(--sombra); }

/* ---------- listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { border-bottom: 1px solid var(--borde); }
.lista > li:last-child { border-bottom: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; color: inherit; text-decoration: none; cursor: pointer; }
.item .principal-txt { flex: 1; min-width: 0; }
.item .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-size: .85rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .der { text-align: right; font-weight: 700; white-space: nowrap; }
.fecha-caja { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--tarjeta-2); padding: 4px 0; line-height: 1.1; }
.fecha-caja b { display: block; font-size: 1.15rem; }
.fecha-caja small { font-size: .7rem; color: var(--texto-2); text-transform: uppercase; font-weight: 700; }
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--tarjeta-2); color: var(--texto-2); vertical-align: middle; }
.chip.bien { background: var(--bien-suave); color: var(--bien); }
.chip.aviso { background: var(--aviso-suave); color: var(--aviso); }
.chip.mal { background: var(--mal-suave); color: var(--mal); }
.chip.info { background: var(--info-suave); color: var(--info); }
.vacio { text-align: center; color: var(--texto-3); padding: 28px 10px; }
.buscador { display: flex; gap: 8px; margin-bottom: 12px; }
.filtros { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.filtros button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--borde); background: var(--tarjeta); font: inherit; font-weight: 600; font-size: .9rem; color: var(--texto-2); cursor: pointer; }
.filtros button.activo { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
table.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.tabla th { text-align: left; font-size: .78rem; color: var(--texto-2); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--borde); }
table.tabla td { padding: 9px 8px; border-bottom: 1px solid var(--borde); }
table.tabla td.d, table.tabla th.d { text-align: right; white-space: nowrap; }
table.tabla tr.clic { cursor: pointer; }
table.tabla tr.clic:hover td { background: var(--tarjeta-2); }

/* ---------- avisos ---------- */
.aviso { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: .92rem; border: 1px solid transparent; }
.aviso.info { background: var(--info-suave); color: var(--info); }
.aviso.amarillo { background: var(--aviso-suave); color: var(--aviso); }
.aviso.rojo { background: var(--mal-suave); color: var(--mal); }
.aviso.verde { background: var(--bien-suave); color: var(--bien); }
.aviso b { color: inherit; }
.barra-conexion { position: sticky; top: 0; z-index: 30; background: var(--aviso-suave); color: var(--aviso); text-align: center; font-size: .85rem; font-weight: 700; padding: 6px 10px; }

/* ---------- hoja (ventana desde abajo) ---------- */
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--fondo); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
.hoja .cab { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hoja .cab h2 { flex: 1; margin: 0; }
@media (min-width: 700px) { .velo { align-items: center; } .hoja { border-radius: 20px; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-alto) + 20px); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--texto); color: var(--fondo); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 60; transition: .2s; max-width: 90vw; text-align: center; }
.toast.ver { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 1000px) { .toast { bottom: 24px; } }

/* ---------- entrada ---------- */
.entrada { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.entrada .tarjeta { width: 100%; max-width: 400px; padding: 26px 22px; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--letra-titulo); font-weight: 700; font-size: 2rem; letter-spacing: .02em; text-transform: uppercase; color: var(--marca); margin-bottom: 18px; }
.logo img { width: 48px; height: 48px; }

/* ---------- gráfico ---------- */
.grafico { position: relative; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico .rej { stroke: var(--rejilla); stroke-width: 1; }
.grafico .eje { fill: var(--texto-3); font-size: 11px; }
.grafico .barra { fill: var(--serie-1); }
.grafico .barra.apagada { opacity: .35; }
.grafico .zona { fill: transparent; cursor: pointer; }
.grafico .val { fill: var(--texto); font-size: 11px; font-weight: 700; }
.tip { position: absolute; pointer-events: none; background: var(--texto); color: var(--fondo); font-size: .82rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; z-index: 5; }
.qr-grande { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; }
.qr-grande img { width: 240px; height: 240px; display: block; }
/* arreglos */
.dos > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
.chip.aviso { padding: 2px 8px; margin: 0; border: 0; border-radius: 99px; font-size: .72rem; }
.rejilla > * { min-width: 0; }
.tarjeta { min-width: 0; overflow-wrap: anywhere; }

/* foco visible con teclado */
.btn:focus-visible, .boton-grande:focus-visible, .btn-icono:focus-visible, a:focus-visible { outline: 3px solid var(--marca); outline-offset: 2px; }
