/*
 * stores.exposcale.app — the whole stylesheet.
 *
 * Hand-written and served as a static file on purpose: there is no Tailwind
 * build, no npm install and no Vite manifest in this repo. A deploy that
 * depends on a node toolchain is a deploy that can fail for a reason that has
 * nothing to do with the money code, and this app's deploy gate is
 * `settlement:verify`, not a bundler.
 *
 * ── THE DESIGN THESIS ────────────────────────────────────────────────────
 *
 * This app's whole doctrine is that a blank is not a zero. So the FIRST
 * visual axis here is not good/bad — it is MEASURED vs UNMEASURED, and it
 * has a dedicated visual language:
 *
 *   • solid fill        — a source said so
 *   • 45° hatch         — nobody measured it        (--hatch)
 *   • brand purple      — a PERSON keyed it in      (imported / by hand)
 *   • amber             — PROVISIONAL, and it lists its reasons
 *
 * The 45° hatch started life on one coverage cell. It is now the system's
 * signature: it marks the not-connected cells, the PROVISIONAL banner and the
 * diagonal stamp on settlement paper. One idea, three scales.
 *
 * Dark only, deliberately. This is a forensic instrument read at night against
 * a sheet, the Exposcale house surfaces are all dark, and the money paper that
 * has to survive a printer is the statement PDF — which is styled separately
 * and stays white.
 *
 * ── CONTENTS ────────────────────────────────────────────────────────────
 *   1  Fonts
 *   2  Tokens
 *   3  Reset + typography
 *   4  Motion primitives
 *   5  Shell: sidebar, brand, nav, main
 *   6  Panels, tiles, empty states
 *   7  Tables
 *   8  Chips + badges
 *   9  Forms + buttons
 *  10  Notices + flash
 *  11  Money surfaces (P1)
 *  12  Coverage strip + bar
 *  13  Statements: the money paper
 *  14  Checklist cards
 *  15  Bell
 *  16  Tabs, meters, sellers, misc
 *  17  Auth
 *  18  Error pages
 *  19  Responsive
 *  20  Reduced motion + print
 */

/* ══ 1 ═ FONTS ══════════════════════════════════════════════════════════
 * Vendored under public/fonts. ⛔ NO Google Fonts CDN: the CSP is 'self'
 * only, and a font that 404s under CSP silently falls back to Helvetica,
 * which is exactly the "why does it look wrong in prod" bug nobody finds.
 * Both files are the variable cut, so one download serves 400–800.
 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ══ 2 ═ TOKENS ═════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* Surfaces — dark first, five steps so a panel inside a panel still reads. */
  --bg:        #0d0d12;
  --bg-deep:   #08080c;
  --sidebar:   #0a0a0f;
  --panel:     #13131a;
  --panel-hi:  #17171f;   /* the top of a card's gradient */
  --panel-2:   #1a1a24;   /* wells, hovers, inset rows */
  --line:      #1e1e2e;
  --line-2:    #2b2b3d;

  /* Ink. ⛔ --muted is 5.5:1 on --panel. The house #6b7280 is 4.0:1 and fails
     AA for the 12px labels this app is full of, so it lives on as --muted-2
     for rules and icon strokes only — never for a sentence. */
  --text:      #ffffff;
  --text-2:    #dfe1ea;
  --muted:     #8b93a7;
  --muted-2:   #6b7280;

  /* Brand. #8c52fd is sampled from the wordmark itself. --brand-ink is the
     text-safe step (5.9:1 on --panel); --brand never carries small type. */
  --brand:      #8c52fd;
  --brand-ink:  #a47bff;
  --brand-deep: #7c3aed;
  --brand-tint: rgba(140, 82, 253, .12);
  --brand-glow: rgba(140, 82, 253, .34);

  /* Status. Validated for CVD separation as a set (worst adjacent pair
     ΔE 8.1 deutan) and never used as colour alone — every status carries a
     word, and the coverage grid carries texture as well. */
  --ok:        #10b981;  --ok-ink:   #34d399;  --ok-tint:   rgba(16, 185, 129, .12);
  --warn:      #f59e0b;  --warn-ink: #fbbf24;  --warn-tint: rgba(245, 158, 11, .12);
  --bad:       #ef4444;  --bad-ink:  #f87171;  --bad-tint:  rgba(239, 68, 68, .12);
  --info:      #3b82f6;  --info-ink: #7dabff;  --info-tint: rgba(59, 130, 246, .12);

  /* ⭐ THE SIGNATURE. 45° = nobody measured this. */
  --hatch: repeating-linear-gradient(45deg,
            transparent, transparent 3px,
            rgba(255, 255, 255, .045) 3px, rgba(255, 255, 255, .045) 5px);
  --hatch-warn: repeating-linear-gradient(45deg,
            transparent, transparent 4px,
            rgba(245, 158, 11, .10) 4px, rgba(245, 158, 11, .10) 7px);

  --radius:    12px;
  --radius-sm: 9px;
  --radius-lg: 16px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -16px rgba(0, 0, 0, .8);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, .5), 0 24px 60px -28px rgba(0, 0, 0, .9);
  /* The top-edge highlight that makes a card read as lit rather than drawn. */
  --edge: inset 0 1px 0 rgba(255, 255, 255, .045);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --rail: 236px;
}

