/* Showra, in the landing page's look: Archivo headings over Inter, navy text on white and a
   soft lavender ground, Showra violet for actions, links, focus and selection; status colours
   only where something needs attention. Light only: the app doesn't follow the browser's
   dark mode. */
:root {
  --bg: #ffffff;
  --side: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f8f7fc;
  --surface-3: #efecf9;
  --border: #ecebf3;
  --border-strong: #dcd9ea;
  --text: #1e1b4b;
  --muted: #5e5a7d;
  --faint: #9a96b4;
  --ink: #5a22ff;
  --ink-hover: #3e12c4;
  --ink-text: #ffffff;
  --violet: #5a22ff;
  --black: #0b0b12;
  --accent: #5a22ff;
  --accent-soft: #f1ecff;
  --good: #0f7a4f; --good-soft: #e5f6ee;
  --bad: #c8323f; --bad-soft: #fdecee;
  --warn: #935706; --warn-soft: #fff5dc;
  --radius: 14px;
  --radius-sm: 10px;
  --overlay-shadow: 0 24px 56px -16px rgba(30, 27, 75, .28), 0 2px 6px rgba(30, 27, 75, .06);
  --side-w: 236px;
  --gutter: clamp(16px, 2.6vw, 32px);
  --display: Archivo, Inter, "Segoe UI", system-ui, sans-serif;
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
/* Dark mode, only when picked in Settings › Appearance (or "Match my device" on a dark device).
   The landing page's product preview colours: near-black greys with a lighter violet for text. */
:root[data-theme="dark"] {
  --bg: #111217; --side: #0c0d11; --surface: #15161c; --surface-2: #1a1b22; --surface-3: #23242d;
  --border: #25262e; --border-strong: #363742; --text: #ecedf1; --muted: #a2a4b1; --faint: #6e7080;
  --ink: #8f6bff; --ink-hover: #a88cff; --black: #ffffff;
  --accent: #a88cff; --accent-soft: #231d3d;
  --good: #34d399; --good-soft: #10291f; --bad: #f87171; --bad-soft: #2e1618; --warn: #fbbf24; --warn-soft: #2a2112;
  --overlay-shadow: 0 24px 56px -16px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-family: var(--display); font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.025em; line-height: 1.15; color: var(--black); }
h2 { font-family: var(--display); font-size: 1.08rem; font-weight: 700; margin: 0 0 .75rem; letter-spacing: -.01em; color: var(--black); }
h3 { font-size: .9rem; font-weight: 600; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); }
strong { font-weight: 600; }
.i { width: 16px; height: 16px; flex: none; }
kbd { font: inherit; font-size: .74rem; color: var(--muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--border); padding: 10px 10px 8px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }
.side-top { display: flex; align-items: center; gap: 6px; padding: 4px 4px 8px 6px; }
.ws { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.ws-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--violet); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .8rem; flex: none; }
.ws-mark.has-logo { background: none; overflow: hidden; }
.ws-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ws-mark.big { width: 48px; height: 48px; border-radius: 12px; font-size: 1.2rem; }
.logo-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.made-by { display: flex; align-items: center; gap: 6px; padding: 8px 8px 2px; color: var(--faint); font-family: var(--display); font-weight: 800; font-size: .74rem; letter-spacing: -.01em; }
.made-by svg { width: 13px; height: 13px; flex: none; }
.collapsed .made-by { justify-content: center; }
.collapsed .made-by span { display: none; }
.ws-name { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; color: var(--black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 30px; height: 30px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: .75rem; font-weight: 500; color: var(--faint); padding: 14px 8px 4px; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 999px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a .i { color: var(--faint); }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on .i { color: var(--accent); }
.side .foot { margin-top: auto; padding-top: 8px; position: relative; }
.me { width: 100%; border: 0; background: none; justify-content: flex-start; gap: 9px; padding: 6px; font-weight: 400; text-align: left; }
.me:hover { background: var(--surface-3); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font-size: .74rem; font-weight: 650; flex: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: .78rem; }
.me-menu { position: absolute; bottom: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--overlay-shadow); padding: 4px; z-index: 40; }
.me-menu button { width: 100%; border: 0; background: none; justify-content: flex-start; font-weight: 400; }
.me-menu button:hover { background: var(--surface-2); }

/* collapsed sidebar: an icon rail */
.shell.collapsed { grid-template-columns: 56px 1fr; }
.collapsed .side { padding: 10px 8px 8px; }
.collapsed .ws-name, .collapsed .nav a span, .collapsed .me-text { display: none; }
.collapsed .side-top { flex-direction: column; padding: 4px 0 8px; }
.collapsed .nav-label { height: 1px; padding: 0; margin: 10px 6px; background: var(--border); color: transparent; overflow: hidden; }
.collapsed .nav a { justify-content: center; padding: 8px 0; }
.collapsed .me { justify-content: center; }
.collapsed .me-menu { right: auto; width: 200px; }
.collapsed .collapse .i { transform: scaleX(-1); }

main { padding: 0 var(--gutter) 80px; width: 100%; max-width: 1240px; min-width: 0; }
.topbar, .scrim { display: none; }
/* Grid/flex children default to min-width:auto and stretch to fit wide tables; keep them
   inside the viewport so .table-wrap scrolls instead of the page. */
.grid > *, .card, .table-wrap { min-width: 0; }
input, select, textarea { max-width: 100%; }

/* ---- page header: the first .head on a page sticks under the top edge ---- */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
main > .head:first-child { position: sticky; top: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); margin: 0 calc(-1 * var(--gutter)) 20px; padding: 16px var(--gutter) 14px; border-bottom: 1px solid var(--border); min-height: 66px; }
.titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sub { margin: 0; color: var(--muted); font-size: .88rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.help { color: var(--muted); font-size: .88rem; margin: -6px 0 16px; max-width: 72ch; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card > h2:first-child { margin-bottom: 12px; }

/* KPI strip: one bordered band split into cells (cells draw their own left/top rules, the
   band's overflow clips the rules on its outer edge, so wrapping rows still look right) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tiles > .tile { padding: 14px 16px 15px; border: 0; border-radius: 0; box-shadow: -1px 0 0 var(--border), 0 -1px 0 var(--border); background: none; }
.tile .label { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.tile .value { font-size: 1.5rem; font-weight: 700; color: var(--black); font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 4px; line-height: 1.2; }
.tile .value.good { color: var(--good); } .tile .value.bad { color: var(--bad); }
.tile .small { margin-top: 3px; font-size: .8rem; color: var(--muted); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; padding-top: 8px; padding-bottom: 8px; }
td { font-size: .93rem; }
td .small { font-size: .8rem; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.on td { background: var(--accent-soft); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.card.empty { padding: 36px 20px; }

/* ---- forms ---- */
label { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; font-size: .93rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 7px 12px; min-width: 0; min-height: 38px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--surface-2); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--violet); margin: 0; }
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=radio]:focus-visible { border-radius: 50%; }
/* Our own message for a field the browser says is missing or wrong (see core.js). */
:is(input, select, textarea).invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--bad); font-size: .8rem; font-weight: 500; }
.field-error::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.form > .wide, .form > div, .form > fieldset, .form > p { align-self: start; }
.form .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); }

