/* CartaNova staff apps: kitchen screen (body.k) and waiter app (body.w). Dark, high contrast, big touch targets. */
:root {
  --bg: #0f1215; --panel: #181d22; --panel-2: #20262c; --line: #2c343c; --text: #eef1f4; --muted: #95a1ad;
  --card: #fbfaf7; --ink: #1b1f23; --ink-2: #5d6670;
  --new: #e5484d; --prep: #f5a524; --ready: #30a46c; --info: #3e8ef7; --note: #fff3c4; --note-ink: #6b4b00;
  --r: 14px; --fs: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 400 var(--fs)/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; transition: transform .12s, background .15s, border-color .15s; }
.btn:hover { border-color: #3d4752; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--info); border-color: var(--info); color: #fff; }
.btn.go { background: var(--ready); border-color: var(--ready); color: #fff; }
.btn.warn { background: var(--prep); border-color: var(--prep); color: #1b1300; }
.btn.danger { background: transparent; border-color: #5a2a2c; color: #ff8c8f; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }

/* ---------- gate (restaurant + PIN) ---------- */
.gate { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.gate h1 { font-size: 24px; font-weight: 700; }
.gate p { color: var(--muted); max-width: 34ch; }
.g-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #fff; margin-bottom: 6px; }
.g-role { font-weight: 600; color: var(--text) !important; }
.g-err { min-height: 22px; color: #ff8c8f !important; font-weight: 600; }
.dots { display: flex; gap: 14px; margin: 18px 0 2px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; margin-top: 12px; }
.pad button { height: 76px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); font-size: 28px; font-weight: 500; transition: background .12s, transform .1s; }
.pad button:active { background: #2e3740; transform: scale(.94); }
.pad .ok { background: var(--info); border-color: var(--info); color: #fff; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px); opacity: 0; max-width: calc(100% - 32px); padding: 13px 20px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 10px 30px rgb(0 0 0 / .4); transition: .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--ready); color: #fff; }
.toast.bad { background: var(--new); color: #fff; }

.tap-start { position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgb(10 12 14 / .92); text-align: center; padding: 24px; backdrop-filter: blur(6px); }
.tap-start b { font-size: 26px; }
.tap-start span { color: var(--muted); }

.net { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.net::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ready); box-shadow: 0 0 0 3px rgb(48 164 108 / .25); }
.net.off { color: #ff8c8f; }
.net.off::before { background: var(--new); box-shadow: 0 0 0 3px rgb(229 72 77 / .25); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ================= KITCHEN ================= */
.k { overflow: hidden; }
.k-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.k-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-right: auto; min-width: 0; }
.k-brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; object-fit: cover; }
.k-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-clock { font: 700 20px/1 ui-monospace, 'SF Mono', Consolas, monospace; letter-spacing: .02em; }
.k-open { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; font-size: 14px; }
.k-open i { width: 42px; height: 24px; border-radius: 99px; background: #3a434c; position: relative; transition: background .2s; flex: none; }
.k-open i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.k-open.on { border-color: rgb(48 164 108 / .6); }
.k-open.on i { background: var(--ready); }
.k-open.on i::after { transform: translateX(18px); }
.k-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.k-tools .btn { min-height: 44px; min-width: 44px; padding: 0 12px; }
.k-tools select { height: 44px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); padding: 0 8px; max-width: 170px; }

.k-main { display: flex; height: calc(100dvh - 65px); }
.board { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px; min-width: 0; }
.col { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: 16px; border: 1px solid var(--line); }
.col h2 { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
.col h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.col h2 b { margin-left: auto; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 99px; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 14px; }
.col[data-s="new"] { --c: var(--new); } .col[data-s="prep"] { --c: var(--prep); } .col[data-s="ready"] { --c: var(--ready); }
.col[data-s="prep"] h2 b { color: #1b1300; }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px 12px; display: grid; align-content: start; gap: 10px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; }

.tk { background: var(--card); color: var(--ink); border-radius: var(--r); overflow: hidden; border-top: 6px solid var(--c, var(--new)); box-shadow: 0 6px 18px rgb(0 0 0 / .25); animation: pop .35s ease-out; }
.tk[data-s="prep"] { --c: var(--prep); } .tk[data-s="ready"] { --c: var(--ready); }
.tk.fresh { box-shadow: 0 0 0 3px var(--new), 0 6px 18px rgb(0 0 0 / .25); animation: pop .35s ease-out, pulse 1.6s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgb(229 72 77 / .35), 0 6px 18px rgb(0 0 0 / .25); } }
.tk-h { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 8px; border-bottom: 1px dashed #d9d4cb; }
.tk-t { min-width: 0; overflow-wrap: anywhere; font-size: calc(var(--fs) * 1.9); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.tk-t small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 3px; }
.tk-meta { margin-left: auto; text-align: right; font-size: 13px; color: var(--ink-2); display: grid; gap: 3px; justify-items: end; }
.tk-num { font-weight: 800; color: var(--ink); font-size: 15px; }
.tk-src { display: inline-flex; gap: 5px; align-items: center; padding: 2px 8px; border-radius: 99px; background: #eceae4; font-weight: 600; font-size: 12px; color: var(--ink); }
.tk-src.cli { background: #e3eefe; color: #0b4fae; }
.timer { font: 700 14px/1 ui-monospace, Consolas, monospace; padding: 4px 8px; border-radius: 8px; background: #e6f4ec; color: #1d6b45; }
.timer.mid { background: #fdf0d6; color: #8a5a00; }
.timer.late { background: #fde2e3; color: #b4232a; animation: blink 1.2s infinite; }
.tk-b { padding: 6px 6px 8px; }
.seat { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding: 8px 8px 3px; }
.ln { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 7px 8px; border-radius: 10px; font-size: var(--fs); line-height: 1.3; }
button.ln:hover { background: #f1eee7; }
.ln b { min-width: 30px; font-size: calc(var(--fs) * 1.1); }
.ln span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.ln em { display: block; font-style: normal; font-weight: 700; font-size: .85em; margin-top: 3px; padding: 2px 7px; border-radius: 6px; background: var(--note); color: var(--note-ink); width: fit-content; }
.ln.done { opacity: .45; }
.ln.done span, .ln.done b { text-decoration: line-through; text-decoration-thickness: 2px; }
.ln.done::after { content: "✓"; color: var(--ready); font-weight: 900; }
.tk-note { margin: 4px 10px 8px; padding: 8px 10px; border-radius: 10px; background: var(--note); color: var(--note-ink); font-weight: 700; font-size: .92em; }
.tk-f { display: flex; gap: 8px; padding: 10px; background: #f3f1ec; }
.tk-f .btn { flex: 1; min-height: 52px; font-size: 16px; border: 0; }
.tk-f .btn.x { flex: 0 0 52px; background: #fde2e3; color: #b4232a; }
.tk-f .btn.acc { background: var(--prep); color: #1b1300; }
.tk-f .btn.rdy { background: var(--ready); color: #fff; }
.tk-f .btn.srv { background: #2c343c; color: #fff; }

.side { width: 280px; flex: none; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side h3 { padding: 14px 16px 6px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.side .hint { padding: 0 16px 8px; font-size: 12.5px; color: var(--muted); }
.agg { flex: 1; overflow-y: auto; padding: 4px 10px 14px; display: grid; align-content: start; gap: 4px; }
.agg div { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--panel-2); }
.agg b { font-size: 20px; min-width: 34px; color: var(--prep); }
.agg span { font-weight: 600; }

.drawer { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgb(0 0 0 / .5); }
.drawer > div { width: min(460px, 100%); height: 100%; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 18px; margin-right: auto; }
.drawer .body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: grid; align-content: start; gap: 8px; }
.hrow { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--panel-2); }
.hrow .t { font-weight: 800; font-size: 18px; min-width: 64px; }
.hrow .d { flex: 1; font-size: 13.5px; color: var(--muted); }
.hrow .d b { color: var(--text); }
.hrow .s { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #2c343c; }
.hrow .s.cancelled { background: #4a2124; color: #ffb3b5; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 6px; }
.stats div { padding: 12px; border-radius: 12px; background: var(--panel-2); }
.stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1100px) { .side { display: none; } .side.show { display: flex; position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: -10px 0 30px rgb(0 0 0 / .4); } }
@media (max-width: 760px) {
  .k { overflow: auto; }
  .k-main { height: auto; min-height: calc(100dvh - 120px); }
  .board { grid-template-columns: 1fr; }
  .col { max-height: none; }
  .k-tools .lbl { display: none; }
}

/* ================= WAITER ================= */
.w { padding-bottom: env(safe-area-inset-bottom); }
.w-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: rgb(15 18 21 / .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.w-top h1 { font-size: 18px; font-weight: 700; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-top .back { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-size: 20px; }
.w-who { font-size: 13px; color: var(--muted); }
.wrap { padding: 14px; max-width: 760px; margin: 0 auto; }
.sec-t { display: flex; align-items: center; gap: 8px; margin: 18px 2px 10px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ready-list { display: grid; gap: 8px; }
.ready-it { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 14px; background: rgb(48 164 108 / .14); border: 1px solid rgb(48 164 108 / .5); animation: pop .3s; }
.ready-it b { font-size: 18px; }
.ready-it span { flex: 1; font-size: 13.5px; color: #b7e4cb; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.tb { position: relative; aspect-ratio: 1; min-width: 0; overflow-wrap: anywhere; text-align: center; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; place-content: center; justify-items: center; gap: 2px; font-size: 24px; font-weight: 800; transition: transform .1s; }
.tb:active { transform: scale(.95); }
.tb small { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.tb.busy { border-color: var(--prep); background: rgb(245 165 36 / .1); }
.tb.busy small { color: var(--prep); }
.tb.ready { border-color: var(--ready); background: rgb(48 164 108 / .16); animation: glow 1.6s infinite; }
.tb.ready small { color: #7fd8a7; }
.tb.served { border-color: #3e4a56; background: var(--panel-2); }
.tb.served small { color: var(--text); }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgb(48 164 108 / .3); } }
.other { display: flex; gap: 8px; margin-top: 12px; }
.other input { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; }

.seats { position: sticky; top: 65px; z-index: 15; display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.seats::-webkit-scrollbar { display: none; }
.seats button { flex: none; min-width: 52px; height: 44px; padding: 0 14px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 700; }
.seats button.on { background: var(--info); border-color: var(--info); color: #fff; }
.seats button i { font-style: normal; margin-left: 6px; font-size: 12px; opacity: .8; }
.guests { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.guests span { flex: 1; font-weight: 600; }
.step { display: flex; align-items: center; gap: 4px; }
.step button { width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.step b { min-width: 30px; text-align: center; font-size: 18px; }

.draft { display: grid; gap: 4px; }
.dg { padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.dg h4 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.dl { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.dl:first-of-type { border-top: 0; }
.dl .nm { flex: 1; min-width: 0; }
.dl .nm b { display: block; font-weight: 600; }
.dl .nm em { display: block; font-style: normal; font-size: 12.5px; color: var(--note); margin: 2px 0; }
.dl .nm button { font-size: 12.5px; color: var(--info); padding: 2px 0; }
.dl .step button { width: 38px; height: 38px; font-size: 18px; }

.menu-b { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
.menu-b .w-top { position: static; }
.mb-search { padding: 10px 14px 0; }
.mb-search input { width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; }
.mb-cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; scrollbar-width: none; }
.mb-cats::-webkit-scrollbar { display: none; }
.mb-cats button { flex: none; height: 40px; padding: 0 14px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.mb-cats button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.mb-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 120px; display: grid; align-content: start; gap: 8px; }
.di { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-height: 60px; transition: transform .08s, border-color .15s; }
.di:active { transform: scale(.98); }
.di span { flex: 1; font-weight: 600; }
.di small { color: var(--muted); font-weight: 500; }
.di b.q { min-width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; background: var(--info); color: #fff; font-size: 15px; }
.di.off { opacity: .45; pointer-events: none; }
.di.off small::after { content: " · Agotado"; color: #ff8c8f; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; }
.bar .btn { flex: 1; min-height: 56px; font-size: 17px; }

.sent { display: grid; gap: 8px; }
.st { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--c); }
.st[data-s="new"] { --c: var(--new); } .st[data-s="prep"] { --c: var(--prep); } .st[data-s="ready"] { --c: var(--ready); } .st[data-s="served"] { --c: #4b5865; }
.st header { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.st header b { color: var(--text); font-size: 15px; }
.st header .pill { margin-left: auto; padding: 3px 10px; border-radius: 99px; background: var(--c); color: #fff; font-weight: 700; font-size: 12px; }
.st[data-s="prep"] header .pill { color: #1b1300; }
.st ul { list-style: none; margin-top: 6px; font-size: 14px; display: grid; gap: 2px; }
.st li i { font-style: normal; color: var(--muted); font-size: 12px; }
.st .act { display: flex; gap: 8px; margin-top: 10px; }

.sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / .55); }
.sheet > div { width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
.sheet h2 { font-size: 20px; margin-bottom: 12px; }
.sheet label { display: grid; gap: 6px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.sheet input, .sheet textarea { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 14px; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips button { height: 38px; padding: 0 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; }
.chips button.on { background: var(--info); border-color: var(--info); color: #fff; }
.bill { display: grid; gap: 10px; }
.bill .bs { padding: 12px; border-radius: 12px; background: var(--panel-2); }
.bill .bs h4 { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 4px; }
.bill .bs div { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; }
.bill .tot { font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; padding: 14px 4px 4px; font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