/* ══ 3 ═ RESET + TYPOGRAPHY ═════════════════════════════════════════════ */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-2);
  font: 400 14.5px/1.55 var(--sans);
  font-feature-settings: 'cv05' 1, 'ss03' 1;  /* single-storey l, curved r */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* A command string like `sync:processors --full` has no break opportunity
     and will otherwise widen a grid track until the whole page scrolls
     sideways on a phone. */
  overflow-wrap: break-word;
}

::selection { background: rgba(140, 82, 253, .34); color: #fff; }

/* Thin, themed scrollbars — the app has a lot of horizontal table scroll and
   a fat OS bar eats a whole row of a dense grid. */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3b3b52; background-clip: content-box; }

a {
  color: var(--brand-ink);
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color .14s var(--ease);
}
a:hover { color: #c4a4ff; text-decoration: underline; }

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
  border-radius: 6px;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.028em;
  color: var(--text);
  margin: 0 0 6px;
}
h2 {
  font-size: 16.5px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.016em;
  color: var(--text);
  margin: 0 0 10px;
}
/* ⭐ h3 is an EYEBROW, not a heading: mono, caps, tracked. The instrument
   register — it is how a label reads as an instrument label and not as prose,
   and it is what ties the tile labels, the section eyebrows and the table
   heads into one family. */
h3 {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 0 0 10px;
}
p { margin: 0 0 10px; }
strong { font-weight: 650; color: var(--text); }

.muted { color: var(--muted); }
.small { font-size: 12.75px; line-height: 1.5; }
.mono  { font-family: var(--mono); font-size: 12px; font-weight: 450; letter-spacing: -.01em; }

/* ══ 4 ═ MOTION PRIMITIVES ══════════════════════════════════════════════
 * Everything here is opt-in through a class the layouts apply, everything is
 * under 400ms end to end, and every single one is switched off wholesale in
 * section 20 under prefers-reduced-motion.
 */

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes railIn  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes drawIn  { to { stroke-dashoffset: 0; } }
@keyframes growX   { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shimmer { to { background-position: 200% 0; } }
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(4%, -3%, 0) scale(1.08); }
  66%      { transform: translate3d(-3%, 4%, 0) scale(.96); }
}
@keyframes wiggle {
  0%, 65%, 100% { transform: rotate(0); }
  70% { transform: rotate(-11deg); }
  78% { transform: rotate(9deg); }
  86% { transform: rotate(-5deg); }
  93% { transform: rotate(2deg); }
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 currentColor; opacity: .5; }
  70%  { box-shadow: 0 0 0 6px currentColor; opacity: 0; }
  100% { box-shadow: 0 0 0 6px currentColor; opacity: 0; }
}

/* The page-load sequence. `both` means the from-state is applied before the
   delay elapses, so nothing flashes in at full opacity and then re-animates. */
.stagger > * { animation: rise .34s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 155ms; }
.stagger > *:nth-child(6) { animation-delay: 185ms; }
.stagger > *:nth-child(7) { animation-delay: 210ms; }
.stagger > *:nth-child(8) { animation-delay: 230ms; }
.stagger > *:nth-child(n+9) { animation-delay: 245ms; }

/* A grid of tiles reads as one gesture, so its own stagger is faster and
   nests inside the page's — total stays under 400ms. */
.grid.stagger-fast > * { animation: rise .3s var(--ease-out) both; }
.grid.stagger-fast > *:nth-child(1) { animation-delay: 30ms; }
.grid.stagger-fast > *:nth-child(2) { animation-delay: 60ms; }
.grid.stagger-fast > *:nth-child(3) { animation-delay: 90ms; }
.grid.stagger-fast > *:nth-child(4) { animation-delay: 118ms; }
.grid.stagger-fast > *:nth-child(5) { animation-delay: 142ms; }
.grid.stagger-fast > *:nth-child(n+6) { animation-delay: 160ms; }

/* Rows that arrive after first paint (a re-rendered /data table). */
.row-enter { animation: rise .26s var(--ease-out) both; }

.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 0%, #23232f 40%, var(--panel-2) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
}
.skeleton * { visibility: hidden; }

/* ══ 5 ═ SHELL ══════════════════════════════════════════════════════════ */

.shell { display: flex; min-height: 100vh; max-width: 100%; }

.sidebar {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}
/* A hairline of brand down the rail's edge. One pixel, and it is the only
   thing on the page that says which product this is when the logo scrolls. */
.sidebar::after {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: linear-gradient(180deg, var(--brand) 0%, transparent 42%);
  opacity: .5;
  pointer-events: none;
}

