/* Andén 11 · noche de bar, latón y señalética de estación */
:root {
  --bg: oklch(0.17 0.012 55);
  --bg-2: oklch(0.21 0.014 55);
  --bg-3: oklch(0.26 0.016 55);
  --line: oklch(0.32 0.016 55);
  --ink: oklch(0.95 0.012 75);
  --ink-2: oklch(0.78 0.018 70);
  --ink-3: oklch(0.6 0.02 65);
  --brass: oklch(0.8 0.13 75);
  --brass-ink: oklch(0.22 0.04 60);
  --brass-soft: oklch(0.8 0.13 75 / 0.14);
  --signal: oklch(0.74 0.14 150);
  --signal-soft: oklch(0.74 0.14 150 / 0.15);
  --stop: oklch(0.66 0.17 28);
  --stop-soft: oklch(0.66 0.17 28 / 0.16);
  --display: 'Overpass', 'Arial Narrow', sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --s-xs: 4px; --s-sm: 8px; --s-md: 12px; --s-lg: 16px; --s-xl: 24px; --s-2xl: 32px; --s-3xl: 48px;
  --r: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: calc(64px + var(--safe-b));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; overscroll-behavior: none; }
body { -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input, select { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

.app { position: fixed; inset: 0; overflow: hidden; max-width: 560px; margin: 0 auto; }
.stack { position: absolute; inset: 0; }

/* ---------- pantallas apiladas */
.screen { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; will-change: transform; }
.screen.has-tabs { bottom: var(--tab-h); }
.screen.enter { animation: push-in 380ms var(--ease) both; }
.screen.leave { animation: push-out 300ms var(--ease) both; }
.screen.under { animation: under 380ms var(--ease) both; }
.screen.back-under { animation: back-under 300ms var(--ease) both; }
.screen.fade { animation: fade-in 260ms var(--ease) both; }
@keyframes push-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes push-out { from { transform: none; } to { transform: translateX(100%); } }
@keyframes under { to { transform: translateX(-24%); opacity: .6; } }
@keyframes back-under { from { transform: translateX(-24%); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bar { padding: calc(var(--safe-t) + 20px) var(--s-lg) var(--s-md); display: flex; align-items: center; gap: var(--s-md); min-height: 60px; }
.bar h1 { font-family: var(--display); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.01em; line-height: 1; margin: 0; flex: 1; }
.bar .sub { display: block; font-family: var(--body); font-weight: 400; font-size: .82rem; color: var(--ink-3); letter-spacing: 0; margin-top: 6px; }
.back { width: 44px; height: 44px; display: grid; place-items: center; margin-left: -10px; border-radius: 50%; }
.back:active { background: var(--bg-3); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.icon-btn:active { background: var(--bg-3); }
.body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 var(--s-lg) var(--s-2xl); }

/* ---------- barra de pestañas */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: var(--tab-h); padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(4, 1fr); background: oklch(0.15 0.012 55 / 0.96); border-top: 1px solid var(--line); z-index: 20; backdrop-filter: blur(12px); }
.tabbar[hidden] { display: none; }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.tabbar button.on { color: var(--brass); }
.tabbar button:active svg { transform: scale(.9); }
.tabbar svg { transition: transform 120ms; }

/* ---------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-sm); min-height: 54px; padding: 0 var(--s-xl); border-radius: var(--r); font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; transition: transform 120ms var(--ease), background 160ms; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brass); color: var(--brass-ink); }
.btn.go { background: var(--signal); color: oklch(0.2 0.05 150); }
.btn.ghost { background: var(--bg-3); color: var(--ink); }
.btn.danger { background: var(--stop-soft); color: var(--stop); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.link { color: var(--brass); font-weight: 700; }

/* ---------- login */
.login { justify-content: center; align-items: center; padding: var(--s-xl); gap: var(--s-2xl); }
.plate { display: flex; align-items: stretch; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.plate .n { background: var(--brass); color: var(--brass-ink); font-family: var(--display); font-weight: 900; font-size: 3.4rem; line-height: 1; padding: 14px 16px 6px; }
.plate .t { padding: 12px 18px; display: flex; flex-direction: column; justify-content: center; background: var(--bg-2); }
.plate .t b { font-family: var(--display); font-weight: 900; font-size: 1.5rem; letter-spacing: .14em; line-height: 1; }
.plate .t span { color: var(--ink-3); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; margin-top: 6px; }
.dots { display: flex; gap: 14px; height: 18px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink-3); transition: background 120ms, box-shadow 120ms; }
.dots i.on { background: var(--brass); box-shadow: none; }
.dots.shake { animation: shake 380ms; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- teclado numérico */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 340px; }
.keypad button { height: 62px; border-radius: var(--r); background: var(--bg-2); font-family: var(--display); font-size: 1.6rem; font-weight: 700; transition: background 100ms, transform 100ms; }
.keypad button:active { background: var(--bg-3); transform: scale(.96); }
.keypad button.fn { background: none; color: var(--ink-2); font-size: 1rem; }
.keypad.compact button { height: 52px; font-size: 1.35rem; }

/* ---------- caja */
.figure { font-family: var(--display); font-weight: 900; font-size: 3.2rem; line-height: 1; letter-spacing: -0.02em; }
.figure small { font-size: .45em; color: var(--ink-3); font-weight: 700; margin-left: 4px; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); font-weight: 700; }
.state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; }
.state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.open { background: var(--signal-soft); color: var(--signal); }
.state.open::before { animation: pulse 2s infinite; }
.state.closed { background: var(--bg-3); color: var(--ink-3); }
@keyframes pulse { 50% { opacity: .35; } }
.hero { padding: var(--s-lg) 0 var(--s-xl); display: grid; gap: var(--s-md); }
.rows { display: grid; border-top: 1px solid var(--line); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-md); padding: 14px 0; border-bottom: 1px solid var(--line); }
.row .k { color: var(--ink-2); }
.row .v { font-family: var(--display); font-weight: 700; font-size: 1.12rem; }
.row .v.strong { font-size: 1.3rem; color: var(--brass); }
.row.sub .k { padding-left: var(--s-lg); font-size: .92rem; color: var(--ink-3); }
.row.sub .v { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: var(--s-xl) 0 var(--s-md); }
.section-t { font-family: var(--display); font-weight: 800; font-size: 1.05rem; margin: var(--s-2xl) 0 var(--s-sm); display: flex; justify-content: space-between; align-items: baseline; }
.section-t span { font-family: var(--body); font-weight: 400; font-size: .85rem; color: var(--ink-3); }
.note { color: var(--ink-3); font-size: .88rem; }
.warn { background: var(--stop-soft); color: oklch(0.85 0.08 30); border-radius: var(--r); padding: var(--s-md) var(--s-lg); font-size: .92rem; }

