/* ==========================================================================
   Heroes Hospitality Suite — staff design system
   Palette: espresso brand + crema gold accent on cool neutral paper.
   Type: Fraunces (titles) + IBM Plex Sans (interface, tabular figures).
   ========================================================================== */

@font-face { font-family: "Plex"; src: url("../fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/IBMPlexSans-Italic-Latin1.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/IBMPlexSans-Bold-Latin1.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/Fraunces-var.woff2") format("woff2-variations"), url("../fonts/Fraunces-var.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }

:root {
  --brand: #3E2419;
  --accent: #E9B824;
  --brand-ink: #FFFFFF;
  --accent-ink: #2A1A10;

  --bg: #F1F2F4;
  --surface: #FFFFFF;
  --surface-2: #F7F8F9;
  --surface-3: #ECEDF0;
  --line: #E1E3E7;
  --line-strong: #CDD0D6;
  --text: #22201F;
  --text-2: #4A4744;
  --muted: #6B6965;
  --focus: #C8920A;

  --c-new: #B86E00;        --c-new-bg: #FFF4DF;
  --c-prep: #1F5FC4;       --c-prep-bg: #E6EFFD;
  --c-ready: #12804F;      --c-ready-bg: #E2F5EB;
  --c-served: #5D6670;     --c-served-bg: #EEF0F2;
  --c-danger: #C23A2B;     --c-danger-bg: #FCE9E6;
  --c-warn: #A35F00;       --c-warn-bg: #FFF3DC;
  --c-info: #2F5D8A;       --c-info-bg: #E7F0F9;
  --c-ok: #12804F;         --c-ok-bg: #E2F5EB;

  --sidebar-bg: var(--brand);
  --sidebar-ink: rgba(255,255,255,.86);
  --sidebar-ink-dim: rgba(255,255,255,.55);
  --sidebar-hover: rgba(255,255,255,.08);

  --font-ui: "Plex", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: "Fraunces", Georgia, "Times New Roman", serif;

  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem; --fs-lg: 1.0625rem; --fs-xl: 1.3125rem; --fs-2xl: 1.625rem; --fs-3xl: 2.0625rem;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(25,20,15,.06), 0 1px 1px rgba(25,20,15,.04);
  --shadow-2: 0 10px 30px rgba(25,20,15,.14), 0 2px 6px rgba(25,20,15,.08);
  --shadow-3: 0 24px 60px rgba(25,20,15,.22);

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --gutter: 24px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15130F;
  --surface: #1E1B17;
  --surface-2: #24211C;
  --surface-3: #2D2923;
  --line: #36312A;
  --line-strong: #4A443B;
  --text: #EFEBE5;
  --text-2: #D3CDC4;
  --muted: #A49D92;
  --focus: #F0C44C;
  --c-new: #F2A93B;   --c-new-bg: #3A2A10;
  --c-prep: #7FB0FF;  --c-prep-bg: #182A47;
  --c-ready: #4CC98C; --c-ready-bg: #11331F;
  --c-served: #A6AFB8;--c-served-bg: #2A2E33;
  --c-danger: #FF7B6B;--c-danger-bg: #3D1A15;
  --c-warn: #F2B04B;  --c-warn-bg: #3A2A10;
  --c-info: #8CB8E6;  --c-info-bg: #1A2A3B;
  --c-ok: #4CC98C;    --c-ok-bg: #11331F;
  --sidebar-bg: #1A1511;
  --shadow-2: 0 10px 30px rgba(0,0,0,.45);
  --shadow-3: 0 24px 60px rgba(0,0,0,.55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #15130F; --surface: #1E1B17; --surface-2: #24211C; --surface-3: #2D2923;
    --line: #36312A; --line-strong: #4A443B; --text: #EFEBE5; --text-2: #D3CDC4; --muted: #A49D92; --focus: #F0C44C;
    --c-new: #F2A93B; --c-new-bg: #3A2A10; --c-prep: #7FB0FF; --c-prep-bg: #182A47; --c-ready: #4CC98C; --c-ready-bg: #11331F;
    --c-served: #A6AFB8; --c-served-bg: #2A2E33; --c-danger: #FF7B6B; --c-danger-bg: #3D1A15; --c-warn: #F2B04B; --c-warn-bg: #3A2A10;
    --c-info: #8CB8E6; --c-info-bg: #1A2A3B; --c-ok: #4CC98C; --c-ok-bg: #11331F;
    --sidebar-bg: #1A1511; --shadow-2: 0 10px 30px rgba(0,0,0,.45); --shadow-3: 0 24px 60px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ui); font-size: var(--fs-md); line-height: 1.5; color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 1000; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- App frame ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; z-index: 60; transition: width .2s ease, transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; min-height: var(--topbar-h); }
.sidebar-brand img { width: 36px; height: 36px; border-radius: 50%; background: #fff; flex: none; }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-text strong { font-family: var(--font-title); font-weight: 600; font-size: 1.02rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-text span { font-size: var(--fs-xs); color: var(--sidebar-ink-dim); }
.sidebar-close { margin-left: auto; color: #fff; display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-group { margin-top: 10px; }
.nav-group-title { font-size: var(--fs-xs); color: var(--sidebar-ink-dim); padding: 8px 10px 4px; font-weight: 500; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); text-decoration: none;
  color: var(--sidebar-ink); background: none; border: 0; cursor: pointer; font-size: var(--fs-md); text-align: left; position: relative;
}
.nav-link i { width: 20px; text-align: center; font-size: 1rem; opacity: .85; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.is-active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-link.is-active i { color: var(--accent); opacity: 1; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; display: inline-grid; place-items: center; }
.sidebar-foot { padding: 8px 10px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-scrim { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-menu { display: none; }
.topbar-title { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.topbar-title h1 { font-family: var(--font-title); font-weight: 600; font-size: var(--fs-xl); letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variation-settings: "opsz" 48, "SOFT" 30; }
.topbar-sub { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-clock { color: var(--muted); font-size: var(--fs-sm); margin-right: 6px; }
.topbar-bell { position: relative; }
.dot-badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--c-danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.page { flex: 1; padding: 20px var(--gutter) calc(32px + var(--safe-b)); width: 100%; max-width: 1560px; margin: 0 auto; outline: none; }
.page.page-flush { padding: 0; max-width: none; }

html.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .nav-label, html.sidebar-collapsed .sidebar-brand-text, html.sidebar-collapsed .nav-group-title { display: none; }
html.sidebar-collapsed .nav-link { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
html.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 14px 0; }

@media (max-width: 1023px) {
  :root { --gutter: 16px; }
  .sidebar { transform: translateX(-102%); width: min(300px, 86vw) !important; box-shadow: var(--shadow-3); }
  .sidebar-close { display: inline-grid; }
  html.sidebar-open .sidebar { transform: none; }
  html.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(15,10,5,.45); z-index: 55; }
  .app-main, html.sidebar-collapsed .app-main { margin-left: 0; }
  html.sidebar-collapsed .nav-label, html.sidebar-collapsed .sidebar-brand-text, html.sidebar-collapsed .nav-group-title { display: revert; }
  html.sidebar-collapsed .nav-link { justify-content: flex-start; padding: 9px 10px; }
  .sidebar-foot { display: none; }
  .topbar-menu { display: inline-grid; margin-left: -6px; }
  .topbar-clock, .user-chip-text, .user-chip .fa-chevron-down { display: none; }
}
@media (max-width: 599px) {
  .topbar { gap: 6px; }
  .topbar-title h1 { font-size: var(--fs-lg); }
  .topbar-sub { display: none; }
  .page { padding-top: 14px; }
}

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-ink: var(--text); --b-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--r-md); border: 1px solid var(--b-line); background: var(--b-bg); color: var(--b-ink);
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: color-mix(in srgb, var(--b-bg) 92%, var(--text)); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --b-bg: var(--brand); --b-ink: var(--brand-ink); --b-line: var(--brand); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
:root[data-theme="dark"] .btn-primary { --b-bg: var(--accent); --b-ink: var(--accent-ink); --b-line: var(--accent); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .btn-primary { --b-bg: var(--accent); --b-ink: var(--accent-ink); --b-line: var(--accent); } }
.btn-accent { --b-bg: var(--accent); --b-ink: var(--accent-ink); --b-line: var(--accent); }
.btn-success { --b-bg: var(--c-ready); --b-ink: #fff; --b-line: var(--c-ready); }
.btn-danger { --b-bg: var(--c-danger); --b-ink: #fff; --b-line: var(--c-danger); }
.btn-ghost { --b-bg: transparent; --b-line: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline-danger { --b-ink: var(--c-danger); --b-line: color-mix(in srgb, var(--c-danger) 45%, transparent); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 6px; }
.btn-lg { min-height: 52px; padding: 12px 22px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn .fa-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-md); border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; text-decoration: none; font-size: 1.05rem; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- User menu ---------- */
.menu-wrap { position: relative; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.user-chip:hover { border-color: var(--line-strong); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip-text strong { font-size: var(--fs-sm); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-text small { color: var(--muted); font-size: var(--fs-xs); }
.user-chip .fa-chevron-down { font-size: .7rem; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: var(--fs-sm); flex: none; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px; z-index: 80; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; font-size: var(--fs-md); color: var(--text); }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu i { width: 18px; color: var(--muted); }
.menu form { margin: 0; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-lead { color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 599px) {
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
}
.section-title { font-family: var(--font-title); font-weight: 600; font-size: var(--fs-xl); margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title:first-child { margin-top: 0; }
.section-title small { font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: var(--fs-lg); font-weight: 600; }
.panel-head .muted { font-size: var(--fs-sm); }
.panel-head .panel-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.text-danger { color: var(--c-danger); }
.text-ok { color: var(--c-ok); }
.text-warn { color: var(--c-warn); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1199px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-sidebar { grid-template-columns: 1fr; } }
@media (max-width: 899px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 699px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; position: relative; min-width: 0; }
a.stat:hover { border-color: var(--line-strong); }
.stat-label { color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.stat-label i { width: 16px; }
.stat-value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-note { font-size: var(--fs-xs); color: var(--muted); }
.stat.is-alert { border-color: color-mix(in srgb, var(--c-danger) 40%, var(--line)); }
.stat.is-alert .stat-value { color: var(--c-danger); }
.delta-up { color: var(--c-ok); }
.delta-down { color: var(--c-danger); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.field-inline { flex-direction: column; }
.req::after { content: " *"; color: var(--c-danger); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), .field select, .field textarea, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  font-size: var(--fs-md); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 84px; resize: vertical; line-height: 1.45; }
.field select, select.input { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field input[type=color] { width: 56px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.input-group { display: flex; align-items: stretch; }
.input-group > .input, .input-group > input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; min-width: 0; }
.input-group > .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 599px) { .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 767px) { .input, .field input, .field select, .field textarea { font-size: 16px; } }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
:root[data-theme="dark"] .check input { accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--c-ready); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 220px; }
.filters .custom-dates { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 599px) { .filters .field, .filters .custom-dates, .filters .custom-dates .field { flex: 1 1 100%; } .filters .btn { flex: 1; } }
.search-input { position: relative; }
.search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input input { padding-left: 36px !important; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 14px; border: 1px solid transparent; font-size: var(--fs-md); display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--c-ok-bg); color: var(--c-ok); border-color: color-mix(in srgb, var(--c-ok) 25%, transparent); }
.alert-error { background: var(--c-danger-bg); color: var(--c-danger); border-color: color-mix(in srgb, var(--c-danger) 25%, transparent); }
.alert-warning { background: var(--c-warn-bg); color: var(--c-warn); border-color: color-mix(in srgb, var(--c-warn) 25%, transparent); }
.alert-info { background: var(--c-info-bg); color: var(--c-info); border-color: color-mix(in srgb, var(--c-info) 25%, transparent); }

/* ---------- Pills & chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--c-served-bg); color: var(--c-served); line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-pending, .pill-unpaid, .pill-active, .pill-booked, .pill-open { background: var(--c-new-bg); color: var(--c-new); }
.pill-preparing, .pill-confirmed, .pill-ordered, .pill-occupied, .pill-partial, .pill-seated, .pill-acknowledged { background: var(--c-prep-bg); color: var(--c-prep); }
.pill-ready, .pill-paid, .pill-available, .pill-completed, .pill-vacant, .pill-done, .pill-closed_ok { background: var(--c-ready-bg); color: var(--c-ready); }
.pill-cancelled, .pill-void, .pill-dirty, .pill-no_show, .pill-out_of_service, .pill-bill_requested { background: var(--c-danger-bg); color: var(--c-danger); }
.pill-credit, .pill-room, .pill-reserved, .pill-cleaning { background: var(--c-info-bg); color: var(--c-info); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; color: var(--text-2); text-decoration: none; }
.chip:hover { border-color: var(--text-2); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .count { background: rgba(0,0,0,.08); border-radius: var(--r-pill); padding: 0 7px; font-size: var(--fs-xs); }
.chip.is-active .count { background: rgba(255,255,255,.2); }
.tag { display: inline-block; padding: 1px 8px; border-radius: var(--r-sm); background: var(--surface-3); font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; color: var(--muted); font-weight: 500; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { background: var(--surface-3); border-radius: var(--r-pill); padding: 0 8px; font-size: var(--fs-xs); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented button, .segmented a { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.segmented .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 600; }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th { text-align: left; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table tr.is-muted td { color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; }
.table .row-link { text-decoration: none; font-weight: 600; }
.table .row-link:hover { text-decoration: underline; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-sm); text-align: left; font-weight: 500; flex: none; }
  .table-stack td[data-label=""]::before, .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.cell-title { font-size: var(--fs-lg); justify-content: flex-start; text-align: left; }
  .table-stack td.actions { justify-content: flex-end; padding-top: 8px; }
  .table-stack tfoot { display: block; }
  .table-stack tbody tr:hover td { background: none; }
}

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state > i { font-size: 2.2rem; opacity: .5; }
.empty-state h2, .empty-state h3 { color: var(--text); font-size: var(--fs-lg); }
.empty-state .btn { margin-top: 6px; }

/* ---------- Modal & sheet ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20,14,8,.48); animation: fadeIn .15s ease; }
.modal-box { background: var(--surface); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: var(--r-lg); box-shadow: var(--shadow-3); animation: popIn .18s ease; }
.modal-box:focus { outline: none; }
.modal-box.wide { max-width: 760px; }
.modal-box.xwide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-family: var(--font-title); font-weight: 600; font-size: var(--fs-xl); flex: 1; min-width: 0; }
.modal-body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 599px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-box, .modal-box.wide, .modal-box.xwide { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; max-height: 92dvh; animation: sheetUp .22s ease; }
  .modal-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; }
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
.drawer { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: flex-end; background: rgba(20,14,8,.4); animation: fadeIn .15s; }
.drawer-box { width: min(480px, 100%); background: var(--surface); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-3); animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(40px); opacity: .5; } }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; z-index: 200; right: 16px; bottom: calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; background: #241a14; color: #fff; padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-2); display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; animation: popIn .2s ease; font-size: var(--fs-md); }
.toast.is-error { background: var(--c-danger); }
.toast.is-success i { color: #7ee2ad; }
@media (max-width: 599px) { .toast-root { left: 12px; right: 12px; bottom: auto; top: calc(10px + env(safe-area-inset-top, 0px)); } .toast { max-width: none; animation-name: dropIn; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item.is-wrap { flex-wrap: wrap; }
.list-item.is-wrap .grow { min-width: 180px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.row-actions:empty { display: none; }
.list-item .title { font-weight: 600; }
.list-item .meta { font-size: var(--fs-sm); color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.totals { display: grid; gap: 6px; }
.totals .row { display: flex; justify-content: space-between; gap: 12px; }
.totals .row.grand { font-size: var(--fs-xl); font-weight: 700; padding-top: 8px; border-top: 1px dashed var(--line-strong); margin-top: 4px; }
.totals .row.balance { color: var(--c-danger); font-weight: 700; }

/* ---------- Quick links (home) ---------- */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick a { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; min-height: 76px; }
.quick a:hover { border-color: var(--brand); box-shadow: var(--shadow-1); }
.quick a i { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--brand); font-size: 1.15rem; flex: none; }
:root[data-theme="dark"] .quick a i { color: var(--accent); }
.quick a strong { display: block; }
.quick a span { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Order ticket (the docket) ---------- */
.ticket {
  --t-c: var(--c-new); --t-bg: var(--c-new-bg);
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 4px var(--r-md) var(--r-md);
  box-shadow: var(--shadow-1); display: flex; flex-direction: column; overflow: hidden;
}
.ticket::before { content: ""; height: 6px; background: var(--t-c); display: block; }
.ticket::after {
  content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 8px;
  background: radial-gradient(circle at 6px -2px, var(--bg) 5px, transparent 5.5px) 0 0 / 12px 8px repeat-x;
}
.ticket.is-preparing { --t-c: var(--c-prep); --t-bg: var(--c-prep-bg); }
.ticket.is-ready { --t-c: var(--c-ready); --t-bg: var(--c-ready-bg); }
.ticket.is-late { box-shadow: 0 0 0 2px var(--c-danger), var(--shadow-1); }
.ticket-head { padding: 14px 14px 8px; display: flex; gap: 8px; align-items: flex-start; }
.ticket-no { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
.ticket-where { font-weight: 600; font-size: var(--fs-md); }
.ticket-sub { color: var(--muted); font-size: var(--fs-sm); }
.ticket-timer { margin-left: auto; text-align: right; font-weight: 700; font-size: var(--fs-lg); color: var(--t-c); white-space: nowrap; }
.ticket-timer small { display: block; font-weight: 500; font-size: var(--fs-xs); color: var(--muted); }
.ticket.is-late .ticket-timer { color: var(--c-danger); }
.ticket-items { list-style: none; margin: 0; padding: 4px 14px 10px; border-top: 1px dashed var(--line-strong); }
.ticket-items li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dotted var(--line); }
.ticket-items li:last-child { border-bottom: 0; }
.ticket-qty { font-weight: 800; min-width: 28px; font-size: var(--fs-lg); }
.ticket-item-name { font-weight: 600; font-size: var(--fs-lg); line-height: 1.3; }
.ticket-mods { font-size: var(--fs-sm); color: var(--text-2); }
.ticket-note { font-size: var(--fs-sm); color: var(--c-danger); font-weight: 600; }
.ticket-request { margin: 0 14px 10px; padding: 8px 10px; background: var(--c-warn-bg); color: var(--c-warn); border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; }
.ticket-actions { margin-top: auto; padding: 10px 14px 14px; display: flex; gap: 8px; }
.ticket-actions .btn { flex: 1; }
.ticket-station { font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: var(--r-sm); background: var(--t-bg); color: var(--t-c); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: var(--fs-sm); }
.bar-row .bar { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
:root[data-theme="dark"] .bar-row .bar span { background: var(--accent); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.page-link { min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line); text-decoration: none; background: var(--surface); font-size: var(--fs-sm); }
.page-link.is-current { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-link.is-disabled { opacity: .4; }
.page-gap { padding: 0 6px; align-self: center; color: var(--muted); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.thumb { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-3); flex: none; display: grid; place-items: center; color: var(--muted); }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: .8em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
.loading { display: grid; place-items: center; padding: 40px; color: var(--muted); gap: 8px; }
.loading i { animation: spin 1s linear infinite; font-size: 1.4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.callout { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: 12px 14px; color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .filters, .no-print, .toast-root, .pagination, .tabs { display: none !important; }
  .app-main { margin: 0 !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .page { padding: 0; max-width: none; }
  .tab-panel { display: block !important; margin-bottom: 18px; }
}

/* ---------- Shift banner ---------- */
.shift-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--c-warn-bg); border: 1px solid color-mix(in srgb, var(--c-warn) 30%, transparent); margin-bottom: 16px; flex-wrap: wrap; }
.shift-banner > i { font-size: 1.3rem; color: var(--c-warn); }
.shift-banner.is-open { background: var(--c-ok-bg); border-color: color-mix(in srgb, var(--c-ok) 25%, transparent); }
.shift-banner.is-open > i { color: var(--c-ok); }
.shift-banner .grow { flex: 1; min-width: 200px; display: flex; flex-direction: column; }

/* ---------- Payment dialog ---------- */
.pay-due { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 16px; text-align: center; }
.pay-due strong { font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pay-method { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.pay-method i { font-size: 1.25rem; color: var(--brand); }
:root[data-theme="dark"] .pay-method i { color: var(--accent); }
.pay-method:hover { border-color: var(--brand); background: var(--surface-2); }
.pay-lines { display: grid; gap: 10px; }
.pay-line { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-2); }
.pay-line-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pay-line-head .icon-btn { margin-left: auto; }
.pay-line-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pay-extra { margin-top: 12px; }
.pay-summary { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: var(--fs-lg); }
.pay-summary .balance { color: var(--c-danger); }

/* ---------- Bill view ---------- */
.bill-order { border-bottom: 1px dashed var(--line); padding: 10px 0; }
.bill-order:last-child { border-bottom: 0; }
.bill-order-head { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }
.bill-line { display: flex; gap: 10px; padding: 3px 0; }
.bill-line .q { min-width: 28px; font-weight: 600; }
.bill-line .n { flex: 1; min-width: 0; }
.bill-line .n small { display: block; color: var(--muted); }
.bill-line.is-void { color: var(--muted); text-decoration: line-through; }

/* ---------- Late responsive overrides (must stay last) ---------- */
@media (max-width: 1023px) {
  .topbar-clock, .user-chip-text, .user-chip .fa-chevron-down { display: none; }
  .user-chip { padding: 3px; border-color: transparent; background: transparent; }
}
@media (max-width: 420px) {
  .topbar-actions [data-theme-toggle] { display: none; }
}
.stat-value, .pay-due strong { font-variant-numeric: proportional-nums; }
.table th.num { text-align: right; }
.table .row-link { white-space: nowrap; }
.grid > .panel + .panel, .stack > .panel + .panel, .bill-cards > .panel + .panel { margin-top: 0; }
.grid + .panel, .panel + .grid, .grid + .grid, .stats + .grid { margin-top: 16px; }

/* native file pickers in the same style as buttons */
input[type="file"] { font: inherit; font-size: var(--fs-sm); color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 8px 14px; margin-right: 10px; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
.btn-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
