/* ==========================================================================
   Mr Restaurant POS — app stylesheet
   Hand-written, no preprocessor, no build step. Uses CSS custom properties
   so the whole app re-themes from the settings page.
   ========================================================================== */

:root {
  /* ---- brand palette -------------------------------------------------
     Vivid, but not garish: a warm orange for action, a cooler spectrum for
     the charts and the categories so every number has its own colour. */
  --accent: #ea580c;
  --accent-600: #c2410c;
  --accent-soft: #fff2e8;

  --ink: #171a21;
  --ink-2: #414a5c;
  --ink-3: #6c7689;
  --ink-4: #9aa3b4;

  --bg: #f6f7fb;
  --panel: #ffffff;
  --line: #e7e9f0;
  --line-strong: #d3d7e3;

  --ok: #059669;
  --ok-soft: #e7faf3;
  --warn: #d97706;
  --warn-soft: #fff7e6;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #eaf1ff;
  --violet: #7c3aed;
  --violet-soft: #f2ecfe;
  --pink: #db2777;
  --pink-soft: #fdecf5;
  --teal: #0d9488;
  --teal-soft: #e4f8f6;

  /* Chart + category spectrum. One colour per series, in this order, so a
     report's bars, dots and legends always line up. */
  --c1: #ea580c;
  --c2: #2563eb;
  --c3: #059669;
  --c4: #7c3aed;
  --c5: #db2777;
  --c6: #0891b2;
  --c7: #d97706;
  --c8: #4f46e5;

  /* Gradients used by the rail, the till header and the stat cards. */
  --grad-brand: linear-gradient(150deg, #f97316 0%, #ea580c 42%, #c026d3 100%);
  --grad-cool: linear-gradient(140deg, #2563eb 0%, #7c3aed 100%);
  --grad-mint: linear-gradient(140deg, #059669 0%, #0d9488 100%);
  --grad-sun: linear-gradient(140deg, #f59e0b 0%, #ea580c 100%);
  --grad-berry: linear-gradient(140deg, #db2777 0%, #7c3aed 100%);
  --grad-slate: linear-gradient(140deg, #334155 0%, #0f172a 100%);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(23, 26, 33, .05), 0 1px 3px rgba(23, 26, 33, .07);
  --shadow: 0 2px 8px rgba(23, 26, 33, .07), 0 12px 28px -10px rgba(23, 26, 33, .16);
  --shadow-lg: 0 20px 52px -14px rgba(23, 26, 33, .30);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --tap: 48px;         /* minimum touch target */
  --rail: 232px;       /* sidebar width */
  --zoom: 1;
}

[data-theme="dark"] {
  --ink: #eef1f7;
  --ink-2: #c4cbd8;
  --ink-3: #94a0b4;
  --ink-4: #6b7688;
  --bg: #0c1017;
  --panel: #151b24;
  --line: #232c38;
  --line-strong: #33404f;
  --accent-soft: #331a09;
  --ok-soft: #06281f;
  --warn-soft: #2e2006;
  --danger-soft: #2c1111;
  --info-soft: #0d1b33;
  --violet-soft: #1e1233;
  --pink-soft: #2c0f20;
  --teal-soft: #062825;
  --c1: #fb923c;
  --c2: #60a5fa;
  --c3: #34d399;
  --c4: #a78bfa;
  --c5: #f472b6;
  --c6: #22d3ee;
  --c7: #fbbf24;
  --c8: #818cf8;
  --grad-brand: linear-gradient(150deg, #ea580c 0%, #c026d3 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px -10px rgba(0,0,0,.6);
  --shadow-lg: 0 20px 52px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: calc(15px * var(--zoom));
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
small, .small { font-size: .82em; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ----------------------------------------------------------- layout ---- */

/* ---------------------------------------------------------------- shell ---
   The sidebar is a fixed column, not a sticky element inside the page flow.
   Sticky breaks the moment anything above it gets its own scroll container
   (a browser zoom, an extension, a wide table) and then the whole rail slides
   up with the page. Fixed height + a single scrolling content pane cannot do
   that: the rail has no scroll of its own to take part in.

   Layout: one viewport-tall row, split into rail | main. Only .content
   scrolls. */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;   /* the scrolling happens inside .content, never on <html> */
}

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--grad-slate);
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  /* Exactly one viewport tall, whatever the parent is doing. */
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;         /* lets .rail-nav shrink and scroll instead of pushing */
  z-index: 40;
  /* Inside the fixed shell this is a no-op: the rail already fills a column
     that never scrolls. It is kept as a belt-and-braces measure for the case
     where a host stylesheet pushes .app back into normal flow, which is the
     situation that used to make the rail slide up the page. */
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.rail-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(234, 88, 12, .9);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
  flex: 0 0 auto;
}
.rail-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.rail-shop { font-weight: 650; font-size: .95rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.rail-role { font-size: .72rem; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .06em; }

.rail-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 8px 20px; }
.rail-scrim { display: none; }
.rail-group { margin: 14px 0 4px; padding: 0 10px; font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.42); font-weight: 700; }

.rail a.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.74);
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  min-height: 42px;
  transition: background .14s ease, color .14s ease;
}
.rail a.nav:hover { background: rgba(255,255,255,.09); text-decoration: none; color: #fff; }
.rail a.nav.active {
  background: var(--grad-brand);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 8px 20px -10px rgba(234, 88, 12, .95);
}
.rail a.nav .ico { font-size: 1.05rem; width: 20px; text-align: center; flex: 0 0 20px; }
.rail a.nav .badge { margin-left: auto; }

.rail-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.10); }
.rail-foot .btn-ghost { --btn-fg: rgba(255,255,255,.8); }
.rail-foot .btn-ghost:hover { background: rgba(255,255,255,.10); color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.topbar {
  height: 60px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  flex: 0 0 auto;        /* never shrinks; stays put while .content scrolls */
  position: relative;
  z-index: 30;
}
.topbar h1 { font-size: 1.06rem; margin: 0; }
.topbar .spacer { flex: 1; }

/* The one scrolling pane. overscroll-behavior stops the page behind it from
   rubber-banding on a trackpad and taking the rail with it. */
.content {
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.content.narrow { max-width: 860px; }
.content.wide { padding: 14px; }

/* ------------------------------------------------------------ buttons -- */

.btn {
  --btn-bg: var(--panel);
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none !important;
  transition: filter .12s ease, transform .06s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary { --btn-bg: var(--accent); --btn-fg: #fff; --btn-line: var(--accent); }
.btn-dark    { --btn-bg: var(--ink); --btn-fg: var(--panel); --btn-line: var(--ink); }
.btn-ok      { --btn-bg: var(--ok); --btn-fg: #fff; --btn-line: var(--ok); }
.btn-danger  { --btn-bg: var(--danger); --btn-fg: #fff; --btn-line: var(--danger); }
.btn-ghost   { --btn-bg: transparent; --btn-line: transparent; --btn-fg: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-soft    { --btn-bg: var(--accent-soft); --btn-fg: var(--accent); --btn-line: transparent; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: .84rem; border-radius: 7px; }
.btn-lg { min-height: 56px; font-size: 1.05rem; padding: 0 22px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ------------------------------------------------------------- panels -- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--r) var(--r); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.auto-lg { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* -------------------------------------------------------------- stats -- */

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; }
.stat .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--ink-3); }
.stat.accent { border-left: 3px solid var(--accent); }
.stat .trend-up { color: var(--ok); }
.stat .trend-down { color: var(--danger); }

/* Coloured stat tiles. A tinted left edge plus a soft wash of the same hue —
   enough colour to read at a glance, still calm enough to sit behind numbers. */
.stat.c-blue   { border-left: 3px solid var(--c2); background: linear-gradient(180deg, color-mix(in srgb, var(--c2) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-green  { border-left: 3px solid var(--c3); background: linear-gradient(180deg, color-mix(in srgb, var(--c3) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-violet { border-left: 3px solid var(--c4); background: linear-gradient(180deg, color-mix(in srgb, var(--c4) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-pink   { border-left: 3px solid var(--c5); background: linear-gradient(180deg, color-mix(in srgb, var(--c5) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-teal   { border-left: 3px solid var(--c6); background: linear-gradient(180deg, color-mix(in srgb, var(--c6) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-amber  { border-left: 3px solid var(--c7); background: linear-gradient(180deg, color-mix(in srgb, var(--c7) 8%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-indigo { border-left: 3px solid var(--c8); background: linear-gradient(180deg, color-mix(in srgb, var(--c8) 7%, var(--panel)) 0%, var(--panel) 68%); }
.stat.c-orange { border-left: 3px solid var(--c1); background: linear-gradient(180deg, color-mix(in srgb, var(--c1) 8%, var(--panel)) 0%, var(--panel) 68%); }

.stat.c-blue .value   { color: var(--c2); }
.stat.c-green .value  { color: var(--c3); }
.stat.c-violet .value { color: var(--c4); }
.stat.c-pink .value   { color: var(--c5); }
.stat.c-teal .value   { color: var(--c6); }
.stat.c-amber .value  { color: var(--c7); }
.stat.c-indigo .value { color: var(--c8); }
.stat.c-orange .value { color: var(--c1); }

/* Hero stat: a filled gradient card, for the one number that matters most. */
.stat.hero {
  background: var(--grad-brand);
  border: 0;
  color: #fff;
  box-shadow: 0 14px 32px -16px rgba(234, 88, 12, .85);
}
.stat.hero .label, .stat.hero .sub { color: rgba(255,255,255,.82); }
.stat.hero .value { color: #fff; }

/* -------------------------------------------------------------- forms -- */

label.field { display: block; margin-bottom: 12px; }
label.field > span.lbl {
  display: block;
  font-size: .8rem;
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 5px;
  letter-spacing: .01em;
}

input[type=text], input[type=password], input[type=number], input[type=email],
input[type=tel], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea { min-height: 80px; resize: vertical; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; vertical-align: -3px; }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input[readonly] { background: var(--bg); color: var(--ink-2); }

.check { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; cursor: pointer; }
.check input { margin-top: 2px; flex: 0 0 auto; }
.check .txt { font-size: .9rem; }
.check .txt small { display: block; color: var(--ink-3); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }

.field-row { display: flex; gap: 8px; align-items: center; }
.field-row > input { flex: 1; }

/* ------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--bg); }
table.data.compact td, table.data.compact th { padding: 6px 10px; }

/* --------------------------------------------------------------- bits -- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .01em;
  background: var(--bg);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.flash {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: .9rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty .big { font-size: 2rem; margin-bottom: 8px; opacity: .35; }

.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  gap: 2px;
}
.seg button, .seg a {
  border: 0; background: transparent; font: inherit; font-weight: 600; font-size: .86rem;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; color: var(--ink-3);
  min-height: 38px; display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on, .seg a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; font-size: .9rem; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; text-decoration: none !important; white-space: nowrap;
}
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------- POS layout -- */

.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: 1fr;
  gap: 0;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  margin: -20px;
}
.pos-left { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pos-right {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pos-tools { display: flex; gap: 8px; padding: 10px 12px; align-items: center; border-bottom: 1px solid var(--line); background: var(--panel); }
.pos-search { flex: 1; position: relative; }
.pos-search input { min-height: 44px; padding-left: 36px; }
.pos-search .mag { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-4); }

.cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 12px 10px;
  background: var(--panel);
  scrollbar-width: thin;
  /* Wrap on a narrow counter screen: a horizontal scroller hides categories
     past the right edge, and nobody scrolls a till sideways. */
}
@media (max-width: 700px) { .cats { flex-wrap: wrap; overflow-x: visible; } }
.cats button {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel); font: inherit; font-weight: 600;
  font-size: .86rem; color: var(--ink-2); cursor: pointer;
}
.cats button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.prod-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  /* max-content is load-bearing: inside a scrolling grid Chrome otherwise
     measures rows against the visible area and squashes the tiles. */
  grid-auto-rows: max-content;
  gap: 10px;
  align-content: start;
  align-items: start;
  background: var(--bg);
}

/* Product tile.
   Plain block flow on purpose: a fixed-height image box plus a text block
   below it. Flex/grid inside the tile collapses badly once the parent grid
   stretches its rows, and this has to look identical on every till. */
.prod {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  transition: box-shadow .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.prod:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.prod .thumb {
  display: block;
  height: 96px;
  background: var(--bg);
  text-align: center;
  line-height: 96px;
  font-size: 1.7rem;
  color: var(--ink-4);
  overflow: hidden;
}
.prod .thumb img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
}
.prod .meta { padding: 8px 10px 10px; }
.prod .nm {
  font-weight: 650;
  font-size: .86rem;
  line-height: 1.25;
  height: 2.5em;
  overflow: hidden;
}
.prod .pr {
  font-weight: 700;
  color: var(--accent);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}
.prod .pr small { color: var(--ink-4); font-weight: 600; font-size: .72rem; }
.prod.out { opacity: .45; pointer-events: none; }

/* Roomy tills get a bigger photo; the text block below it stays the same. */
@media (min-width: 1600px) {
  .prod .thumb, .prod .thumb img { height: 118px; }
  .prod .thumb { line-height: 118px; }
}

.cart { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cart-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.cart-head .title { font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 6px; min-height: 80px; }
.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  padding: 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.cart-line:hover { background: var(--bg); }
.cart-line .nm { font-weight: 600; font-size: .9rem; }
.cart-line .sub { font-size: .76rem; color: var(--ink-3); }
.cart-line .qty { display: flex; align-items: center; gap: 4px; }
.cart-line .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.qbtn {
  width: 30px; height: 30px; min-height: 30px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: var(--panel); font-weight: 700;
  cursor: pointer; font-size: .95rem; line-height: 1; display: grid; place-items: center; color: var(--ink);
}
.qbtn:hover { background: var(--bg); }

.cart-foot { border-top: 1px solid var(--line); padding: 12px 14px; background: var(--panel); }
.tot-row { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; padding: 2px 0; }
.tot-row .v { font-variant-numeric: tabular-nums; }
.tot-row.grand { font-size: 1.25rem; font-weight: 800; padding-top: 6px; }
.tot-row.grand .v { color: var(--accent); }
.cart-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }

/* ---------------------------------------------------------- keypad ----- */

.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.keypad button {
  min-height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font: inherit; font-size: 1.15rem; font-weight: 650;
  cursor: pointer; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.keypad button:hover { background: var(--bg); }
.keypad button:active { background: var(--accent-soft); }
.keypad button.wide { grid-column: span 2; }
.keypad button.fn { font-size: .9rem; font-weight: 700; background: var(--bg); }
.keypad button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }

.numeric-display {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  text-align: right;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------- tables grid -- */

.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tbl {
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  background: var(--panel);
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-height: 108px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.tbl:hover { border-color: var(--accent); }
.tbl .nm { font-weight: 700; font-size: 1.05rem; }
.tbl .seats { font-size: .76rem; color: var(--ink-3); }
.tbl .st { font-size: .76rem; font-weight: 700; }
.tbl.free { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.tbl.busy { background: var(--warn-soft); border-color: var(--warn); }
.tbl.busy .st { color: var(--warn); }
.tbl .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------- KDS board ---- */

.kds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  align-content: start;
}
.ticket {
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.ticket.warn { border-color: var(--warn); }
.ticket.late { border-color: var(--danger); }
.ticket .tk-head {
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.ticket.warn .tk-head { background: var(--warn-soft); }
.ticket.late .tk-head { background: var(--danger-soft); }
.ticket .tk-no { font-weight: 800; font-size: 1.05rem; }
.ticket .tk-age { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket.warn .tk-age { color: var(--warn); }
.ticket.late .tk-age { color: var(--danger); }
.ticket .tk-body { padding: 10px 12px; flex: 1; }
.ticket .tk-item { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.ticket .tk-item:last-child { border-bottom: 0; }
.ticket .tk-qty { font-weight: 800; min-width: 26px; }
.ticket .tk-nm { flex: 1; font-weight: 600; }
.ticket .tk-add { font-size: .78rem; color: var(--ink-3); }
.ticket .tk-note { font-size: .8rem; font-weight: 700; color: var(--warn); }
.ticket.done .tk-item { text-decoration: line-through; opacity: .55; }
.ticket .tk-foot { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; gap: 6px; }
.ticket .tk-foot .btn { flex: 1; }

.kds-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(4,120,87,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(4,120,87,0); } 100% { box-shadow: 0 0 0 0 rgba(4,120,87,0); } }

/* ------------------------------------------------------------ modals --- */

.modal-back {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.modal-back.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--panel);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: 92vh;
  display: flex; flex-direction: column;
  transform: translateY(8px) scale(.99);
  transition: transform .16s ease;
}
.modal-back.open .modal { transform: none; }
.modal.wide { width: min(820px, 100%); }
.modal.narrow { width: min(420px, 100%); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------------------------------------ receipt -- */

.rh-paper {
  background: #fff;
  color: #000;
  margin: 0 auto;
  box-shadow: var(--shadow);
  border-radius: 3px;
  overflow: hidden;
}
.rh-paper-80 { width: 302px; }
.rh-paper-58 { width: 220px; }
.rh-paper-a4 { width: min(794px, 100%); }
.rh-paper .receipt { width: 100% !important; }

/* ------------------------------------------------------------ login ---- */

.auth-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 520px at 8% -10%,  color-mix(in srgb, var(--c1) 22%, transparent), transparent 62%),
    radial-gradient(820px 520px at 92% 4%,   color-mix(in srgb, var(--c4) 20%, transparent), transparent 62%),
    radial-gradient(760px 560px at 60% 108%, color-mix(in srgb, var(--c2) 18%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--panel);
  backdrop-filter: blur(2px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-card .mark {
  width: 54px; height: 54px; border-radius: 15px;
  background: var(--grad-brand); color: #fff;
  display: grid; place-items: center; font-size: 1.4rem; font-weight: 800;
  margin-bottom: 16px;
  box-shadow: 0 12px 28px -14px rgba(234, 88, 12, .95);
}
.auth-card h1 { font-size: 1.35rem; }

/* -------------------------------------------------------- responsive --- */

.menu-toggle { display: none; }

@media (max-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  /* Below 860 px the rail becomes an overlay drawer. It is fixed to the
     viewport, slides in over the content and never scrolls with it. */
  .app { display: block; overflow: hidden; }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0;
    height: 100%; width: 260px; flex-basis: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
    z-index: 90;
  }
  .rail.open { transform: none; }
  .rail-scrim {
    display: none;
    position: fixed; inset: 0;
    background: rgba(12, 16, 23, .45);
    z-index: 80;
  }
  .rail-scrim.show { display: block; }
  .main { height: 100%; }
  .menu-toggle { display: inline-flex; }
  /* Narrow counter screen: stack the till and let the page scroll, rather than
     squeezing the product grid into whatever is left of the viewport. */
  .pos { display: block; grid-template-columns: 1fr; height: auto; margin: -14px; }
  .pos-left { overflow: visible; }
  .prod-grid { overflow: visible; }
  .pos-right { border-left: 0; border-top: 1px solid var(--line); position: static; max-height: none; }
  .cart, .cart-items { overflow: visible; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
}

@media (min-width: 1600px) {
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 440px; }
}

/* ------------------------------------------------------- print setup --- */

@media print {
  .rail, .topbar, .no-print, .btn { display: none !important; }
  .app { display: block; height: auto; overflow: visible; }
  .main { height: auto; overflow: visible; }
  .content { overflow: visible; height: auto; }
  body { background: #fff; }
  .content { padding: 0; }
  .panel { border: 0; box-shadow: none; }
  table.data th { position: static; }
  .rh-paper { box-shadow: none; width: 100% !important; }
  a[href]::after { content: ""; }
}

/* Reduce motion for anyone who asks for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------- toasts -- */

#toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  width: min(420px, calc(100% - 24px));
}
.toast {
  background: var(--ink);
  color: var(--panel);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  text-align: center;
}
.toast.in { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

#net-status {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

/* Full-bleed pages (POS, KDS) */
.content.flush { padding: 0; }
.content.flush .pos { margin: 0; }
.content.flush > .flash { margin: 12px; }

/* ------------------------------------------------------------- small screens
   Placed last so these beat the desktop tile rules above — same specificity,
   later in the file. */
@media (max-width: 700px) {
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; padding: 10px; }
  .prod .thumb, .prod .thumb img { height: 74px; }
  .prod .thumb { line-height: 74px; font-size: 1.3rem; }
  .prod .meta { padding: 6px 8px 8px; }
  .prod .nm { font-size: .8rem; height: 2.4em; }
  .prod .pr { font-size: .88rem; }
}

/* ==========================================================================
   Colour layer
   Everything below is presentation only: no layout, no behaviour. It exists so
   the app reads at a glance — a green ticket is fine, an amber one is behind,
   a red one is late — without anyone having to read a number first.
   ========================================================================== */

/* ------------------------------------------------------- rail + brand ---- */

.rail { box-shadow: 4px 0 24px -18px rgba(15, 23, 42, .8); }

.rail-logo img { box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

/* Gradient hairline under the top bar: the accent, fading out to the right. */
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--c1) 0%, var(--c5) 28%, var(--c4) 55%, var(--c2) 78%, var(--c6) 100%);
  opacity: .55;
}

.topbar h1 { letter-spacing: -.02em; }

/* ------------------------------------------------------------ buttons ---- */

.btn-primary {
  background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0));
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-ok { box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--ok) 85%, transparent); }
.btn-danger { box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--danger) 85%, transparent); }

/* ------------------------------------------------------------- panels ---- */

.panel { transition: box-shadow .16s ease, border-color .16s ease; }
.panel-head {
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, var(--panel)) 0%, var(--panel) 100%);
}
.panel-head h2, .panel-head h3 { letter-spacing: -.015em; }

/* --------------------------------------------------------------- tabs ---- */

.tabs a.on {
  color: var(--accent);
  border-color: var(--accent);
}

/* ------------------------------------------------------------- badges ---- */

.badge.ok    { background: var(--ok-soft);     color: var(--ok); }
.badge.warn  { background: var(--warn-soft);   color: var(--warn); }
.badge.bad,
.badge.danger{ background: var(--danger-soft); color: var(--danger); }
.badge.info  { background: var(--info-soft);   color: var(--info); }
.badge.violet{ background: var(--violet-soft); color: var(--violet); }
.badge.pink  { background: var(--pink-soft);   color: var(--pink); }
.badge.teal  { background: var(--teal-soft);   color: var(--teal); }

/* ------------------------------------------------------- product tiles --- */

.prod { position: relative; }
.prod::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 var(--accent);
  transition: box-shadow .14s ease;
}
.prod:hover::after { box-shadow: inset 0 0 0 2px var(--accent); }
.prod:hover { transform: translateY(-1px); }
.prod { transition: box-shadow .14s ease, border-color .14s ease, transform .1s ease; }

/* The photo well gets a soft tint of the accent so a wall of tiles is not a
   wall of identical grey rectangles. */
.prod .thumb {
  background:
    radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%),
    var(--bg);
}
.prod .pr { color: var(--accent-600); }
.dark .prod .pr, [data-theme="dark"] .prod .pr { color: var(--c1); }

/* Category chips: the active one wears the brand gradient. */
.cats button.on {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -10px rgba(234, 88, 12, .9);
}

/* Order-type segmented control. */
.seg button.on {
  background: var(--grad-cool);
  color: #fff;
  border-color: transparent;
}
.seg button.on[data-type="dinein"]  { background: var(--grad-mint); }
.seg button.on[data-type="takeaway"]{ background: var(--grad-sun); }
.seg button.on[data-type="delivery"]{ background: var(--grad-berry); }

/* Payment methods, one colour each — cash green, card blue, mobile violet. */
#pay-methods button[data-method="cash"].on   { background: var(--grad-mint); color: #fff; border-color: transparent; }
#pay-methods button[data-method="card"].on   { background: var(--grad-cool); color: #fff; border-color: transparent; }
#pay-methods button[data-method="mobile"].on { background: var(--grad-berry); color: #fff; border-color: transparent; }
#pay-methods button[data-method="bank"].on   { background: var(--grad-slate); color: #fff; border-color: transparent; }

/* ------------------------------------------------------- kitchen board --- */

.ticket { transition: transform .12s ease, box-shadow .16s ease; }
.ticket:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ticket .tk-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--c3) 10%, var(--panel)) 0%, var(--panel) 100%);
  border-bottom-color: color-mix(in srgb, var(--c3) 30%, var(--line));
}
.ticket.warn {
  border-color: var(--warn);
  box-shadow: 0 10px 26px -18px color-mix(in srgb, var(--warn) 90%, transparent);
}
.ticket.warn .tk-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 22%, var(--panel)) 0%, var(--warn-soft) 100%);
}
.ticket.late {
  border-color: var(--danger);
  box-shadow: 0 12px 30px -16px color-mix(in srgb, var(--danger) 85%, transparent);
}
.ticket.late .tk-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 24%, var(--panel)) 0%, var(--danger-soft) 100%);
}
.ticket.late .tk-no { color: var(--danger); }
.ticket.warn .tk-no { color: var(--warn); }
.pulse { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }

/* ------------------------------------------------------------- tables ---- */

/* Busy tables glow; free ones stay quiet. Driven by the data-state class the
   page already sets. */
.table-card.busy, .tbl.busy {
  border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--panel)) 0%, var(--panel) 100%);
}

/* ----------------------------------------------------------- login page -- */

.auth-wrap, .login-wrap { background: var(--bg); }

/* --------------------------------------------------------------- print --- */

@media print {
  .topbar::after { display: none; }
  .rail { background: none; box-shadow: none; }
}

/* ==========================================================================
   Charts
   Plain SVG and divs, so they print, work offline and need no dependency.
   ========================================================================== */

.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.chart-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--c2) 6%, var(--panel)) 0%,
    color-mix(in srgb, var(--c4) 6%, var(--panel)) 55%,
    var(--panel) 100%);
}
.chart-head h3 { margin: 0; font-size: 1rem; letter-spacing: -.015em; }
.chart-sub { margin: 3px 0 0; font-size: .8rem; color: var(--ink-3); }
.chart-sub strong { color: var(--ink-2); font-weight: 650; }