/* ---------- mesas */
.seg { display: flex; gap: 6px; padding: 4px; background: var(--bg-2); border-radius: 12px; margin: 0 var(--s-lg) var(--s-md); }
.seg button { flex: 1; height: 40px; border-radius: 9px; font-family: var(--display); font-weight: 800; font-size: .92rem; letter-spacing: .06em; color: var(--ink-3); transition: background 160ms, color 160ms; }
.seg button.on { background: var(--bg-3); color: var(--ink); }
.tables { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.table { position: relative; aspect-ratio: 1; border-radius: var(--r); background: var(--bg-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform 120ms var(--ease); }
.table:active { transform: scale(.94); }
.table b { font-family: var(--display); font-weight: 900; font-size: 1.6rem; line-height: 1; color: var(--ink-2); }
.table.busy { background: var(--brass-soft); box-shadow: inset 0 0 0 1.5px var(--brass); }
.table.busy b { color: var(--brass); }
.table small { font-size: .74rem; color: var(--ink-2); font-weight: 700; }
.table .ref { position: absolute; top: 6px; left: 8px; right: 8px; font-size: .62rem; color: var(--ink-3); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick { display: flex; align-items: center; gap: var(--s-md); width: 100%; padding: var(--s-lg); border-radius: var(--r); background: var(--bg-2); margin-bottom: var(--s-lg); text-align: left; }
.quick:active { background: var(--bg-3); }
.quick .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brass); color: var(--brass-ink); }
.quick b { font-family: var(--display); font-weight: 800; font-size: 1.05rem; display: block; }
.quick span { color: var(--ink-3); font-size: .85rem; }
.closed-gate { display: grid; gap: var(--s-lg); justify-items: start; padding: var(--s-2xl) 0; }
.closed-gate h2 { font-family: var(--display); font-weight: 900; font-size: 2rem; line-height: 1.05; margin: 0; }

/* ---------- comanda */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--s-lg) var(--s-md); scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); font-weight: 700; font-size: .9rem; white-space: nowrap; transition: background 140ms, color 140ms; }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.type.on { background: var(--brass); color: var(--brass-ink); }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 0; }
.search { margin: 0 var(--s-lg) var(--s-md); position: relative; flex-shrink: 0; }
.search input { width: 100%; height: 44px; border-radius: 12px; border: 0; background: var(--bg-2); padding: 0 14px 0 40px; outline: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--brass); }
.search svg { position: absolute; left: 12px; top: 10px; width: 22px; height: 22px; color: var(--ink-3); }
.products { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-bottom: 120px; }
.prod { position: relative; min-height: 76px; border-radius: 12px; background: var(--bg-2); padding: 12px 12px 10px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; transition: transform 110ms var(--ease), background 140ms; }
.prod:active { transform: scale(.96); background: var(--bg-3); }
.prod .n { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.prod .p { font-family: var(--display); font-weight: 700; color: var(--ink-3); font-size: .95rem; }
.prod .q { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 99px; background: var(--brass); color: var(--brass-ink); font-family: var(--display); font-weight: 900; font-size: .9rem; display: grid; place-items: center; }
.prod .q.pop { animation: pop 260ms var(--ease); }
@keyframes pop { 40% { transform: scale(1.35); } }
.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s-md) var(--s-lg) calc(var(--s-md) + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; }
.dock .tot { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--s-md); min-height: 58px; padding: 0 var(--s-lg); border-radius: var(--r); background: var(--bg-3); }
.dock .tot b { font-family: var(--display); font-size: 1.4rem; font-weight: 900; }
.dock .tot span { color: var(--ink-2); font-size: .9rem; font-weight: 700; }
.dock .btn { min-height: 58px; }

