/* ============================================================================
   ECLIPSE — panel interno (Caja, Stock, Finanzas).
   Dashboard neutro y oscuro, con barra lateral, en la línea del panel de El Mariachi (pedido de Tomi el 5/11): grises parejos,
   un solo acento (rojo) y sin motivos de marca. También tiene modo claro. La carta pública (/carta/) usa su propio estilo.
   ========================================================================== */
:root {
  --bg: #15171b;
  --surface: #1e2025;
  --surface-2: #272a31;
  --surface-3: #31343c;
  --border: #353841;
  --border-2: #484c56;
  --text: #f5f6f8;
  --text-2: #c6cad1;
  --text-3: #9aa0ab;
  --accent: #e5484d;
  --accent-hover: #f0575b;
  --accent-soft: rgba(229, 72, 77, 0.14);
  --accent-ink: #ffffff;
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.15);
  --warn: #d6a333;
  --warn-soft: rgba(214, 163, 51, 0.15);
  --danger: #e5484d;
  --info: #6aa8f5;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --r: 10px;
  --r-sm: 7px;
  --sb-w: 232px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* nombres que ya usan las pantallas */
  --fg: var(--text); --muted: var(--text-3); --dim: var(--text-3); --ok: var(--success);
  --line: var(--border); --line-strong: var(--border-2); --radio: var(--r);
  --gold: var(--warn); --oro: var(--warn); --vino: var(--surface-3); --vino-profundo: var(--surface-2);
  --barra-1: #6aa8f5; --barra-2: #b79cf0; --barra-3: #f0a0b5; --barra-4: #6fd3b8; --barra-5: #e8c88a;
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3f6; --surface: #ffffff; --surface-2: #f6f7fa; --surface-3: #eceef3; --border: #e1e4ea; --border-2: #cbd0d9;
  --text: #14171c; --text-2: #444b57; --text-3: #667085;
  --accent: #d1303a; --accent-hover: #b9262f; --accent-soft: rgba(209, 48, 58, 0.1);
  --success: #1a7f37; --success-soft: rgba(26, 127, 55, 0.12); --warn: #8f5f00; --warn-soft: rgba(176, 120, 0, 0.14); --danger: #c62832; --info: #2456b8;
  --shadow: 0 18px 50px rgba(20, 24, 35, 0.14);
  --barra-1: #2f6fcf; --barra-2: #6d4fc4; --barra-3: #c2456f; --barra-4: #1f8f73; --barra-5: #9a6a10;
}

* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; padding: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .dato b, .kpi b, .total, .linea-t { font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--text-3); }
.dim { color: var(--text-3); opacity: .65; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mas { color: var(--success); } .neg { color: var(--danger); } .alerta { color: var(--warn); }
code { font: 600 12.5px ui-monospace, Consolas, monospace; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.link { color: var(--text); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--border-2); }
.link:hover { border-color: var(--accent); }

/* ───────── marca ───────── */
.brandmark { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px; background: var(--surface-2); border: 1.5px solid var(--accent); }
.marca-nombre { font-size: 14px; font-weight: 600; }
.marca-nombre .nom { letter-spacing: .2em; text-transform: uppercase; font-weight: 700; font-size: 13px; }
.marca-nombre b { color: var(--text-3); font-weight: 500; }

/* ───────── botones ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s, transform .08s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(.5px); }
a.btn { text-decoration: none; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.vino { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--accent-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.grande { height: 46px; font-size: 15px; padding: 0 22px; }
.btn.bloque { width: 100%; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--text-3); font-size: 22px; line-height: 1; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ───────── campos ───────── */
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; border: 0; padding: 0; }
.fld > span, .fld > legend { font-size: 12px; color: var(--text-2); padding: 0; }
.fld .ayuda { font-size: 12px; color: var(--text-3); }
input[type="text"], input[type="search"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], select, textarea {
  width: 100%; min-width: 0; height: 34px; padding: 0 11px; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-color: var(--surface-2); cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa0ab' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
input[type="number"] { font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .row2.apilar, .row3.apilar { grid-template-columns: 1fr; gap: 0; } }
.chk { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 13px; color: var(--text-2); }
.err { color: var(--danger); font-size: 12.5px; margin: 0 0 10px; }
.err:empty { display: none; }
.buscar { max-width: 260px; height: 30px; font-size: 12.5px; background-color: var(--surface-2); }
.sel-chico select { height: 30px; font-size: 12.5px; }
.password-field { position: relative; }

/* ───────── etiquetas, píldoras, segmentos ───────── */
.label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2); font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pill:hover { background: var(--surface-3); color: var(--text); }
.pill[aria-pressed="true"], .pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-3); white-space: nowrap; border: 1px solid transparent; }
.chip.ok { color: var(--success); background: var(--success-soft); border-color: rgba(63, 185, 80, .3); }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(214, 163, 51, .3); }
.chip.danger { color: var(--danger); background: var(--accent-soft); border-color: rgba(229, 72, 77, .3); }
.chip.info { color: var(--info); background: var(--surface-3); }
.punto { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--text-3)); flex: none; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); max-width: 100%; }
.seg button { padding: 0 14px; height: 32px; font-size: 12.5px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; border-left: 1px solid var(--border-2); white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface-3); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.seg.chico button { height: 28px; padding: 0 11px; }
.tabs-scroll { overflow-x: auto; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.subnav { display: flex; gap: 2px; margin: -4px 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { position: relative; padding: 9px 13px; font-size: 13px; font-weight: 500; color: var(--text-3); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ───────── tarjetas, tablas, listas ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; min-width: 0; overflow-wrap: break-word; }
.card.vino { background: var(--surface-2); border-color: var(--border-2); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-titulo { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.tres, .grid.cuatro { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.dos, .grid.tres, .grid.cuatro { grid-template-columns: 1fr; } }
.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.tabla td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr { transition: background .1s; }
.tabla tbody tr:hover { background: var(--surface-2); }
.tabla tr.click { cursor: pointer; }
.tabla tr.apagado td { opacity: .5; }
.tabla .num { text-align: right; white-space: nowrap; }
.tabla th.num { text-align: right; }
.tabla tr.grupo td { background: var(--surface-2); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding-block: 7px; }
.tabla.editando td { padding-block: 5px; }
.matriz td, .matriz th { text-align: center; }
.matriz td:first-child, .matriz th:first-child { text-align: left; }
.lista-fila { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lista-fila:last-child { border-bottom: 0; }
.vacio { padding: 44px 24px; border: 1px dashed var(--border-2); border-radius: var(--r); background: var(--surface); text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vacio h3 { color: var(--text); font-size: 14px; font-weight: 600; }
.vacio p { font-size: 12.5px; max-width: 420px; }
.skel { height: 54px; border-radius: var(--r); background: var(--surface); margin-top: 10px; position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.barra-prog { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.barra-prog i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 4px; }

/* ───────── páginas ───────── */
.pagina { padding: 22px 26px 90px; max-width: 1180px; width: 100%; animation: entrada .16s ease; }
@keyframes entrada { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.enc { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.titulo { font-size: 18px; font-weight: 600; }
.subtitulo { color: var(--text-3); font-size: 13px; margin-top: 3px; max-width: 72ch; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.acciones .resto { flex: 1; }
.filtros-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.filtros-fila .fld { margin: 0; }
.resumen-fila { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 14px; }
.dato { display: flex; flex-direction: column; gap: 2px; }
.dato b { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.dato small { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi.vino { border-color: var(--border-2); background: var(--surface-2); }
.kpi b { font-size: 21px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpis + .vacio, .kpis + .grid { margin-top: 18px; }
.barra-fila { margin-bottom: 12px; }
.barra-fila-t { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.top { display: flex; flex-direction: column; }
.top li { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.top li:last-child { border-bottom: 0; }
.abrir { max-width: 460px; }
.ayuda-impresion summary { cursor: pointer; color: var(--text-3); font-weight: 500; padding: 6px 0; }
.ayuda-impresion ol { margin: 8px 0 0 18px; display: grid; gap: 6px; list-style: decimal; }
.codigo-grande { font: 700 24px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .08em; word-break: break-all; }
.aj-fila { align-items: flex-start; margin-bottom: 14px; }
.aj-fila span { display: flex; flex-direction: column; gap: 2px; }
.aj-fila small { font-size: 12px; font-weight: 400; }
.guardar-barra { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-top: 14px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow); }
.barra-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; margin-bottom: 12px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r); }
.barra-acciones .resto { flex: 1; }
.precio-in { width: 104px; height: 30px; padding: 0 8px; text-align: right; background: transparent; border-color: transparent; }
.precio-in:hover { border-color: var(--border-2); }
.precio-in.cambiado { border-color: var(--warn); background: var(--warn-soft); }
.pillrow { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.precios { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 6px; }
.precios label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.receta-fila { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; margin-top: 8px; }
@media (max-width: 520px) { .receta-fila { grid-template-columns: 1fr 90px auto; } }

/* ───────── ventanas (hojas) y avisos ───────── */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
:root[data-theme="light"] .scrim { background: rgba(15, 18, 25, .45); }
.sheet { width: 100%; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px 16px 0 0; max-height: 92vh; max-height: 92dvh; overflow: auto; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; box-shadow: var(--shadow); animation: hoja .14s ease; }
@keyframes hoja { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 760px) { .scrim { align-items: center; } .sheet { width: min(var(--ancho, 600px), 94vw); border-radius: var(--r); max-height: 90vh; padding: 20px 22px 22px; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-h h2 { font-size: 15px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 14px); display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--surface-3); border: 1px solid var(--border-2); border-left: 3px solid var(--success); border-radius: var(--r-sm); font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 120; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-left-color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .toast, .btn, .sheet, .pagina { transition: none; animation: none; } }

/* ───────── marco: barra lateral ───────── */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar__brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 16px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.navitem { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background .12s, color .12s; }
.navitem svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navitem:hover { background: var(--surface-2); color: var(--text); }
.navitem[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.navitem[aria-current="page"] svg { color: var(--accent); }
.navitem__dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.sidebar__foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.theme-switch { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-switch button { flex: 1 1 0; min-width: 0; padding: 5px 4px; font-size: 12px; font-weight: 500; color: var(--text-3); border-radius: 6px; text-align: center; white-space: nowrap; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.is-active { color: var(--text); background: var(--surface-3); box-shadow: 0 0 0 1px var(--border-2) inset; }
.usuario-btn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; }
.usuario-btn:hover { background: var(--surface-2); }
.inicial { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent); }
.usuario-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.usuario-txt b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-txt small { font-size: 11.5px; color: var(--text-3); }
.vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); padding: 0 8px; }
.vivo i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.vivo.on i { background: var(--success); }
.vivo.off { color: var(--danger); font-weight: 600; }
.vivo.off i { background: var(--danger); }
.main { min-width: 0; }
.topbar, .bottomnav { display: none; }

/* celular y tablet: arriba la marca y el usuario, abajo las tres secciones */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar .brand { display: flex; align-items: center; gap: 9px; }
  .topbar .der { display: flex; align-items: center; gap: 6px; }
  .bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 4px 7px; font-size: 11px; font-weight: 500; color: var(--text-3); text-decoration: none; }
  .bottomnav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .bottomnav a[aria-current="page"] { color: var(--text); }
  .bottomnav a[aria-current="page"] svg { color: var(--accent); }
  .pagina { padding: 16px 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ───────── caja ───────── */
.caja-enc { align-items: center; }
.caja-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.caja-acc { display: flex; gap: 8px; flex-wrap: wrap; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-carrito { position: sticky; top: 18px; }
.pos-filtros { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pos-filtros input[type="search"], .pos-filtros input[type="text"] { height: 38px; font-size: 14px; background-color: var(--surface); }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.pos-cats .pill { flex: none; height: 32px; }
.pos-tragos { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.trago { position: relative; min-height: 88px; padding: 11px 12px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; justify-content: space-between; gap: 8px; text-align: left; transition: transform .06s, border-color .12s, background .12s; }
.trago:hover { border-color: var(--border-2); background: var(--surface-2); }
.trago:active { transform: scale(.975); }
.trago.en-pedido { background: var(--accent-soft); border-color: var(--accent); }
.trago-nombre { font-weight: 600; font-size: 13.5px; line-height: 1.25; padding-right: 26px; overflow-wrap: anywhere; }
.trago-precio { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.trago-cant { position: absolute; top: 8px; right: 8px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.carrito-card { padding: 14px 16px; }
.lineas { display: flex; flex-direction: column; }
.linea { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.linea-n { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.linea-n b { overflow-wrap: anywhere; font-weight: 600; }
.linea-t { font-weight: 600; min-width: 72px; text-align: right; }
.cant { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.mini { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--border-2); font-size: 17px; font-weight: 600; display: grid; place-items: center; }
.mini:hover { background: var(--border); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 26px; font-weight: 600; margin: 14px 0; letter-spacing: -.02em; }
.total span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.metodos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.efectivo { margin-bottom: 4px; }
.rapidos { display: flex; flex-wrap: wrap; gap: 8px; }
.vuelto { font-size: 20px; font-weight: 600; margin: 8px 0 12px; min-height: 30px; }
.vuelto.falta { color: var(--danger); }
.ultima { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r); padding: 11px 14px; margin-bottom: 12px; }
.pos-flotante { display: none; }
.ventas-recientes { margin-top: 28px; }
.barra-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); }
.barra-chip b { font-size: 15px; }
.barra-fija { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 14px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); }
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos-carrito { position: static; }
  .pos-flotante { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); z-index: 44; min-height: 50px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 8px 28px rgba(0, 0, 0, .5); }
  .pos-flotante[hidden] { display: none; }
  .pos-tragos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ───────── conteo de stock ───────── */
.conteo-in { width: 112px; height: 30px; text-align: right; }
.conteo-in.cambiado { border-color: var(--warn); background: var(--warn-soft); }
.conteo-in.igual { border-color: var(--success); }
.conteo-pie { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 14px; margin-top: 14px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow); }
.conteo-pie .resto { flex: 1; min-width: 160px; }
@media (max-width: 900px) { .conteo-pie { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); } .guardar-barra { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); } }

/* ───────── entrada ───────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(80% 55% at 50% 0%, var(--surface-2), var(--bg)); }
.login__card { width: 100%; max-width: 340px; padding: 26px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.login__brand { display: flex; align-items: center; gap: 9px; }
.login__sub { font-size: 12.5px; color: var(--text-3); margin: 9px 0 18px; }
.login .pie { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 14px; }

/* ───────── impresión de tickets (rollo de 80 mm) ───────── */
#ticketPrint { display: none; }
@media print {
  @page { size: 80mm auto; margin: 3mm; }
  body.imprimiendo > *:not(#ticketPrint) { display: none !important; }
  body.imprimiendo #ticketPrint { display: block !important; }
  html, body.imprimiendo { background: #fff !important; color: #000 !important; }
  .tk { width: 100%; padding: 1mm 0 3mm; text-align: center; color: #000; font-family: 'Inter', Arial, sans-serif; break-after: page; page-break-after: always; }
  .tk:last-child { break-after: auto; page-break-after: auto; }
  .tk-logo svg { width: 44mm; height: auto; }
  .tk-barra { margin: 3mm 0 2mm; padding: 2mm 1mm; background: #000; color: #fff; font-weight: 800; font-size: 5mm; letter-spacing: .24em; text-transform: uppercase; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tk-trago { font-size: 8mm; font-weight: 800; line-height: 1.15; margin: 5mm 0 4mm; overflow-wrap: anywhere; }
  .tk-meta { font-size: 3mm; margin-top: 2mm; }
  .tk-aviso { font-size: 2.9mm; margin-top: 2mm; padding-top: 2mm; border-top: .3mm dashed #000; }
}