.chart-legend { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--ink-3); font-weight: 600; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.chart-plot { display: flex; gap: 10px; padding: 14px 16px 0; }
.chart-yaxis {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: .68rem; color: var(--ink-4); font-variant-numeric: tabular-nums;
  text-align: right; min-width: 58px; padding-bottom: 4px;
}
.chart-svg { flex: 1; min-width: 0; height: 210px; display: block; color: var(--ink); overflow: visible; }

.chart-xaxis {
  display: flex; padding: 6px 16px 14px calc(16px + 68px);
  font-size: .68rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.chart-xaxis span { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- donut: used for the payment-method split ---------------------------- */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: 0 0 132px; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 20; stroke-linecap: butt; }
.donut-key { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 7px; }
.donut-key .row { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.donut-key .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.donut-key .nm { flex: 1; color: var(--ink-2); }
.donut-key .vl { font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-key .pc { color: var(--ink-3); font-size: .76rem; min-width: 38px; text-align: right; }

/* --- horizontal bars: used for best sellers and hourly sales ------------- */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.hbar .nm { font-size: .84rem; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .vl { font-size: .84rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; background: var(--grad-cool); }
.hbar:nth-child(8n+1) .fill { background: linear-gradient(90deg, var(--c1), var(--c7)); }
.hbar:nth-child(8n+2) .fill { background: linear-gradient(90deg, var(--c2), var(--c4)); }
.hbar:nth-child(8n+3) .fill { background: linear-gradient(90deg, var(--c3), var(--c6)); }
.hbar:nth-child(8n+4) .fill { background: linear-gradient(90deg, var(--c4), var(--c5)); }
.hbar:nth-child(8n+5) .fill { background: linear-gradient(90deg, var(--c5), var(--c1)); }
.hbar:nth-child(8n+6) .fill { background: linear-gradient(90deg, var(--c6), var(--c2)); }
.hbar:nth-child(8n+7) .fill { background: linear-gradient(90deg, var(--c7), var(--c1)); }
.hbar:nth-child(8n+8) .fill { background: linear-gradient(90deg, var(--c8), var(--c4)); }

/* --- mini bar column used inside table cells ---------------------------- */
.cellbar { display: inline-block; height: 8px; border-radius: 999px; background: var(--grad-cool); opacity: .9; min-width: 3px; vertical-align: middle; }

/* --- sparkline strip ---------------------------------------------------- */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.spark i { flex: 1; border-radius: 2px 2px 0 0; background: var(--grad-cool); min-height: 2px; }

@media print {
  .chart-card { break-inside: avoid; box-shadow: none; }
  .chart-svg { height: 160px; }
}

/* --- report tables -------------------------------------------------------
   A faint bar behind each number, scaled to the column's own maximum. The
   tallest bar is the biggest number in that column, so the eye finds it
   before reading a single digit. */

.num-cell {
  position: relative;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  z-index: 0;
  font-variant-numeric: tabular-nums;
}
.num-cell::before {
  content: "";
  position: absolute;
  right: 0; top: 50%; transform: translateY(-50%);
  height: 26px;
  width: var(--bar, 0%);
  max-width: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--c2) 0%, transparent) 0%,
    color-mix(in srgb, var(--c2) 13%, transparent) 100%);
  z-index: -1;
}
.pct-good { color: var(--ok); font-weight: 700; }
.pct-mid  { color: var(--warn); font-weight: 650; }
.pct-bad  { color: var(--danger); font-weight: 700; }
.money-out { color: var(--pink); }

.cellbar-wrap { display: flex; justify-content: flex-end; }
.cellbar {
  display: block; height: 9px; min-width: 3px; border-radius: 999px;
  background: linear-gradient(90deg, var(--c6), var(--c2));
}

/* Totals row: give it a tint so it never disappears into the body. */
table.data tfoot td {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  font-weight: 700;
  border-top: 2px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

/* Zebra rows, very light — the bars do the heavy lifting. */
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--ink) 2.2%, var(--panel)); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }

/* --- login: the two-column split ---------------------------------------- */

.auth-wrap {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  place-items: stretch;      /* both halves fill their column */
  gap: 0;
  padding: 0;
}
.auth-card { align-self: center; justify-self: center; }
.auth-visual {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(28px, 6vw, 76px);
  background: var(--grad-brand);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-visual::before {
  /* a soft light sweep so the gradient is not a flat wall */
  content: "";
  position: absolute; inset: -20% -10% auto auto;
  width: 62%; height: 90%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.28), transparent 62%);
  pointer-events: none;
}
.auth-visual::after {
  content: "";
  position: absolute; left: -12%; bottom: -28%;
  width: 66%; height: 66%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,.18), transparent 68%);
  pointer-events: none;
}
.av-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.02rem; margin-bottom: 28px; }
.av-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  display: grid; place-items: center; font-weight: 800; letter-spacing: -.02em;
  backdrop-filter: blur(4px);
}
.av-head {
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  line-height: 1.18; letter-spacing: -.025em;
  margin: 0 0 12px; color: #fff; font-weight: 700;
}
.av-sub { margin: 0 0 22px; color: rgba(255,255,255,.88); max-width: 34ch; font-size: .95rem; }
.av-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.av-list li { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: rgba(255,255,255,.94); }
.av-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; opacity: .9; }

.auth-visual { grid-row: 1; }
.auth-card { margin: 24px; }

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { padding: 26px 22px 30px; justify-content: flex-start; }
  .av-head { font-size: 1.32rem; }
  .av-sub, .av-list { display: none; }
  .av-brand { margin-bottom: 4px; }
  .auth-card { margin: 18px auto 32px; }
}

/* ------------------------------------------------------- drawer behaviour --
   Only meaningful below 860 px, where the rail slides in over the page. */
@media (max-width: 860px) {
  body.rail-open { overflow: hidden; }
  .rail-scrim.show { display: block; }
}
.rail-scrim[hidden] { display: none !important; }

/* Safety net: if a page ever ends up with a taller-than-viewport element
   inside .content (a wide table, a print sheet), the content pane scrolls and
   the rail still does not move. */
@media (min-width: 861px) {
  .content > * { min-width: 0; }
}
