/* Choice brand tokens (docs/brand-guide.html §08), carried over from the prototype:
   light Alabaster and dark Obsidian themes, ember accent. Channels are "r g b" for alpha.
   Everything visual below reads these tokens; a UI direction (static/themes/, served as
   /theme.css) only overrides them, so a new look never touches the page markup or rules. */
:root {
  --bg: 247 244 239; --card: 255 253 250; --raised: 237 232 224; --line: 226 220 210; --line2: 211 204 192;
  --fg: 18 17 16; --fg2: 74 70 64; --muted: 110 106 99;
  --ember: 255 90 38; --onember: 18 17 16; --accent: 194 65 12; --accent-soft: 253 228 216; --credit: 212 255 51;
  --ok: 26 122 74; --ok-soft: 227 242 233; --bad: 197 48 48; --bad-soft: 251 230 228; --warn: 154 100 8; --warn-soft: 251 240 220;
  --shadow: 40 30 20;
  --font-latin: "Plus Jakarta Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r-lg: 16px; --r-md: 14px; --r-sm: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: 13 12 11; --card: 23 22 20; --raised: 31 29 27; --line: 41 39 36; --line2: 58 54 50;
    --fg: 243 239 232; --fg2: 201 196 187; --muted: 158 154 147;
    --accent: 255 112 66; --accent-soft: 48 24 14;
    --ok: 16 185 129; --ok-soft: 14 40 30; --bad: 255 107 94; --bad-soft: 52 22 19; --warn: 242 181 68; --warn-soft: 44 34 14;
    --shadow: 0 0 0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: 13 12 11; --card: 23 22 20; --raised: 31 29 27; --line: 41 39 36; --line2: 58 54 50;
  --fg: 243 239 232; --fg2: 201 196 187; --muted: 158 154 147;
  --accent: 255 112 66; --accent-soft: 48 24 14;
  --ok: 16 185 129; --ok-soft: 14 40 30; --bad: 255 107 94; --bad-soft: 52 22 19; --warn: 242 181 68; --warn-soft: 44 34 14;
  --shadow: 0 0 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: rgb(var(--bg)); color: rgb(var(--fg)); }