/* ---- buttons ---- */
button, .btn { font: inherit; font-size: .9rem; font-weight: 600; border-radius: 999px; padding: 0 16px; height: 36px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { text-decoration: none; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--violet); color: #fff; border-color: var(--violet); transition: background-color .15s, box-shadow .2s; }
button.primary:hover, .btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); box-shadow: 0 10px 28px -8px rgba(90, 34, 255, .7); }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad-soft); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; font-weight: 500; }
button.link:hover { text-decoration: underline; text-underline-offset: 2px; }
button.link.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }

/* segmented control: week/period steppers and inventory filters */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.seg > button, .seg > .btn { height: 28px; border: 0; background: none; color: var(--muted); padding: 0 12px; border-radius: 999px; }
.seg > button:hover, .seg > .btn:hover { color: var(--text); background: var(--surface-3); }
.seg > .on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(30, 27, 75, .1), 0 0 0 1px var(--border); }
.seg .label { padding: 0 10px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 0 1 260px; }
.toolbar .spacer { flex: 1; }

/* date range: preset + two dates in one control */
.range { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 6px; background: var(--surface); overflow: hidden; }
.range select, .range input { border: 0; border-radius: 0; min-height: 32px; height: 32px; padding: 0 8px; box-shadow: none !important; background: none; }
.range select { border-right: 1px solid var(--border); font-weight: 500; padding-right: 4px; }
.range input { width: 132px; }
.range .to { align-self: center; color: var(--faint); }
.range:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- badges & notices ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-weight: 500; border: 1px solid var(--border); white-space: nowrap; line-height: 1.5; }
.badge.good::before, .badge.bad::before, .badge.warn::before, .badge.accent::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--good); } .badge.good::before { background: var(--good); }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.badge.warn { color: var(--text); } .badge.warn::before { background: var(--warn); }
.badge.accent { color: var(--accent); }
.notice { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--text);
  margin-bottom: 12px; font-size: .9rem; border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); }
