:root {
  --ink: #17201b;
  --muted: #718078;
  --line: #e6ebe7;
  --canvas: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --brand: #245c45;
  --brand-2: #34785b;
  --accent: #e8844d;
  --accent-soft: #fff0e7;
  --success: #23885c;
  --warning: #c47b19;
  --danger: #c84b45;
  --info: #3975a8;
  /* Elevation: hairline for flat controls, soft for cards, deep for
     floating layers (menus, modals, toasts). */
  --shadow-xs: 0 1px 2px rgba(16, 32, 24, .05);
  --shadow: 0 1px 2px rgba(16, 32, 24, .04), 0 6px 20px rgba(16, 32, 24, .05);
  --shadow-lg: 0 24px 60px rgba(10, 26, 18, .18), 0 4px 14px rgba(10, 26, 18, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  /* Status tints, mixed from the theme so every preset (incl. midnight) works. */
  --success-soft: color-mix(in srgb, var(--success) 12%, var(--surface));
  --warning-soft: color-mix(in srgb, var(--warning) 14%, var(--surface));
  --danger-soft: color-mix(in srgb, var(--danger) 11%, var(--surface));
  --info-soft: color-mix(in srgb, var(--info) 12%, var(--surface));
  --brand-soft: color-mix(in srgb, var(--brand) 9%, var(--surface));
  --row-hover: color-mix(in srgb, var(--brand) 3.5%, var(--surface));
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --sidebar-bg: #173c2e;
  --sidebar-fg: #edf7f1;
  --sidebar-fg-dim: #a9c6b7;
  --sidebar-fg-muted: #83aa96;
  --sidebar-item-fg: #cfe1d8;
  --topbar-bg: rgba(255, 255, 255, .9);
  --sidebar: 244px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  /* Fluid type scale: clamp(min, preferred, max) so text scales smoothly
     between mobile/tablet/desktop instead of jumping at breakpoints. */
  --fs-h1: clamp(16px, .5vw + 13px, 18px);
  --fs-h2: clamp(22px, 1.2vw + 15px, 28px);
  --fs-h3: 15px;
  --fs-stat: clamp(20px, 1.2vw + 14px, 26px);
  --fs-body: 13px;
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { width: 100%; min-width: 0; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; }
body { width: 100%; margin: 0; min-height: 100vh; overflow-x: clip; background: var(--canvas); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
:where(body:not(.receipt-page)) :where(h1, h2, h3, h4) { line-height: 1.2; }
/* Printed receipts, KOT tickets and purchase notes keep the browser's
   default text metrics they were laid out with. */
body.receipt-page { font-size: 16px; line-height: normal; -webkit-font-smoothing: auto; text-rendering: auto; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
svg { display: block; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
:where(button, a, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent);
  outline-offset: 2px;
}
/* Thin, quiet scrollbars wherever a panel scrolls on its own. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 18%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--ink) 18%, transparent) padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { min-height: 100vh; }
.skip-link { position: fixed; z-index: 300; left: 12px; top: -64px; padding: 10px 14px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 700; box-shadow: var(--shadow-lg); transition: top .15s ease; }
.skip-link:focus { top: 12px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: var(--sidebar);
  padding: calc(18px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  color: var(--sidebar-fg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 92%, #fff) 0, var(--sidebar-bg) 180px);
  display: flex; flex-direction: column;
  transition: transform .28s var(--ease), background .2s ease;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 16px; }
.brand-visual { position: relative; flex: 0 0 auto; display: block; padding: 0; border: 0; border-radius: 12px; background: transparent; }
.brand-visual.is-editable { cursor: pointer; }
.brand-visual-badge {
  position: absolute; right: -5px; bottom: -5px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: var(--brand); border: 2px solid var(--sidebar-bg);
  font-size: 9px; box-shadow: 0 4px 10px rgba(6,31,20,.3);
  opacity: 0; transform: scale(.8); transition: opacity .15s ease, transform .15s ease;
}
.brand-visual.needs-logo .brand-visual-badge,
.brand-visual.is-editable:hover .brand-visual-badge,
.brand-visual.is-editable:focus-visible .brand-visual-badge { opacity: 1; transform: none; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; display: block;
  flex: 0 0 auto; object-fit: cover;
  background: #fff;
  box-shadow: 0 6px 16px rgba(6,31,20,.3), 0 0 0 2px rgba(255,255,255,.14);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(145deg, #f3a170, #e5763b); color: #fff;
  font-family: Georgia, serif; font-size: 19px; font-weight: 800;
  box-shadow: 0 6px 16px rgba(232,132,77,.25);
}
.brand-mark i { font-size: 17px; }
/* Scoped to the text column only — a bare `.brand span` also matched the
   <span class="brand-mark"> badge, knocking its icon to the top-left and
   uppercasing the whole name. */
.brand-copy { min-width: 0; flex: 1; color: var(--sidebar-fg); }
.brand-copy strong { display: block; letter-spacing: -.02em; font-size: 15px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.brand-copy > span { display: block; margin-top: 2px; color: var(--sidebar-fg-dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nav-group { margin: 0; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary.has-active { color: #fff; }
.nav-caret { margin-left: 6px; font-size: 11.5px; opacity: .6; transition: transform .2s var(--ease); }
.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.nav-group > summary .nav-count + .nav-caret { margin-left: 6px; }
.nav-group > summary .nav-count { margin-left: auto; }
.nav-group > summary > span:nth-child(2) { flex: 1; }
.nav-group[open] > .nav-sub { animation: nav-sub-in .2s var(--ease); }
@keyframes nav-sub-in { from { opacity: 0; transform: translateY(-3px); } }
.nav-sub { display: grid; gap: 1px; margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-subitem {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: 9px;
  color: var(--sidebar-item-fg); font-size: 13px; font-weight: 550; transition: background-color .15s ease, color .15s ease;
}
.nav-subitem i { width: 16px; text-align: center; font-size: 12px; opacity: .75; }
.nav-subitem:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-subitem.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.nav-subitem.active i { opacity: 1; color: var(--accent); }
.nav-subitem.active::before { content: ""; position: absolute; left: -11px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav-subitem .nav-count { margin-left: auto; }
.nav-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px 12px; }
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-label { margin: 10px 10px 6px; color: var(--sidebar-fg-muted); font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px;
  padding: 8px 10px; border-radius: 10px; color: var(--sidebar-item-fg);
  font-size: 13.5px; font-weight: 600; transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.active .nav-icon, .nav-group > summary.has-active .nav-icon { color: var(--accent); }
.nav-icon { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; }
.nav-icon svg { width: 19px; height: 19px; stroke-width: 1.9; }
.nav-icon i { font-size: 14px; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: white; font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sidebar-footer { margin-top: auto; padding: 10px 2px 0; border-top: 1px solid rgba(255,255,255,.08); }
/* Signed-in account: one compact row, with profile / password / sign-out
   as a single row of icon buttons underneath. */
.shift-card { padding: 10px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.07); }
.shift-row { display: flex; align-items: center; gap: 10px; }
.shift-row > div { min-width: 0; flex: 1; }
.shift-avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 12px; font-weight: 800; }
.shift-avatar img { width: 100%; height: 100%; object-fit: cover; }
.shift-card small { color: var(--sidebar-fg-dim); font-size: 12px; }
.shift-card strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-card small, .shift-card strong { display: block; }
.live-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #61d79b; box-shadow: 0 0 0 4px rgba(97,215,155,.14); animation: live-dot-pulse 2.2s ease infinite; }
@keyframes live-dot-pulse { 50% { box-shadow: 0 0 0 2px rgba(97,215,155,.08); } }
.shift-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.08); }
.logout-form { margin: 0; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky; top: 0; z-index: 35; min-height: var(--topbar-h);
  padding: env(safe-area-inset-top) calc(24px + env(safe-area-inset-right)) 0 calc(24px + env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
.menu-toggle { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font-size: var(--fs-h1); font-weight: 750; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-heading p:empty { display: none; }
/* A page with its own header (.page-lead) keeps the topbar for status and
   account controls only, so the page name is never shown twice; the
   branch/date context takes the freed space. */
.topbar-context { display: none; align-items: center; gap: 10px; min-width: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.topbar-context i { margin-right: 6px; font-size: 12px; color: var(--brand-2); }
.topbar-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; white-space: nowrap; }
.topbar-date { white-space: nowrap; }
.main-shell:has(.content .page-lead h2) .topbar .page-heading { display: none; }
.main-shell:has(.content .page-lead h2) .topbar-context { display: flex; }
.topbar .pwa-status { margin-left: auto; }
.global-search { position: relative; max-width: 430px; flex: 1; margin-left: auto; }
.global-search input { width: 100%; height: 42px; padding: 0 42px 0 40px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--surface-2); color: var(--ink); }
.global-search input:focus { border-color: color-mix(in srgb, var(--brand) 55%, var(--surface)); box-shadow: var(--ring); background: var(--surface); }
.search-icon { position: absolute; left: 13px; top: 12px; color: var(--muted); }
.toolbar-search i.fa-solid { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.shortcut { position: absolute; right: 10px; top: 10px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.pwa-status { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sync-indicator {
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sync-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(35,136,92,.1); }
.sync-indicator.syncing i, .sync-indicator[data-state="syncing"] i { background: var(--warning); box-shadow: 0 0 0 4px rgba(196,123,25,.1); animation: sync-pulse 1s ease-in-out infinite; }
.sync-indicator.offline, .sync-indicator.is-offline, .sync-indicator[data-state="offline"] { color: var(--danger); }
.sync-indicator.offline i, .sync-indicator.is-offline i, .sync-indicator[data-state="offline"] i { background: var(--danger); box-shadow: 0 0 0 4px rgba(200,75,69,.1); }
@keyframes sync-pulse { 50% { opacity: .4; transform: scale(.75); } }
.icon-btn { position: relative; width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.icon-btn i { font-size: 14px; }
.icon-btn:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--surface)); background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.menu-toggle { display: none; }
.icon-btn.is-muted { color: var(--muted); background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
.pwa-install-btn { height: 40px; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); color: var(--brand); background: var(--brand-soft); animation: pwa-invite-pulse 2.4s ease-in-out infinite; }
.pwa-install-btn:hover { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.pwa-install-btn i { font-size: 13px; }
@keyframes pwa-invite-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 16%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
@media (max-width: 640px) {
  .pwa-install-btn span { display: none; }
  .pwa-install-btn { width: 40px; padding: 0; }
}
.notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); }
.profile-button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 3px 10px 3px 3px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; transition: background-color .15s ease, border-color .15s ease; }
.profile-button:hover { border-color: var(--line); background: var(--surface); }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: color-mix(in srgb, var(--brand) 15%, var(--surface)); color: var(--brand); font-size: 13px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-copy { min-width: 0; max-width: 170px; }
.profile-copy strong, .profile-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 13px; font-weight: 700; }
.profile-copy span { margin-top: 1px; color: var(--muted); font-size: 11.5px; }
.content { width: 100%; max-width: 1760px; margin-inline: auto; padding: 24px calc(28px + env(safe-area-inset-right)) calc(44px + env(safe-area-inset-bottom)) calc(28px + env(safe-area-inset-left)); }

.page-lead { margin-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 18px; }
.page-lead > div:first-child { min-width: 0; }
.page-lead h2 { margin: 0; font-size: var(--fs-h2); font-weight: 750; line-height: 1.15; letter-spacing: -.03em; }
.page-lead p { max-width: 78ch; margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin-bottom: 6px; color: var(--brand-2); font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }

/* Buttons: one primary action per area, quiet secondary ones around it. */
.btn {
  min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: inherit; cursor: pointer; font-size: 13.5px; font-weight: 650; line-height: 1.2; text-align: center;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn i { font-size: .95em; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-2); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-soft { border-color: var(--line); color: color-mix(in srgb, var(--ink) 90%, var(--surface)); box-shadow: var(--shadow-xs); }
.btn-soft:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--surface)); background: var(--surface-2); }
.btn-outline-primary { border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); color: var(--brand); background: var(--surface); }
.btn-outline-primary:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 24%, var(--line)); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; transform: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { padding: 18px; position: relative; overflow: hidden; }
.stat-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.stat-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.stat-icon i { font-size: 15px; }
.stat-icon i.fa-regular { font-size: 17px; }
.stat-icon.accent { background: var(--accent-soft); color: var(--accent); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-card small { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-value { margin: 12px 0 4px; font-size: var(--fs-stat); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.trend { font-size: 12px; font-weight: 650; color: var(--success); }
.trend.down { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; margin-bottom: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.card { min-width: 0; }
.card-head { min-height: 58px; padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: var(--fs-h3); font-weight: 700; letter-spacing: -.015em; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.card-link { color: var(--brand); font-size: 12.5px; font-weight: 700; }
.card-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.mini-chart { height: 244px; display: flex; align-items: stretch; gap: 14px; padding-top: 18px; }
.chart-y { width: 38px; padding: 3px 0 25px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 11px; text-align: right; }
.chart-plot { flex: 1; position: relative; display: flex; align-items: flex-end; justify-content: space-around; gap: 9px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #edf1ee 25%); }
.chart-col { height: 100%; min-width: 25px; max-width: 42px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.chart-bar { width: 100%; min-height: 7px; border-radius: 7px 7px 2px 2px; background: linear-gradient(to top, var(--brand), #61a082); position: relative; transition: height .35s ease; }
.chart-bar:hover { filter: brightness(1.08); }
.chart-bar::after { content: attr(data-label); position: absolute; top: -21px; left: 50%; transform: translateX(-50%); padding: 3px 5px; border-radius: 5px; background: #20382d; color: white; font-size: 11px; opacity: 0; pointer-events: none; transition: .15s; }
.chart-bar:hover::after { opacity: 1; }
.chart-label { min-height: 19px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.order-list { display: grid; gap: 8px; }
.order-row { padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.order-row:hover { border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); background: var(--row-hover); }
.order-source { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.order-source i { font-size: 14px; }
.order-main { min-width: 0; }
.order-main strong, .order-main span { display: block; }
.order-main strong { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-main span { margin-top: 3px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-meta { text-align: right; }
.order-meta strong { display: block; margin-bottom: 5px; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* Status badges: one shape everywhere, colour carries the meaning. The tints
   are mixed with --surface so they also sit right on the dark theme. */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: color-mix(in srgb, var(--ink) 72%, var(--muted)); font-size: 11.5px; font-weight: 700; line-height: 1; white-space: nowrap; text-transform: capitalize; }
.badge::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.badge-new, .badge-placed { background: color-mix(in srgb, #5d63ba 12%, var(--surface)); color: #5d63ba; }
.badge-accepted, .badge-confirmed, .badge-received, .badge-sent, .badge-delivery, .badge-cleaning { background: var(--info-soft); color: var(--info); }
.badge-preparing, .badge-occupied { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 85%, var(--ink)); }
.badge-ready, .badge-served, .badge-available, .badge-active, .badge-completed, .badge-paid, .badge-approved, .badge-clean, .badge-inspected { background: var(--success-soft); color: var(--success); }
.badge-generated, .badge-partial-ready, .badge-partially-paid, .badge-pending, .badge-needs-bill, .badge-dirty { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 85%, var(--ink)); }
.badge-cancelled, .badge-low, .badge-overdue, .badge-offline, .badge-inactive, .badge-not-generated, .badge-void, .badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-reserved, .badge-away { background: color-mix(in srgb, #8850b4 12%, var(--surface)); color: #8850b4; }
.badge-partially-seated { background: color-mix(in srgb, #2f6fa8 12%, var(--surface)); color: #2f6fa8; }
.badge-out-of-service { background: var(--surface-2); color: var(--muted); }
.badge-pickup { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }

/* --- Hotel dashboard room status board --------------------------------- */
.room-status-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.room-status-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.room-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.room-status-dot-available { background: var(--success); }
.room-status-dot-occupied { background: var(--warning); }
.room-status-dot-dirty { background: var(--danger); }
.room-status-dot-cleaning { background: var(--info); }
.room-status-dot-out_of_service { background: var(--muted); }

.room-status-grid { display: grid; grid-template-columns: repeat(auto-fill, 52px); gap: 6px; margin-bottom: 26px; }
.room-status-grid > .room-status-empty { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13.5px; }
.room-cell { aspect-ratio: 1 / 1; width: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 9px; text-decoration: none; color: #fff; position: relative; transition: transform .15s ease, box-shadow .15s ease, z-index 0s; }
.room-cell:hover, .room-cell:focus-visible { transform: scale(1.16); box-shadow: var(--shadow); z-index: 1; }
.room-cell-number { font-size: 13px; font-weight: 800; line-height: 1; }
.room-cell-cap { font-size: 11px; font-weight: 700; opacity: .9; display: inline-flex; align-items: center; gap: 2px; }
.room-cell-cap i { font-size: 11px; }

.room-cell-available { background: var(--success); animation: room-cell-breathe 3.2s ease-in-out infinite; }
.room-cell-occupied { background: var(--warning); }
.room-cell-occupied::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: room-cell-blink 1.6s ease-in-out infinite; }
.room-cell-dirty { background: var(--danger); }
.room-cell-cleaning { background: var(--info); animation: room-cell-blink 2.4s ease-in-out infinite; }
.room-cell-out_of_service { background: var(--muted); opacity: .5; }

@keyframes room-cell-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(35,136,92,.35); } 50% { box-shadow: 0 0 0 5px rgba(35,136,92,0); } }
@keyframes room-cell-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.table-wrap { width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { padding: 10px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color .12s ease; }
.data-table tbody tr:hover { background: var(--row-hover); }
.data-table td strong { font-weight: 700; }
/* Row buttons stay on one line; a wide table scrolls inside its own box
   (tablets) rather than stacking every button into a tall cell. */
@media (min-width: 761px) {
  .data-table .inline-actions, .data-table .row-actions { flex-wrap: nowrap; }
  .data-table td:last-child .btn { white-space: nowrap; }
}
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; flex: 0 0 auto; overflow: hidden; }
.cell-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --- Card-head inline filter form (date range etc.) ------------------ */
.card-head .filter-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-head .filter-toolbar .field { width: auto; height: 38px; padding: 0 10px; font-size: 12px; }
.card-head .filter-toolbar .btn-sm { height: 38px; }
@media (max-width: 700px) {
  .card-head { flex-direction: column; align-items: stretch; }
  .card-head .filter-toolbar { width: 100%; }
  .card-head .filter-toolbar .field { flex: 1; min-width: 0; }
}

/* --- Role access matrix ------------------------------------------------ */
.staff-access-card { margin: 18px 0; }
.access-matrix th:not(:first-child), .access-matrix td:not(:first-child) { text-align: center; }
.access-matrix th i { margin-right: 5px; }
.access-yes { color: var(--success, #1c7d50); font-size: 13px; }
.access-no { color: var(--muted); font-size: 12px; opacity: .45; }
.access-view { color: var(--info, #3975a8); font-size: 12px; }
.access-matrix-note { display: flex; align-items: flex-start; gap: 8px; margin: 14px 18px 4px; padding: 11px 13px; border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.5; }
.access-matrix-note i { margin-top: 1px; color: var(--brand); flex: 0 0 auto; }
.cell-copy { min-width: 0; }
.cell-copy strong, .cell-copy span { display: block; }
.cell-copy strong { font-size: 13px; font-weight: 700; }
.cell-copy span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 12%, transparent); }
.empty-state .empty-icon i { font-size: 20px; }
.empty-state strong { display: block; color: var(--ink); font-size: 14.5px; font-weight: 700; }
.empty-state span { display: block; max-width: 46ch; margin: 5px auto 0; font-size: 13px; line-height: 1.5; }
.empty-state .btn { margin-top: 14px; }
/* Loading placeholder shown in popups while their content is fetched. */
.empty-state.is-loading { display: grid; justify-items: center; gap: 12px; padding: 40px 20px; }
.empty-state.is-loading strong { color: var(--muted); font-size: 13px; font-weight: 600; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--brand) 16%, transparent); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { min-height: 60px; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-search { position: relative; min-width: 220px; flex: 1; }
.toolbar-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface); color: var(--ink); font-size: 13.5px; transition: border-color .15s ease, box-shadow .15s ease; }
.toolbar-search input:focus { border-color: color-mix(in srgb, var(--brand) 55%, var(--surface)); box-shadow: var(--ring); }
.toolbar-search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
/* Theme tokens, not fixed light colours, so fields stay readable in the
   dark "midnight" theme; the mixes match the old values in light themes. */
.field, .select { width: 100%; height: 42px; padding: 0 13px; border: 1px solid color-mix(in srgb, var(--ink) 15%, var(--surface)); border-radius: 10px; outline: 0; background: var(--surface); color: var(--ink); font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
.field:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--ink) 26%, var(--surface)); }
.field:focus, .select:focus, .textarea:focus { border-color: color-mix(in srgb, var(--brand) 55%, var(--surface)); box-shadow: var(--ring); }
.field::placeholder, .textarea::placeholder, .toolbar-search input::placeholder { color: color-mix(in srgb, var(--muted) 80%, var(--surface)); }
.field:disabled, .select:disabled, .textarea:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.select { padding-right: 34px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23808c86' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
.select[multiple], .select[size] { padding-right: 13px; background-image: none; height: auto; }
/* Referenced by popup/panel forms everywhere (role="alert" boxes and
   per-field error text) but never actually styled — every validation
   error in the app was rendering as plain unstyled text. */
.form-alert { padding: 10px 14px; border-radius: 10px; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line)); color: var(--danger); font-size: 13px; font-weight: 600; }
.form-alert:empty { display: none; }
.field-error, .field-errors { display: block; color: var(--danger); font-size: 12px; font-weight: 600; margin-top: 4px; }
.form-help { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.textarea { width: 100%; min-height: 92px; padding: 11px 13px; resize: vertical; border: 1px solid color-mix(in srgb, var(--ink) 15%, var(--surface)); border-radius: 10px; outline: 0; background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.5; transition: border-color .15s ease, box-shadow .15s ease; }
.filter-tabs { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab { min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; transition: background .15s ease, color .15s ease, transform .1s ease; -webkit-tap-highlight-color: transparent; }
.filter-tab.active { background: var(--surface-2); color: var(--brand); }
.filter-tab:active { transform: scale(.96); background: var(--surface-2); }
@media (hover: hover) {
  .filter-tab:hover { background: var(--surface-2); color: var(--ink); }
  .filter-tab.active:hover { color: var(--brand); }
}

.pos-layout { display: grid; grid-template-columns: minmax(0,1fr) 350px; gap: 18px; align-items: start; }
.menu-categories { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.menu-categories::-webkit-scrollbar { display: none; }
.menu-grid { padding: 16px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.menu-card { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; position: relative; transition: .17s; text-align: left; }
.menu-card:hover { transform: translateY(-2px); border-color: #abc4b6; box-shadow: 0 10px 20px rgba(24,50,37,.06); }
.menu-card.sold-out { opacity: .55; cursor: not-allowed; }
.menu-visual { height: 85px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, #f1f6f2, #e1ebe5); color: var(--brand); font-family: Georgia, serif; font-size: 31px; }
.menu-card:nth-child(3n+2) .menu-visual { background: linear-gradient(145deg, #fff4ec, #fce1d2); color: var(--accent); }
.menu-card:nth-child(3n+3) .menu-visual { background: linear-gradient(145deg, #fff8df, #f4e7b6); color: #8b6c24; }
.menu-card h4 { margin: 11px 0 4px; font-size: 13px; }
.menu-card p { margin: 0; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-price { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; color: var(--brand); font-size: 12px; font-weight: 850; }
.plus {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 38%, transparent);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.plus:hover { background: var(--brand-2); transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 45%, transparent); }
.plus:active { transform: scale(.92); box-shadow: 0 2px 6px color-mix(in srgb, var(--brand) 35%, transparent); }
.plus:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent); outline-offset: 2px; }
.plus[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.cart-panel { position: sticky; top: 92px; overflow: hidden; }
.cart-items { max-height: 320px; overflow: auto; padding: 8px 16px; }
.cart-line { padding: 11px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.cart-line strong { font-size: 12px; }
.cart-line small { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
.qty-btn:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.qty { min-width: 18px; text-align: center; font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-form { padding: 14px 16px; display: grid; gap: 9px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.cart-summary { padding: 14px 16px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.summary-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.summary-row.total { padding-top: 8px; border-top: 1px dashed var(--line); color: var(--ink); font-size: 14px; font-weight: 850; }

.kds-summary { display: flex; gap: 9px; margin-bottom: 16px; overflow-x: auto; }
.summary-chip { min-width: 116px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary-chip strong, .summary-chip span { display: block; }
.summary-chip strong { font-size: 16px; }
.summary-chip span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.kds-board { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; align-items: start; }
.ticket { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.ticket.urgent { border-color: #efb8b4; }
.ticket-head { padding: 13px 14px; display: flex; justify-content: space-between; gap: 9px; background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); border-bottom: 1px solid var(--line); }
.ticket.urgent .ticket-head { background: var(--danger-soft); }
.ticket-head strong { display: block; font-size: 12px; }
.ticket-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.ticket-time { font-size: 12px; font-weight: 850; color: var(--success); }
.ticket.urgent .ticket-time { color: var(--danger); }
.ticket-items { padding: 11px 14px; display: grid; gap: 8px; }
.ticket-item { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 8px; font-size: 11.5px; }
.ticket-item b { color: var(--brand); }
.modifier { grid-column: 2; margin-top: -4px; color: var(--accent); font-size: 11px; }
.ticket-note { margin: 0 14px 11px; padding: 8px 9px; border-radius: 8px; background: var(--warning-soft); color: #8b681d; font-size: 11px; }
.ticket-actions { padding: 11px 14px; border-top: 1px solid var(--line); display: flex; gap: 7px; }
.ticket-actions .btn { flex: 1; }

.inventory-meter { min-width: 100px; }
.meter-track { height: 6px; margin-top: 5px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.meter-fill { height: 100%; border-radius: inherit; background: var(--success); }
.meter-fill.low { background: var(--danger); }
.meter-fill.mid { background: var(--warning); }

.floor-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(285px,.6fr); gap: 18px; }
.floor-card { min-height: 550px; }
.floor-head { padding: 14px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.floor-map { min-height: 480px; padding: 25px; display: grid; grid-template-columns: repeat(4,1fr); gap: 19px; align-content: start; background-image: radial-gradient(#dfe6e1 1px, transparent 1px); background-size: 18px 18px; }
.cafe-table { aspect-ratio: 1; max-width: 118px; width: 100%; justify-self: center; border: 2px solid #cbd7d0; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface); cursor: pointer; box-shadow: 0 8px 15px rgba(27,50,38,.05); }
.cafe-table:hover { transform: translateY(-2px); }
.cafe-table.occupied { border-color: #e0b15b; background: var(--warning-soft); }
.cafe-table.reserved { border-color: #a98bc6; background: color-mix(in srgb, #8850b4 12%, var(--surface)); }
.cafe-table.cleaning { border-color: #739dbf; background: var(--info-soft); }
.cafe-table strong { font-size: 12px; }
.cafe-table span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.reservation-list { padding: 12px; display: grid; gap: 8px; max-height: 500px; overflow: auto; }
.reservation { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.reservation-top { display: flex; justify-content: space-between; gap: 8px; }
.reservation strong { font-size: 12px; }
.reservation small { color: var(--muted); font-size: 11px; }
.reservation p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.donut-wrap { padding: 15px 18px 18px; display: grid; grid-template-columns: 155px minmax(0,1fr); align-items: center; gap: 18px; }
.donut { width: 145px; height: 145px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) 0 52%, var(--accent) 52% 76%, #e7b74d 76% 91%, #d9e2dc 91%); position: relative; }
.donut::after { content: ""; width: 88px; height: 88px; border-radius: 50%; background: var(--surface); position: absolute; }
.donut-value { z-index: 1; text-align: center; }
.donut-value strong, .donut-value span { display: block; }
.donut-value strong { font-size: 20px; }
.donut-value span { color: var(--muted); font-size: 11px; }
.legend { display: grid; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }
.legend-row b { margin-left: auto; }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 18px; }
.settings-nav { padding: 9px; align-self: start; position: sticky; top: 92px; }
.settings-link { width: 100%; min-height: 40px; padding: 0 11px; border: 0; border-radius: 10px; display: flex; align-items: center; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.settings-link.active { background: var(--surface-2); color: var(--brand); }
.settings-section { display: none; }
.settings-section.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-group { display: grid; gap: 6px; align-content: start; } /* a taller neighbour (help text) must not push this field down */
.form-group.full { grid-column: 1 / -1; }
/* Same full-width span, but for any direct child of a .form-grid — not just
   .form-group labels. Covers section wrappers (e.g. a line-item table) and
   the trailing .form-actions/.form-alert rows that popup forms outside
   admin-menu/admin-settings (which define their own scoped .full rules)
   would otherwise render squeezed into a single grid column. */
.form-grid > .full { grid-column: 1 / -1; }

/* --- Modern image-upload widget (logo / staff photo / menu image) ----- */
.file-upload-field { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.file-upload-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px dashed #c9d5cd;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-2);
  color: var(--brand);
  font-size: 20px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.file-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-upload-preview-empty { color: var(--muted); }
.file-upload-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-upload-actions input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.file-upload-remove { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); font-size: 12px; font-weight: 700; cursor: pointer; }
.file-upload-remove input { accent-color: var(--danger); }
.form-label { color: color-mix(in srgb, var(--ink) 78%, var(--muted)); font-size: 12px; font-weight: 750; }
.help { color: var(--muted); font-size: 11px; line-height: 1.45; }
.switch-row { min-height: 58px; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.switch-row:last-child { border: 0; }
.switch-copy strong, .switch-copy span { display: block; }
.switch-copy strong { font-size: 12px; }
.switch-copy span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.switch { width: 39px; height: 22px; padding: 2px; border: 0; border-radius: 999px; background: #ccd6d0; cursor: pointer; transition: .2s; }
.switch::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: .2s; }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(17px); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(10,22,16,.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: backdrop-in .18s ease; }
.modal-backdrop.open { display: flex; }
.modal { width: min(640px,100%); max-height: calc(100dvh - 36px); overflow: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); animation: modal-pop .24s var(--ease) backwards; }
.modal::-webkit-scrollbar { display: none; }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.modal-head { position: relative; min-height: 60px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 2px 0 0; font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.modal-close { width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 18px; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.modal-close:hover { background: color-mix(in srgb, var(--ink) 10%, var(--surface)); color: var(--ink); }
.modal-close i { font-size: 15px; }
.modal-body { padding: 20px; }

.profile-photo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.profile-photo-row > div { min-width: 0; }
.profile-photo-row strong { display: block; font-size: 13px; }
.profile-photo-upload { position: relative; flex: 0 0 auto; width: 68px; height: 68px; cursor: pointer; }
.profile-photo-upload input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.profile-photo-preview { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; overflow: hidden; background: var(--brand); color: #fff; font-weight: 800; font-size: 20px; }
.profile-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-badge { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11.5px; border: 2px solid #fff; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: color-mix(in srgb, var(--surface-2) 35%, var(--surface)); }
.confirm-modal { width: min(440px, 100%); }
.confirm-modal .modal-head { border-bottom: 0; }
.confirm-modal .modal-body { padding: 0 20px 20px; }
.confirm-modal .modal-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.order-detail-head { padding: 15px; border-radius: 13px; background: var(--surface-2); display: flex; justify-content: space-between; gap: 12px; }
.order-detail-items { margin: 15px 0; display: grid; gap: 10px; }
.detail-line { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; gap: 8px; font-size: 12px; }

.toast-stack { position: fixed; z-index: 200; right: calc(20px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); width: min(360px,calc(100vw - 40px)); display: grid; gap: 9px; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); animation: toast-in .25s ease; }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast strong { display: block; font-size: 13px; }
.toast span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.sidebar-overlay { display: none; }
body.modal-open { overflow: hidden; }
body.sidebar-open { overflow: hidden; }
@media (min-width: 1025px) { body.sidebar-open { overflow: auto; } }
.mobile-only { display: none; }

/* --- Mobile app-style bottom tab bar (phones only) ------------------- */
.mobile-tabbar { display: none; }
@media (max-width: 700px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    z-index: 40;
    left: 0; right: 0; bottom: 0;
    padding: 5px calc(6px + env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    gap: 2px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(20,40,30,.07);
  }
  .tabbar-item {
    flex: 1; min-width: 0; min-height: 54px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; border-radius: 14px; background: transparent; cursor: pointer;
    color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: -.01em;
    white-space: nowrap;
  }
  .tabbar-item span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tabbar-icon { position: relative; width: 48px; height: 28px; display: grid; place-items: center; border-radius: 999px; transition: background-color .2s var(--ease), color .2s ease; }
  .tabbar-icon i { font-size: 17px; }
  .tabbar-item:active .tabbar-icon { transform: scale(.94); }
  .tabbar-item.active { color: var(--brand); font-weight: 750; }
  .tabbar-item.active .tabbar-icon { background: color-mix(in srgb, var(--brand) 13%, var(--surface)); color: var(--brand); }
  .tabbar-icon .nav-count { position: absolute; top: -4px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--surface); font-size: 10.5px; }
  body[data-page="pos"] .mobile-tabbar { display: none; }
}
.text-right { text-align: right; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.nowrap { white-space: nowrap; }
.mt-18 { margin-top: 18px; }
.w-full { width: 100%; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kds-board { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .menu-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-copy { display: none; }
}

/* --- Desktop: the sidebar can fold into an icon rail ------------------
   Toggled by the topbar menu button (dashboard.js) and remembered in the
   `chuski_sidebar` cookie, so the server renders `.is-rail` straight away
   and the page never flashes the wide sidebar first. Labels become hover
   tooltips; a group's links open as a flyout beside the rail. */
@media (min-width: 1025px) {
  .icon-btn.menu-toggle { display: grid; }
  .app-shell.is-rail { --sidebar: 76px; }
  .main-shell { transition: margin-left .28s var(--ease); }
  .is-rail .sidebar { padding-left: 12px; padding-right: 12px; }
  .is-rail .brand { justify-content: center; padding: 0 0 14px; }
  .is-rail .brand-copy, .is-rail .nav-label, .is-rail .nav-caret, .is-rail .branch-switch-form,
  .is-rail .shift-row > div, .is-rail .shift-row .live-dot, .is-rail .shift-actions span { display: none; }
  .is-rail .nav-scroll { overflow-x: hidden; }
  .is-rail .nav-item { justify-content: center; min-height: 42px; padding: 8px; }
  .is-rail .nav-item.active::before { top: 11px; bottom: 11px; }
  .is-rail .nav-item > .nav-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--sidebar-bg); font-size: 10.5px; }
  .is-rail .nav-item > span:nth-child(2):not(.nav-count) {
    position: fixed; left: calc(var(--sidebar) + 4px); z-index: 70;
    padding: 7px 11px; border-radius: 9px; background: #0e1c15; color: #fff;
    font-size: 12.5px; font-weight: 650; white-space: nowrap; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s ease, visibility 0s linear .12s;
  }
  .is-rail a.nav-item:hover > span:nth-child(2), .is-rail a.nav-item:focus-visible > span:nth-child(2) { opacity: 1; visibility: visible; transition: opacity .12s ease; }
  .is-rail .nav-group > summary > span:nth-child(2) { display: none; }
  .is-rail .nav-group > .nav-sub {
    position: fixed; left: calc(var(--sidebar) - 8px); z-index: 70;
    width: 236px; margin: -42px 0 0; padding: 8px; border: 0; border-left: 12px solid transparent;
    border-radius: 0 14px 14px 0; background: var(--sidebar-bg) padding-box;
    box-shadow: 18px 18px 44px rgba(6, 22, 14, .3);
    opacity: 0; visibility: hidden; transform: translateX(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility 0s linear .2s;
    animation: none;
  }
  .is-rail .nav-group > .nav-sub::before {
    content: attr(data-title); display: block; padding: 4px 10px 8px; color: var(--sidebar-fg-muted);
    font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
  }
  .is-rail .nav-group:hover > .nav-sub, .is-rail .nav-group:focus-within > .nav-sub { opacity: 1; visibility: visible; transform: none; transition: opacity .14s ease, transform .14s ease; }
  .is-rail .nav-subitem.active::before { display: none; }
  .is-rail .shift-card { padding: 8px 6px; display: grid; justify-items: center; }
  .is-rail .shift-row { justify-content: center; }
  .is-rail .shift-actions { grid-template-columns: 1fr; width: 100%; }
}

@media (max-width: 1024px) {
  :root { --sidebar: 272px; }
  /* Off-canvas drawer: no shadow while it's parked off screen (it used to
     bleed a grey band down the left edge), and hidden from keyboard/screen
     reader users until it is opened. */
  .sidebar { width: min(var(--sidebar), 86vw); transform: translateX(-102%); visibility: hidden; transition: transform .28s var(--ease), visibility 0s linear .28s; }
  body.sidebar-open .sidebar { transform: translateX(0); visibility: visible; box-shadow: 18px 0 45px rgba(8,28,18,.22); transition: transform .28s var(--ease); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 45; border: 0; background: rgba(10,22,16,.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .main-shell { margin-left: 0; }
  .icon-btn.menu-toggle { display: grid; }
  .page-heading { min-width: 0; }
  .global-search { max-width: none; }
  .nav-item { min-height: 44px; }
  .nav-subitem { min-height: 40px; }
}

@media (max-width: 900px) {
  .pos-layout, .floor-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav-item, .btn, .btn-sm, .icon-btn, .modal-close, .filter-tab, .choice, .qty-btn,
  .payment-method, .settings-link, .switch, .cafe-table, .menu-card { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .btn-icon { width: 44px; }
  .qty-btn { width: 44px; height: 44px; }
  .profile-button { min-height: 44px; }
  .switch { width: 48px; height: 44px; padding: 3px; display: flex; align-items: center; flex: 0 0 auto; }
  .switch::after { width: 22px; height: 22px; }
  .switch.on::after { transform: translateX(20px); }
  .plus { width: 32px; height: 32px; }
  .field, .select, .textarea, .toolbar-search input, .global-search input,
  input, select, textarea { font-size: 16px; }
  .field, .select, .toolbar-search input, .global-search input { min-height: 44px; height: 44px; }
  .textarea { min-height: 96px; }
  .filter-tabs, .menu-categories, .workflow-strip, .kds-summary { overscroll-behavior-inline: contain; }
  .data-table { min-width: 680px; }
}

@media (max-width: 760px) {
  .table-wrap { overflow: visible; }
  .data-table { display: block; min-width: 0; }
  .data-table thead { display: none; }
  .data-table tbody { display: block; width: 100%; }
  .data-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .data-table tbody tr:hover { background: var(--surface); }
  .data-table td { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 6px 0; border: 0; font-size: 13.5px; overflow-wrap: anywhere; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
  .data-table td:first-child { grid-column: 1 / -1; font-size: 14.5px; }
  .data-table td:first-child::before { display: none; }
  .data-table td, .data-table td.num { align-items: flex-start; text-align: left; }
  /* The actions cell runs along the bottom of each card. */
  .data-table td:last-child:not(:first-child):has(.btn, .inline-actions, .row-actions, form) {
    grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line);
  }
  .data-table td:last-child:not(:first-child):has(.btn, .inline-actions, .row-actions, form)::before { display: none; }
  .data-table td:last-child .inline-actions { width: 100%; }
  .data-table td:last-child .inline-actions > .btn, .data-table td:last-child > .btn { flex: 1 1 0; min-height: 42px; }
  .data-table td[data-label=""]::before, .data-table td:not([data-label])::before { display: none; }
  .data-table td[colspan] { grid-column: 1 / -1; }
  .data-table .row-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 8px; justify-content: stretch; margin-top: 6px; }
  .data-table .row-actions form, .data-table .row-actions .btn, .data-table .row-actions button { width: 100%; }
  .data-table .row-actions .btn { min-height: 44px; }
  .card-head { flex-wrap: wrap; row-gap: 6px; }
  .card-head .badge { margin-left: auto; }
}

@media (max-width: 700px) {
  :root { --topbar-h: 58px; }
  .topbar {
    height: auto;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
    gap: 8px;
  }
  .topbar .icon-btn { width: 44px; height: 44px; border-color: transparent; background: transparent; }
  .topbar .icon-btn:hover { background: var(--surface-2); }
  .content { padding: 16px calc(14px + env(safe-area-inset-right)) calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
  .page-heading p, .global-search, .top-actions .icon-btn { display: none; }
  .page-heading { flex: 1; }
  /* Phones get an app bar: the page's own heading moves up into the topbar
     (dashboard.js copies its text there) instead of repeating below it. */
  .main-shell:has(.content .page-lead h2) .topbar .page-heading { display: block; }
  .main-shell:has(.content .page-lead h2) .topbar-context { display: none; }
  .content .page-lead h2, .content .page-lead .eyebrow {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .content .page-lead:not(:has(.page-actions > *)) { margin-bottom: 0; }
  .profile-button { padding: 0; }
  .page-lead { align-items: stretch; flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .btn { flex: 1; }
  .stats-grid, .grid-equal { grid-template-columns: 1fr; }
  .stat-card { padding: 15px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  .menu-grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 11px; gap: 9px; }
  .menu-visual { height: 70px; }
  .kds-board { grid-template-columns: 1fr; }
  .floor-map { grid-template-columns: repeat(3,1fr); padding: 16px; gap: 12px; min-height: 400px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-link { min-width: max-content; width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .form-grid > .full { grid-column: auto; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .mobile-only { display: initial; }
  .toast-stack { right: calc(12px + env(safe-area-inset-right)); bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  body[data-page="pos"] .toast-stack { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-backdrop { padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
  .modal { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 18px; }
  .topbar-date { display: none; }
}

/* Phones: every dialog becomes a bottom sheet that slides up, with its
   actions at thumb height. */
@media (max-width: 560px) {
  .modal-backdrop { align-items: flex-end; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
  .modal-backdrop .modal { width: 100%; max-width: none; max-height: calc(100dvh - 10px - env(safe-area-inset-top)); margin-top: auto; border-radius: 22px 22px 0 0; border-bottom: 0; animation: sheet-up .28s var(--ease) backwards; }
  .modal-backdrop .modal > .modal-head:first-child { position: sticky; top: 0; z-index: 3; padding-top: 18px; background: var(--surface); }
  .modal-backdrop .modal > .modal-head:first-child::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 16%, transparent); }
  .modal-backdrop .modal > .modal-foot:last-child { position: sticky; bottom: 0; z-index: 3; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-backdrop .modal-body { padding: 16px; }
  .modal-foot .btn { flex: 1; }
}

@media (max-width: 430px) {
  .main-shell:has(.content .page-lead h2) .topbar-context { display: none; }
  .page-heading h1 { font-size: 17px; }
  .profile-button { display: none; }
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .menu-card { padding: 9px; }
  .menu-card p { display: none; }
  .floor-map { grid-template-columns: repeat(2,1fr); }
  .toolbar { align-items: stretch; }
  .toolbar-search { min-width: 100%; }
  .pwa-status { gap: 3px; }
  .sync-indicator { width: 19px; min-height: 28px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .sync-indicator > span { display: none; }
  .page-heading { overflow: hidden; }
  .page-heading h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 350px) {
  .topbar { padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); gap: 7px; }
  .content { padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  .page-heading h1 { font-size: 15px; }
  .menu-grid { grid-template-columns: 1fr; }
  .floor-map { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px; gap: 8px; }
}

@media (hover: none) {
  .btn:hover, .menu-card:hover, .cafe-table:hover, .role-action-card:hover, .role-gate-card:hover { transform: none; }
}

@media (pointer: coarse) {
  .btn, .btn-sm, .btn-icon { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .nav-item, .filter-tab, .choice, .qty-btn, .modal-close, .payment-method,
  .settings-link, .switch, .cafe-table, .menu-card, .plus, .setup-table,
  .setup-service, .custom-option, .table-check-grid label, .status-check span,
  .role-switch, .card-link { min-height: 44px; }
  .plus { width: 34px; height: 34px; }
  .qty-btn { width: 40px; height: 40px; }
  .switch { width: 48px; height: 44px; padding: 3px; display: flex; align-items: center; flex: 0 0 auto; }
  .switch::after { width: 22px; height: 22px; }
  .switch.on::after { transform: translateX(20px); }
  .profile-button { min-height: 44px; }
  .field, .select, .textarea, .toolbar-search input, .global-search input,
  input, select, textarea { font-size: 16px; }
  .field, .select, .toolbar-search input, .global-search input { min-height: 44px; height: 44px; }
  .textarea { min-height: 96px; }
  .filter-tabs, .menu-categories, .workflow-strip, .kds-summary { overscroll-behavior-inline: contain; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ Charts (admin analytics) ============ */
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.chart-card { min-width: 0; }
section.chart-card { margin-bottom: 18px; }
.chart-wide { grid-column: span 2; }
.chart-body { min-height: 250px; display: flex; align-items: stretch; }
.chart-box { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-total {
  align-self: flex-start; min-height: 28px; padding: 0 11px;
  display: inline-flex; align-items: center;
  border-radius: 999px; background: var(--surface-2); color: var(--brand);
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}
.chart-empty { padding: 42px 16px; flex: 1; display: grid; place-items: center; }

.bars-plot {
  flex: 1; min-height: 210px; padding: 6px 4px 0;
  display: flex; align-items: flex-end; gap: 6px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #edf1ee 25%);
}
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.bar-fill {
  width: min(100%, 42px); border-radius: 8px 8px 2px 2px;
  background: linear-gradient(to top, var(--brand), #5c9a7e);
  position: relative; transform-origin: bottom;
  animation: chart-grow .55s cubic-bezier(.25, .7, .3, 1) backwards;
}
.bar-fill:focus-visible { outline: 3px solid rgba(36, 92, 69, .3); outline-offset: 2px; }
.bar-fill:hover { filter: brightness(1.07); }
.bar-tip {
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  z-index: 2; padding: 4px 8px; border-radius: 7px;
  background: #20382d; color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: .15s ease;
  box-shadow: 0 8px 18px rgba(20, 40, 30, .2);
}
.bar-tip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #20382d;
}
.bar-col:hover .bar-tip, .bar-fill:focus-visible .bar-tip { opacity: 1; }
.bar-x { min-height: 15px; max-width: 100%; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes chart-grow { from { transform: scaleY(0); } }

.chart-donut { width: min(150px, 100%); }
.donut-wrap { padding: 10px 0 0; }
.donut-legend { gap: 9px; }
.legend-row b { margin-left: auto; text-align: right; font-size: 11.5px; white-space: nowrap; }
.legend-row b small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }

.hbar-list { display: grid; gap: 14px; padding: 3px 0; }
.hbar-row { display: grid; gap: 7px; }
.hbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hbar-top span { font-size: 12px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-top b { font-size: 12px; font-weight: 850; text-align: right; white-space: nowrap; }
.hbar-top small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.hbar-track { height: 7px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.hbar-fill {
  display: block; height: 100%; border-radius: inherit;
  background: var(--hbar-color, var(--brand));
  transform-origin: left; transform: scaleX(0);
  animation: chart-grow-x .6s cubic-bezier(.25, .7, .3, 1) forwards;
}
@keyframes chart-grow-x { to { transform: scaleX(1); } }

@media (max-width: 1180px) {
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-wide { grid-column: auto; }
  .chart-body { min-height: 220px; }
  .bars-plot { min-height: 170px; }
  .bar-fill { width: min(100%, 34px); }
}

/* ============ Charts (admin analytics) end ============ */

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .btn { display: none !important; }
  html, body { width: auto; min-width: 0; overflow: visible; background: #fff; }
  .main-shell { margin: 0; }
  .content { padding: 0; }
  .card, .stat-card { box-shadow: none; }
  /* Long tables flow across pages; only small blocks stay whole. */
  .stat-card, .kv, .data-table tr { break-inside: avoid; }
  :root, html, body { background: #fff !important; }
  .print-page-head { display: flex !important; }
  body.modal-open #dashboardContent > *:not(.modal-backdrop) { display: none !important; }
  .modal-backdrop:not(.open) { display: none !important; }
  .modal-backdrop.open { position: static; background: none; padding: 0; }
  .modal-backdrop.open .modal { position: static; width: auto; max-height: none; box-shadow: none; }
}

/* Reports: Sales / Staff Performance / Ledger share one tab bar. */
.reports-tabs { margin: 0 0 18px; }
.reports-tabs .filter-tab { display: inline-flex; align-items: center; gap: 7px; }

/* Section tabs (Store sections, Reports) as one segmented control. */
.filter-tabs.store-subnav, .filter-tabs.reports-tabs {
  width: fit-content; max-width: 100%; padding: 4px; gap: 4px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
}
.filter-tabs.store-subnav .filter-tab, .filter-tabs.reports-tabs .filter-tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 12px;
}
.filter-tabs.store-subnav .filter-tab.active, .filter-tabs.reports-tabs .filter-tab.active {
  background: var(--brand); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 25%, transparent);
}
.filter-tabs.reports-tabs + .filter-tabs.store-subnav { margin-top: -6px; box-shadow: none; }

/* --- Phones: keep the page to what staff act on ----------------------- */
/* Page intros and stat footnotes help on big screens; on a phone they push
   the actual list below the fold. Stats sit two to a row, compact. */
@media (max-width: 700px) {
  .page-lead p { display: none; }
  .page-lead { margin-bottom: 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 12px 13px; }
  .stat-card .trend, .stat-card .stat-fill-bar, .stat-card .stat-mini-chart { display: none; }
  .stat-card .stat-value { margin: 8px 0 0; font-size: 21px; }
  .stat-card .stat-icon { width: 32px; height: 32px; border-radius: 10px; }
  .stat-card .stat-icon i { font-size: 13px; }
}

