:root {
  --brand: #1d4ed8;
  --on-brand: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c2533;
  background: #f3f5f8;
  font-size: 17px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
/* A class with `display` beats the browser rule for [hidden], so make hidden win everywhere. */
[hidden] { display: none !important; }
body { margin: 0; }
.wrap { max-width: 640px; margin: 28px auto; padding: 0 18px; }
.admin-wrap { max-width: 920px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow, .brand { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); margin: 0; }
.muted { color: #526174; }
.small { font-size: 14px; }
.card, details.card {
  background: #fff;
  border: 1px solid #e4e9f1;
  border-radius: 18px;
  padding: 22px;
  margin: 14px 0;
  box-shadow: 0 1px 2px #1b36500a;
}
.panel { background: #f4f7fb; border-radius: 12px; padding: 16px; margin: 14px 0; }
.token { font-size: 56px; letter-spacing: -.04em; font-weight: 800; margin: 4px 0; line-height: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { text-align: center; padding: 16px; background: #f4f7fb; border-radius: 12px; }
.stat strong { display: block; font-size: 28px; }
h1 { font-size: 32px; letter-spacing: -.03em; margin: 6px 0 8px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
p { line-height: 1.5; }
label { display: block; font-weight: 650; font-size: 14px; margin: 14px 0 6px; }
input, textarea {
  width: 100%;
  border: 1px solid #cfd7e2;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  min-height: 48px;
  background: #fff;
}
input[type=checkbox] { width: auto; min-height: auto; accent-color: var(--brand); }
input[type=file] { padding: 10px; background: #f8fafc; }
button {
  font: inherit;
  cursor: pointer;
  background: var(--brand);
  color: var(--on-brand);
  border: 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  min-height: 48px;
}
button:hover { filter: brightness(.97); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
.secondary { background: #e8eef8; color: #1e3a5f; }
.danger { background: #fde8e6; color: #9f1239; }
.full { width: 100%; margin-top: 8px; }
.ql-textbtn {
  background: none;
  color: var(--brand);
  padding: 8px 0;
  min-height: 44px;
  font-weight: 650;
  width: auto;
  margin: 4px 0 0;
}
.ql-signin-extra { margin: 4px 0 0; }
a.full-link {
  display: block;
  text-align: center;
  background: var(--brand);
  color: var(--on-brand);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  min-height: 48px;
  margin-top: 8px;
  box-sizing: border-box;
}
button[data-ql-back] { margin: 0 0 12px; }
.screen-back { margin: 0 0 8px; }
.screen-back a { font-weight: 650; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e5f6ec;
  color: #146c37;
  font-size: 13px;
  font-weight: 700;
}
.pill.closed { background: #fde8e6; color: #9f1239; }
.queue-entry {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e8edf3;
  padding: 14px 0;
}
.queue-entry:last-child { border: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { font-size: 14px; padding: 8px 12px; min-height: 40px; }
.chip { padding: 3px 7px; background: #e8eef8; color: #1e3a5f; border-radius: 6px; font-size: 12px; font-weight: 650; }
.call { background: #e5f6ec; color: #146c37; padding: 14px; border-radius: 12px; font-weight: 700; }
.error { color: #9f1239; font-size: 14px; }
.ok { color: #146c37; font-size: 14px; }
a { color: #1d4ed8; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; margin: 14px 0; }
.checkbox input { margin-top: 3px; }
.admin-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.qr { width: 180px; height: auto; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid #e4e9f1; }
.logo-preview { margin: 10px 0 4px; }
.logo-preview img {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #f4f7fb;
  padding: 6px;
}
footer { margin: 22px 0 32px; text-align: center; font-size: 13px; color: #6b7787; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.tabs button { background: #e8eef8; color: #1e3a5f; }
.tabs button.on { background: var(--brand); color: var(--on-brand); }
.logo { max-width: 180px; max-height: 72px; object-fit: contain; display: block; margin-bottom: 8px; }
/* Business logo sits top-right so the page feels like that shop, not a generic form. */
.brand-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 6px;
}
.brand-head > div { min-width: 0; }
.brand-name { margin: 2px 0 0; overflow-wrap: anywhere; }
.brand-logo {
  flex: 0 0 auto;
  max-width: 112px;
  max-height: 56px;
  object-fit: contain;
  display: block;
}
@media (max-width: 380px) {
  .brand-logo { max-width: 84px; max-height: 44px; }
  .brand-name { font-size: 26px; }
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img, .offer img { width: 100%; height: 120px; object-fit: cover; border-radius: 12px; background: #eef2f6; }
.gallery figcaption { margin-top: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.swatch { width: 44px; height: 44px; min-height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #d5dbe6; padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px #1c2533; }
.business { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #e8edf3; }
.business:last-child { border: 0; }
.turn-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #146c37;
  color: #fff;
  text-align: center;
  padding: 14px 16px;
  font-weight: 750;
}
.game-canvas { width: 100%; max-width: 420px; display: block; background: #111827; border-radius: 16px; touch-action: none; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 0 auto;
}
.tile-grid[hidden], .pad[hidden], .game-canvas[hidden] { display: none; }
.tile {
  aspect-ratio: 1;
  min-height: 62px;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 800;
  padding: 0;
  border: 0;
  transition: background .12s ease;
}
.pad { display: grid; justify-items: center; gap: 8px; margin: 12px 0; }
.pad-row { display: flex; gap: 8px; }
.pad button { min-width: 64px; font-size: 22px; }
details summary { cursor: pointer; font-weight: 700; }
.block { margin-top: 18px; padding-top: 8px; border-top: 1px solid #e8edf3; }
.party { display: grid; gap: 10px; margin: 8px 0 4px; }
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f4f7fb;
  border-radius: 12px;
  padding: 10px 12px;
}
.stepper-label { font-size: 15px; font-weight: 650; }
.stepper-controls { display: flex; align-items: center; gap: 6px; }
.stepper-controls button {
  width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  border-radius: 10px; font-size: 20px; line-height: 1; padding: 0;
}
.stepper-controls output { min-width: 34px; text-align: center; font-weight: 750; font-size: 18px; }
.phone-row { display: grid; grid-template-columns: 118px 1fr; gap: 8px; }
.phone-row select {
  border: 1px solid #cfd7e2; border-radius: 12px; padding: 0 8px;
  font: inherit; min-height: 48px; background: #fff; color: #1c2533;
}
select {
  border: 1px solid #cfd7e2; border-radius: 12px; padding: 0 10px;
  font: inherit; min-height: 48px; background: #fff; color: #1c2533;
}
.token-label { font-weight: 650; font-size: 13px; color: #526174; }
.code-box { font-size: 34px; letter-spacing: .16em; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.checkin-qr { display: block; width: 180px; height: 180px; margin: 10px auto; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid #e4e9f1; }
.seat-line { font-size: 14px; margin: 4px 0 0; }
.legal { margin: 0; }
/* The mark leads the legal links, centred on the same line and sized to the text. */
.legal img {
  display: inline-block;
  vertical-align: -2px;
  width: auto;
  height: 13px;
  margin: 0 2px 0 0;
  opacity: .95;
}
footer .brand-slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
footer .brand-slot .legal { font-size: 13px; }
@media (max-width: 360px) {
  .legal img { height: 12px; }
}
.countdown {
  display: inline-block; margin-left: 6px; padding: 2px 7px;
  background: #e8eef8; color: #1e3a5f; border-radius: 6px;
  font-size: 12px; font-weight: 750; vertical-align: middle;
}
.countdown.urgent { background: #fde8e6; color: #9f1239; }
.turn-countdown { font-weight: 750; color: #9f1239; margin: -8px 0 14px; }
.turn-countdown.urgent { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.line { list-style: none; padding: 0; margin: 10px 0 0; }
.line li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #e8edf3; font-size: 15px;
}
.line li:last-child { border: 0; }
.line li.mine { background: #eef4ff; margin: 0 -10px; padding: 10px; border-radius: 10px; }
.line li.at-counter strong { color: #146c37; }
.chip.you { background: #1d4ed8; color: #fff; }
.party-tag {
  display: inline-block; margin-left: 6px; padding: 2px 7px;
  background: #eef2f8; color: #33415c; border-radius: 6px;
  font-size: 12px; font-weight: 700; vertical-align: middle;
}
.turn-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #0f2d1dcc;
  display: grid; place-items: center; padding: 20px;
}
/* A class with `display` beats the browser's [hidden] rule, so opt out explicitly. */
.turn-overlay[hidden] { display: none; }
.turn-dialog {
  background: #fff; border-radius: 20px; padding: 26px 22px;
  max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 24px 60px #0006;
  animation: pop .22s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.turn-dialog h2 { font-size: 26px; margin: 8px 0 6px; color: #146c37; }
.turn-dialog .token { font-size: 44px; }
.turn-dialog p { color: #526174; margin: 8px 0 18px; }
@media (prefers-reduced-motion: reduce) { .turn-dialog { animation: none; } }
@media (max-width: 360px) { .phone-row { grid-template-columns: 104px 1fr; } }
@media (max-width: 720px) {
  .wrap { margin: 16px auto; }
  .card { padding: 16px; }
  .admin-grid { grid-template-columns: 1fr; }
  .queue-entry, .business { align-items: flex-start; flex-direction: column; }
  .token { font-size: 48px; }
}
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* Demo-mode banner. Only rendered when /api/demo/info answers, which happens only
   in the isolated demo stack (see compose.demo.yml).

   `demo.js` inserts this as the FIRST child of <body>. On a page whose <body> is a
   CSS grid (`.zq` at >=860px uses `grid-template-columns: 236px 1fr`), an
   unspanned first child occupies grid cell 1 — so the banner took the sidebar
   column, the rail took the main column, and <main> was pushed into a new row
   below the fold at sidebar width. The dashboard looked completely blank.

   Spanning every column keeps the banner a full-width strip on any layout, grid
   or not, so it can never displace page content again. */
.demo-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: #7c2d12;
  color: #fff7ed;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
  text-align: center;
  grid-column: 1 / -1;
}
.demo-bar a { color: #fff7ed; }
@media print { .demo-bar { display: none; } }

/* Layout utilities — keep markup free of style="" so CSP style-src stays 'self'. */
.mw-120 { max-width: 120px; }
.mw-140 { max-width: 140px; }
.mw-160 { max-width: 160px; }
.mw-170 { max-width: 170px; }
.mw-180 { max-width: 180px; }
.mw-190 { max-width: 190px; }
.mw-200 { max-width: 200px; }
.mw-220 { max-width: 220px; }
.mw-280 { max-width: 280px; }
.mt-16 { margin-top: 16px; }
.pre-wrap { white-space: pre-wrap; font: inherit; }
.break-all { word-break: break-all; }
.grievance-message {
  width: 100%;
  min-height: 90px;
  font: inherit;
  padding: 12px;
  border: 1px solid #cfd7e2;
  border-radius: 10px;
}