.notice::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; transform: translateY(-1px); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 22%, transparent); } .notice.bad::before { background: var(--bad); }
.notice.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 22%, transparent); } .notice.good::before { background: var(--good); }

/* ---- money breakdown ---- */
.breakdown { display: grid; grid-template-columns: 1fr auto; font-variant-numeric: tabular-nums; }
.breakdown > span { padding: 6px 0; border-bottom: 1px solid var(--border); }
.breakdown > span:nth-child(2n) { text-align: right; }
.breakdown .total { font-weight: 650; color: var(--text); border-bottom-color: var(--border-strong); padding: 9px 0; }
.breakdown .small { font-size: .78rem; font-weight: 400; }

/* ---- drawer, palette, toast ---- */
.overlay { position: fixed; inset: 0; background: rgba(30, 27, 75, .28); display: flex; justify-content: flex-end; z-index: 30; animation: fade .12s ease-out; }
.drawer { background: var(--bg); width: min(640px, 100%); height: 100%; overflow-y: auto; padding: 0 24px 28px; box-shadow: var(--overlay-shadow);
  animation: slide .16s ease-out; border-left: 1px solid var(--border); }
.drawer > .head:first-child { position: sticky; top: 0; background: var(--bg); padding: 16px 0 14px; margin-bottom: 18px; z-index: 1; border-bottom: 1px solid var(--border); flex-wrap: nowrap; }
.drawer > .head:first-child h1 { font-size: 1.15rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.drawer .card { padding: 16px; }
.drawer .grid { gap: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }

.palette-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(30, 27, 75, .24); display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; animation: fade .1s ease-out; }
.palette { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--overlay-shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--faint); }
.palette-input input { border: 0; box-shadow: none !important; flex: 1; font-size: 1rem; height: 50px; padding: 0; background: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette li.group { font-size: .74rem; color: var(--faint); padding: 8px 10px 4px; font-weight: 500; }
.palette li.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.palette li.item .i { color: var(--muted); }
.palette li.item.sel { background: var(--accent-soft); }
.palette li.item .hint { margin-left: auto; color: var(--faint); font-size: .8rem; }
.palette li.none { padding: 18px 10px; color: var(--muted); text-align: center; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--black); color: #fff; padding: 10px 18px; border-radius: 999px;
  z-index: 70; font-size: .9rem; max-width: calc(100% - 32px); box-shadow: var(--overlay-shadow); animation: fade .15s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- chart ---- */
.chart svg { width: 100%; height: 190px; display: block; overflow: visible; }
.chart rect.pos { fill: var(--accent); } .chart rect.neg { fill: var(--bad); }
.chart rect:hover { opacity: .8; }
.chart .grid-line { stroke: var(--border); }
.axis { display: flex; justify-content: space-between; font-size: .76rem; color: var(--faint); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---- auth pages ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--side); }
.auth-box { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0 0 20px; font: 800 1.45rem/1 var(--display); letter-spacing: -.02em; color: var(--black); }
.auth-brand .logo { width: 28px; height: 28px; }
.auth .card { padding: 32px; border-radius: 20px; box-shadow: 0 1px 2px rgba(30, 27, 75, .04), 0 18px 40px -20px rgba(30, 27, 75, .16); }
.auth form { display: grid; gap: 14px; }
.auth form button.primary { height: 46px; margin-top: 6px; font-size: .95rem; }
.auth h1 { margin-bottom: 6px; font-size: 1.75rem; }
.auth h3 { margin: 8px 0 0; }
.auth label.agree { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-weight: 400; font-size: .875rem; color: var(--muted); line-height: 1.45; }
.auth label.agree input { margin-top: 2px; }
.auth label.agree > span:not(.field-error) { grid-row: 1; grid-column: 2; }
.auth label.agree .field-error { grid-row: 2; grid-column: 1 / -1; margin-top: -4px; }
.auth-legal { display: flex; justify-content: center; gap: 8px; margin: 18px 0 0; font-size: .8rem; color: var(--faint); }
.auth-legal a { color: var(--muted); }
/* /terms and /privacy */
.legal { max-width: 760px; margin: 0 auto; padding: 40px 20px 72px; }
.legal .auth-brand { justify-content: flex-start; text-decoration: none; }
.legal .card { padding: 40px; border-radius: 20px; }
.legal h1 { font-size: 2rem; margin: 0 0 4px; }
.legal h2 { font-size: 1.15rem; margin: 32px 0 8px; }
.legal p, .legal li { line-height: 1.65; color: var(--text); }
.legal ul { padding-left: 22px; margin: 8px 0; }
.legal li { margin: 4px 0; }
.legal .updated { color: var(--muted); margin: 0 0 24px; }
.legal .draft { padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: .875rem; margin: 0 0 24px; }
.legal mark { background: var(--warn-soft); color: inherit; padding: 0 3px; border-radius: 4px; }
@media (max-width: 600px) { .legal .card { padding: 24px 20px; } }

