/*
 * ONE theme for every restaurant and every screen (guest, billing counter, kitchen, owner, manager). These are the platform's own colours: a restaurant cannot recolour them,
 * and no role has an accent of its own. To change the look, change the tokens here and nowhere else. (Status colours ok / warn / bad / info are meanings, not theme.)
 * The only thing a role changes is the kitchen's dark SURFACE (a kitchen display is read from across a room); it keeps the same brand accent.
 */
:root {
  --accent: #c2410c; --accent-ink: #fff; --accent-soft: #ffedd5;
  --brand-dark: #2b1a12; --brand-dark-2: #4a2e21; --brand-dark-line: #6b4a3a; --brand-dark-ink: #d9c6bb; /* the dark header / side bar on every staff screen */
  --bg: #f6f2ec; --card: #fff; --ink: #1d1b18; --mute: #6b6558; --line: #e6dfd3; --line-strong: #cfc6b6;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 1px 2px rgba(29,27,24,.06), 0 4px 14px rgba(29,27,24,.06);
  --gutter: 16px; --tap: 46px; --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: ui-monospace, Consolas, monospace;
}
body[data-role='kitchen'] { --bg: #14171c; --card: #1e232b; --ink: #f2efe9; --mute: #9aa3b0; --line: #2b323d; --line-strong: #3a4350; --accent: #c2410c; --accent-ink: #fff; --accent-soft: #3a1a0c; --ok-soft: #12351f; --warn-soft: #3a2a08; --bad-soft: #3d1717; --info-soft: #14284d; --shadow: none; }

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--ink); overflow-x: hidden; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0; } h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 8px; } a { color: var(--accent); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; /* 16px stops iOS zooming into fields */ min-height: var(--tap); width: 100%; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); }
/* tick boxes and radio buttons keep their own size (the label next to them is the tap target), instead of stretching like text fields */
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); }
/* a tick box with its label: the label wraps on a narrow screen, the box stays at the start of its first line */
label.tick { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 14px; } label.tick input { margin-top: 1px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.muted { color: var(--mute); } .small { font-size: 12.5px; } .b { font-weight: 700; } .r { text-align: right; } .nowrap { white-space: nowrap; } .mono { font-family: var(--mono); overflow-wrap: anywhere; }
.stack { display: grid; gap: 10px; } .stack.lg { gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; } .grow { flex: 1 1 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 8px 16px; border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover:not(:disabled) { border-color: var(--ink); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; } .btn.lg { min-height: 54px; font-size: 17px; width: 100%; } .btn.sm { min-height: 36px; padding: 4px 10px; font-size: 13px; } .btn.block { width: 100%; }
.icon-btn { width: var(--tap); height: var(--tap); border: 0; background: transparent; border-radius: 50%; font-size: 18px; cursor: pointer; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card > h2:first-child, .card-h { margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed='true'], .chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--ink); white-space: nowrap; }
.badge.s-submitted, .badge.s-kitchen_received, .badge.s-new, .badge.s-pending, .badge.s-initiated { background: var(--warn-soft); color: var(--warn); }
.badge.s-accepted, .badge.s-preparing, .badge.s-food_preparing { background: #ffe4cc; color: #9a3412; }
.badge.s-ready, .badge.s-served, .badge.s-success, .badge.s-paid, .badge.s-succeeded { background: var(--ok-soft); color: var(--ok); }
.badge.s-bill_generated, .badge.s-payment_pending, .badge.s-open, .badge.s-occupied { background: var(--info-soft); color: var(--info); }
.badge.s-failed, .badge.s-rejected, .badge.s-cancelled, .badge.s-refunded { background: var(--bad-soft); color: var(--bad); }
body[data-role='kitchen'] .badge.s-accepted, body[data-role='kitchen'] .badge.s-preparing { background: #4a2a0a; color: #fdba74; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; } .kv.total { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 17px; }
.kv.sub { color: var(--mute); font-size: 13.5px; padding-left: 12px; } .kv .v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kv .v.wrap { white-space: normal; text-align: left; overflow-wrap: anywhere; } /* a value that can be a long URL/id, not a short number: let it wrap instead of overflow */
.divider { border: 0; border-top: 1px dashed var(--line-strong); margin: 10px 0; }
.avail-row { display: flex; align-items: center; gap: 6px; flex: none; }
.avail-sw { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.avail-sw button { border: 0; background: transparent; padding: 5px 10px; min-height: 32px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--mute); }
.avail-sw button.yes[aria-pressed='true'] { background: var(--ok-soft, #dcfce7); color: var(--ok, #15803d); } .avail-sw button.no[aria-pressed='true'] { background: var(--bad-soft, #fee2e2); color: var(--bad, #b91c1c); }
.avail-sw button:disabled { cursor: default; opacity: .6; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button { min-height: 40px; border: 0; border-radius: 7px; background: transparent; font-weight: 600; cursor: pointer; padding: 4px 6px; font-size: 14px; }
.seg button[aria-pressed='true'] { background: var(--card); box-shadow: var(--shadow); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; } table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; } table.data td.r, table.data th.r { text-align: right; } table.data tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.skeleton { height: 64px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 50%, white) 50%, var(--line) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 28px 12px; color: var(--mute); } .empty-icon { font-size: 30px; opacity: .4; }
.errorbox { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 12px 14px; } .errorbox p { margin: 4px 0 8px; }
.form-error { color: var(--bad); min-height: 1.3em; font-size: 14px; margin: 8px 0 0; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mute); } .conn i { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); } .conn[data-state='live'] i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); } .conn[data-state='polling'] i { background: var(--info); }
.toasts { position: fixed; z-index: 300; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); display: grid; gap: 8px; justify-items: center; pointer-events: none; padding-inline: 12px; }
.toast { pointer-events: auto; background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 99px; font-weight: 600; box-shadow: var(--shadow); max-width: min(92vw, 460px); } .toast.error { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; text-transform: uppercase; letter-spacing: .03em; }
.veg { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ok); border-radius: 3px; position: relative; flex: none; } .veg::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--ok); } .veg.nv { border-color: var(--bad); } .veg.nv::after { background: var(--bad); }

