:root {
  --bg: #0e0c0b;
  --panel: #171412;
  --panel-2: #1f1b18;
  --ink: #f3ede6;
  --ink-2: #cfc6bc;
  --muted: #a39a90;
  --line: rgba(243, 237, 230, 0.1);
  --line-2: rgba(243, 237, 230, 0.2);
  --ember: #e4512f;
  --ember-ink: #140d0a;
  --brass: #cfae74;

  /* chart series (validated on #171412, dark) */
  --s-rev: #e4512f;
  --s-exp: #4f8fd6;

  /* status */
  --good: #5fc48a;
  --warn: #e7b949;
  --bad: #ff7a66;
  --info: #7fb2ec;

  --f-serif: "Zodiak", Georgia, serif;
  --f-cond: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --f-body: "Switzer", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 0.9375rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 0.875rem; white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, color 160ms, transform 120ms; touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary { background: var(--ember); color: var(--ember-ink); }
.btn--primary:hover { background: #f06a48; }
.btn--ghost { border-color: var(--line-2); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: 0.9375rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: none; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--ink); }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at 70% 20%, rgba(228,81,47,0.18), transparent 55%), var(--bg); }
.gate__card { width: min(440px, 100%); padding: 40px 32px; border: 1px solid var(--line-2); border-radius: 16px; background: rgba(23,20,18,0.8); text-align: center; display: grid; gap: 16px; justify-items: center; }
.gate__logo { font-family: var(--f-cond); font-weight: 900; font-size: 1.6rem; letter-spacing: 0.24em; }
.gate__title { font-family: var(--f-serif); font-weight: 700; font-size: 2.6rem; letter-spacing: -0.02em; line-height: 1; }
.gate__text { color: var(--ink-2); }
.gate__fine { color: var(--muted); font-size: 0.8125rem; max-width: 34ch; }

/* ---------- Layout ---------- */
.app { display: grid; min-height: 100vh; }
.side {
  position: fixed; inset: auto 0 0 0; z-index: 50; background: rgba(17,15,13,0.96); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); padding-bottom: env(safe-area-inset-bottom);
}
.side__logo, .side__foot { display: none; }
.side__nav { display: grid; grid-template-columns: repeat(5, 1fr); }
.side__nav a {
  position: relative; display: grid; justify-items: center; gap: 3px; padding: 9px 4px 8px; min-height: 58px;
  text-decoration: none; color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
}
.side__nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side__nav a[aria-current="page"] { color: var(--ink); }
.side__nav a[aria-current="page"] svg { stroke: var(--ember); }
.side__badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ember); color: var(--ember-ink); font-size: 0.6875rem; line-height: 18px; text-align: center; }