/* ---- CSV import drop zone ---- */
.drop { display: block; margin-top: 12px; padding: 26px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.drop input { display: none; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
[hidden] { display: none !important; }

/* ---- inventory ---- */
fieldset.cardrow { margin: 12px 0 0; min-width: 0; padding: 12px 14px; }
.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--surface-2); float: left; margin-right: 10px; border: 1px solid var(--border); }
.cardrow .thumb, .thumb.lg { float: none; margin: 0; }
.thumb.lg { width: 96px; height: 96px; }

/* ---- phones and narrow windows ---- */
@media (max-width: 820px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); z-index: 50; transform: translateX(-102%); transition: transform .18s ease-out; height: 100%; }
  .side.open { transform: none; box-shadow: var(--overlay-shadow); }
  .side.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(30, 27, 75, .28); z-index: 45; }
  .collapse { display: none; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 0 16px 80px; }
  main > .head:first-child { position: static; margin: 0 -16px 16px; padding: 14px 16px 12px; background: var(--bg); backdrop-filter: none; min-height: 0; }
  .hide-sm { display: none; }
  .grid[style] { grid-template-columns: 1fr !important; }
  .head .row { width: 100%; }
  .head .row > .range { flex: 1 1 100%; }
  .range input { flex: 1; width: auto; min-width: 0; }
  th, td { padding: 8px 10px; }
  .drawer { padding: 0 16px 24px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile .value { font-size: 1.2rem; }
  .palette-wrap { padding-top: 8vh; }
}