/* sheets: bottom sheet on phones, dialog on larger screens; never taller than the screen */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(20,18,15,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-height: 92dvh; background: var(--card); color: var(--ink); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; padding-bottom: env(safe-area-inset-bottom, 0px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); flex: none; } .sheet-body { padding: 16px 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
@media (min-width: 768px) { .overlay { align-items: center; padding: 24px; } .sheet { width: min(520px, 100%); border-radius: var(--radius); max-height: 88dvh; } .sheet.wide { width: min(880px, 100%); } }

/* login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; } .login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; } .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.demo-hint { margin-top: 18px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); } .demo-hint p { margin: 2px 0 8px; font-size: 13px; }

/* status stepper (customer) */
.steps { display: flex; gap: 4px; margin: 8px 0 2px; } .steps span { flex: 1; text-align: center; font-size: 10.5px; font-weight: 700; padding-top: 6px; border-top: 4px solid var(--line-strong); color: var(--mute); text-transform: uppercase; letter-spacing: .02em; } .steps span.done { border-color: var(--ok); color: var(--ok); } .steps span.now { border-color: var(--accent); color: var(--accent); }

/* charts */
.chart { width: 100%; height: auto; display: block; } .chart text { font: 11px var(--font); fill: var(--mute); } .chart .bar { fill: var(--accent); } .chart .bar2 { fill: var(--line-strong); } .chart .grid { stroke: var(--line); } .chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--mute); flex-wrap: wrap; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--accent); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); } .kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; } .kpi .n { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; } .kpi .l { color: var(--mute); font-size: 12.5px; font-weight: 600; } .kpi .d { font-size: 12.5px; font-weight: 700; } .up { color: var(--ok); } .down { color: var(--bad); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, 1fr); } } @media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
@media print { body { background: #fff; } .no-print { display: none !important; } .overlay { position: static; background: none; } .sheet { max-height: none; } }

/* the restaurant's own logo picture, in place of the first-letter badge */
img.logo { object-fit: cover; background: #fff; border: 1px solid var(--line); }