body { font: 15px/1.5 var(--font-latin); -webkit-font-smoothing: antialiased; }
[dir="rtl"] body, [dir="rtl"] { font-family: var(--font-ar); }
[dir="rtl"] * { letter-spacing: 0 !important; }
.latin { font-family: var(--font-latin); }
.mono { font-family: var(--font-mono); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 .5em; }
a { color: rgb(var(--accent)); }
:focus-visible { outline: 2px solid rgb(var(--ember)); outline-offset: 2px; }
.muted { color: rgb(var(--muted)); }
.small { font-size: 13px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; color: rgb(var(--muted)); margin: 0 0 .5em; }
[dir="rtl"] .eyebrow { font-family: var(--font-ar); font-size: 12px; text-transform: none; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.center { text-align: center; }

.page { max-width: 560px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)) 140px; }
.page.narrow { padding-bottom: 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.wordmark { direction: ltr; unicode-bidi: isolate; font: 800 22px/1 var(--font-latin); letter-spacing: -0.04em; color: rgb(var(--fg)); text-decoration: none; }
.wordmark span { color: rgb(var(--ember)); }
/* The app icon (static/brand/mark.svg, the "c." avatar) in front of every wordmark. */
.wordmark { display: inline-flex; align-items: center; }
.wordmark::before { content: ""; flex: none; width: 1.3em; height: 1.3em; margin-inline-end: .4em; border-radius: .3em;
  background: url("/static/brand/mark.svg") center / contain no-repeat; box-shadow: 0 0 0 1px rgb(var(--line2)); }

/* Home (choice-ksa.com): the brand line, centred on the page. */
.home .page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.home .topbar { padding: 20px 0; }
.home .card { margin: auto 0; padding: 32px 24px; }
.home h1 { font-size: clamp(32px, 9vw, 46px); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: .45em; }
.home h1 em { font-style: normal; color: rgb(var(--accent)); }
.home .card p { font-size: 17px; margin: 0; }
.chip { display: inline-block; padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid rgb(var(--line2)); color: rgb(var(--fg)); text-decoration: none; font-size: 13px; }
.card { background: rgb(var(--card)); border: 1px solid rgb(var(--line)); border-radius: var(--r-lg); padding: 16px; margin: 0 0 14px;
  box-shadow: 0 1px 2px rgb(var(--shadow) / .05), 0 6px 20px -8px rgb(var(--shadow) / .14); }
.banner { padding: 10px 14px; border-radius: var(--r-sm); background: rgb(var(--raised)); margin: 0 0 12px; }
.banner.bad { background: rgb(var(--bad-soft)); color: rgb(var(--bad)); }
.banner.warn { background: rgb(var(--warn-soft)); color: rgb(var(--warn)); }
.banner.offline { background: rgb(var(--warn-soft)); color: rgb(var(--warn)); border: 2px solid rgb(var(--warn)); position: sticky; top: 0; z-index: 2; }
.btn.queued, button.queued { opacity: .6; outline: 2px dashed rgb(var(--warn)); outline-offset: 2px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 8px; background: rgb(var(--raised)); color: rgb(var(--fg2)); }
.tag.ad { font-weight: 700; color: rgb(var(--fg)); border: 1px solid rgb(var(--line2)); background: transparent; }
.tag.via { background: rgb(var(--accent-soft)); color: rgb(var(--accent)); }
.tag.bad { background: transparent; color: rgb(var(--bad)); border: 1px solid rgb(var(--bad)); }
.tag.good { background: rgb(var(--ok-soft)); color: rgb(var(--ok)); }

.btn { appearance: none; border: 1px solid rgb(var(--line2)); background: rgb(var(--card)); color: rgb(var(--fg)); border-radius: var(--r-md);
  padding: 12px 18px; font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; transition: transform 140ms var(--ease); }
.btn:active { transform: scale(.97); }
.btn.primary { background: rgb(var(--ember)); border-color: rgb(var(--ember)); color: rgb(var(--onember)); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn { display: inline-block; text-decoration: none; }

/* Landing */
.creator { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 14px; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #2F7A60, #174C3C); }
.creator-line { margin: 0; font-size: 14px; }
.hook { margin: 2px 0 0; font-size: 15px; color: rgb(var(--fg2)); }
.venue { font-size: 26px; margin-top: 4px; }
.venue .muted { font-weight: 600; font-size: 18px; }
.disclosure { font-size: 12px; color: rgb(var(--muted)); border-inline-start: 3px solid rgb(var(--ember)); padding-inline-start: 8px; margin: 6px 0 14px; }
.pinned { padding: 0; overflow: hidden; }
.dish-art { height: 150px; background:
  radial-gradient(circle at 50% 60%, #c7772f 0 28%, transparent 29%),
  radial-gradient(circle at 50% 48%, #e9b45c 0 33%, transparent 34%),
  linear-gradient(135deg, #5a3a26, #2b1c13); }
.dish-photo { display: block; width: 100%; height: 190px; object-fit: cover; }
.dish-thumb { flex: none; width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); }
img.avatar { object-fit: cover; background: rgb(var(--line)); }
.menu-item-text { flex: 1; min-width: 0; }
.pinned-body { padding: 14px 16px 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.price { font-weight: 700; }
.perk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgb(var(--accent-soft)); color: rgb(var(--accent));
  padding: 10px 14px; border-radius: var(--r-sm); margin: 0 0 18px; font-size: 14px; }
.perk .muted { color: inherit; opacity: .8; }
.perk-dot { width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--ember)); }
.menu-section { margin: 0 0 18px; }
.menu-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgb(var(--line)); }
.item-name { font-weight: 600; margin: 0; }
.menu-item .small { margin: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid rgb(var(--line2)); border-radius: var(--r-sm); overflow: hidden; flex: none; }
.stepper input { width: 40px; text-align: center; border: 0; background: transparent; color: inherit; font: 700 15px var(--font-latin); -moz-appearance: textfield; padding: 8px 0; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.step { appearance: none; border: 0; background: rgb(var(--raised)); color: rgb(var(--fg)); width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.stepper.sold-out { border: 0; }
.checkout fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.checkout legend { font-weight: 600; margin-bottom: 8px; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }
.mode { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgb(var(--line2)); border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; }
.mode:has(input:checked) { border-color: rgb(var(--ember)); background: rgb(var(--accent-soft)); }
fieldset.choices { border: 0; padding: 0; margin: 8px 0 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.choices legend { padding: 0; margin-bottom: 4px; width: 100%; }
.choice { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgb(var(--line2)); border-radius: var(--r-sm); padding: 6px 10px; font-size: 14px; cursor: pointer; }
.choice:has(input:checked) { border-color: rgb(var(--ember)); background: rgb(var(--accent-soft)); }
.fields { display: grid; gap: 10px; margin: 0 0 10px; }
.fields label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.fields input { font: 16px var(--font-latin); padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid rgb(var(--line2)); background: rgb(var(--bg)); color: inherit; }
.hint { font-weight: 400; color: rgb(var(--muted)); }
/* Only show the fields for the chosen mode where :has() is supported; otherwise all stay visible. */
@supports selector(:has(*)) {
  .checkout:not(:has(#mode-car:checked)) .car-fields { display: none; }
  .checkout:not(:has(#mode-dine:checked)) .dine-fields { display: none; }
}
.paybar { position: fixed; inset: auto 0 0 0; padding: 12px max(16px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom));
  background: rgb(var(--card) / .96); border-top: 1px solid rgb(var(--line)); box-shadow: 0 -8px 24px -12px rgb(var(--shadow) / .22); text-align: center; }
.paybar .btn { width: 100%; max-width: 528px; font-size: 17px; padding: 16px; }
.paybar p { margin: 6px 0 0; }

/* Pass */
.pass .status-label { font-size: 26px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 14px 0; font-size: 12px; }
.steps li { border-top: 4px solid rgb(var(--line2)); padding-top: 6px; color: rgb(var(--muted)); }
.steps li.done { border-color: rgb(var(--ember)); color: rgb(var(--fg)); }
.steps li.current { font-weight: 700; }
.code { text-align: center; background: rgb(var(--raised)); border-radius: var(--r-md); padding: 14px; }
.code-digits { font-size: 48px; letter-spacing: .2em; margin: 0; font-weight: 500; }
.status-ready .code { background: rgb(var(--ok-soft)); }
.status-ready .status-label { color: rgb(var(--ok)); }
.lines { list-style: none; padding: 0; margin: 0 0 10px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed rgb(var(--line)); }
.perk-line { color: rgb(var(--accent)); }
.totals { margin: 0; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals dt, .totals dd { margin: 0; }
.totals .grand { font-weight: 800; font-size: 17px; }
.links li { margin: 4px 0; }
.earned { font-size: 40px; color: rgb(var(--ok)); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: start; padding: 8px 4px; border-bottom: 1px solid rgb(var(--line)); vertical-align: top; }

/* Venue board: a tablet on the counter */
.board-body { background: rgb(var(--bg)); }
.board-page { padding: 0 16px 24px; }
.board-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; position: sticky; top: 0; background: rgb(var(--bg)); z-index: 2; }
.board-venue { margin-inline-start: 10px; font-size: 18px; }
.board-actions { display: flex; gap: 8px; align-items: center; }
.complete-form { display: flex; gap: 8px; }
.complete-form input { width: 9ch; font: 500 22px var(--font-mono); text-align: center; letter-spacing: .2em; padding: 8px; border-radius: var(--r-sm); border: 2px solid rgb(var(--line2)); background: rgb(var(--card)); color: inherit; }
.pin-field { display: flex; flex-direction: column; gap: 2px; }
.pin-field input, .ticket .pin-input { width: 8ch; font: 500 18px var(--font-mono); text-align: center; padding: 6px; border-radius: 10px; border: 2px solid rgb(var(--line2)); background: rgb(var(--card)); color: inherit; }
.pin-input[hidden] { display: none; }
#sound.on { background: rgb(var(--ok-soft)); border-color: rgb(var(--ok)); color: rgb(var(--ok)); }
.columns { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.column .count { display: inline-block; min-width: 1.6em; text-align: center; border-radius: 8px; background: rgb(var(--raised)); padding: 0 4px; }
.ticket { background: rgb(var(--card)); border: 1px solid rgb(var(--line)); border-radius: var(--r-lg); padding: 12px 14px; margin: 0 0 10px; }
.ticket header { display: flex; justify-content: space-between; align-items: baseline; }
.ticket .num { font-size: 22px; }
.ticket .guest { margin: 4px 0; font-weight: 600; }
.ticket .note { margin: 6px 0; padding: 6px 10px; border-radius: var(--r-sm); background: rgb(var(--warn-soft)); color: rgb(var(--warn)); font-weight: 600; }
.ticket .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket.is-new { border: 2px solid rgb(var(--ember)); animation: pulse 1.4s ease-out infinite; }
.ticket.status-ready { border-color: rgb(var(--ok)); }
.ticket.status-completed, .ticket.status-declined, .ticket.status-cancelled, .ticket.status-no_show { opacity: .6; }
.ticket-actions { display: flex; gap: 8px; }
.ticket-actions form { flex: 1; }
.ticket-actions .btn { width: 100%; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,90,38,.55); } 100% { box-shadow: 0 0 0 14px rgba(255,90,38,0); } }
@media (prefers-reduced-motion: reduce) { .ticket.is-new { animation: none; } }
.lines strong, .lines li > span:last-child { white-space: nowrap; }
.btn.wide { width: 100%; margin: 0 0 8px; padding: 15px; }
.pay-options { margin: 14px 0 8px; }
.btn.wide { display: block; text-align: center; text-decoration: none; } .cancel-form { margin-top: 12px; }

/* Forms and dashboards (M3) */
.fields select, .fields textarea { font: 16px var(--font-latin); padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid rgb(var(--line2)); background: rgb(var(--bg)); color: inherit; }
.fields textarea { min-height: 70px; resize: vertical; }
.fields .check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; }
.two { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.dash { max-width: 920px; margin: 0 auto; padding: 0 16px 60px; }
.dash-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid rgb(var(--line)); padding-bottom: 10px; }
.dash-nav a { padding: 6px 12px; border-radius: 10px; text-decoration: none; color: rgb(var(--fg2)); font-weight: 600; }
.dash-nav a[aria-current="page"] { background: rgb(var(--raised)); color: rgb(var(--fg)); }
.topbar .who { display: flex; gap: 8px; align-items: center; }
.topbar .who form { margin: 0; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0 0 14px; }
.stat { background: rgb(var(--card)); border: 1px solid rgb(var(--line)); border-radius: var(--r-md); padding: 12px 14px; }
.stat strong { display: block; font-size: 24px; font-weight: 800; }
.status-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; background: rgb(var(--raised)); }
.status-pill.live { background: rgb(var(--ok-soft)); color: rgb(var(--ok)); }
.status-pill.submitted { background: rgb(var(--warn-soft)); color: rgb(var(--warn)); }
.status-pill.suspended { background: rgb(var(--bad-soft)); color: rgb(var(--bad)); }
.todo { list-style: none; padding: 0; margin: 0 0 12px; }
.todo li { padding: 6px 0; }
.todo li::before { content: "○"; margin-inline-end: 8px; color: rgb(var(--muted)); }
.todo li.done::before { content: "✓"; color: rgb(var(--ok)); }
.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.hours-row { display: grid; grid-template-columns: 7em auto 1fr 1fr; gap: 8px; align-items: center; padding: 4px 0; }
.hours-row input[type=time] { padding: 8px; }
.item-row { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px solid rgb(var(--line)); }
details > summary { cursor: pointer; font-weight: 600; }
.secret { font-family: var(--font-mono); word-break: break-all; background: rgb(var(--raised)); padding: 10px; border-radius: 10px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.fields-input { font: 15px var(--font-latin); padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid rgb(var(--line2)); background: rgb(var(--bg)); color: inherit; }
a.card.row { text-decoration: none; color: inherit; }
.card-link { display: block; text-decoration: none; color: inherit; }
.qr { background: #fff; border-radius: var(--r-sm); }
.code-big { font-size: 32px; }
.drop-note { color: rgb(var(--ember)); font-weight: 700; margin: 2px 0; }
.tried { margin: 0 0 12px; }
.stamp { margin: 6px 0; padding: 8px 12px; border-radius: var(--r-sm); background: rgb(var(--raised)); }
.stamp.highlighted { background: rgb(var(--accent-soft)); }
.vibes { display: flex; gap: 8px; flex-wrap: wrap; }
.group .share { display: flex; gap: 8px; align-items: center; }
.group .share input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid rgb(var(--line2)); border-radius: var(--r-sm); background: rgb(var(--raised)); color: rgb(var(--fg)); }
.group-pay { margin-bottom: 120px; }
.story { border-radius: var(--r-md); box-shadow: 0 6px 24px rgb(var(--shadow) / 0.18); }