/* ---- dashboard ---- */
/* Needs attention: at the top, amber (falling behind) or red (money at risk) so it reads as urgent. */
.attn { border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); border-radius: var(--radius); padding: 14px 16px 10px; margin-bottom: 18px; }
.attn.attn-bad { border-color: color-mix(in srgb, var(--bad) 30%, transparent); background: var(--bad-soft); }
.attn h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1rem; }
.attn-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--warn); color: #fff; }
.attn.attn-bad .attn-count { background: var(--bad); }
.attn ul { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.attn li:first-child { border-top: 0; }
.attn li .grow { display: flex; flex-direction: column; min-width: 0; }
.attn li strong { font-weight: 600; font-size: .92rem; }
.attn li small { color: var(--muted); font-size: .82rem; }
.attn li .btn { height: 32px; font-size: .84rem; background: var(--surface); flex: none; }
.attn-more { margin: 4px 0 4px 19px; font-size: .86rem; }
@media (max-width: 640px) { .attn li { flex-wrap: wrap; } .attn li .btn { margin-left: 19px; } }

.tiles-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .tiles-4 { grid-template-columns: repeat(2, 1fr); } }
.tile .small .up { color: var(--good); font-weight: 600; } .tile .small .down { color: var(--bad); font-weight: 600; }
button.tile-open { all: unset; box-sizing: border-box; cursor: pointer; padding: 14px 16px 15px; box-shadow: -1px 0 0 var(--border), 0 -1px 0 var(--border); display: block; }
button.tile-open:hover { background: var(--surface-2); }
button.tile-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
div.tile-open { cursor: pointer; } div.tile-open:hover { background: var(--surface-2); }
div.tile-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile-open .label { display: flex; align-items: center; gap: 4px; }
.tile-open .label .i { width: 14px; height: 14px; color: var(--accent); }

/* From sales to profit */
.flow { font-variant-numeric: tabular-nums; }
.flow-row { display: grid; grid-template-columns: 1fr auto 64px; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.flow-row .amt { text-align: right; } .flow-row .pct { text-align: right; color: var(--muted); }
.flow-row .op { display: inline-block; width: 18px; color: var(--faint); }
.flow-row.first { font-weight: 600; }
.flow-row.total { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--border-strong); }

/* No shows yet */
.empty-start { padding: 22px 24px; margin-bottom: 18px; }
.empty-start h2 { margin-bottom: 6px; }
.empty-start p { margin: 0 0 14px; max-width: 60ch; }
.preview { opacity: .45; pointer-events: none; user-select: none; }
.preview-label { font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 8px; }

/* Day chart: toggle, hover targets and the day popup */
.chart .hit { fill: transparent; cursor: pointer; }
.chart g.on rect.sales, .chart g:hover rect.sales { fill: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); }
.chart rect.sales.solo { fill: color-mix(in srgb, var(--accent) 45%, var(--surface-3)); }
.day-pop { position: absolute; top: 8px; z-index: 5; width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--overlay-shadow); padding: 10px 12px; font-size: .86rem; font-variant-numeric: tabular-nums; }
.day-pop .pop-head { display: flex; justify-content: space-between; gap: 12px; }
.day-pop .pop-key { color: var(--faint); font-size: .74rem; text-align: right; }
.day-pop ul { list-style: none; margin: 6px 0 0; padding: 0; }
.day-pop li a { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--border); color: var(--text); }
.day-pop li a:hover { text-decoration: none; background: var(--surface-2); }
.day-pop .t { width: 62px; flex: none; color: var(--muted); white-space: nowrap; }
.day-pop .grow { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.day-pop .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-pop small { color: var(--faint); font-size: .76rem; }
.day-pop .a { white-space: nowrap; }
:root[data-theme="dark"] .chart rect.pos { fill: #8f6bff; }

/* a section heading inside a page (Schedule → Shipping hours) */
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 12px; }
.section-head h2 { margin: 0; font-size: 1.1rem; }
.section-head .spacer { flex: 1; }
/* Sign-up's password box with its Show button (no Confirm password box). */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 64px; }
.pw-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; box-shadow: none;
  color: var(--muted); font-size: .85rem; padding: 4px 8px; min-height: 0; cursor: pointer; }
.pw-show:hover { color: var(--text); }
.nowrap { white-space: nowrap; }
/* "More details" inside a short form (setup's Add a purchase). */
.more-details summary { cursor: pointer; color: var(--accent, #5a22ff); font-weight: 500; font-size: .9rem; }
.preview .tile { position: relative; }
.sample-tag { position: absolute; top: 10px; right: 10px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 7px; }

/* The public demo's notice (app.js boot) */
.demo-bar { position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: 420px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
  background: #5A22FF; color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px -10px rgba(20,10,75,.6); }
.demo-bar a { color: #7CF0D4; }
@media (max-width: 700px) { .demo-bar { left: 12px; right: 12px; bottom: 12px; max-width: none; } body.demo .toast { bottom: 84px; } }