/* ── the wordmark ── */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 18px;
  min-height: 30px;
}
.brand:hover { text-decoration: none; }
.brand img.brand-word {
  width: 118px;
  height: auto;
  display: block;
  transition: opacity .16s var(--ease);
}
.brand img.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: none; }
.brand:hover img { opacity: .82; }
.brand .brand-sub {
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted-2);
  border-left: 1px solid var(--line-2);
  padding-left: 8px;
  margin-left: 1px;
}

/* ── nav items ── */
.ni {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.ni:hover { background: rgba(255, 255, 255, .045); color: var(--text); text-decoration: none; }
.ni svg { flex: 0 0 16px; color: var(--muted-2); transition: color .15s var(--ease); }
.ni:hover svg { color: var(--muted); }

.ni.active { background: var(--brand-tint); color: var(--text); font-weight: 600; }
.ni.active svg { color: var(--brand-ink); }
/* ⭐ The active indicator is a left-edge rail that grows in — a purple bar is
   findable at a glance down a 12-item list in a way a background tint is not. */
.ni.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  transform-origin: center;
  animation: railIn .28s var(--ease-out) both;
}

.nav-group {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted-2);
  padding: 14px 10px 5px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sidebar-who {
  display: block;
  padding: 2px 10px 9px;
  font-size: 11.5px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.4;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 30px 76px;
  max-width: 1640px;
}
.page-head { margin-bottom: 20px; }
.page-head .lede { max-width: 82ch; }
.page-head h1 + .lede { margin-top: 2px; }

/* ══ 6 ═ PANELS, TILES, EMPTY STATES ════════════════════════════════════ */

.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-hi) 0%, var(--panel) 58%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--edge), var(--shadow-2);
}
.panel > h2:first-child { margin-bottom: 4px; }
.panel > h2 + p.muted { margin-bottom: 14px; }

/* ⛔ `min-width: 0` on the children. A grid item defaults to `min-width: auto`,
   which means its longest unbreakable word — not its track — decides its
   width, and one long token overflows the viewport on a narrow screen. */
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(198px, 1fr)); }
/* ⭐ `auto-fill`, NOT `auto-fit`. A KPI row wants its tiles to stretch and fill
   the width (auto-fit); a row of CONTENT cards does not — one store card
   stretched across 1400px puts its label at one end of the screen and its
   figure at the other. */
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* A tile that holds a small label/figure list rather than one hero number. */
.tile table { font-size: 13px; }
.tile table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.tile table tr:last-child td { border-bottom: 0; }
.tile table tr:hover { background: none; }
.tile .tile-title { font-size: 16px; font-weight: 650; letter-spacing: -.015em; margin: 6px 0 10px; }

/* ── the stat tile ──
 * Per the house dataviz rules: one big tabular number, one small label, the
 * qualifying detail underneath in muted. The number is the hero; nothing else
 * on the tile competes with it. */
.tile {
  position: relative;
  background: linear-gradient(180deg, var(--panel-hi) 0%, var(--panel) 62%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 16px;
  box-shadow: var(--edge), var(--shadow-1);
  overflow: hidden;
}
.tile .n {
  display: block;
  font-size: 29px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.032em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-bottom: 5px;
}
/* ⭐ The eyebrow, in mono caps — see h3. */
.tile .l {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .11em;
  line-height: 1.35;
}
.tile .n.danger { color: var(--bad-ink); }
.tile .n.muted  { color: var(--muted); }
.tile .n.good   { color: var(--ok-ink); }

/* The qualifying note under a tile. Subordinate to the number by size and
   separated from it by a rule — a tile whose caveat competes with its figure
   is a tile nobody reads the figure off. */
.tile > .small {
  font-size: 11.75px;
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.tile > .small .chip { margin-right: 2px; }

a.tile-link {
  display: block;
  color: inherit;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
a.tile-link:hover {
  border-color: var(--line-2);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--edge), var(--shadow-2);
}
a.tile-link:active { transform: translateY(0); }
/* A tile you can open says so with a corner arrowhead that slides on hover.
   ⛔ Drawn from two borders, not a data: URI — the CSP is 'self' only and a
   masked data: image is exactly the kind of thing that works locally and
   silently disappears in production. */
a.tile-link::after {
  content: '';
  position: absolute;
  top: 16px;
  right: 17px;
  width: 6px;
  height: 6px;
  border-top: 1.6px solid currentColor;
  border-right: 1.6px solid currentColor;
  transform: rotate(-45deg);
  opacity: .26;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
a.tile-link:hover::after { opacity: .7; transform: rotate(-45deg) translate(1.5px, -1.5px); }

/* ── empty states ──
 * An empty screen is an invitation to act, so it gets the X mark as a
 * watermark, a sentence that says what will appear here, and the control that
 * makes it happen. */
.empty {
  position: relative;
  padding: 30px 22px 26px;
  text-align: center;
  overflow: hidden;
  border-radius: var(--radius);
}
.empty::before {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 168px;
  height: 168px;
  transform: translate(-50%, -52%);
  background: url('/brand/icon-512.png') no-repeat center / contain;
  opacity: .05;
  pointer-events: none;
}
.empty > * { position: relative; }
.empty .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 12px; }

/* ══ 7 ═ TABLES ═════════════════════════════════════════════════════════ */

/* ⭐ SCROLL SHADOWS. A table sized to its content scrolls sideways, and a
   scroller with no edge cue is a column nobody knows is there. The two
   `local` layers are the paper edges and the two `scroll` layers are the
   shadows that appear only while there is more to reach — pure CSS, no
   listener, and it cannot desynchronise from the scroll position. */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: rgba(0, 0, 0, .16);
  background-image:
    linear-gradient(to right, var(--panel), rgba(19, 19, 26, 0)),
    linear-gradient(to left, var(--panel), rgba(19, 19, 26, 0)),
    linear-gradient(to right, rgba(0, 0, 0, .5), transparent),
    linear-gradient(to left, rgba(0, 0, 0, .5), transparent);
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-repeat: no-repeat;
  background-size: 26px 100%, 26px 100%, 13px 100%, 13px 100%;
  background-attachment: local, local, scroll, scroll;
}
.panel > .table-wrap { margin-top: 4px; }

/* ⭐ `max-content` + `min-width: 100%`, NOT `width: 100%`. A fourteen-column
   money table forced to 100% squeezes every column until a store name wraps
   over four lines and the row is 90px tall; sized to its content it fills the
   panel when it fits and SCROLLS when it does not, which is what the
   horizontal scroller on `.table-wrap` was always for. */
table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13.5px; }