/* ---------- hojas modales */
.scrim { position: absolute; inset: 0; background: oklch(0.08 0.01 55 / 0.6); z-index: 40; animation: fade 240ms both; }
.scrim.out { animation: fade 220ms reverse both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; z-index: 41; background: var(--bg-2); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: sheet-in 360ms var(--ease) both; padding-bottom: var(--safe-b); touch-action: pan-y; }
.sheet.out { animation: sheet-out 240ms var(--ease) both; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 10px auto 4px; flex-shrink: 0; }
.sheet .sh-h { padding: var(--s-sm) var(--s-lg) var(--s-md); display: flex; align-items: center; justify-content: space-between; gap: var(--s-md); }
.sheet .sh-h h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 1.4rem; }
.sheet .sh-b { overflow-y: auto; padding: 0 var(--s-lg) var(--s-lg); display: grid; gap: var(--s-lg); }
.sheet .rows, .sheet .row { border-color: var(--bg-3); }

.lines { display: grid; }
.ln { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--s-md); padding: 10px 0; border-bottom: 1px solid var(--bg-3); }
.ln .n { font-weight: 700; }
.ln .n small { display: block; color: var(--ink-3); font-weight: 400; font-size: .82rem; }
.ln .v { font-family: var(--display); font-weight: 700; min-width: 64px; text-align: right; }
.stepper { display: flex; align-items: center; background: var(--bg-3); border-radius: 99px; }
.stepper button { width: 38px; height: 38px; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; border-radius: 50%; }
.stepper button:active { background: var(--line); }
.stepper b { min-width: 22px; text-align: center; font-family: var(--display); }

