/* Resto front-of-house apps: POS, waiter, kitchen, driver, terminal. Touch-first, dark. */
:root {
    --bg: #0d0f13; --panel: #15181e; --panel-2: #1c2028; --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
    --text: #f3f4f6; --muted: #9aa3b2; --accent: #FF5A2C; --accent-2: #ff7a45; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #38bdf8;
    --r: 14px; --font: "Plus Jakarta Sans", "Noto Sans Georgian", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,90,44,.5); border-color: var(--accent); }
[x-cloak] { display: none !important; }
.app { display: grid; grid-template-rows: 58px 1fr; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.03em; font-size: 18px; }
.brand img { width: 28px; height: 28px; }
.top .sp { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.chip.dot.off::before { background: var(--bad); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); font-weight: 700; transition: transform .08s, background .15s; user-select: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 10px 24px -12px rgba(255,90,44,.8); }
.btn.ok { background: var(--ok); border-color: transparent; color: #04120a; }
.btn.bad { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 16px 20px; font-size: 17px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.muted { color: var(--muted); }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { width: 6px; } .scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.badge.ok { background: rgba(34,197,94,.16); color: #86efac; } .badge.warn { background: rgba(245,158,11,.16); color: #fcd34d; } .badge.bad { background: rgba(239,68,68,.16); color: #fca5a5; } .badge.info { background: rgba(56,189,248,.15); color: #7dd3fc; }
.money { font-variant-numeric: tabular-nums; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; align-content: start; }
.tile { position: relative; min-height: 92px; padding: 12px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); text-align: left; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; transition: transform .08s; }
.tile:active { transform: scale(.97); }
.tile b { font-size: 14.5px; line-height: 1.25; }
.tile .p { font-weight: 800; color: var(--accent-2); }
.tile .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.tile.na { opacity: .35; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.tile > * { position: relative; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cats .chip { flex: none; }

/* cart */
.cart { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.cart-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cart-lines { flex: 1; min-height: 0; }
.line { display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: start; }
.line .q { font-weight: 800; color: var(--accent-2); }
.line small { display: block; color: var(--muted); font-size: 12.5px; }
.line.sent { opacity: .75; } .line.void { opacity: .35; text-decoration: line-through; } .line.held .q::after { content: " ⏸"; }
.line.sel { background: rgba(255,90,44,.08); }
.course-h { padding: 6px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: rgba(255,255,255,.02); }
.totals { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.totals .t { display: flex; justify-content: space-between; } .totals .grand { font-size: 22px; font-weight: 800; }
.cart-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 14px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; display: flex; flex-direction: column; box-shadow: 0 40px 80px -20px rgba(0,0,0,.7); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt { padding: 12px; border-radius: 12px; background: var(--panel-2); border: 2px solid transparent; text-align: left; }
.opt.on { border-color: var(--accent); background: rgba(255,90,44,.12); }
.opt small { display: block; color: var(--muted); }

/* keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { padding: 18px 0; font-size: 22px; font-weight: 700; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.keypad button:active { background: var(--line-2); }
.display { font-size: 34px; font-weight: 800; text-align: right; padding: 10px 14px; border-radius: 14px; background: #0a0c10; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { padding: 12px 16px; border-radius: 12px; background: #fff; color: #111; font-weight: 600; box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); animation: pop .2s ease; max-width: 360px; }
.toast.err { background: #fee2e2; color: #7f1d1d; } .toast.ok { background: #dcfce7; color: #14532d; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* floor */
.floor { position: relative; min-height: 100%; min-width: 600px; background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 22px 22px; }
.tbl { position: absolute; border-radius: 16px; background: var(--panel-2); border: 2px solid var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; transition: transform .1s; }
.tbl:active { transform: scale(.96); }
.tbl.round { border-radius: 50%; }
.tbl small { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tbl.busy { background: rgba(255,90,44,.16); border-color: var(--accent); }
.tbl.ready { background: rgba(34,197,94,.18); border-color: var(--ok); animation: pulse 1.6s infinite; }
.tbl.called { border-color: var(--info); animation: pulse 1s infinite; }
.tbl.res { border-style: dashed; border-color: var(--info); }
.tbl .tag { position: absolute; top: -9px; right: -6px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--ok); color: #04120a; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(34,197,94,.15); } }

/* kitchen */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; padding: 12px; align-content: start; }
.ticket { background: var(--panel); border-radius: 16px; border: 2px solid var(--line-2); display: flex; flex-direction: column; overflow: hidden; }
.ticket.warn { border-color: var(--warn); } .ticket.alert { border-color: var(--bad); animation: pulse-r 1.4s infinite; }
@keyframes pulse-r { 50% { box-shadow: 0 0 0 6px rgba(239,68,68,.2); } }
.ticket-h { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; background: var(--panel-2); }
.ticket-h b { font-size: 20px; }
.ticket-i { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; }
.ticket-i .q { font-size: 22px; font-weight: 800; min-width: 28px; }
.ticket-i b { font-size: 17px; }
.ticket-i small { display: block; color: var(--warn); font-size: 13.5px; }
.ticket-i.preparing { background: rgba(245,158,11,.1); } .ticket-i.ready { background: rgba(34,197,94,.12); text-decoration: line-through; opacity: .7; }

/* pin */
.pin-wrap { height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 20% 0%, rgba(255,90,44,.18), transparent 60%), var(--bg); padding: 16px; }
.pin-card { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; align-content: start; max-height: 70vh; overflow-y: auto; }
.person { padding: 16px 10px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); text-align: center; }
.person.on { border-color: var(--accent); }
.avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 8px; font-weight: 800; font-size: 20px; color: #fff; }
.dots { display: flex; gap: 12px; justify-content: center; margin: 14px 0 18px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); }
.dots i.on { background: var(--accent); border-color: var(--accent); }
.shake { animation: shake .3s; } @keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

@media (max-width: 900px) {
    .pin-card { grid-template-columns: 1fr; }
    .people { max-height: 30vh; }
    html, body { font-size: 14px; }
}

/* POS / waiter layout */
.pos { display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.menu-pane { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; min-height: 0; }
.menu-pane .tiles { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px; }
.search { max-width: 260px; }
.mobile-tabs { display: none; }
.split-q { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); width: 100%; text-align: left; }
.list-row + .list-row { margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.offline-bar { background: var(--warn); color: #1a1200; text-align: center; font-weight: 700; padding: 6px; font-size: 13px; }
.drv { background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 900px) {
    .pos { grid-template-columns: 1fr; grid-template-rows: 1fr; }
    .pos .menu-pane, .pos .cart { display: none; }
    .pos.show-menu .menu-pane, .pos.show-cart .cart { display: flex; }
    .cart { border-left: 0; }
    .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line); }
    .app.has-tabs { grid-template-rows: 58px 1fr auto; }
    .top .hide-sm { display: none; }
    .search { max-width: none; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .grid2 { grid-template-columns: 1fr; }
}
a.chip, a.btn { color: inherit; text-decoration: none; }
.cart-actions .btn { padding: 12px 8px; font-size: 14px; white-space: nowrap; }
/* phones: the floor plan becomes a simple grid of tables */
@media (max-width: 700px) {
    .floor { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; min-width: 0; min-height: 0; height: auto !important; align-content: start; background: none; }
    .floor .tbl { position: relative; left: auto !important; top: auto !important; width: auto !important; height: 96px !important; border-radius: 16px; }
}
@media (max-width: 900px) {
    .cart .row { flex-wrap: wrap; }
    .top { overflow-x: auto; }
    .demo-badge { display: none; }
}