th, td {
  text-align: left;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .075em;
  white-space: nowrap;
  background: var(--panel-2);
  border-bottom-color: var(--line-2);
  padding-top: 8px;
  padding-bottom: 8px;
}
tbody tr { transition: background .12s linear; }
tbody tr:hover { background: rgba(255, 255, 255, .028); }
tbody tr:last-child td { border-bottom: 0; }

tfoot th {
  background: var(--panel-2);
  border-top: 1px solid var(--line-2);
  border-bottom: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
tfoot th.small { font-weight: 500; }

/* ⭐ A long table pins its head AND its foot. On the daily P&L the foot is
   the window total — the number you are comparing every row against — and a
   total you have to scroll back to is a total nobody checks. */
.table-wrap.sticky {
  max-height: min(72vh, 720px);
  overflow: auto;
}
.table-wrap.sticky thead th { position: sticky; top: 0; z-index: 3; }
.table-wrap.sticky tfoot th { position: sticky; bottom: 0; z-index: 3; }
.table-wrap.sticky thead th::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--line-2);
}

/* Money columns: right-aligned, tabular, never wrapped mid-figure. */
td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.pct, th.pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
td.mono, .mono { font-family: var(--mono); }

/* ⛔ A CAP ON PROSE CELLS. `width: max-content` lets a column of sentences run
   to the width of its longest sentence and push every column after it off the
   panel; capped, the sentence wraps and the numbers stay on screen. */
.table-wrap td { max-width: 60ch; }

/* ══ 8 ═ CHIPS + BADGES ═════════════════════════════════════════════════
 * One family, five tones. Every chip is a WORD plus a colour — the colour is
 * never the only carrier, which is also what makes the coverage grid legible
 * to a colour-blind reader and in greyscale.
 */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .005em;
  line-height: 1.5;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
  vertical-align: middle;
}
.chip.ok   { color: var(--ok-ink);    background: var(--ok-tint);    border-color: rgba(16, 185, 129, .32); }
.chip.warn { color: var(--warn-ink);  background: var(--warn-tint);  border-color: rgba(245, 158, 11, .32); }
.chip.bad  { color: var(--bad-ink);   background: var(--bad-tint);   border-color: rgba(239, 68, 68, .32); }
.chip.info { color: var(--info-ink);  background: var(--info-tint);  border-color: rgba(59, 130, 246, .32); }
/* ⭐ `gold` is the app's "a PERSON did this" tone — imported by hand, and the
   unread bell. It is the brand purple on purpose: the same colour the coverage
   grid uses for a hand-keyed day. Provenance has one colour here. */
.chip.gold { color: var(--brand-ink); background: var(--brand-tint); border-color: rgba(140, 82, 253, .34); }

/* A status dot for the chips that describe a live thing. */
.chip.dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 5px;
}
/* ⛔ THE RING IS A SECOND PSEUDO-ELEMENT, NOT THE DOT. Animating the dot's own
   opacity leaves the status marker INVISIBLE for a third of every cycle — a
   state indicator that blinks out is worse than one that never moved.
   ⛔ Three pulses, then still: a permanent animation in a table of thirty rows
   is thirty repaints a second and a page nobody can read. */
.chip.dot.live { position: relative; }
.chip.dot.live::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  animation: ping 2.4s var(--ease) 3 both;
  pointer-events: none;
}

/* ⛔ PROVISIONAL keeps its amber and gets the hatch as well, so it survives a
   greyscale print and a colour-blind reader. It must never become quiet. */
.chip.warn.is-provisional { background-image: var(--hatch-warn); }