/* cobro */
.due { display: flex; justify-content: space-between; align-items: flex-end; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.method { height: 64px; border-radius: var(--r); background: var(--bg-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: .9rem; color: var(--ink-2); transition: background 140ms, color 140ms, box-shadow 140ms; }
.method svg { width: 22px; height: 22px; }
.method.on { background: var(--brass-soft); color: var(--brass); box-shadow: inset 0 0 0 1.5px var(--brass); }
.amount-in { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 16px; border-radius: var(--r); background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); }
.amount-in.focus { box-shadow: inset 0 0 0 2px var(--brass); }
.amount-in .k { color: var(--ink-3); font-size: .9rem; }
.amount-in .v { font-family: var(--display); font-weight: 900; font-size: 1.8rem; }
.bills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bills button { height: 46px; border-radius: 12px; background: var(--bg-3); font-family: var(--display); font-weight: 800; }
.bills button:active { background: var(--line); }
.change { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: var(--r); background: var(--signal-soft); color: var(--signal); }
.change b { font-family: var(--display); font-size: 1.8rem; font-weight: 900; }
.change.short { background: var(--stop-soft); color: var(--stop); }

/* hecho */
.done { position: absolute; inset: 0; z-index: 60; background: var(--bg); display: grid; place-content: center; justify-items: center; gap: var(--s-lg); text-align: center; animation: fade 200ms both; }
.done .ring { width: 104px; height: 104px; border-radius: 50%; background: var(--signal-soft); color: var(--signal); display: grid; place-items: center; animation: pop 500ms var(--ease); }
.done .ring svg { width: 52px; height: 52px; stroke-width: 2.4; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 420ms 160ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { font-family: var(--display); font-weight: 900; font-size: 2.2rem; margin: 0; line-height: 1; }

/* tickets */
.tk { display: grid; grid-template-columns: 52px 1fr auto; gap: var(--s-md); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.tk:active { background: var(--bg-2); }
.tk .h { font-family: var(--display); font-weight: 700; color: var(--ink-3); font-size: .95rem; }
.tk .m b { font-weight: 700; display: block; }
.tk .m span { font-size: .82rem; color: var(--ink-3); }
.tk .t { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--bg-3); color: var(--ink-2); font-size: .74rem; font-weight: 700; margin-right: 4px; }
.tag.cash { color: var(--signal); }
.tag.card { color: var(--brass); }
.filters { display: grid; gap: 8px; margin-bottom: var(--s-sm); }
.totline { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s-sm) 0 var(--s-md); color: var(--ink-2); }
.totline b { font-family: var(--display); font-size: 1.3rem; color: var(--ink); }
.empty { padding: var(--s-3xl) 0; color: var(--ink-3); text-align: center; }
.empty b { display: block; color: var(--ink-2); font-family: var(--display); font-size: 1.2rem; margin-bottom: 4px; }

/* preticket en papel */
.paper { background: oklch(0.96 0.01 85); color: oklch(0.2 0.01 60); border-radius: 6px; padding: 20px 18px; font-family: 'Courier New', monospace; font-size: .86rem; line-height: 1.5; }
.paper h3 { text-align: center; margin: 0 0 2px; font-size: 1rem; }
.paper .c { text-align: center; }
.paper .r { display: flex; justify-content: space-between; gap: 8px; }
.paper hr { border: 0; border-top: 1px dashed currentColor; margin: 10px 0; opacity: .5; }
.paper .big { font-weight: 700; font-size: 1.05rem; }

/* resumen */
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: var(--s-sm); }
.range input { height: 44px; border-radius: 12px; border: 0; background: var(--bg-2); padding: 0 12px; width: 100%; }
.bar-split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; margin: var(--s-md) 0 var(--s-sm); }
.bar-split i { display: block; }
.legend { display: flex; gap: var(--s-lg); font-size: .85rem; color: var(--ink-2); flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--c); }
.export { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: var(--s-xl); }

/* formularios */
.field { display: grid; gap: 6px; }
.field input, .field textarea { border: 0; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); padding: 12px 14px; outline: none; resize: none; }
.field input:focus, .field textarea:focus { box-shadow: inset 0 0 0 2px var(--brass); }
.types-edit { display: grid; gap: 8px; }
.types-edit div { display: flex; gap: 8px; }
.types-edit input { flex: 1; }

.toast { position: absolute; left: var(--s-lg); right: var(--s-lg); top: calc(var(--safe-t) + 12px); z-index: 80; padding: 14px 16px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: 700; transform: translateY(-140%); transition: transform 320ms var(--ease); }
.toast.show { transform: none; }
.toast.err { background: var(--stop); color: oklch(0.98 0.01 30); }
.skeleton { height: 18px; border-radius: 6px; background: var(--bg-2); animation: pulse 1.4s infinite; margin: 14px 0; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: rot 700ms linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper { position: fixed; left: 0; top: 0; width: 80mm; background: #fff; color: #000; }
}

/* ajustes tras prueba en móvil */
.hero .state { justify-self: start; }
.sheet .keypad button { background: var(--bg-3); }
.sheet .keypad button.fn { background: none; }
.sheet .keypad button:active { background: var(--line); }
.dock .tot span, .dock .tot b { white-space: nowrap; }
.sheet .sh-b > .btn.go:last-child, .sheet .sh-b > #ok:last-child { position: sticky; bottom: 0; box-shadow: 0 -14px 14px var(--bg-2); }
.sheet .chip { background: var(--bg-3); }
.sheet .chip.on { background: var(--ink); color: var(--bg); }
.tag { font-style: normal; }