.main { padding: 20px 16px 110px; min-width: 0; outline: none; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.top__date { color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 4px; }
.top__title { font-family: var(--f-serif); font-weight: 700; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.05; letter-spacing: -0.02em; }
.top__actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (min-width: 960px) {
  .app { grid-template-columns: 240px 1fr; }
  .side {
    position: sticky; top: 0; inset: auto; height: 100vh; display: flex; flex-direction: column; gap: 28px;
    padding: 28px 16px; border-top: 0; border-right: 1px solid var(--line); background: var(--panel);
  }
  .side__logo { display: flex; align-items: baseline; gap: 10px; padding: 0 12px; text-decoration: none; font-family: var(--f-cond); font-weight: 900; font-size: 1.5rem; letter-spacing: 0.22em; }
  .side__logo span { font-family: var(--f-serif); font-style: italic; font-weight: 400; font-size: 1rem; letter-spacing: 0; color: var(--brass); }
  .side__nav { display: grid; grid-template-columns: none; gap: 2px; }
  .side__nav a { grid-template-columns: 22px 1fr auto; justify-items: start; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 8px; font-size: 0.9375rem; font-weight: 500; letter-spacing: 0; }
  .side__nav a:hover { background: var(--panel-2); color: var(--ink); }
  .side__nav a[aria-current="page"] { background: var(--panel-2); }
  .side__badge { position: static; }
  .side__foot { margin-top: auto; display: grid; gap: 8px; padding: 0 12px; }
  .side__site { color: var(--ink-2); text-decoration: none; font-size: 0.875rem; padding: 6px 0; }
  .side__site:hover { color: var(--ink); }
  .side__reset { background: none; border: 0; padding: 6px 0; text-align: left; color: var(--muted); font-size: 0.8125rem; }
  .side__reset:hover { color: var(--bad); }
  .main { padding: 36px clamp(24px, 3vw, 48px) 60px; }
}

/* ---------- Cards / tiles ---------- */
.view { display: grid; gap: 18px; animation: fadeUp 360ms var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card__title { font-size: 1rem; font-weight: 600; }
.card__sub { color: var(--muted); font-size: 0.8125rem; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--brass); font-weight: 600; font-size: 0.8125rem; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 6px; min-width: 0; }
.tile__label { color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.tile__value { font-family: var(--f-cond); font-weight: 800; font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1; font-variant-numeric: tabular-nums; }
.tile__foot { font-size: 0.8125rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta--up { color: var(--good); }
.delta--down { color: var(--bad); }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(4, 1fr); gap: 16px; } .tile { padding: 20px; } }

.cols { display: grid; gap: 18px; }
@media (min-width: 1100px) { .cols { grid-template-columns: 1.6fr 1fr; } .cols--even { grid-template-columns: 1fr 1fr; } }

/* ---------- Chart ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(243,237,230,0.05); outline: none; }
.chart .dl { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--f-body); }
.tip {
  position: fixed; z-index: 200; pointer-events: none; min-width: 170px; padding: 10px 12px; border-radius: 8px;
  background: #221d1a; border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,0.5); font-size: 0.8125rem;
}
.tip__t { font-weight: 600; margin-bottom: 6px; }
.tip__r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip__r span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip__r i { width: 8px; height: 8px; border-radius: 2px; }
.tip__r b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip__n { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(96px, 30%) 1fr auto; align-items: center; gap: 12px; font-size: 0.875rem; }
.hbar__track { height: 10px; background: rgba(243,237,230,0.05); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar__fill { height: 100%; background: var(--s-exp); border-radius: 0 4px 4px 0; transform-origin: left; animation: grow 700ms var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.hbar__val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 72px; text-align: right; }
.hbar__pct { color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ---------- Lists ---------- */
.list { display: grid; }
.row { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row__time { font-family: var(--f-cond); font-weight: 800; font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; }
.row__name { font-weight: 600; }
.row__meta { color: var(--muted); font-size: 0.8125rem; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 8px; }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; }
.chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chip--confirmed { color: var(--good); }
.chip--pending { color: var(--warn); }
.chip--seated { color: var(--info); }
.chip--completed { color: var(--ink-2); border-color: var(--line-2); }
.chip--no-show { color: var(--bad); }
.chip--cancelled { color: var(--muted); border-color: var(--line-2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; background: rgba(207,174,116,0.14); color: var(--brass); }
.tag--allergy { background: rgba(255,122,102,0.14); color: var(--bad); }
.tag--new { background: rgba(228,81,47,0.18); color: #ff8e70; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; max-width: 100%; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; }
.seg button { border: 0; background: none; min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.search input, .input, .f input, .f select, .toolbar select {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); color-scheme: dark;
}
.search input { padding-left: 36px; border-radius: 999px; }
.toolbar select { width: auto; border-radius: 999px; padding-right: 30px; }
.search input:focus, .f input:focus, .f select:focus, .toolbar select:focus, .note-area:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(207,174,116,0.22); }
.count { color: var(--muted); font-size: 0.8125rem; margin-left: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.t th { text-align: left; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr { transition: background-color 120ms; }
.t tbody tr:hover { background: rgba(243,237,230,0.03); }
.t .r { text-align: right; }
.t tr.is-click { cursor: pointer; }
.cell-strong { font-weight: 600; }
.t td.c-main.cell-strong { white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 0.8125rem; }
.status-select { min-height: 34px; padding: 4px 28px 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font-size: 0.8125rem; color-scheme: dark; }
.rcpt-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: none; font-size: 0.8125rem; }
.rcpt-btn:hover { border-color: var(--ink); }
.rcpt-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.rcpt-none { color: var(--bad); font-size: 0.8125rem; }
.more { display: flex; justify-content: center; padding-top: 16px; }

/* Stack table rows as cards on phones */
@media (max-width: 720px) {
  .t thead { display: none; }
  .t, .t tbody, .t tr, .t td { display: block; width: 100%; }
  .t tr { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .t td { padding: 0; border: 0; }
  .t td[data-l]::before { content: attr(data-l) " · "; color: var(--muted); font-size: 0.75rem; }
  .t td.c-main { grid-column: 1; }
  .t td.c-side { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
  .t .r { text-align: left; }
}

/* ---------- Dialogs ---------- */
.dlg { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.dlg::backdrop { background: rgba(5,4,3,0.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg[open] { animation: pop 260ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.dlg__form { display: grid; gap: 16px; padding: 22px; }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg__head h2 { font-family: var(--f-serif); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.01em; }
.dlg__foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.f { display: grid; gap: 6px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.f input, .f select { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.9375rem; min-height: 44px; }
.f__err { color: var(--bad); font-size: 0.875rem; font-weight: 500; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 10px; transition: border-color 160ms, background-color 160ms; }
.drop.is-over, .drop:focus-within { border-color: var(--brass); background: rgba(207,174,116,0.06); }
.drop__label { display: flex; align-items: center; gap: 14px; padding: 18px; cursor: pointer; color: var(--ink-2); font-size: 0.875rem; }
.drop__label svg { width: 26px; height: 26px; fill: none; stroke: var(--brass); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop__label strong { color: var(--ink); }
.drop img { max-height: 120px; border-radius: 6px; }

.dlg--receipt { width: min(480px, calc(100% - 24px)); }
.paper { background: #f5f1ea; color: #1d1a17; border-radius: 6px; padding: 26px 24px; font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.8125rem; line-height: 1.6; }
.paper h3 { font-family: var(--f-cond); font-weight: 900; font-size: 1.5rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.paper hr { border: 0; border-top: 1px dashed #a9a197; margin: 12px 0; }
.paper .pr { display: flex; justify-content: space-between; gap: 12px; }
.paper .tot { font-weight: 700; font-size: 1rem; }
.rcpt-img { width: 100%; border-radius: 6px; background: #000; }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 150; background: rgba(5,4,3,0.6); }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--panel); border-left: 1px solid var(--line-2); padding: 22px; overflow-y: auto; display: grid; align-content: start; gap: 18px; animation: slideIn 320ms var(--ease); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kv div { background: var(--panel-2); border-radius: 8px; padding: 12px; }
.kv dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.kv dd { margin: 4px 0 0; font-family: var(--f-cond); font-weight: 800; font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.note-area { width: 100%; min-height: 96px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); resize: vertical; }
.contact { display: grid; gap: 4px; color: var(--ink-2); }
.contact a { text-decoration: none; }
.contact a:hover { color: var(--brass); }
.h3 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 300; left: 50%; bottom: 84px; transform: translateX(-50%); padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 0.875rem; box-shadow: 0 12px 30px rgba(0,0,0,0.5); animation: fadeUp 260ms var(--ease); max-width: calc(100% - 32px); }
@media (min-width: 960px) { .toast { bottom: 28px; } }

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