/* Dispute countdowns — the semantics are load-bearing: red under 24h, amber
   under 72h. Designed, never designed away. */
.chip.due-overdue  { color: #fff; background: var(--bad); border-color: var(--bad); font-weight: 700; }
.chip.due-critical { color: var(--bad-ink);  background: var(--bad-tint);  border-color: rgba(239, 68, 68, .45); }
.chip.due-urgent   { color: var(--warn-ink); background: var(--warn-tint); border-color: rgba(245, 158, 11, .45); }
.chip.due-ok       { color: var(--muted); }
.chip.due-none     { color: var(--muted); font-style: italic; }

/* ══ 9 ═ FORMS + BUTTONS ════════════════════════════════════════════════ */

.field { margin-bottom: 12px; }
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: .005em;
}
label:has(> input[type=checkbox]),
label:has(> input[type=radio]) {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-2);
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
}
.hint { font-size: 11.75px; color: var(--muted); margin-top: 5px; line-height: 1.45; }

/* ⛔⛔ `input:not([type])` IS NOT OPTIONAL. `<input name="slug">` has no type
   attribute, so `input[type=text]` does not match it — a whole page of form
   fields renders at the browser's intrinsic 20-character width while the
   selects beside them are full width. Several forms in this app are written
   without the attribute. Specificity is deliberately identical across the
   list so the checkbox/radio rule below still wins. */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-deep);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover:not(:disabled):not([type=checkbox]):not([type=radio]),
select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #37374d; }
input:focus:not([type=checkbox]):not([type=radio]),
select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
input[type=checkbox], input[type=radio] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  margin: 2px 0 0;
  flex: 0 0 15px;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
select { cursor: pointer; }

/* ⭐ `flex-start`, so labels line up across a row whether or not the field
   below them carries a hint. A field whose only content is a button opts back
   into bottom alignment — that is the filter-bar case, where the button
   belongs on the input's baseline. */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.row > .field { flex: 1 1 190px; margin-bottom: 0; }
.row > .field:has(> .btn:only-child),
.row > .field:has(> button:only-child) { align-self: flex-end; flex: 0 0 auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8.5px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #1e1e29 0%, #16161e 100%);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13.25px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--edge), var(--shadow-1);
  transition: border-color .15s var(--ease), transform .1s var(--ease),
              background .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { border-color: #43435c; text-decoration: none; color: var(--text); }
.btn:active { transform: scale(.975); }
.btn svg { flex: 0 0 auto; }

/* ⭐ The primary button carries the brand gradient and a sheen on its top
   edge. It is the one place on a screen allowed to glow. */
.btn.primary {
  background: linear-gradient(180deg, #9d6bff 0%, var(--brand-deep) 100%);
  border-color: #8552f0;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .4);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #ab7fff 0%, #8749f5 100%);
  border-color: #9d6bff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), 0 4px 16px -4px var(--brand-glow);
}
.btn.danger { color: var(--bad-ink); border-color: rgba(239, 68, 68, .34); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-tint); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled], .btn.disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ══ 10 ═ NOTICES ═══════════════════════════════════════════════════════ */

.notice {
  position: relative;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--brand);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 13.25px;
  line-height: 1.5;
  box-shadow: var(--edge);
}
.notice.bad  { border-left-color: var(--bad);  background: linear-gradient(90deg, var(--bad-tint), transparent 42%), var(--panel); }
.notice.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-tint), transparent 42%), var(--panel); }
.notice.ok   { border-left-color: var(--ok);   background: linear-gradient(90deg, var(--ok-tint), transparent 42%), var(--panel); }
.notice ul { margin: 7px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 3px; }
.notice > strong { display: block; margin-bottom: 2px; }

.error { color: var(--bad-ink); font-size: 12.25px; margin-top: 5px; }

/* ══ 11 ═ MONEY SURFACES (P1) ═══════════════════════════════════════════
 * ⛔ `—` (unmeasured) sits in the same column as a figure and must never be
 * mistaken for a small number. It inherits the cell's colour rather than being
 * styled to look like data — the point is that it is NOT data.
 */

/* The PROVISIONAL badge expands to name every missing input, verbatim. */
details.prov > summary { list-style: none; cursor: pointer; }
details.prov > summary::-webkit-details-marker { display: none; }
details.prov > summary:hover .chip { border-color: var(--warn); }
details.prov[open] > summary { margin-bottom: 6px; }
details.prov[open] > ul.gaps { animation: rise .2s var(--ease-out) both; }
ul.gaps { margin: 0; padding-left: 15px; }
ul.gaps li { font-size: 11.75px; color: var(--muted); line-height: 1.5; margin-bottom: 2px; }

details > summary { cursor: pointer; }
details[open] > summary { margin-bottom: 4px; }

/* ── the revenue sparkline ──
 * One series, so no legend: the panel heading names it. A day nobody measured
 * is a BREAK in the line, never an interpolation across it — drawing straight
 * through an unmeasured day would invent the exact number this app exists to
 * refuse to invent. Those days get a hatched column instead. */
.spark {
  display: block;
  width: 100%;
  height: 46px;
  overflow: visible;
}
.spark .spark-line {
  fill: none;
  stroke: var(--brand-ink);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.spark .spark-area { fill: url(#sparkfill); }
.spark .spark-gap { fill: rgba(255, 255, 255, .035); }
/* The chart wears the same frame as the table it sits above, so the two read
   as one instrument rather than as a graphic and a grid. */
.spark-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .16);
  padding: 13px 15px 10px;
  margin-bottom: 14px;
}
.spark .spark-dot { fill: var(--brand-ink); }
.spark .spark-base { stroke: var(--line-2); stroke-width: 1; }
.spark-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.spark-head .spark-cap { font-size: 11.5px; color: var(--muted); }
/* The draw-in. The dash length is set per-path inline because only the server
   knows how long the path is. */
.js-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: drawIn .85s var(--ease-out) .12s forwards; }
.js-fadein { animation: fade .5s var(--ease-out) .5s both; }

/* ══ 12 ═ COVERAGE ══════════════════════════════════════════════════════ */

table.coverage th.cov-day {
  font-size: 9.5px;
  letter-spacing: 0;
  text-align: center;
  padding: 6px 2px;
  font-family: var(--mono);
  text-transform: none;
}
table.coverage td.cov { padding: 3px 2px; text-align: center; }
table.coverage td, table.coverage th { border-bottom-color: rgba(30, 30, 46, .6); }

/* ⭐ A 2px surface gap between cells — adjacent fills that touch read as one
   shape and the eye stops counting days. */
.cov-cell {
  display: inline-block;
  width: 17px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  vertical-align: middle;
}
/* ⭐ ok and imported are DIFFERENT colours on purpose: a partner is entitled
   to see which of their revenue a machine measured and which a person keyed
   in. Making them both green would hide exactly that. */
.cov-ok            { background: var(--ok);    border-color: var(--ok); }
.cov-imported      { background: var(--brand); border-color: var(--brand); }
.cov-error         { background: var(--bad);   border-color: var(--bad); }
.cov-missing       { background: var(--warn-tint); border-color: var(--warn); }
/* ⭐⭐ THE SIGNATURE, at its smallest: 45° = nobody measured this. */
.cov-not_connected { background-color: var(--panel-2); background-image: var(--hatch); border-color: var(--line-2); }
.cov-not_applicable{ background: var(--panel-2); opacity: .4; }

.cov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
}
.cov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cov-legend .cov-cell { width: 13px; height: 11px; }

/*
 * ⭐ The coverage bar is inline SVG. No chart library: this repo has no build
 * step on purpose, and one rectangle is not worth a dependency.
 */
.cov-bar { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.cov-bar svg { display: block; }
.cov-bar .cov-fill { transform-origin: left center; animation: growX .6s var(--ease-out) .15s both; }

/* ══ 13 ═ STATEMENTS — THE MONEY PAPER ══════════════════════════════════
 * A settlement statement is the one screen in this app where somebody decides
 * to create a debt. It is styled as a DOCUMENT, not as a dashboard: a wider
 * measure, a serif-weight hierarchy in the worked math, and the arithmetic
 * given the visual authority of a printed clause.
 */

.doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-2);
}
h1.doc-no {
  font-family: var(--mono);
  font-size: 25px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 8px;
}
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.75px; color: var(--muted); }
.doc-meta .sep { color: var(--line-2); }

/* ⭐⭐ THE WORKED MATH IS THE MOST IMPORTANT THING ON THE PAGE. A table of
   numbers is something a partner accepts or does not; a paragraph they can
   check clause by clause is something they can argue with. So it is set as a
   callout: indented behind a brand rule, one measure, generous leading. */
.math {
  position: relative;
  border-left: 2px solid var(--brand);
  background: linear-gradient(90deg, var(--brand-tint), transparent 55%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px 15px;
  margin: 4px 0 6px;
  max-width: 78ch;
}
.math p { color: var(--text-2); }
.math p.small { font-size: 13.25px; line-height: 1.6; margin: 0 0 7px; }
/* The answer. It is the sentence the whole page exists to deliver. */
.math .statement-answer,
.statement-answer {
  font-size: 17px;
  line-height: 1.45;
  font-weight: 650;
  letter-spacing: -.012em;
  color: var(--text);
  margin: 12px 0 0;
}

/* ⭐⭐ THE PROVISIONAL STAMP. Diagonal, hatched, and impossible to skim past —
   the whole failure mode of a provisional statement is that it reads exactly
   like a final one. ⛔ It is decoration OVER copy that already says the same
   thing in words, so it is aria-hidden and nothing depends on it. */
.notice.is-provisional {
  overflow: hidden;
  background-image: var(--hatch-warn), linear-gradient(90deg, var(--warn-tint), transparent 46%);
  border-left-width: 3px;
  padding-right: 150px;
}
.notice.is-provisional .stamp {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%) rotate(-13deg);
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .16em;
  color: transparent;
  -webkit-text-stroke: 1.4px rgba(245, 158, 11, .5);
  text-stroke: 1.4px rgba(245, 158, 11, .5);
  border: 2.5px solid rgba(245, 158, 11, .34);
  border-radius: 8px;
  padding: 5px 12px;
  pointer-events: none;
  user-select: none;
  animation: popIn .4s var(--ease-out) .18s both;
}

/* Statement line table: the subtotal rows carry the weight. */
tr.line-subtotal td, tr.line-subtotal th {
  background: rgba(140, 82, 253, .05);
  font-weight: 650;
  color: var(--text);
  border-top: 1px solid var(--line-2);
}

/* ══ 14 ═ CHECKLIST CARDS ═══════════════════════════════════════════════ */

.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.ck-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-hi) 0%, var(--panel) 58%);
  padding: 16px 18px;
  box-shadow: var(--edge), var(--shadow-1);
  overflow: hidden;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.ck-card:hover { border-color: var(--line-2); }
/* The left edge is the status. A whole card in alarm colours makes a page of
   five items unreadable; a 3px rail is legible at a glance and survives being
   printed in greyscale because the chip repeats it in words. */
.ck-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line-2);
}
.ck-verified::before       { background: var(--ok); }
.ck-broken::before         { background: var(--bad); }
.ck-provided::before       { background: var(--warn); }
.ck-missing::before        { background: var(--line-2); }
.ck-not_applicable         { opacity: .8; }
.ck-not_applicable::before { background: var(--line-2); }
/* A broken credential is freezing a store's revenue right now, so its card
   gets an ambient tint on top of the rail. */
.ck-broken { background: linear-gradient(180deg, rgba(239, 68, 68, .05) 0%, var(--panel) 46%); }

.ck-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ck-head strong { font-size: 14px; }
.ck-unlocks { margin: 9px 0 11px; }
.ck-lines { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 11px; }
.ck-verdict {
  border-left: 2px solid var(--line-2);
  padding-left: 11px;
  margin: 11px 0;
  color: var(--text-2);
}
.ck-verdict ul { margin: 5px 0 0; padding-left: 16px; }
.ck-stamps { margin-top: 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.ck-scopes {
  margin: 13px 0 4px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ck-scopes ul { margin: 6px 0 0; padding-left: 16px; }
.ck-scopes li { margin-bottom: 4px; color: var(--muted); }
.ck-scopes .mono { color: var(--brand-ink); }
.ck-form { margin-top: 13px; }
.ck-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; align-items: flex-start; }
.ck-na { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ck-na input[type="text"] { flex: 1 1 150px; }

/* The pipeline ring — n of m required items ready. */
.ck-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ck-ring {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: conic-gradient(var(--brand) var(--pct), var(--panel-2) 0);
}
.ck-ring > span {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ══ 15 ═ BELL ══════════════════════════════════════════════════════════
 * ⭐ A <details> element, no javascript. This repo has no build step on
 * purpose, and a dropdown that needs a bundler breaks the day the bundler goes.
 */
.bell { margin: 6px 0 4px; position: relative; }
.bell > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.bell > summary::-webkit-details-marker { display: none; }
.bell > summary:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.bell > summary svg { flex: 0 0 16px; color: var(--muted-2); }
.bell > summary .chip { margin-left: auto; }
/* One wiggle on load when something is unread. Once, not a loop — a permanent
   animation in the corner of the eye is a notification people learn to mute. */
.bell.has-unread > summary svg { color: var(--brand-ink); animation: wiggle 2.4s var(--ease) .6s 2; transform-origin: 50% 15%; }
.bell[open] > summary { color: var(--text); background: rgba(255, 255, 255, .045); }

.bell-list {
  margin-top: 5px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 6px;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: var(--shadow-3);
  animation: rise .2s var(--ease-out) both;
}
.bell-item { padding: 8px 9px; border-bottom: 1px solid var(--line); border-radius: 7px; }
.bell-item:last-of-type { border-bottom: 0; }
.bell-item:hover { background: var(--panel-2); }
.bell-item.read { opacity: .5; }
.bell-list form { margin-top: 6px; padding: 0 3px 2px; }

/* ══ 16 ═ TABS, METERS, SELLERS, MISC ═══════════════════════════════════ */

.tabs { display: flex; gap: 3px; margin-top: 14px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  margin-bottom: -1px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.tab:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .03); }
.tab.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: var(--panel);
  box-shadow: inset 0 2px 0 var(--brand);
}

/* The allowance meter — a magnitude of one value against a known ceiling, so
   it is a meter and not a chart. */
.meter {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand-ink));
  transform-origin: left center;
  animation: growX .7s var(--ease-out) .1s both;
}
.meter.is-full > span { background: linear-gradient(90deg, #b91c1c, var(--bad)); }
.meter.is-high > span { background: linear-gradient(90deg, #b45309, var(--warn)); }

/* Bestsellers: a card that is allowed to be simply unavailable. */
.sellers { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; }
.seller {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel-2);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.seller:hover { border-color: var(--line-2); transform: translateY(-2px); }
.seller img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--bg); }
.seller .b { padding: 9px 11px; }
.seller .t { font-size: 12.25px; line-height: 1.35; }
.seller .u { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  color: var(--text-2);
}
code { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ══ 17 ═ AUTH ══════════════════════════════════════════════════════════
 * The only screen a partner sees before they trust us with a processor key.
 * A slow ambient drift behind the card, the X mark very faint behind that,
 * and the wordmark above — nothing else.
 */

.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 44px;
  background: var(--bg-deep);
  overflow: hidden;
}
.auth-glow {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  background:
    radial-gradient(46% 42% at 26% 22%, rgba(124, 58, 237, .34), transparent 68%),
    radial-gradient(40% 38% at 78% 76%, rgba(140, 82, 253, .22), transparent 70%),
    radial-gradient(32% 30% at 62% 12%, rgba(59, 130, 246, .10), transparent 72%);
  filter: blur(28px);
  animation: drift 26s ease-in-out infinite;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(560px, 92vw);
  height: min(560px, 92vw);
  transform: translate(-50%, -50%);
  background: url('/brand/icon-512.png') no-repeat center / contain;
  opacity: .022;
  pointer-events: none;
}

.auth-brand { position: relative; margin-bottom: 22px; animation: rise .5s var(--ease-out) both; }
.auth-brand img { width: 158px; height: auto; display: block; }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 408px;
  background: linear-gradient(180deg, rgba(24, 24, 33, .975) 0%, rgba(15, 15, 21, .985) 100%);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  padding: 28px 28px 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 30px 70px -30px rgba(0, 0, 0, .95);
  backdrop-filter: blur(10px);
  animation: rise .5s var(--ease-out) 70ms both;
}
.auth-card.wide { max-width: 540px; }
.auth-card h1 { font-size: 19px; margin-bottom: 6px; }
.auth-card .btn.primary { width: 100%; margin-top: 4px; }
.auth-card .btn.small { width: auto; }
.auth-card form > .field:last-of-type { margin-bottom: 16px; }
.auth-alt {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.auth-foot {
  position: relative;
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
  animation: fade .6s var(--ease-out) .3s both;
}

.qr {
  background: #fff;
  padding: 11px;
  border-radius: var(--radius-sm);
  width: max-content;
  margin: 0 auto 15px;
  line-height: 0;
  box-shadow: 0 6px 22px -10px rgba(0, 0, 0, .9);
}
.secret {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-deep);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
  letter-spacing: .1em;
  word-break: break-all;
  color: var(--brand-ink);
}
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 15px 0; }
.codes span {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  text-align: center;
  color: var(--text);
}

/* A one-time code wants to be big, spaced and unmistakable. */
input.otp {
  font-family: var(--mono);
  font-size: 21px;
  letter-spacing: .34em;
  text-align: center;
  padding: 12px;
}

/* ══ 18 ═ ERROR PAGES ═══════════════════════════════════════════════════ */

.err-code {
  font-family: var(--mono);
  font-size: 62px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.04em;
  color: transparent;
  background: linear-gradient(180deg, var(--brand-ink), var(--brand-deep));
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: 12px;
}

/* ══ 19 ═ RESPONSIVE ════════════════════════════════════════════════════ */

@media (max-width: 1080px) {
  .main { padding: 22px 20px 64px; }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: auto;
    flex: none;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }
  .sidebar::after { inset: auto 0 0 0; width: auto; height: 1px; background: linear-gradient(90deg, var(--brand), transparent 45%); }
  /* Collapsed: the X mark carries the brand where the wordmark will not fit. */
  .brand { padding: 0 8px 0 0; }
  .brand img.brand-word, .brand .brand-sub { display: none; }
  .brand img.brand-mark { display: block; }
  .ni { padding: 6px 9px; font-size: 12.75px; }
  .ni.active::before { top: auto; bottom: -2px; left: 6px; right: 6px; width: auto; height: 2px; border-radius: 2px 2px 0 0; }
  .bell { margin: 0; }
  .bell-list { position: absolute; right: 0; z-index: 30; min-width: 300px; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; gap: 8px; }
  .sidebar-who { display: none; }
  .main { padding: 18px 16px 56px; }
  h1 { font-size: 22px; }
}

@media (max-width: 560px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .checklist { grid-template-columns: 1fr; }
  .panel { padding: 15px 14px; }
  .notice.is-provisional { padding-right: 14px; }
  .notice.is-provisional .stamp { display: none; }
}

/* ══ 20 ═ REDUCED MOTION + PRINT ════════════════════════════════════════
 * ⛔ One block, no exceptions. Every animation in this file is named above and
 * every one of them stops here.
 */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .js-draw { stroke-dashoffset: 0 !important; }
  .auth-glow { animation: none !important; }
}

@media print {
  .sidebar, .bell, .btn, form { display: none !important; }
  body { background: #fff; color: #111; }
  .panel, .tile, .ck-card { background: #fff; border-color: #ddd; box-shadow: none; }
  .main { padding: 0; }
}
