/* =============================================================================
   PrimeTanki Control — "Modern Blue Ops" design system
   -----------------------------------------------------------------------------
   Single hand-written stylesheet. No framework, no build step, no CDN.
   Every colour, size, radius and shadow used by a component comes from a token.

   Reading order:
     01  Fonts
     02  Primitive tokens (raw palette + scales — never used directly by components)
     03  Semantic tokens (dark = default, light mapping ready for later)
     04  Reset & base elements
     05  Utilities
     06  App shell (rail, topbar, env banner, main, footer)
     07  Page header / section
     08  Panels, cards, stat tiles, key-value lists
     09  Dense data table  <- the density anchor; other components sized around it
     10  Forms & inputs
     11  Buttons
     12  Badges, tier chips, status dots, meters, tabs, toolbar, pagination
     13  States: empty / loading / error / forbidden / degraded / banners
     14  Toasts, modal, drawer, tooltip, kbd hints
     15  Command palette
     16  Styleguide-only helpers
     17  Responsive + motion + print
     18  DENSITY + the calm layer (nav, notices, actions, disclosure, list rows)
     19  Content catalog (picture tiles, the confidence scale, battle pass rungs)
     20  The rarity board (six columns, draggable family cards, the unsaved bar)

   Design rules baked in (owner direction, 2026-07-26):
     - MODERN. Linear / Vercel / Grafana feel: hairline borders, 6px radii,
       layered surfaces instead of heavy shadows, quiet micro-interactions.
     - BLUE. Blue-slate surfaces by elevation, vivid blue primary, sky secondary.
     - Amber + red are RESERVED for mutation actions (reversible / irreversible).
       They never appear as decoration on read-only observation screens.
       The single exception is --env-live-*, because "you are on the live game"
       is a genuine danger semantic, not decoration.
     - No military/stencil styling, no hazard stripes, no bevels, no gradients
       as chrome, nothing echoing the Flash-era game UI.

   ⭐ OWNER CORRECTION, 2026-07-27 - READ BEFORE ADDING A font-size RULE.
     The original direction above said "COMPACT. 13px base." That was built, and
     the owner's verdict on it was: "make it look less words less small text, but
     only usefull infomration". The measured state at that moment: 702 sites of
     deliberately-small or faint text across 56 files, and 65 of the 87 font-size
     rules in this file (75%) set a size BELOW the 13px base - 13 rules at 10px,
     31 at 11px, 21 at 12px.

     The fix is FEWER WORDS AT A COMFORTABLE SIZE, never many words at a small one.
     So the scale below starts at 15px and the 10px and 11px steps are GONE from
     the system entirely. Two hard rules now:

       1. 15px (--fs-sm) is the base. 13px (--fs-2xs) is the FLOOR for anything a
          person reads. 12px (--fs-3xs) exists only for UPPERCASE letterspaced
          micro-labels and keycaps - never for a sentence.
       2. If a sentence is only readable at 11px, CUT THE SENTENCE. Do not add a
          size below --fs-2xs to fit it, and do not reach for --text-faint to make
          it recede. Faint is for decoration; anything a person must read is
          --text-muted or stronger.

     Density did not disappear - it moved from type size to LAYOUT, and it is now
     per-person. `[data-density='simple']` (the moderator app: roomier rows, no
     group labels, one accent) vs `[data-density='full']` (the instrument panel:
     the same type, tighter metrics). See section 18. The mode is computed from
     the capabilities somebody holds - portal/rbac/surface.py.
   ========================================================================== */


/* == 01  Fonts ============================================================= */
/* Self-hosted. Zero external requests (CSP-safe, works offline on the VPS).   */
@font-face {
  font-family: 'InterVar';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/inter-var-latin.woff2') format('woff2');
}


/* == 02  Primitive tokens ================================================== */
/* Raw values. Components must NOT reference these directly — only section 03. */
:root {
  /* --- blue-slate neutral ramp (the surfaces + the text) ------------------ */
  --c-slate-1000: #05080d;
  --c-slate-950:  #080c13;
  --c-slate-900:  #0b111a;
  --c-slate-850:  #0f1621;
  --c-slate-800:  #131c29;
  --c-slate-750:  #182233;
  --c-slate-700:  #1e2a3d;
  --c-slate-650:  #24344a;
  --c-slate-600:  #2d4059;
  --c-slate-500:  #3d5573;
  --c-slate-400:  #587294;
  --c-slate-350:  #6d87a8;
  --c-slate-300:  #8ba3c0;
  --c-slate-250:  #a3b8d0;
  --c-slate-200:  #c0cfe0;
  --c-slate-150:  #d6e0ec;
  --c-slate-100:  #e7edf5;
  --c-slate-50:   #f3f7fb;
  --c-white:      #ffffff;

  /* --- blue: the primary accent, carries identity ------------------------ */
  --c-blue-200: #bfd8ff;
  --c-blue-300: #93bcff;
  --c-blue-400: #63a0fb;
  --c-blue-500: #3b82f6;
  --c-blue-600: #2563eb;
  --c-blue-700: #1d4ed8;
  --c-blue-800: #1a3a94;
  --c-blue-900: #14275c;
  --c-blue-950: #0e1c40;

  /* --- sky/cyan: secondary highlight, links, focus ----------------------- */
  --c-sky-300: #7dd3fc;
  --c-sky-400: #38bdf8;
  --c-sky-500: #0ea5e9;
  --c-sky-700: #0b5f86;
  --c-sky-900: #082f45;

  /* --- indigo / violet / teal: tier identity only ------------------------ */
  --c-violet-300: #c4b5fd;
  --c-violet-400: #a78bfa;
  --c-violet-900: #2c2258;
  --c-indigo-300: #a5b4fc;
  --c-indigo-400: #818cf8;
  --c-indigo-900: #26295e;
  --c-teal-300:   #5eead4;
  --c-teal-400:   #2dd4bf;
  --c-teal-900:   #0c3b39;

  /* --- action colours: RESERVED (see header note) ------------------------ */
  --c-amber-300: #fcd34d;
  --c-amber-400: #fbbf24;
  --c-amber-500: #f59e0b;
  --c-amber-700: #b45309;
  --c-amber-900: #402b06;
  --c-red-300:   #fca5a5;
  --c-red-400:   #f87171;
  --c-red-500:   #ef4444;
  --c-red-600:   #dc2626;
  --c-red-700:   #b91c1c;
  --c-red-900:   #3d1113;
  --c-green-300: #86efac;
  --c-green-400: #4ade80;
  --c-green-500: #22c55e;
  --c-green-700: #15803d;
  --c-green-900: #0b3520;
  /* orange: added 2026-09-05 for the `event` paint type, which had to be
     distinguishable from the gold of `tournament` beside it. */
  --c-orange-300: #fdba74;
  --c-orange-400: #fb923c;

  /* --- typography -------------------------------------------------------- */
  --font-sans: 'InterVar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', 'Segoe UI Mono',
               'JetBrains Mono', Consolas, 'Liberation Mono', monospace;

  /* The 2026-07-27 scale. There is no step below 12px and no step between 12
     and 13 - if a thing does not fit at 13px it is too many words, not too big
     a font. See the owner-correction note at the top of this file. */
  --fs-3xs: 0.75rem;    /* 12px — UPPERCASE micro labels + keycaps ONLY */
  --fs-2xs: 0.8125rem;  /* 13px — chips, badges, meta. THE FLOOR for reading */
  --fs-xs:  0.875rem;   /* 14px — table cells, secondary body, buttons */
  --fs-sm:  0.9375rem;  /* 15px — BASE UI SIZE */
  --fs-md:  1rem;       /* 16px — emphasised body, dialog titles */
  --fs-lg:  1.125rem;   /* 18px — panel titles */
  --fs-xl:  1.375rem;   /* 22px — page titles */
  --fs-2xl: 1.625rem;   /* 26px — stat figures */
  --fs-3xl: 2rem;       /* 32px — hero figures only */

  --lh-tight:  1.2;
  --lh-snug:   1.35;
  --lh-normal: 1.5;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  --ls-caps:  0.06em;
  --ls-tight: -0.011em;

  /* --- spacing: 4px unit ------------------------------------------------- */
  --sp-0:   0;
  --sp-05:  2px;
  --sp-1:   4px;
  --sp-15:  6px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-16:  64px;

  /* --- radii ------------------------------------------------------------- */
  --radius-xs:   3px;
  --radius-sm:   4px;
  --radius-md:   6px;   /* default */
  --radius-lg:   8px;
  --radius-xl:   12px;
  --radius-full: 999px;

  /* --- fixed layout metrics (density anchors) ----------------------------
     These are the FULL-density values (the instrument panel). Simple density
     overrides them in section 18; nothing else in this file should. */
  --rail-w:          236px;
  --rail-w-collapsed: 56px;
  --topbar-h:        48px;
  --envstrip-h:      2px;
  --row-h:           36px;   /* table row — the anchor for everything */
  --row-h-compact:   32px;
  --row-h-roomy:     40px;
  --control-h:       32px;   /* inputs & buttons */
  --control-h-sm:    26px;
  --control-h-lg:    38px;
  /* THE READING COLUMN. Was 1680px until 2026-09-04, which on the owner's very
     wide monitor is not a column at all - it is the whole screen with a thin
     margin, and the eye has to cross it to pair a label with its value.
     1180px holds a three-across card grid at a comfortable card width and keeps
     a two-value row inside one glance. A data table whose columns genuinely need
     more opts out with .content--wide. Nothing else may. */
  --content-max:      1180px;
  --content-max-wide: 1440px;
  --panel-pad:       var(--sp-4);   /* real internal padding, Proton-style */

  /* --- z layers ---------------------------------------------------------- */
  --z-base:     0;
  --z-sticky:   100;
  --z-rail:     200;
  --z-topbar:   300;
  --z-dropdown: 400;
  --z-drawer:   500;
  --z-modal:    600;
  --z-toast:    700;
  --z-palette:  800;
  --z-tooltip:  900;

  /* --- motion ------------------------------------------------------------ */
  --dur-fast: 90ms;
  --dur-med:  150ms;
  --dur-slow: 240ms;
  --ease:     cubic-bezier(0.2, 0, 0.15, 1);
}


/* == 03  Semantic tokens =================================================== */
/* Components use ONLY these. Re-map this block to add a theme; do not touch
   component rules. Dark is the default (:root); light is a full mapping.      */
:root,
:root[data-theme='dark'] {
  color-scheme: dark;

  /* surfaces, by elevation */
  --bg-canvas:      var(--c-slate-1000);  /* the page behind everything */
  --surface-1:      var(--c-slate-900);   /* app chrome: rail, topbar */
  --surface-2:      var(--c-slate-850);   /* panels, cards, table head */
  --surface-3:      var(--c-slate-800);   /* raised: dropdown, modal, drawer */
  --surface-4:      var(--c-slate-750);   /* highest: palette, tooltip */
  --surface-sunken: var(--c-slate-950);   /* inputs, code, wells */
  --surface-hover:  rgba(99, 160, 251, 0.07);
  --surface-active: rgba(99, 160, 251, 0.13);
  --surface-selected: rgba(59, 130, 246, 0.14);

  /* text — four levels, ALL of them WCAG AA on every surface token above.
     Measured against --surface-3 (the lightest surface) which is the worst
     case: primary 14.9:1, secondary 11.1:1, muted 8.6:1, faint 6.3:1.

     ⭐ --text-faint was --c-slate-350 (4.7:1) until 2026-07-27. It is now one
     step brighter, because the audit found 158 template sites using .text-faint
     for things a person is expected to READ, not for decoration. Lifting the
     token fixes all 158 at once without touching a single template. Faint still
     means "quietest thing on the screen"; it no longer means "barely there".
     --c-slate-400 and below are decorative only — never text. */
  --text-primary:   var(--c-slate-100);
  --text-secondary: var(--c-slate-200);
  --text-muted:     var(--c-slate-250);
  --text-faint:     var(--c-slate-300);
  --text-inverse:   var(--c-slate-1000);
  --text-on-accent: var(--c-white);
  --text-link:      var(--c-sky-400);
  --text-link-hover: var(--c-sky-300);

  /* borders */
  --border-subtle:  rgba(148, 178, 216, 0.10);
  --border-default: rgba(148, 178, 216, 0.16);
  --border-strong:  rgba(148, 178, 216, 0.28);
  --border-accent:  var(--c-blue-600);

  /* accent (primary blue) */
  --accent:          var(--c-blue-500);
  --accent-strong:   var(--c-blue-600);
  --accent-stronger: var(--c-blue-700);
  --accent-text:     var(--c-blue-300);
  --accent-soft-bg:  rgba(59, 130, 246, 0.14);
  --accent-soft-bd:  rgba(59, 130, 246, 0.34);

  /* secondary (sky) — highlights, links, focus */
  --highlight:         var(--c-sky-400);
  --highlight-text:    var(--c-sky-300);
  --highlight-soft-bg: rgba(56, 189, 248, 0.13);
  --highlight-soft-bd: rgba(56, 189, 248, 0.32);

  /* observation surface — the calm default for read-only screens */
  --observe-bg: rgba(120, 155, 200, 0.055);
  --observe-bd: rgba(148, 178, 216, 0.16);
  --observe-tx: var(--c-slate-250);

  /* mutation: reversible (amber) — RESERVED for action surfaces */
  --warn:         var(--c-amber-500);
  --warn-text:    var(--c-amber-300);
  --warn-bg:      rgba(245, 158, 11, 0.12);
  --warn-bd:      rgba(245, 158, 11, 0.38);
  --warn-solid:   var(--c-amber-500);
  --warn-on-solid: #241704;

  /* mutation: irreversible (red) — RESERVED for destructive actions */
  --danger:         var(--c-red-500);
  --danger-text:    var(--c-red-300);
  --danger-bg:      rgba(239, 68, 68, 0.12);
  --danger-bd:      rgba(239, 68, 68, 0.40);
  --danger-solid:   var(--c-red-600);
  --danger-solid-hover: var(--c-red-700);
  --danger-on-solid: var(--c-white);

  /* confirmed (green) */
  --success:      var(--c-green-500);
  --success-text: var(--c-green-300);
  --success-bg:   rgba(34, 197, 94, 0.12);
  --success-bd:   rgba(34, 197, 94, 0.36);

  /* informational (blue) */
  --info-text: var(--c-blue-300);
  --info-bg:   rgba(59, 130, 246, 0.12);
  --info-bd:   rgba(59, 130, 246, 0.34);

  /* neutral chip */
  --neutral-text: var(--c-slate-250);
  --neutral-bg:   rgba(148, 178, 216, 0.10);
  --neutral-bd:   rgba(148, 178, 216, 0.20);

  /* environment banner (the one sanctioned non-action use of red) */
  --env-test-text: var(--c-sky-300);
  --env-test-bg:   rgba(56, 189, 248, 0.14);
  --env-test-bd:   rgba(56, 189, 248, 0.42);
  --env-test-line: var(--c-sky-500);
  --env-live-text: var(--c-red-300);
  --env-live-bg:   rgba(239, 68, 68, 0.16);
  --env-live-bd:   rgba(239, 68, 68, 0.48);
  --env-live-line: var(--c-red-500);

  /* staff authority tiers — cool hues only (amber/red stay reserved).
     Higher tier = more saturated + more violet. Lower tier = muted steel. */
  --tier-100-text: var(--c-violet-300); --tier-100-bg: rgba(167,139,250,0.16); --tier-100-bd: rgba(167,139,250,0.40);
  --tier-90-text:  var(--c-indigo-300); --tier-90-bg:  rgba(129,140,248,0.15); --tier-90-bd:  rgba(129,140,248,0.38);
  --tier-85-text:  var(--c-blue-300);   --tier-85-bg:  rgba(99,160,251,0.15);  --tier-85-bd:  rgba(99,160,251,0.38);
  --tier-70-text:  var(--c-sky-300);    --tier-70-bg:  rgba(56,189,248,0.14);  --tier-70-bd:  rgba(56,189,248,0.36);
  --tier-60-text:  var(--c-teal-300);   --tier-60-bg:  rgba(45,212,191,0.13);  --tier-60-bd:  rgba(45,212,191,0.34);
  --tier-50-text:  var(--c-teal-300);   --tier-50-bg:  rgba(45,212,191,0.10);  --tier-50-bd:  rgba(45,212,191,0.26);
  --tier-40-text:  var(--c-slate-200);  --tier-40-bg:  rgba(148,178,216,0.12); --tier-40-bd:  rgba(148,178,216,0.26);
  --tier-30-text:  var(--c-slate-250);  --tier-30-bg:  rgba(148,178,216,0.09);  --tier-30-bd:  rgba(148,178,216,0.20);
  --tier-20-text:  var(--c-slate-300);  --tier-20-bg:  rgba(148,178,216,0.07);  --tier-20-bd:  rgba(148,178,216,0.18);
  --tier-10-text:  var(--c-slate-350);  --tier-10-bg:  rgba(148,178,216,0.06);  --tier-10-bd:  rgba(148,178,216,0.16);

  /* role RANK - the four colours the owner names roles by, plus grey.
     Deliberately NOT the tier ramp above: a tier is a number on the ladder, a
     rank is what somebody calls the job. gold owner, yellow admin, silver mod,
     brown candidate. Warm hues are allowed here because a rank badge is not a
     mutation surface - the amber/red reservation is about ACTIONS. */
  --rank-gold-text:   #f2c14e; --rank-gold-bg:   rgba(242,193,78,0.14);  --rank-gold-bd:   rgba(242,193,78,0.42);
  --rank-yellow-text: #e3d264; --rank-yellow-bg: rgba(227,210,100,0.12); --rank-yellow-bd: rgba(227,210,100,0.36);
  --rank-silver-text: #cbd7e6; --rank-silver-bg: rgba(203,215,230,0.11); --rank-silver-bd: rgba(203,215,230,0.32);
  --rank-brown-text:  #c79a6b; --rank-brown-bg:  rgba(199,154,107,0.12); --rank-brown-bd:  rgba(199,154,107,0.34);
  --rank-grey-text:   var(--c-slate-300); --rank-grey-bg: rgba(148,178,216,0.07); --rank-grey-bd: rgba(148,178,216,0.20);

  /* PAINT RARITY - the six colours of the Tanki wiki's own paint tiles.
     ⛔ THESE ARE COPIED, NOT CHOSEN (owner, 2026-09-05). They are the hex
     values on en.tankiwiki.com/Paints, and the point of putting them on a tile
     border is that they are the colours a player already reads as "rare" or
     "exotic". They must stay in step with RARITY_COLOURS in
     portal/gamecatalog/paint_types.py, which is the source both this and the
     chip dots come from.

     Warm hues are allowed here for exactly the reason the rank block above
     states - the amber/red reservation is about ACTION surfaces, and a paint's
     rarity is a label on a read-only tile.

     ⚠ COMMON IS THE ONE DEVIATION. The wiki draws it white, which on this
     dark theme reads as a highlighted tile rather than as the cheapest paint in
     the game, so it is a quiet grey here. Python still says #FFFFFF, because
     that is what the source says.

     ⭐ THESE SIX ARE THE ONLY RARITY COLOURS IN THE PORTAL (2026-09-05). The
     rarity board used to carry a second set of its own, `--rarity-*`, on the old
     common/rare/epic/legendary/exotic/ultimate ladder - so the Paints page and
     the board disagreed about what "rare" looks like. The ladder became the
     wiki's for the whole game that day, and this is now the one set: the board,
     the case editor and the paint tiles all read it. Do not reintroduce a
     screen-local ladder. */
  --rar-common:    rgba(203,215,230,0.42);
  --rar-uncommon:  #bfff56;
  --rar-rare:      #16b9ff;
  --rar-epic:      #ad87ff;
  --rar-legendary: #ffbc09;
  --rar-exotic:    #ff5309;


  /* elevation — subtle, layered, never a "card float" */
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(0, 0, 0, 0.28);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.03);

  /* focus */
  --focus-color: var(--c-sky-400);
  --focus-ring:  0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--focus-color);
  --focus-width: 2px;

  /* skeleton shimmer */
  --skeleton-base:  rgba(148, 178, 216, 0.07);
  --skeleton-shine: rgba(148, 178, 216, 0.14);

  /* scrollbars */
  --scroll-thumb: rgba(148, 178, 216, 0.20);
  --scroll-track: transparent;
}

/* Light theme — the same semantic names, remapped. Components need no change.
   Not shipped as a user-facing toggle in phase 1; it exists to prove the token
   layer is theme-clean. */
:root[data-theme='light'] {
  color-scheme: light;

  --bg-canvas:      #eef2f8;
  --surface-1:      #ffffff;
  --surface-2:      #ffffff;
  --surface-3:      #ffffff;
  --surface-4:      #ffffff;
  --surface-sunken: #f4f7fb;
  --surface-hover:  rgba(37, 99, 235, 0.06);
  --surface-active: rgba(37, 99, 235, 0.10);
  --surface-selected: rgba(37, 99, 235, 0.09);

  --text-primary:   #0b1622;
  --text-secondary: #37485e;
  --text-muted:     #55697f;
  --text-faint:     #71849a;
  --text-inverse:   #ffffff;
  --text-on-accent: #ffffff;
  --text-link:      #1258c8;
  --text-link-hover: #0e47a1;

  --border-subtle:  rgba(15, 32, 55, 0.09);
  --border-default: rgba(15, 32, 55, 0.15);
  --border-strong:  rgba(15, 32, 55, 0.28);
  --border-accent:  var(--c-blue-600);

  --accent:          var(--c-blue-600);
  --accent-strong:   var(--c-blue-600);
  --accent-stronger: var(--c-blue-700);
  --accent-text:     #1550c0;
  --accent-soft-bg:  rgba(37, 99, 235, 0.09);
  --accent-soft-bd:  rgba(37, 99, 235, 0.28);

  --highlight:         var(--c-sky-500);
  --highlight-text:    #0b6a94;
  --highlight-soft-bg: rgba(14, 165, 233, 0.10);
  --highlight-soft-bd: rgba(14, 165, 233, 0.30);

  --observe-bg: rgba(15, 32, 55, 0.025);
  --observe-bd: rgba(15, 32, 55, 0.12);
  --observe-tx: #37485e;

  --warn-text:    #8a5307;
  --warn-bg:      rgba(245, 158, 11, 0.14);
  --warn-bd:      rgba(180, 83, 9, 0.42);
  --warn-on-solid: #241704;

  --danger-text:  #a51616;
  --danger-bg:    rgba(220, 38, 38, 0.10);
  --danger-bd:    rgba(185, 28, 28, 0.38);

  --success-text: #15703a;
  --success-bg:   rgba(34, 197, 94, 0.13);
  --success-bd:   rgba(21, 128, 61, 0.36);

  --info-text: #1550c0;
  --info-bg:   rgba(37, 99, 235, 0.09);
  --info-bd:   rgba(37, 99, 235, 0.28);

  --neutral-text: #37485e;
  --neutral-bg:   rgba(15, 32, 55, 0.055);
  --neutral-bd:   rgba(15, 32, 55, 0.14);

  --env-test-text: #0b6a94;
  --env-test-bg:   rgba(14, 165, 233, 0.13);
  --env-test-bd:   rgba(14, 165, 233, 0.40);
  --env-live-text: #a51616;
  --env-live-bg:   rgba(220, 38, 38, 0.12);
  --env-live-bd:   rgba(185, 28, 28, 0.42);

  --tier-100-text: #5b32c4; --tier-100-bg: rgba(124,58,237,0.11); --tier-100-bd: rgba(124,58,237,0.30);
  --tier-90-text:  #3a41b8; --tier-90-bg:  rgba(79,70,229,0.10);  --tier-90-bd:  rgba(79,70,229,0.28);
  --tier-85-text:  #1550c0; --tier-85-bg:  rgba(37,99,235,0.09);  --tier-85-bd:  rgba(37,99,235,0.26);
  --tier-70-text:  #0b6a94; --tier-70-bg:  rgba(14,165,233,0.10); --tier-70-bd:  rgba(14,165,233,0.28);
  --tier-60-text:  #0a6b62; --tier-60-bg:  rgba(13,148,136,0.10); --tier-60-bd:  rgba(13,148,136,0.26);
  --tier-50-text:  #0a6b62; --tier-50-bg:  rgba(13,148,136,0.07); --tier-50-bd:  rgba(13,148,136,0.20);
  --tier-40-text:  #37485e; --tier-40-bg:  rgba(15,32,55,0.06);   --tier-40-bd:  rgba(15,32,55,0.16);
  --tier-30-text:  #45596f; --tier-30-bg:  rgba(15,32,55,0.05);   --tier-30-bd:  rgba(15,32,55,0.14);
  --tier-20-text:  #55697f; --tier-20-bg:  rgba(15,32,55,0.04);   --tier-20-bd:  rgba(15,32,55,0.12);
  --tier-10-text:  #55697f; --tier-10-bg:  rgba(15,32,55,0.03);   --tier-10-bd:  rgba(15,32,55,0.11);

  --rank-gold-text:   #8a6206; --rank-gold-bg:   rgba(202,138,4,0.12);   --rank-gold-bd:   rgba(202,138,4,0.34);
  --rank-yellow-text: #6f6410; --rank-yellow-bg: rgba(161,143,20,0.11);  --rank-yellow-bd: rgba(161,143,20,0.30);
  --rank-silver-text: #4b5e73; --rank-silver-bg: rgba(15,32,55,0.06);    --rank-silver-bd: rgba(15,32,55,0.18);
  --rank-brown-text:  #7a5327; --rank-brown-bg:  rgba(146,99,46,0.10);   --rank-brown-bd:  rgba(146,99,46,0.28);
  --rank-grey-text:   #55697f; --rank-grey-bg:   rgba(15,32,55,0.04);    --rank-grey-bd:   rgba(15,32,55,0.12);

  /* PAINT RARITY - the same six wiki colours, darkened only where a 2px line of
     them would disappear into a white page. Uncommon and legendary are the two
     that do; the other three are the wiki's values unchanged, and common is the
     dark theme's grey, flipped. */
  --rar-common:    rgba(15,32,55,0.30);
  --rar-uncommon:  #6fae12;
  --rar-rare:      #0e9ada;
  --rar-epic:      #8b5cf6;
  --rar-legendary: #c98f04;
  --rar-exotic:    #e5480a;


  --shadow-xs: 0 1px 1px rgba(15, 32, 55, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 32, 55, 0.08), 0 0 0 1px rgba(15, 32, 55, 0.04);
  --shadow-md: 0 8px 20px -8px rgba(15, 32, 55, 0.20), 0 0 0 1px rgba(15, 32, 55, 0.06);
  --shadow-lg: 0 24px 56px -16px rgba(15, 32, 55, 0.28), 0 0 0 1px rgba(15, 32, 55, 0.08);
  --shadow-inset: none;

  --focus-color: var(--c-blue-600);

  --skeleton-base:  rgba(15, 32, 55, 0.06);
  --skeleton-shine: rgba(15, 32, 55, 0.11);

  --scroll-thumb: rgba(15, 32, 55, 0.22);
}


/* == 04  Reset & base ====================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;              /* keep rem honest for user zoom/a11y */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-tight);
  font-feature-settings: 'cv05' 1, 'ss03' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1 { font-size: var(--fs-xl); line-height: var(--lh-tight); font-weight: var(--fw-semibold); }
h2 { font-size: var(--fs-lg); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
h3 { font-size: var(--fs-md); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
h4 { font-size: var(--fs-sm); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }

a {
  color: var(--text-link);
  text-decoration: none;
  border-radius: var(--radius-xs);
}
a:hover { color: var(--text-link-hover); text-decoration: underline; text-underline-offset: 2px; }

code, kbd, samp, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--sp-4) 0;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }

/* ⛔ THE `hidden` ATTRIBUTE MUST WIN. The UA stylesheet's `[hidden]{display:none}`
   is beaten by ANY author rule that sets `display` on the same element, so every
   `.banner`, `.fact`, `.diff`, `.field`, `.meter`, `.row` and `.err` that JS
   toggles with `el.hidden = true` stayed on screen - an empty red alert box
   permanently parked above every moderation drawer. Two hand-patched special
   cases (.overlay[hidden], .palette-overlay[hidden]) used to paper over this one
   element at a time; they are deleted in favour of this. */
[hidden] { display: none !important; }

/* One focus treatment everywhere. Always visible for keyboard users. */
:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent-soft-bg); color: var(--text-primary); }

/* Scrollbars: thin, quiet, blue-neutral. */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scroll-track); }
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }


/* == 05  Utilities ========================================================= */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: var(--sp-2); left: var(--sp-2);
  transform: translateY(-200%);
  z-index: var(--z-tooltip);
  background: var(--accent-strong);
  color: var(--text-on-accent);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); text-decoration: none; }

.stack   { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-4 { display: flex; flex-direction: column; gap: var(--sp-4); }
.row     { display: flex; align-items: center; gap: var(--sp-2); }
.row-3   { display: flex; align-items: center; gap: var(--sp-3); }
.row-wrap { flex-wrap: wrap; }
.spacer  { flex: 1 1 auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-faint     { color: var(--text-faint); }
.text-accent    { color: var(--accent-text); }
.text-warn      { color: var(--warn-text); }
.text-danger    { color: var(--danger-text); }
.text-success   { color: var(--success-text); }

.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-md { font-size: var(--fs-md); }
.t-semibold { font-weight: var(--fw-semibold); }
.t-right { text-align: right; }
.t-center { text-align: center; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap   { white-space: nowrap; }

/* Numbers, ids, hashes: monospace + tabular so columns line up. */
.num, .mono, .id {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
  letter-spacing: 0;
}
/* One step up, for a figure somebody actually acts on. */
.num--lead { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-primary); }
.id { color: var(--text-muted); }

/* Micro section label ("OVERVIEW", "MODERATION"). Uppercase, never stencil. */
.eyebrow {
  font-size: var(--fs-3xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.divider { height: 1px; background: var(--border-subtle); margin: var(--sp-3) 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border-subtle); margin: 0 var(--sp-1); }

.icon { flex: none; display: block; }
.icon--inline { display: inline-block; vertical-align: -0.18em; }


/* == 06  App shell ========================================================= */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: 100vh;
  min-height: 100vh;
}
.app[data-rail='collapsed'] { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }

/* --- environment strip: a 2px line across the very top of the app --------- */
.env-strip {
  position: fixed; inset: 0 0 auto 0;
  height: var(--envstrip-h);
  background: var(--env-test-line);
  z-index: var(--z-tooltip);
}
[data-env='live'] .env-strip { background: var(--env-live-line); }

/* --- left rail ------------------------------------------------------------ */
.rail {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-rail);
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--topbar-h);
  padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  flex: none;
}
.rail__mark {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-strong);
  color: var(--text-on-accent);
}
.rail__wordmark {
  display: flex; flex-direction: column; line-height: 1.05; min-width: 0;
}
.rail__wordmark b {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary);
  letter-spacing: 0.01em;
}
.rail__wordmark span {
  font-size: var(--fs-3xs); letter-spacing: var(--ls-caps);
  text-transform: uppercase; color: var(--text-faint);
}

.rail__nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
}

.nav-group { margin-bottom: var(--sp-1); }
.nav-group__label {
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); text-decoration: none; }
.nav-item .icon { color: var(--text-faint); transition: color var(--dur-fast) var(--ease); }
.nav-item:hover .icon { color: var(--text-secondary); }

.nav-item.is-active {
  background: var(--accent-soft-bg);
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.is-active .icon { color: var(--accent-text); }

/* Kept for in-page use (a row action that is genuinely unavailable). It is no
   longer used by the rail: the "soon" nav items were deleted on 2026-07-27 —
   advertising three screens that had never once been clickable cost every
   person three lines of reading on every page, forever. */
.nav-item.is-disabled {
  color: var(--text-faint);
  cursor: default;
  pointer-events: none;
}
.nav-item.is-disabled .icon { color: var(--text-faint); opacity: 0.7; }
.nav-item__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-2xs);
  color: var(--text-secondary);
  background: var(--neutral-bg);
  border-radius: var(--radius-full);
  padding: 0 var(--sp-2);
  line-height: 20px;
}
.rail__foot {
  flex: none;
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-2);
}

/* collapsed rail: icons only */
.app[data-rail='collapsed'] .rail__wordmark,
.app[data-rail='collapsed'] .nav-group__label,
.app[data-rail='collapsed'] .nav-item span,
.app[data-rail='collapsed'] .rail__foot .staff-card__meta { display: none; }
.app[data-rail='collapsed'] .nav-item { justify-content: center; padding: 0; }

/* --- main column ---------------------------------------------------------- */
.main {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--topbar-h);
  padding: 0 var(--sp-4) 0 var(--sp-3);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0;
  z-index: var(--z-topbar);
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-15);
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--env-test-text);
  background: var(--env-test-bg);
  border: 1px solid var(--env-test-bd);
  white-space: nowrap;
}
.env-pill__dot {
  width: 6px; height: 6px; border-radius: var(--radius-full);
  background: currentColor;
}
[data-env='live'] .env-pill {
  color: var(--env-live-text);
  background: var(--env-live-bg);
  border-color: var(--env-live-bd);
}
[data-env='live'] .env-pill__dot { animation: pulse-dot 2.4s var(--ease) infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* the palette trigger doubles as the global search box */
.topbar__search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--control-h);
  width: min(360px, 34vw);
  padding: 0 var(--sp-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.topbar__search:hover { border-color: var(--border-strong); background: var(--surface-2); }
/* Its label wrapped to two lines inside a 32px-high button once the viewport
   dropped under ~1200px. It is three words - it never wraps. */
.topbar__search > span:not(.kbd-hint) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__search .icon { color: var(--text-faint); }
.topbar__search .kbd-hint { margin-left: auto; }

.topbar__actions { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }

/* icon button used in the topbar and panel headers */
.icon-btn {
  display: inline-grid; place-items: center;
  position: relative;
  width: var(--control-h); height: var(--control-h);
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.icon-btn[aria-expanded='true'] { background: var(--surface-active); color: var(--text-primary); }
.icon-btn__badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--accent-strong);
  color: var(--text-on-accent);
  font-family: var(--font-mono);
  /* Was 9px. Nothing in this system is below --fs-3xs any more, badges least of
     all: a count you cannot read is a count you ignore. */
  font-size: var(--fs-3xs); line-height: 17px; font-weight: var(--fw-bold);
  text-align: center;
  border: 2px solid var(--surface-1);
  box-sizing: content-box;
}

/* signed-in staff chip (topbar + rail footer) */
.staff-card {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-15) var(--sp-2);
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast) var(--ease);
}
/* It is an <a href="/account">, so the global a:hover underline has to be undone. */
.staff-card:hover { background: var(--surface-hover); text-decoration: none; }
.avatar {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--accent-soft-bg);
  border: 1px solid var(--accent-soft-bd);
  color: var(--accent-text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0;
}
.avatar--lg { width: 32px; height: 32px; font-size: var(--fs-xs); }
.staff-card__meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.staff-card__name { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-primary); }
.staff-card__role { font-size: var(--fs-2xs); color: var(--text-muted); }
.staff-card { gap: var(--sp-3); padding: var(--sp-2); }
.avatar { width: 30px; height: 30px; }

/* --- content + footer -----------------------------------------------------
   THE COLUMN. .content is the scroll box and fills the space beside the rail;
   .content__inner is the measured column inside it, centred with auto margins.
   Centring happens INSIDE .main, which is the second grid track, so the column
   sits in the middle of the space the rail leaves rather than in the middle of
   the viewport - the rail never pushes it off axis.

   Everything a page draws is inside .content__inner - the page header, the
   flash region and the body all descend from it - so the whole page shares one
   axis by construction and nothing can drift out of it. */
.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-8) var(--sp-12);
}
.content__inner { max-width: var(--content-max); margin: 0 auto; }

/* THE ONE ESCAPE HATCH. A screen whose content is a wide data table sets
   .content--wide and gets the wider cap - still a centred column, just a
   roomier one. It re-points the token, so .content__inner and everything else
   measured against --content-max follow without a second rule.
   It is a separate class from .content--fill on purpose: --wide is horizontal,
   --fill is vertical, and a screen can want either without the other. */
.content--wide { --content-max: var(--content-max-wide); }

/* --- fill-height list screens --------------------------------------------
   A page whose main content is ONE long table opts in: <main class="content
   content--fill"> plus .panel--fill on the panel that owns the table. The panel
   is then the only element in the column allowed to SHRINK, so the table scrolls
   inside its own wrap, the sticky header stays pinned, and .content never gains
   a second scrollbar of its own.

   Why not viewport arithmetic: `max-height: calc(100vh - N)` has to guess how
   much chrome sits above the table, and that is not a constant. On /audit the
   filter disclosure alone moves it by ~250px between closed and open, so no
   single N is right in both states - which is how the first attempt at this
   ended up allowing 660px inside a 550px column and producing the exact nested
   scrollbars it was meant to remove. Flex measures instead of guessing. */
.content--fill { display: flex; flex-direction: column; }
.content--fill > .content__inner {
  /* width:100% because auto cross-margins suppress flex stretch - without it the
     column would collapse to fit-content and every page would go narrow. */
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Pass the shrink through any wrapper between the column and the panel
   (templates/audit/list.html wraps its page in .stack). */
.content--fill > .content__inner > .stack { flex: 1 1 auto; min-height: 0; }
/* 0 1 auto, not 1 1 auto: a short table keeps its natural height instead of
   stretching a half-empty panel to the bottom of the screen. It only shrinks,
   and only when there is not enough room. */
.panel--fill { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.panel--fill > .panel__body { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.panel--fill .table-wrap { flex: 0 1 auto; min-height: 0; max-height: none; }

/* No max-width and no auto margins of its own: it already lives inside the
   measured column, so it simply fills it. It used to re-declare both, which in
   a .content--fill flex column made it shrink-wrap its own text and needed a
   third rule to undo. One column, declared once. */
.flash-region {
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: 100%; margin: 0 0 var(--sp-3);
}

.appfoot {
  flex: none;
  display: flex; align-items: center; gap: var(--sp-3);
  height: 28px;
  padding: 0 var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
}
.appfoot__sep { color: var(--border-strong); }


/* == 07  Page header ======================================================= */
/* Proton separates by SPACE, not by rules. The hairline stays only where the
   header sits directly on top of a table; everything else gets air. */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding-bottom: var(--sp-1);
  margin-bottom: var(--sp-5);
}
.page-head--ruled { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-subtle); }
.page-head__main { min-width: 0; flex: 1 1 auto; }
.page-head__crumbs {
  display: flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-2xs); color: var(--text-faint); margin-bottom: var(--sp-1);
}
.page-head__crumbs a { color: var(--text-muted); }
.page-head__title { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.page-head__title h1 { letter-spacing: -0.015em; }
.page-head__sub { margin-top: var(--sp-15); font-size: var(--fs-xs); color: var(--text-muted); max-width: 66ch; }
.page-head__meta {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin-top: var(--sp-2); font-size: var(--fs-2xs); color: var(--text-faint);
}
.page-head__meta b { color: var(--text-secondary); font-weight: var(--fw-medium); }
.page-head__actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; }

.section-head {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-2);
}
.section-head h2 { font-size: var(--fs-md); }


/* == 08  Panels, stats, key-values ========================================= */
.panel {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel + .panel { margin-top: var(--sp-4); }
/* Inside a grid the gap already does the spacing, and a stacking margin would
   push every panel but the first one out of line with its row. */
.grid-2 > .panel + .panel,
.grid-3 > .panel + .panel,
.grid-4 > .panel + .panel { margin-top: 0; }

.panel__head {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 40px;
  padding: var(--sp-2) var(--panel-pad);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(0deg, transparent, transparent); /* flat by intent */
}
.panel__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  display: flex; align-items: center; gap: var(--sp-15);
}
.panel__title .icon { color: var(--text-faint); }
.panel__hint { font-size: var(--fs-2xs); color: var(--text-muted); }
.panel__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-1); }
.panel__body { padding: var(--panel-pad); }
.panel__body--flush { padding: 0; }
.panel__foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--panel-pad);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}

/* Collapsible panel section. The <summary> IS the panel head, so a filter bar
   costs one 34px row until somebody opens it. Native <details> on purpose: no
   JavaScript, keyboard and screen-reader behaviour for free. */
.disclosure > summary {
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover .panel__title { color: var(--text-primary); }
.disclosure:not([open]) > summary { border-bottom: 0; }
.disclosure__chev {
  display: inline-flex;
  color: var(--text-faint);
  transition: transform var(--dur-fast) var(--ease);
}
.disclosure[open] .disclosure__chev { transform: rotate(180deg); }

/* Intent variants. Observation is the phase-1 default; the two mutation
   variants exist now so later phases stay consistent, and are visually
   SEPARATED from read surfaces exactly as the design doc requires. */
.panel--observation { background: var(--surface-2); }
.panel--mutation {
  background: var(--warn-bg);
  border-color: var(--warn-bd);
}
.panel--mutation .panel__head { border-bottom-color: var(--warn-bd); }
.panel--mutation .panel__title { color: var(--warn-text); }
.panel--destructive {
  background: var(--danger-bg);
  border-color: var(--danger-bd);
}
.panel--destructive .panel__head { border-bottom-color: var(--danger-bd); }
.panel--destructive .panel__title { color: var(--danger-text); }

/* stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-2);
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3) var(--sp-15);
  min-width: 0;
}
.stat__label {
  display: flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  font-weight: var(--fw-semibold);
  color: var(--text-faint);
}
.stat__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
  color: var(--text-primary);
  margin-top: var(--sp-05);
}
.stat__value small { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-regular); }
.stat__delta { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: var(--sp-1); }
.stat--accent .stat__value { color: var(--accent-text); }

/* key/value description rows — used all over player profiles */
.kv { display: grid; grid-template-columns: minmax(96px, 152px) minmax(0, 1fr); }
.kv > dt {
  padding: var(--sp-15) var(--sp-3) var(--sp-15) 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.kv > dd {
  padding: var(--sp-15) 0;
  font-size: var(--fs-xs);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }
/* The qualifier under a value ("Only for chat", "Longest they can set 24"). Its
   own line, because trailing it after the value made a long row wrap into an
   unreadable ribbon and needed a dash to separate the two halves. */
.kv__note {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}


/* == 09  Dense data table ================================================== */
/* The density anchor. 32px rows, 12px text, sticky header, hairline rules.
   A staff member must see 20+ rows without scrolling on a laptop.            */
/* The wrap is the scroll container, which is what makes the sticky header work:
   `position: sticky` anchors to the nearest scrolling ancestor, so the table
   MUST own its own scroll box. The default cap keeps a 5,000-row list inside
   the panel instead of stretching the page; override per table with
   style="--table-max-h: 40vh", or switch it off with .table-wrap--fill. */
.table-wrap {
  position: relative;
  overflow: auto;
  max-height: var(--table-max-h, calc(100vh - 300px));
}
/* --fill means "size to the rows", NOT "stop scrolling": a wrap with
   `max-height: none` is still the sticky containment box, so its header would
   anchor to a box that never scrolls and scroll off the screen with the page -
   which is exactly what every shipped screen did, since they all pass
   max_height='none'. It cannot become `overflow: visible` instead: .panel is
   `overflow: hidden`, so sticky would just anchor there, and a wide table would
   lose its horizontal scroll.

   The four SINGLE-table screens (players, audit, staff, roles) do not use this
   cap at all - they opt into .content--fill / .panel--fill above, which measures
   the space left in the column instead of guessing at it. What is left here are
   the SUB-tables of a record page (the moderation tab stacks four, the garage
   tab one per category, staff detail one). Those pages are legitimately taller
   than the viewport and scroll as a page; the cap only stops one 5,000-row
   section from burying the sections under it, so a generous value is the right
   one. It is deliberately larger than the fill screens' old 240px offset was. */
.table-wrap--fill { --table-max-h: calc(100vh - 180px); }
.table-wrap--bordered {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-xs);
  line-height: 1.35;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: 34px;
  padding: 0 var(--sp-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}
/* keep the sticky header opaque over scrolled rows */
table.data thead th::after {
  content: '';
  position: absolute; inset: auto 0 -1px 0; height: 1px;
  background: var(--border-default);
}

table.data th.is-sortable { cursor: pointer; }
table.data th.is-sortable:hover { color: var(--text-primary); }
table.data th .sort-ind { display: inline-block; margin-left: var(--sp-1); opacity: 0; vertical-align: -0.15em; }
table.data th[aria-sort='ascending'] .sort-ind,
table.data th[aria-sort='descending'] .sort-ind { opacity: 1; color: var(--accent-text); }
table.data th[aria-sort='descending'] .sort-ind { transform: rotate(180deg); }

table.data tbody td {
  height: var(--row-h);
  padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--dur-fast) var(--ease); }
table.data tbody tr:hover td { background: var(--surface-hover); }

/* keyboard cursor row (j/k or arrow keys) + selected row */
table.data tbody tr.is-cursor td {
  background: var(--surface-active);
  box-shadow: inset 2px 0 0 var(--accent);
}
table.data tbody tr[aria-selected='true'] td { background: var(--surface-selected); }
table.data tbody tr[data-href] { cursor: pointer; }

/* density modifiers */
table.data--compact tbody td { height: var(--row-h-compact); }
table.data--roomy tbody td   { height: var(--row-h-roomy); }
table.data--zebra tbody tr:nth-child(even) td { background: rgba(148, 178, 216, 0.028); }
table.data--zebra tbody tr:nth-child(even):hover td { background: var(--surface-hover); }

/* cell helpers */
table.data .cell-primary { color: var(--text-primary); font-weight: var(--fw-medium); }
table.data .cell-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.data .cell-mono { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-muted); }
/* A column of ids nobody types is the first thing to CUT, not to shrink. This
   keeps one where it is genuinely load-bearing (audit rows, promo codes). */
table.data .cell-id { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-faint); }
table.data .cell-actions { text-align: right; width: 1%; }
table.data .cell-tight { width: 1%; }
table.data .cell-wrap { white-space: normal; min-width: 200px; }
table.data .cell-trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.data col.col-narrow { width: 68px; }

/* selection checkbox column */
table.data .cell-select { width: 28px; padding-left: var(--sp-2); padding-right: 0; }

/* table toolbar sits directly above a flush table inside a panel */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.toolbar__count {
  font-size: var(--fs-2xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* pagination strip */
.pager {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--panel-pad);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}
.pager__pages { display: flex; align-items: center; gap: var(--sp-05); margin-left: auto; }
.pager__page {
  min-width: 22px; height: 22px; padding: 0 var(--sp-15);
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-2xs);
  cursor: pointer;
}
.pager__page:hover { background: var(--surface-hover); color: var(--text-primary); }
/* Ends of the range: present, obviously inert, not a dead link. */
.pager__page.is-disabled,
.pager__page[disabled] {
  color: var(--text-faint);
  cursor: default;
  pointer-events: none;
}
.pager__page[aria-current='page'] {
  background: var(--accent-soft-bg);
  border-color: var(--accent-soft-bd);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}


/* == 10  Forms & inputs ==================================================== */
.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field--row { flex-direction: row; align-items: center; gap: var(--sp-2); }

.label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  display: flex; align-items: center; gap: var(--sp-1);
}
.label .req { color: var(--warn-text); font-weight: var(--fw-bold); }
.label .optional { color: var(--text-faint); font-weight: var(--fw-regular); font-size: var(--fs-2xs); }

/* A hint is a SENTENCE, so it obeys the 13px reading floor and never uses the
   faintest colour. If a hint only fits at 11px it was never a hint, it was an
   explanation - put it behind a .why disclosure (section 18) instead. */
.hint { font-size: var(--fs-2xs); color: var(--text-muted); }
.err  { font-size: var(--fs-xs); color: var(--danger-text); display: flex; align-items: center; gap: var(--sp-1); }

.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  height: var(--control-h);
  padding: 0 var(--sp-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.textarea { height: auto; min-height: 64px; padding: var(--sp-15) var(--sp-2); resize: vertical; line-height: var(--lh-snug); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-bg);
  background: var(--surface-2);
}
.input:disabled, .select:disabled, .textarea:disabled {
  opacity: 0.5; cursor: not-allowed; background: var(--surface-2);
}
.input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.input--lg { height: var(--control-h-lg); font-size: var(--fs-md); }

/* The chevron is a data-URI, so its stroke cannot be a var(). It is the ONLY
   hard-coded colour outside the token blocks; keep it equal to --c-slate-350. */
.select {
  appearance: none;
  padding-right: var(--sp-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d87a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-15) center;
}

.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea { border-color: var(--danger-bd); }
.field.is-invalid .input:focus { box-shadow: 0 0 0 3px var(--danger-bg); }

/* input with a leading icon (search boxes, filters) */
.input-icon { position: relative; display: flex; align-items: center; min-width: 0; }
.input-icon > .icon {
  position: absolute; left: var(--sp-2); color: var(--text-faint); pointer-events: none;
}
.input-icon > .input { padding-left: 28px; }

/* segmented control / filter chips row */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  gap: 2px;
}
.segmented button {
  height: 22px;
  padding: 0 var(--sp-2);
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text-primary); }
.segmented button[aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* checkbox / radio */
.check { display: inline-flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; }
.check input[type='checkbox'], .check input[type='radio'] {
  appearance: none;
  width: 14px; height: 14px; margin: 2px 0 0; flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.check input[type='radio'] { border-radius: var(--radius-full); }
.check input:checked {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.check input[type='checkbox']:checked::after {
  content: '';
  width: 8px; height: 8px;
  background: var(--text-on-accent);
  clip-path: polygon(14% 45%, 0 60%, 38% 100%, 100% 22%, 85% 8%, 36% 66%);
}
.check input[type='radio']:checked::after {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--text-on-accent);
}
.check__text { font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.4; }
.check__text b { display: block; color: var(--text-primary); font-weight: var(--fw-medium); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.switch input { appearance: none; margin: 0; width: 28px; height: 16px; flex: none;
  background: var(--border-strong); border-radius: var(--radius-full);
  position: relative; cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-white);
  transition: transform var(--dur-fast) var(--ease);
}
.switch input:checked { background: var(--accent-strong); }
.switch input:checked::after { transform: translateX(12px); }

/* form layout helpers */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); }
.form-actions {
  display: flex; align-items: center; gap: var(--sp-2);
  padding-top: var(--sp-3); margin-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
}

/* typed-confirm field for destructive actions (later phases) */
.confirm-type {
  background: var(--surface-sunken);
  border: 1px dashed var(--danger-bd);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
}
.confirm-type__prompt { font-size: var(--fs-xs); color: var(--danger-text); margin-bottom: var(--sp-15); }


/* == 11  Buttons =========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-15);
  height: var(--control-h);
  padding: 0 var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-4); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
/* Quieter through TOKENS, never through opacity. `opacity: 0.45` blended the
   label toward the surface behind it (~3.9:1 on --surface-3) and the nested
   .text-faint phase suffix down to ~2:1 - and on the player profile those chips
   are not decoration, they are the only place the portal says WHEN a control
   arrives. Same reasoning as .nav-item.is-disabled and .pager__page.is-disabled,
   which already refuse opacity for exactly this. --text-muted on --neutral-bg
   measures ~7.5:1 on --surface-2 and --surface-3. */
.btn:disabled, .btn.is-disabled {
  background: var(--neutral-bg);
  border-color: var(--border-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}
.btn:disabled .icon, .btn.is-disabled .icon { color: var(--text-faint); }
/* The phase suffix carries the payload ("· phase 5"), so it is muted, not faint,
   wherever it sits inside a disabled chip. */
.btn:disabled .text-faint, .btn.is-disabled .text-faint { color: var(--text-muted); }
.btn .icon { margin-left: -2px; }

.btn--primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--text-on-accent);
  font-weight: var(--fw-semibold);
}
.btn--primary:hover { background: var(--accent-stronger); border-color: var(--accent-stronger); }

.btn--secondary { /* the default look, named for clarity in templates */ }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover { background: var(--surface-hover); color: var(--text-primary); border-color: transparent; }

.btn--warn {
  background: var(--warn-bg);
  border-color: var(--warn-bd);
  color: var(--warn-text);
}
.btn--warn:hover { background: rgba(245, 158, 11, 0.2); border-color: var(--warn); }

.btn--danger {
  background: var(--danger-solid);
  border-color: var(--danger-solid);
  color: var(--danger-on-solid);
  font-weight: var(--fw-semibold);
}
.btn--danger:hover { background: var(--danger-solid-hover); border-color: var(--danger-solid-hover); }

.btn--danger-quiet {
  background: transparent;
  border-color: var(--danger-bd);
  color: var(--danger-text);
}
.btn--danger-quiet:hover { background: var(--danger-bg); }

.btn--sm { height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-2xs); }
.btn--lg { height: var(--control-h-lg); padding: 0 var(--sp-5); font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--icon.btn--sm { width: var(--control-h-sm); }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* loading button */
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute; width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--text-on-accent);
  animation: spin 0.6s linear infinite;
}
.btn--secondary.is-loading::after, .btn--ghost.is-loading::after { color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }


/* == 12  Badges, tiers, dots, meters, tabs ================================= */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  border: 1px solid var(--neutral-bd);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}
.badge--info    { background: var(--info-bg);      border-color: var(--info-bd);      color: var(--info-text); }
.badge--accent  { background: var(--accent-soft-bg); border-color: var(--accent-soft-bd); color: var(--accent-text); }
.badge--highlight { background: var(--highlight-soft-bg); border-color: var(--highlight-soft-bd); color: var(--highlight-text); }
.badge--success { background: var(--success-bg);   border-color: var(--success-bd);   color: var(--success-text); }
.badge--warn    { background: var(--warn-bg);      border-color: var(--warn-bd);      color: var(--warn-text); }
.badge--danger  { background: var(--danger-bg);    border-color: var(--danger-bd);    color: var(--danger-text); }
.badge--outline { background: transparent; }
.badge--caps { text-transform: uppercase; letter-spacing: var(--ls-caps); font-size: var(--fs-3xs); font-weight: var(--fw-semibold); }

/* staff authority tier chip — "T60 Senior Mod". Cool hues only, never insignia. */
.tier {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 22px; padding: 0 var(--sp-2) 0 var(--sp-15);
  border-radius: var(--radius-sm);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  border: 1px solid var(--neutral-bd);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}
.tier__n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-3xs);
  font-weight: var(--fw-bold);
  padding: 0 var(--sp-1);
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.22);
  letter-spacing: 0;
}
.tier[data-tier='100'] { color: var(--tier-100-text); background: var(--tier-100-bg); border-color: var(--tier-100-bd); }
.tier[data-tier='90']  { color: var(--tier-90-text);  background: var(--tier-90-bg);  border-color: var(--tier-90-bd); }
.tier[data-tier='85']  { color: var(--tier-85-text);  background: var(--tier-85-bg);  border-color: var(--tier-85-bd); }
.tier[data-tier='70']  { color: var(--tier-70-text);  background: var(--tier-70-bg);  border-color: var(--tier-70-bd); }
.tier[data-tier='60']  { color: var(--tier-60-text);  background: var(--tier-60-bg);  border-color: var(--tier-60-bd); }
.tier[data-tier='50']  { color: var(--tier-50-text);  background: var(--tier-50-bg);  border-color: var(--tier-50-bd); }
.tier[data-tier='40']  { color: var(--tier-40-text);  background: var(--tier-40-bg);  border-color: var(--tier-40-bd); }
.tier[data-tier='30']  { color: var(--tier-30-text);  background: var(--tier-30-bg);  border-color: var(--tier-30-bd); }
.tier[data-tier='20']  { color: var(--tier-20-text);  background: var(--tier-20-bg);  border-color: var(--tier-20-bd); }
.tier[data-tier='10']  { color: var(--tier-10-text);  background: var(--tier-10-bg);  border-color: var(--tier-10-bd); }

/* role rank badge. Same shape as .badge so a row never changes height when one
   role is gold and the next is grey. Colours are tokens, never inline styles. */
.rank {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--rank-grey-bd);
  background: var(--rank-grey-bg);
  color: var(--rank-grey-text);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  white-space: nowrap;
}
.rank[data-rank='gold']   { color: var(--rank-gold-text);   background: var(--rank-gold-bg);   border-color: var(--rank-gold-bd); }
.rank[data-rank='yellow'] { color: var(--rank-yellow-text); background: var(--rank-yellow-bg); border-color: var(--rank-yellow-bd); }
.rank[data-rank='silver'] { color: var(--rank-silver-text); background: var(--rank-silver-bg); border-color: var(--rank-silver-bd); }
.rank[data-rank='brown']  { color: var(--rank-brown-text);  background: var(--rank-brown-bg);  border-color: var(--rank-brown-bd); }
.rank[data-rank='grey']   { color: var(--rank-grey-text);   background: var(--rank-grey-bg);   border-color: var(--rank-grey-bd); }

/* status dot for online/offline/degraded lists */
.dot {
  display: inline-block; width: 7px; height: 7px; flex: none;
  border-radius: var(--radius-full);
  background: var(--text-faint);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.dot--online  { background: var(--success); }
.dot--warn    { background: var(--warn); }
.dot--danger  { background: var(--danger); }
.dot--info    { background: var(--highlight); }
.dot--offline { background: var(--c-slate-500); }

/* quota / budget meter (My Work, Economy ceiling) */
.meter { display: flex; flex-direction: column; gap: var(--sp-05); min-width: 0; }
.meter__top {
  display: flex; align-items: baseline; gap: var(--sp-2);
  font-size: var(--fs-2xs); color: var(--text-muted);
}
.meter__top b {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}
.meter__track {
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease);
}
.meter--warn .meter__fill   { background: var(--warn); }
.meter--danger .meter__fill { background: var(--danger); }

/* tabs (player profile: Overview / Garage / Economy / ...) */
.tabs {
  display: flex; align-items: center; gap: var(--sp-1);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-3);
  overflow-x: auto;
}
.tab {
  height: 34px;
  padding: 0 var(--sp-3);
  display: inline-flex; align-items: center; gap: var(--sp-1);
  border: 0; background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  cursor: pointer;
}
.tab { font-size: var(--fs-xs); }
.tab:hover { color: var(--text-primary); }
.tab[aria-selected='true'] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: var(--fw-semibold); }
.tab__count { font-family: var(--font-mono); font-size: var(--fs-3xs); color: var(--text-faint); }

/* Wizard steps. A tab strip says "which section am I in"; a step strip has to
   say "how far along am I", so each step carries done / current / todo and the
   number badge is what shows it. */
.steps { gap: var(--sp-2); }
.step__n {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-bold);
  line-height: 1;
}
.step[data-step-state='done'] { color: var(--text-secondary); }
.step[data-step-state='done'] .step__n {
  background: var(--success-bg); border-color: var(--success-bd); color: var(--success-text);
}
.step[data-step-state='current'] .step__n {
  background: var(--accent-soft-bg); border-color: var(--accent-soft-bd); color: var(--accent-text);
}


/* == 13  States ============================================================ */
/* Shared shell for empty / error / forbidden / loading panels. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-muted);
}
.state__icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-bd);
  color: var(--text-faint);
}
.state__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-primary); }
.state__body { font-size: var(--fs-xs); color: var(--text-muted); max-width: 52ch; }
.state__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.state--compact { padding: var(--sp-5) var(--sp-4); }

.state--error .state__icon    { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-text); }
.state--forbidden .state__icon { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-text); }
.state--empty .state__icon    { background: var(--observe-bg); border-color: var(--observe-bd); }

/* forbidden must always name the missing capability and who can grant it */
.state__cap {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--text-secondary);
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--sp-05) var(--sp-15);
}

/* banners: page-level notices (degraded dependency, read-only mode, flash) */
.banner {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--info-bd);
  background: var(--info-bg);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}
.banner .icon { color: var(--info-text); margin-top: 1px; }
.banner__title { font-weight: var(--fw-semibold); color: var(--text-primary); }
.banner__body { min-width: 0; }
.banner__actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.banner--success { border-color: var(--success-bd); background: var(--success-bg); }
.banner--success .icon { color: var(--success-text); }
.banner--warn { border-color: var(--warn-bd); background: var(--warn-bg); }
.banner--warn .icon { color: var(--warn-text); }
.banner--danger { border-color: var(--danger-bd); background: var(--danger-bg); }
.banner--danger .icon { color: var(--danger-text); }
.banner--degraded { border-color: var(--warn-bd); background: var(--warn-bg); border-left-width: 3px; }

/* skeletons — layout-preserving, never a spinner over a blank page */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-base);
  border-radius: var(--radius-sm);
  height: 12px;
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--text  { height: 10px; }
.skeleton--title { height: 16px; width: 40%; }
.skeleton--pill  { height: 18px; width: 56px; border-radius: var(--radius-sm); }
.skeleton-rows { display: flex; flex-direction: column; }
.skeleton-rows > div {
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.8fr 0.8fr 0.6fr;
  gap: var(--sp-3);
  align-items: center;
  height: var(--row-h);
  padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}

/* inline spinner */
.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}


/* == 14  Toast, modal, drawer, tooltip, kbd ================================ */
.toast-region {
  position: fixed;
  right: var(--sp-4); bottom: var(--sp-4);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: min(360px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  animation: toast-in var(--dur-med) var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all var(--dur-med) var(--ease); }
.toast__title { font-weight: var(--fw-semibold); color: var(--text-primary); }
.toast__body { min-width: 0; flex: 1 1 auto; }
.toast--success { border-left-color: var(--success); }
.toast--success .icon { color: var(--success-text); }
.toast--warn    { border-left-color: var(--warn); }
.toast--warn .icon { color: var(--warn-text); }
.toast--danger  { border-left-color: var(--danger); }
.toast--danger .icon { color: var(--danger-text); }
.toast .icon { color: var(--accent-text); margin-top: 1px; }

/* modal + drawer share the backdrop */
.overlay {
  position: fixed; inset: 0;
  background: rgba(3, 6, 12, 0.62);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  animation: fade-in var(--dur-med) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }

.modal {
  width: min(520px, 100%);
  max-height: 84vh;
  display: flex; flex-direction: column;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--dur-med) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.modal--wide { width: min(760px, 100%); }
.modal__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.modal__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.modal__body { padding: var(--panel-pad); overflow-y: auto; font-size: var(--fs-xs); color: var(--text-secondary); }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
}
.modal--destructive { border-color: var(--danger-bd); }
.modal--destructive .modal__head { border-bottom-color: var(--danger-bd); background: var(--danger-bg); }
.modal--destructive .modal__title { color: var(--danger-text); }

/* right drawer — every mutation in later phases opens in one of these */
.drawer-overlay { place-items: stretch; justify-items: end; padding: 0; z-index: var(--z-drawer); }
.drawer {
  width: min(480px, 100%);
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface-3);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  animation: drawer-in var(--dur-med) var(--ease);
}
@keyframes drawer-in { from { transform: translateX(16px); opacity: 0; } }
.drawer--wide { width: min(680px, 100%); }
.drawer__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  flex: none;
}
.drawer__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.drawer__sub { font-size: var(--fs-2xs); color: var(--text-muted); }
.drawer__body { padding: var(--sp-3); overflow-y: auto; flex: 1 1 auto; }
.drawer__foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  flex: none;
}

/* before/after preview block — fixed position inside every mutation drawer */
.diff {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.diff__side { min-width: 0; }
.diff__label { font-size: var(--fs-3xs); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--text-faint); }
.diff__val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--text-primary);
}
.diff__val--after { color: var(--warn-text); }
.diff__arrow { color: var(--text-faint); }

/* tooltip */
.tooltip {
  position: absolute;
  z-index: var(--z-tooltip);
  max-width: 260px;
  padding: var(--sp-1) var(--sp-2);
  background: var(--surface-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-2xs);
  color: var(--text-secondary);
}

/* keyboard hints */
kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 var(--sp-1);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-medium);
  line-height: 1;
}
.kbd-hint { display: inline-flex; align-items: center; gap: 3px; color: var(--text-faint); font-size: var(--fs-2xs); }
.kbd-legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  font-size: var(--fs-2xs); color: var(--text-faint);
}
.kbd-legend > span { display: inline-flex; align-items: center; gap: var(--sp-1); }


/* == 15  Command palette (Ctrl+K) ========================================== */
.palette-overlay {
  position: fixed; inset: 0;
  z-index: var(--z-palette);
  background: rgba(3, 6, 12, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  padding-top: 12vh;
  animation: fade-in var(--dur-fast) var(--ease);
}

.palette {
  width: min(600px, calc(100vw - var(--sp-8)));
  max-height: 64vh;
  display: flex; flex-direction: column;
  background: var(--surface-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--dur-med) var(--ease);
}
.palette__search {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  flex: none;
}
.palette__search .icon { color: var(--text-faint); }
.palette__input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent;
  font-size: var(--fs-md);
  color: var(--text-primary);
  outline: none;
}
.palette__input::placeholder { color: var(--text-faint); }
.palette__list { overflow-y: auto; padding: var(--sp-1); flex: 1 1 auto; }
.palette__group {
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: var(--fw-semibold);
}
.palette__item {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 30px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.palette__item .icon { color: var(--text-faint); }
.palette__item small { margin-left: auto; color: var(--text-faint); font-size: var(--fs-2xs); }
.palette__item.is-active {
  background: var(--accent-soft-bg);
  color: var(--text-primary);
}
.palette__item.is-active .icon { color: var(--accent-text); }
.palette__foot {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-15) var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  flex: none;
}
.palette__empty { padding: var(--sp-5); text-align: center; color: var(--text-faint); font-size: var(--fs-xs); }


/* == 16  Styleguide-only helpers =========================================== */
.sg-nav {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; flex-wrap: wrap; gap: var(--sp-1);
  padding: var(--sp-2) 0;
  margin-bottom: var(--sp-3);
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
}
.sg-nav a {
  font-size: var(--fs-2xs); color: var(--text-muted);
  padding: var(--sp-05) var(--sp-15);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.sg-nav a:hover { background: var(--surface-hover); color: var(--text-primary); text-decoration: none; }

.sg-section { margin-bottom: var(--sp-8); scroll-margin-top: 56px; }
.sg-section > h2 {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding-bottom: var(--sp-1);
  margin-bottom: var(--sp-1);
  border-bottom: 1px solid var(--border-default);
}
.sg-section > h2 small { font-size: var(--fs-2xs); font-weight: var(--fw-regular); color: var(--text-faint); }
.sg-note { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-3); max-width: 84ch; }

.sg-demo {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.sg-demo--col { flex-direction: column; align-items: stretch; }
.sg-demo + .sg-demo { margin-top: var(--sp-2); }
.sg-label {
  width: 100%;
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: var(--fw-semibold);
}

.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--sp-2); }
.sg-swatch {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
}
.sg-swatch__chip { height: 40px; border-bottom: 1px solid var(--border-subtle); }
.sg-swatch__meta { padding: var(--sp-1) var(--sp-2) var(--sp-15); }
.sg-swatch__name { font-size: var(--fs-2xs); color: var(--text-primary); font-weight: var(--fw-medium); }
.sg-swatch__var { font-family: var(--font-mono); font-size: var(--fs-3xs); color: var(--text-muted); }

.sg-typerow {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-15) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.sg-typerow__meta {
  width: 150px; flex: none;
  font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-faint);
}

.sg-scale { display: flex; align-items: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.sg-scale__item { text-align: center; }
.sg-scale__bar { background: var(--accent-soft-bg); border: 1px solid var(--accent-soft-bd); border-radius: var(--radius-xs); }
.sg-scale__lbl { font-family: var(--font-mono); font-size: var(--fs-3xs); color: var(--text-muted); margin-top: var(--sp-05); }

.sg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--sp-1); }
.sg-icon {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-secondary);
}
.sg-icon span { font-family: var(--font-mono); font-size: var(--fs-3xs); color: var(--text-muted); }

/* fake shell used to preview rail/topbar inside the styleguide page */
.sg-shell {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-1);
}


/* == 17  Responsive, motion, print ========================================= */
@media (max-width: 1180px) {
  .app { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }
  .app .rail__wordmark,
  .app .nav-group__label,
  .app .nav-item span,
  .app .rail__primary span,
  .app .rail__foot .staff-card__meta { display: none; }
  .app .nav-item { justify-content: center; padding: 0; }
  .app .rail__primary { padding: 0; margin-left: var(--sp-1); margin-right: var(--sp-1); }
  .topbar__search { width: 200px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .rail {
    position: fixed; inset: 0 auto 0 0;
    width: var(--rail-w);
    transform: translateX(-100%);
    transition: transform var(--dur-med) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app[data-rail='open'] .rail { transform: translateX(0); }
  .app[data-rail='open'] .rail__wordmark,
  .app[data-rail='open'] .nav-group__label,
  .app[data-rail='open'] .nav-item span,
  .app[data-rail='open'] .rail__primary span { display: initial; }
  .app[data-rail='open'] .nav-item { justify-content: flex-start; padding: 0 var(--sp-3); }
  .app[data-rail='open'] .rail__primary { padding: 0 var(--sp-3); margin: var(--sp-3) var(--sp-2) var(--sp-1); }
  .content { padding: var(--sp-3) var(--sp-3) var(--sp-8); }
  .page-head { flex-direction: column; gap: var(--sp-2); }
  .topbar__search { width: auto; flex: 1 1 auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .rail, .topbar, .toast-region, .palette-overlay, .appfoot { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { break-inside: avoid; }
}


/* =============================================================================
   == 18  DENSITY + THE CALM LAYER  (added 2026-07-27, owner redesign)
   -----------------------------------------------------------------------------
   Everything below exists because of one verdict:

     "this system doesnt look friendly user at all and it is too complicated and
      too much text ... especially for moderators, battle mods, admins - way more
      simple and easy to navigate and understand. for me is fine you can keep it
      more advanced, but others they need to feel happy to use it and work, they
      need to feel not scared and easy to understand"

   The visual reference the owner named is Proton (Mail / Drive / Pass). What is
   copied is the PRINCIPLES, never the palette - the approved dark blue-slate
   stays exactly as it is:
     - a short sidebar with generous spacing and ONE prominent primary action
       above the list;
     - roomy cards separated by SPACE rather than by borders and rules;
     - comfortable type with strong hierarchy and very little grey micro-text;
     - ONE accent colour, for the primary action and the current item;
     - list rows that breathe - a mail list, not a spreadsheet;
     - brief friendly empty states: what goes here, plus the one action;
     - depth exists, but is tucked away and reached deliberately.

   Honest limit, stated up front: the role builder and the audit bench cannot
   become Proton-simple without lying about what they do. They get the same
   spacing, type and calm. They do not get fewer decisions.
   ========================================================================== */


/* == 18.1  The two densities ==============================================
   `data-density` is set on <body> by base.html from the actor's capabilities
   (portal/rbac/surface.py). It is NEVER an authorization signal - it changes
   layout, wording and how much detail, and nothing else. A control the actor
   may not use is not rendered, in either density, because the SERVER decided so.

   FULL is the default (the :root metrics), so anything that forgets to set the
   attribute gets the instrument panel rather than a silently reduced screen. */

[data-density='simple'] {
  --row-h:          44px;    /* a mail list, not a spreadsheet */
  --row-h-compact:  40px;
  --row-h-roomy:    48px;
  --control-h:      36px;    /* big obvious buttons */
  --control-h-sm:   30px;
  --control-h-lg:   42px;
  --panel-pad:      var(--sp-5);
  --rail-w:         248px;
}

/* Section labels in the rail are FULL-only. Three items do not need to be sorted
   into groups; the label is just another word to read. */
[data-density='simple'] .nav-group__label { display: none; }
[data-density='simple'] .nav-group + .nav-group { margin-top: var(--sp-1); }

/* Simple screens are read at a glance, so headings carry the hierarchy and
   hairlines get out of the way. */
[data-density='simple'] .page-head--ruled { border-bottom: 0; padding-bottom: var(--sp-1); }
[data-density='simple'] .panel { border-radius: var(--radius-xl); }

/* Show a control ONLY in one density. Both start from the server-rendered truth;
   this hides DETAIL, never capability. */
[data-density='simple'] .full-only { display: none !important; }
[data-density='full']   .simple-only { display: none !important; }


/* == 18.2  The rail's one primary action ==================================
   Proton puts "New message" above the folder list: one button, accent coloured,
   the only accent in the sidebar. Ours is whatever that person does most - for a
   moderator, find a player. _partials/nav.html picks it from capabilities. */
.rail__primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--control-h-lg);
  margin: var(--sp-3) var(--sp-2) var(--sp-1);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-lg);
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  color: var(--text-on-accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease);
}
.rail__primary:hover { background: var(--accent-stronger); color: var(--text-on-accent); text-decoration: none; }
.rail__primary .icon { color: currentColor; }
.app[data-rail='collapsed'] .rail__primary { padding: 0; margin-left: var(--sp-1); margin-right: var(--sp-1); }
.app[data-rail='collapsed'] .rail__primary span { display: none; }


/* == 18.3  Notices ========================================================
   FIVE KINDS, ONE CLEARING RULE EACH. The bug this replaces: ~150 banner sites
   across 34 templates all used the same `banner` component regardless of what
   they were, and NOTHING anywhere could be dismissed (0 dismiss controls in 56
   templates). So everything looked like an alarm and no alarm could be silenced.

     A. FACT       a state that is simply true. Clears never, because there is
                   nothing to clear - so it is NOT a banner. It is one line, or
                   the label on the disabled control. Use .fact.
     B. RECEIPT    "that worked". Auto-clears in 4s. A toast.
     C. RETRY      "that did not work". Clears on the next attempt. Inline, next
                   to the button that failed (.err). NEVER a sticky toast.
     D. OUTAGE     a dependency is down. Clears when it recovers. NOT dismissible
                   - dismissing an outage lies to the next reader. Use
                   .banner--degraded.
     E. OPEN ITEM  real work nobody has closed. The ONLY dismissible kind, and
                   the dismissal MOVES it rather than deleting it. Use .notice.
   ---------------------------------------------------------------------------- */

.notice-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.notice__body { min-width: 0; flex: 1 1 auto; }
.notice__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.notice__detail { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-05); }
/* One obvious next step, then a plain text link. A failed command is not an
   irreversible action, so Dismiss gets no reason field and no confirmation. */
.notice__actions {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.notice__dismiss {
  border: 0; background: transparent; padding: 0;
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.notice__dismiss:hover { color: var(--text-primary); }
.notice.is-clearing { opacity: 0; transform: translateY(-4px); }

/* Tone. Only two exist on purpose: something did not happen (amber), and
   something wants a decision (accent). Red is reserved for irreversible actions
   and stays out of the notice system entirely - a failed mute is not a
   catastrophe, it is a retry. */
.notice--todo   { border-left-color: var(--warn); }
.notice--todo .notice__title { color: var(--warn-text); }
.notice--info   { border-left-color: var(--accent); }

/* The "Cleared" disclosure. An ack MOVES an item; this is where it moves to, so
   a dismissal is never a deletion. Bounded in rows and in time by
   portal/notices.py - a list of things you have finished with must not grow. */
.cleared { margin-top: var(--sp-3); }
.cleared > summary {
  list-style: none; cursor: pointer;
  font-size: var(--fs-2xs); color: var(--text-muted);
  display: inline-flex; align-items: center; gap: var(--sp-1);
}
.cleared > summary::-webkit-details-marker { display: none; }
.cleared > summary:hover { color: var(--text-primary); }
.cleared__list { margin-top: var(--sp-2); font-size: var(--fs-2xs); color: var(--text-muted); }


/* == 18.4  Facts (kind A) - the ~90 banners that were never notices ========
   "You cannot change your own access." "This is your own account." "Draft in
   progress." These are STATES, not events: true on every page load, forever,
   with nothing to acknowledge. Rendered as banners they read as ninety
   unresolvable alarms; rendered as one quiet line under the heading, or as the
   label on the control they explain, they read as the interface working.
   Budget: at most ONE fact line per moderator screen. */
.fact {
  display: flex; align-items: baseline; gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: calc(var(--sp-1) * -1) 0 var(--sp-3);
}
.fact b { color: var(--text-secondary); font-weight: var(--fw-medium); }


/* == 18.5  Actions: ONE obvious next step =================================
   Not six equal buttons. The primary is solid accent; everything else is a
   ghost. Destructive keeps its own treatment and is never the default focus. */
.actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.actions--end { justify-content: flex-end; }
/* Secondary actions that must not compete with the primary one. */
.actions__more { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }

/* Big, safe-feeling primary on a moderator screen. Reversible things look
   ORDINARY; only genuinely irreversible things look serious. That contrast is
   the entire reason red still means something. */
[data-density='simple'] .actions > .btn--primary { min-width: 148px; }


/* == 18.6  "Why?" - explanation that is kept, not deleted =================
   Requirement 10: simpler must not mean less capable. Anything cut from the
   surface of a screen goes HERE rather than in the bin, so the sentence still
   exists for the one person in ten who wants it and costs the other nine a
   single quiet word. Native <details>: no JS, keyboard and screen reader free. */
.why { display: inline-block; }
/* The block form (density.html::why_block) wraps a whole section rather than a
   word in a sentence, so it stacks and keeps its distance from the next one. */
.why--block { display: block; }
.why--block + .why--block { margin-top: var(--sp-3); }
.why > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-2xs);
  color: var(--text-link);
  border-radius: var(--radius-xs);
}
.why > summary::-webkit-details-marker { display: none; }
.why > summary:hover { text-decoration: underline; text-underline-offset: 2px; }
.why__body {
  display: block;
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  max-width: 62ch;
  line-height: var(--lh-normal);
}
.why__body > * + * { margin-top: var(--sp-2); }


/* == 18.7  List rows - a mail list, not a spreadsheet =====================
   The alternative to a 7-column table on a moderator screen. The important
   thing first and biggest; at most two supporting facts; one action on the
   right. Everything else lives on the record it links to. */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--row-h);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  color: inherit;
  transition: background var(--dur-fast) var(--ease);
}
.row-item + .row-item { box-shadow: inset 0 1px 0 var(--border-subtle); }
a.row-item:hover, .row-item:hover { background: var(--surface-hover); text-decoration: none; }
.row-item__main { min-width: 0; flex: 1 1 auto; }
.row-item__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.row-item__sub { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: var(--sp-05); }
.row-item__side { flex: none; display: flex; align-items: center; gap: var(--sp-2); }
.row-item__when { font-size: var(--fs-2xs); color: var(--text-muted); white-space: nowrap; }


/* == 18.8  Preset chips - "1 hour / 24 hours / 7 days" ====================
   Replaces a bare "Duration (minutes)" box prefilled with 60. A moderator who
   means "a day" should not have to know that a day is 1440, and one who types 24
   should not silently get 24 minutes. The number field survives behind "Custom"
   (a .why disclosure), so nothing is taken away. */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  height: var(--control-h);
  padding: 0 var(--sp-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip[aria-pressed='true'] {
  background: var(--accent-soft-bg);
  border-color: var(--accent-soft-bd);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}


/* == 18.9  "Nothing needs you" ============================================
   An idle moderator's landing page used to render a green line, seven panel
   headers, seven explanatory empty-state paragraphs, a 55-word footnote about
   why there is no players-online count, and - for a narrow role - a banner
   listing five raw capability ids. This is the replacement, whole: one heading,
   one sentence, one button, and at most one optional line that renders only
   when there is genuinely something to pick up. */
.allclear {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-5);
}
.allclear__title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-primary); }
.allclear__body { font-size: var(--fs-md); color: var(--text-muted); max-width: 44ch; }
.allclear__extra { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-2); }
.allclear .btn { margin-top: var(--sp-1); }


/* == 18.10  Toast region - the one genuinely unbounded surface ============
   It had no max-height and no count cap, and tone:'danger' defaulted to
   timeout:0, so N failed actions left N sticky cards stacked until the page
   navigated. control.js now caps it at three visible and expires every one of
   them; the CSS backstop is here so a future caller cannot reintroduce the pile
   by appending nodes directly. */
.toast-region { max-height: 60vh; overflow: hidden; }


/* == 18.11  Search box in a page (not the palette) ========================
   The moderator's most-used control should look like the point of the screen,
   not like a filter. */
.findbar { display: flex; align-items: center; gap: var(--sp-2); }
.findbar .input { height: var(--control-h-lg); font-size: var(--fs-md); }
.findbar .input-icon > .input { padding-left: 36px; }
.findbar .input-icon > .icon { left: var(--sp-3); }


/* == 18.12  Simple-density table trimming =================================
   A table marked .data--trim hides every cell flagged .col-detail (and its
   header) at simple density. Nothing is deleted: _partials/table.html renders
   the same rows and the same link targets, the detail is simply not on screen
   by default and is one click away on the record itself. */
[data-density='simple'] table.data--trim th.col-detail,
[data-density='simple'] table.data--trim td.col-detail { display: none; }


/* =============================================================================
   == 19  CONTENT CATALOG  (added 2026-07-31, phase 10)
   -----------------------------------------------------------------------------
   The owner's ask was "one place where I can see every item that exists, with
   its picture". That makes the PICTURE TILE the atom of this whole section:
   section grids, a kit's contents, a case's reward list and a battle pass rung
   are all the same tile with different things in it. Every class below is drawn
   by exactly two macros, templates/catalog/_tile.html and
   templates/catalog/_confidence.html, so no screen writes tile markup of its own
   and thirty tiles cannot drift into thirty slightly different tiles.

   TWO RULES THIS SECTION DOES NOT BREAK
     1. TOKENS ONLY. Not one hard-coded colour, size or radius below. The catalog
        renders correctly in both themes for free because it names nothing the
        theme layer does not own.
     2. AMBER AND RED STAY RESERVED FOR ACTIONS (section 12, and the look-and-feel
        note in control/README.md). The catalog is a read-only section, so the
        only amber on it is `partial` on the confidence scale, which means "this
        figure does not tell the whole story" and is the nearest thing to a
        warning a read screen has. `unavailable` is deliberately the QUIETEST
        badge rather than the loudest: a table this box cannot read is a fact
        about this box, not an emergency.

   THE ONE MEASUREMENT WORTH KNOWING
     148px is the tile column, and it is not a new number: it is exactly what
     .sg-swatches has used since the styleguide shipped (section 16). The game's
     preview PNGs are small and transparent, so a wider tile would scale them up
     and a narrower one would not fit a name and a raw id underneath.
   ========================================================================== */


/* == 19.1  The tile grid ==================================================
   auto-fill, not auto-fit: a section holding three cases should leave the empty
   columns empty rather than stretching three tiles across the whole width and
   making three items look like a full shelf. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--sp-3);
}


/* == 19.2  The tile itself ================================================
   A whole link, so the picture, the name and the id are one target rather than
   three. Column layout with the art on top: these images are roughly square, and
   a row layout would spend the width the name needs. */
.tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  color: inherit;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
a.tile:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}
a.tile:focus-visible { box-shadow: var(--focus-ring); }

/* A tile that is not a link: the item page's own art strip, where the four
   upgrade steps are what the reader is already looking at and there is nowhere
   further to go. It keeps the shape and loses every affordance, because a box
   that lifts on hover and then does nothing is the dead control this design
   system removed from six other places. */
.tile--static { background: var(--surface-2); cursor: default; }
.tile--static:hover { background: var(--surface-2); border-color: var(--border-subtle); }

/* The picture box. A fixed aspect plus object-fit: contain, deliberately: the
   game's previews are not all one shape (a hull tile is wider than a paint
   swatch) and `cover` would crop the turret off the top of half of them. */
.tile__art {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3;
  padding: var(--sp-2);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-subtle);
}
/* An <img> whose src 404s draws nothing here rather than a browser broken-image
   glyph, because the macro sets alt="". The CSP forbids an onerror handler
   (script-src 'self', portal/__init__.py), so this is the whole fallback and the
   tile simply goes quiet. A missing FILE is an art-sync problem and belongs on
   the health strip; a missing PICTURE is --gap below and is said in words. */
.tile__art > img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Sizes. 'sm' is the inline thumbnail inside a table row (a battle pass rung, a
   kit's contents); 'lg' is the item page's art strip. */
.tile__art--sm {
  flex: none;
  width: 44px; height: 34px;
  padding: var(--sp-05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.tile__art--lg { padding: var(--sp-4); }

/* No picture exists in the game's resource pack. A dashed frame reads as "this
   is empty on purpose and somebody should draw it"; a solid one would read as a
   component that failed. */
.tile__art--gap {
  border: 1px dashed var(--border-default);
  background: transparent;
}
/* Applied as a mask by the macro, so the colour comes from a token here and no
   colour is invented inside the SVG. */
.tile__gap {
  display: block;
  width: 34px; height: 34px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  opacity: 0.6;
}
.tile__art--sm .tile__gap { width: 20px; height: 20px; }

/* The words under the picture. */
.tile__meta {
  display: flex; flex-direction: column; gap: var(--sp-05);
  padding: var(--sp-2);
  min-width: 0;
}
.tile__label, .tile__name {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
/* The raw id. It is what you type to grant the thing and what every bug report
   will quote, so it belongs on the tile rather than one click away. */
.tile__id {
  font-size: var(--fs-3xs);
  color: var(--text-faint);
  letter-spacing: 0;
}
.tile__facts, .tile__sub { font-size: var(--fs-2xs); color: var(--text-muted); }
.tile__note { font-size: var(--fs-3xs); line-height: var(--lh-snug); }
.tile__chips { display: flex; flex-wrap: wrap; gap: var(--sp-05); margin-top: var(--sp-05); }
.tile__chip { height: 19px; padding: 0 var(--sp-15); font-size: var(--fs-3xs); }


/* == 19.3  A tile plus its own second destination =========================
   The cases page needs two links per tile: the tile goes to the item (its ids,
   its pictures, every way of getting one) and the link under it goes to that
   case's drop list, which is a different question. A link inside a link is
   invalid HTML that browsers silently rearrange, so the second one lives OUTSIDE
   the tile, in a wrapper that becomes the grid cell. */
.tile-cell { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.tile-cell > .tile { flex: 1 1 auto; }
.tile-cell__link {
  display: inline-flex; align-items: center; gap: var(--sp-05);
  font-size: var(--fs-2xs);
  color: var(--text-link);
}
.tile-cell__link:hover { color: var(--text-link-hover); }


/* == 19.4  How sure are we? ===============================================
   The badge is an ordinary .badge on an ordinary tone (section 12) plus one of
   these four classes. Three of them deliberately carry no colour: the tone class
   already chose one, and a second opinion here is exactly how two badges meaning
   the same thing end up different colours on different screens. What these add
   is the one thing a tone cannot say, which is that `unavailable` must never be
   loud. It is quiet, it is dashed, and it is never hidden: a row nobody could
   check is the whole reason this scale exists. */
.confidence { letter-spacing: 0; }
.confidence--exact,
.confidence--mirrored,
.confidence--partial { font-weight: var(--fw-medium); }
.confidence--unavailable {
  font-weight: var(--fw-regular);
  color: var(--text-faint);
  border-style: dashed;
}


/* == 19.5  Battle pass rungs ==============================================
   Fifty rows by two tracks. Each cell is a thumbnail, the item's real name, and
   the line exactly as the season file writes it, because that line is what
   somebody edits when a rung is wrong and paraphrasing it makes the fix harder
   to find. */
.bp-cell { vertical-align: top; }
.bp-reward { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.bp-reward__text { display: flex; flex-direction: column; min-width: 0; }
.bp-reward__title { font-size: var(--fs-xs); color: var(--text-primary); }
.bp-reward__id { font-size: var(--fs-3xs); color: var(--text-faint); letter-spacing: 0; }
/* A rung the game would silently pay nothing for. The colour comes from the
   .text-warn utility the template picks, not from here: a broken rung is amber
   and an unchecked one is muted, and only the template knows which it has. */
.bp-reward__problem {
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  margin-top: var(--sp-05);
  max-width: 46ch;
}


/* == 19.6  Nothing here for .full-only ====================================
   The catalog templates lean on `.full-only` heavily: a tile's raw id, its
   channel chips and every evidence line carry it, so the instrument panel gets
   them and the calm app does not. It is NOT redefined here. It already exists,
   in section 18.1, with `!important`, and a second weaker copy at the bottom of
   the file would be the rule that loses a specificity argument nobody knew they
   were having. If you are looking for it, it is line ~2228. */


/* == 19.7  Crystals, rank badges, and the six paint rarities ==============
   Added 2026-09-05 on the owner's direction. Three separate things live here
   because all three are the same idea: the portal should say what the GAME says,
   with the game's own pictures, instead of translating it into words. */

/* The crystal beside a price. 24px source drawn at 14px, which is roughly the
   cap height of the 15px base, so it sits on the text's line rather than
   pushing it apart. `vertical-align` rather than flex: the price is inline text
   with a picture in it, not a layout. */
/* ⛔ display:inline-block is not optional. The reset at line 580 makes every img
   a BLOCK, which drops the crystal onto its own line under the number - which is
   exactly what it did the first time this shipped. */
.crystal {
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 3px;
  vertical-align: -2px;
}

/* The rank badge. The 60x58 source scaled to 19px: the 12px file the game uses
   in chat is unreadable at any size on a screen like this, and downscaling a
   large image costs nothing. `width:auto` keeps the badge's own proportion, so
   a future badge of a different shape is not squashed. */
.rankbadge {
  display: inline-block;          /* same reason as .crystal above */
  height: 19px; width: auto;
  vertical-align: -4px;
}

/* Price and badge on one line under the name, with the badge pushed to the far
   end: the eye then reads a column of prices down the left of the grid and a
   column of badges down the right, instead of a ragged mix of both. */
.tile__facts--icons {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-1);
  min-height: 19px;
}
/* nowrap is load-bearing: without it the crystal drops onto its own line under
   the number the moment a tile is narrow, which is most of them. */
.tile__price { color: var(--text-secondary); white-space: nowrap; }

/* --- the rarity, as the whole border of the tile -------------------------- */
/* ⭐ OWNER DIRECTION, 2026-09-05: "colour the border of the tile so it is easy
   to see, add the same rarity colours like in the website". So the border IS the
   reading - 2px of the rarity's own colour all the way round, which is what the
   wiki does and what makes a grid of 99 sortable by eye with no legend.

   The tint along the top is what keeps that border legible where two tiles of
   different rarities sit side by side: 2px of colour against a dark surface can
   read as a seam, and a 26px fade of the same hue behind the picture cannot. It
   is a gradient rather than a flat block so nothing competes with the paint
   swatch itself, which is the one thing on the tile that has to be judged by its
   own colour. */
.tile--rarity {
  position: relative;
  border-width: 2px;
  border-color: var(--rar, var(--border-subtle));
}
.tile--rarity::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 26px;
  background: linear-gradient(to bottom, var(--rar, transparent), transparent);
  opacity: 0.14;
  pointer-events: none;
  border-radius: inherit;
}
.tile--rarity:hover { box-shadow: 0 0 0 1px var(--rar, transparent) inset; }

.tile--rarity-common    { --rar: var(--rar-common); }
.tile--rarity-uncommon  { --rar: var(--rar-uncommon); }
.tile--rarity-rare      { --rar: var(--rar-rare); }
.tile--rarity-epic      { --rar: var(--rar-epic); }
.tile--rarity-legendary { --rar: var(--rar-legendary); }
.tile--rarity-exotic    { --rar: var(--rar-exotic); }
/* Common is a grey line and gets no tint: the cheapest paint in the game should
   not glow. */
.tile--rarity-common::before { opacity: 0; }

/* The rarity beside its word, on the item page. The dot's colour is written into
   the element by the template, from paint_types.RARITY_COLOURS, so the six
   values have exactly one home. */
.rarity-tag { display: inline-flex; align-items: center; gap: var(--sp-15); }
.rarity-tag__dot {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.28) inset;
}

/* --- the eight groups down the page -------------------------------------- */
/* The wiki's headings in the wiki's order. The count sits ON the heading because
   the first question about a group is how big it is, and the JS rewrites it
   while a filter is on so it is never a count of things that are hidden. */
.paintgroup__head {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-subtle);
}
.paintgroup__title {
  font-size: var(--fs-md); font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.paintgroup__n {
  font-size: var(--fs-2xs); font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 1px var(--sp-2);
  font-variant-numeric: tabular-nums;
}
.paintgroup__note { flex: 1 1 auto; }

/* --- the two filter rows above the grid ---------------------------------- */
/* Buttons, not links: they change what is on the screen without going anywhere,
   and an <a> that does not navigate is the dead control this design system spent
   a week removing. Two rows rather than one, because they answer two different
   questions and they COMBINE - a reader has to be able to see which of them is
   narrowing the grid. */
.paintfilter { display: flex; flex-direction: column; gap: var(--sp-2); }
.paintfilter__row {
  display: flex; flex-wrap: wrap; gap: var(--sp-15); align-items: center;
}
.paintfilter__legend {
  width: 52px; flex: 0 0 auto;
  font-size: var(--fs-2xs); font-weight: var(--fw-medium);
  color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em;
}
.paintfilter__chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 30px; padding: 0 var(--sp-3);
  font-size: var(--fs-2xs); font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.paintfilter__chip:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.paintfilter__chip:focus-visible { box-shadow: var(--focus-ring); outline: none; }
/* The count. Quiet at rest, because the word is what is being chosen. */
.paintfilter__n { color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* The dot carries the wiki's colour, written in by the template, so the rarity
   row doubles as the legend for the borders below it. There is no second key to
   learn. */
.paintfilter__dot {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.28) inset;
}
/* The one that is on. Filled, not merely outlined: at a glance the answer to
   "why is this grid short" has to be visible without reading the rows. */
.paintfilter__chip[aria-pressed='true'] {
  color: var(--text-on-accent);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.paintfilter__chip[aria-pressed='true'] .paintfilter__n { color: rgba(255,255,255,0.72); }
/* A rarity or a group nothing in the grid has. Kept, disabled, never removed: a
   row that changes shape between two searches is a row nobody can aim at. */
.paintfilter__chip[disabled] { opacity: 0.45; cursor: default; }
.paintfilter__chip[disabled]:hover { background: var(--surface-2); border-color: var(--border-default); }


/* =============================================================================
   == 20  THE RARITY BOARD  (added 2026-07-31, phase 10)
   -----------------------------------------------------------------------------
   One screen: templates/catalog/rarity.html, driven by static/js/rarity-board.js.
   Six columns left to right - common, uncommon, rare, epic, legendary, exotic
   (the Tanki wiki's ladder, owner decision 2026-09-05) - and a draggable card per
   skin FAMILY rather than per skin, because grading 83
   skins one at a time is 83 decisions and grading them by family is about 15.

   THE ONE PLACE THIS SECTION IS ALLOWED TO SPEND COLOUR, AND WHY
     Section 12 and control/README.md reserve amber and red for ACTIONS, and
     section 19 keeps the whole read-only catalog calm on purpose. The six rarity
     tiers break that on the face of it: the game paints them white, blue, purple,
     gold, orange and red, and gold, orange and red are the reserved end of the
     palette.

     They are used anyway, in exactly two places - an 8px swatch in a column
     heading and a 2px rule along the top of a card - for a reason that is not
     decoration. The owner is grading items against what a PLAYER will see, and
     the fastest check that a card landed in the column he meant is that the strip
     on it is the colour the game will paint it. A board whose six columns were
     six shades of blue-slate would need reading rather than seeing, on the one
     screen whose entire job is arranging things by tier.

     The reservation still holds where it matters: nothing on this page uses those
     hues on a button, a banner, a badge or a state. Amber and red still mean "an
     action, and how reversible it is" everywhere a person could confuse the two.

   WHY THE SIX TOKENS ARE DECLARED HERE RATHER THAN IN SECTION 03
     They belong to one screen and to nothing else, so declaring them beside their
     only use keeps them findable and keeps the semantic layer describing the
     PRODUCT rather than the game's tier ladder. They are still tokens, still
     mapped for both themes, and no rule below names a colour that is not one of
     them. If a second screen ever needs the ladder, move the block to section 03
     unchanged - that is the moment it becomes part of the system.
   ========================================================================== */

/* ⭐ The tier colours live in section 03 as `--rar-*` and nowhere else since
   2026-09-05. This screen used to declare its own `--rarity-*` set here, on the
   pre-wiki ladder, which is exactly how the Paints page and this board ended up
   showing two different "rare". `portal/gamecatalog/containers.py::
   RARITY_COLOUR_NAMES` names them in words and `portal/content.py::COLUMN_ORDER`
   fixes their order; both are the wiki's six. */


/* == 20.1  The bar ========================================================
   Sticky, because the columns are taller than a screen and the Save button has
   to be reachable from the bottom of the last column. It carries the two
   filters on the left and the two buttons that decide the fate of the whole
   board on the right, and nothing else has earned a place in it. */
.rb-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.rb-bar__filters { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.rb-bar__search { width: 260px; max-width: 40vw; }

/* The unsaved counter. Reads "No changes yet" until something moves, and it is a
   COUNT rather than a dot on purpose: "3 items moved" is something you can check
   against what you remember doing. */
.rb-bar__count {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}
.rb-bar__count.is-dirty {
  color: var(--accent-text);
  font-weight: var(--fw-medium);
}

/* What is lit, in words: "GT - 17 in legendary, 1 in exotic". The board already
   says this in colour; this says it again for somebody using a screen reader, for
   whom the dimming and the lit headings do not exist at all, and for the ordinary
   case where a family's one stray item is off the bottom of a column. It is only
   here while something is lit, which is why the bar does not grow a permanently
   empty slot. */
.rb-bar__selected {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  max-width: 40vw;
  padding: var(--sp-05) var(--sp-15);
  font-size: var(--fs-2xs);
  color: var(--accent-text);
  background: var(--accent-soft-bg);
  border: 1px solid var(--accent-soft-bd);
  border-radius: var(--radius-full);
}
.rb-bar__selected > span {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.rb-bar__clear {
  flex: none;
  padding: 0 var(--sp-05);
  font: inherit;
  font-size: var(--fs-3xs);
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.rb-bar__clear:hover { color: var(--text-primary); background: var(--surface-hover); }
.rb-bar__clear:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* A board with unsaved work on it that you are not currently looking at. The kind
   switch is a filter over ONE page load, so a save carries every board at once and
   the bar can honestly read "5 items moved" while the board in front of you shows
   none of them. The chip is the only place that can say which board they are on.

   ⚠ A BORDER AND NOT A FILL. `.chip[aria-pressed='true']` (section 18.8) is
   already an accent FILL, this rule sits later in the file at the same
   specificity, and a dirty chip painted the same way would have looked exactly
   like the chip you are standing on - so the board you were looking at and the
   board with unsaved work on it would have been indistinguishable, which is the
   one distinction this rule exists to draw. */
.chip.is-dirty { border-color: var(--accent); }
.chip.is-dirty .chip__count {
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}


/* == 20.2  The one notice slot ============================================
   A refusal from the server, or the receipt after a save. NOT a toast: every
   toast is capped at ten seconds (control.js, THE TOAST BUDGET) and both of
   these sentences have a next step in them, so they stay until they are
   replaced. The default tone is the quiet warn used for a retry; --ok is the
   receipt. */
.rb-error {
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  border-radius: var(--radius-md);
}
.rb-error--ok {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: var(--success-bd);
}


/* == 20.3  The board and its columns ======================================
   Six equal columns that scroll sideways together rather than wrapping. Wrapping
   was the obvious alternative and is wrong here: the columns are a LADDER, and a
   ladder that folds onto a second row stops reading as low to high.

   ⚠ 150px, measured, not chosen. A 1280px screen with the rail expanded leaves
   986px for the board, and six columns plus five 8px gaps fit in it at 157px.
   Anything wider pushes the LAST column off the right-hand edge, and that is
   the one column the owner is most often aiming at - it is the one that changes
   the case odds. A board whose most consequential target needs a sideways scroll
   to reach is a board that will be used wrongly. */
.rb-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
}
.rb-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.rb-col__head {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.rb-col__name {
  display: inline-flex; align-items: center; gap: var(--sp-15);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
/* The tier's own colour, at the smallest size that still reads as a colour. See
   the section header for why this page is allowed one. */
.rb-col__swatch {
  width: 8px; height: 8px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--text-faint);
}
.rb-col__swatch--common    { background: var(--rar-common); }
.rb-col__swatch--uncommon  { background: var(--rar-uncommon); }
.rb-col__swatch--rare      { background: var(--rar-rare); }
.rb-col__swatch--epic      { background: var(--rar-epic); }
.rb-col__swatch--legendary { background: var(--rar-legendary); }
.rb-col__swatch--exotic    { background: var(--rar-exotic); }

/* Written by the browser on every change - a card can move into this column, so
   a number printed once by the server is wrong the moment anybody uses the page. */
.rb-col__count {
  float: right;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
/* The exotic column's sentence is four lines long and is worth reading once,
   not on every glance for the rest of the session. Clamped to two lines with the
   whole thing on hover, and the same text is in the "How this board works"
   disclosure under the board, so nothing lives only here. */
.rb-col__blurb {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: var(--sp-05);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
  color: var(--text-faint);
}
.rb-col__head:hover .rb-col__blurb { -webkit-line-clamp: 12; }

/* The drop target is the whole body and not each card, so a drop into the empty
   space under the last card still lands - which is where a hand naturally goes
   on a short column. min-height keeps an EMPTY column a real target: five of the
   six are empty on a server nobody has graded yet, and a zero-height one could
   not be dropped into at all. */
.rb-col__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 120px;
  max-height: 62vh;
  overflow-y: auto;
  padding: var(--sp-2);
}
.rb-col.is-over {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}
/* An empty column says nothing rather than "no items": it is a place to put
   something, and labelling it would be six labels shouting on a fresh board. */
.rb-col.is-empty .rb-col__body { opacity: 0.85; }


/* == 20.4  The card ======================================================
   A whole family in one draggable box: picture, name, how many items move with
   it, and the line that says so when they do not currently agree. */
.rb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-15);
  padding: var(--sp-2);
  padding-top: calc(var(--sp-2) + 2px);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: default;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}
/* The tier stripe. The second of the two places this page spends a game colour,
   and the reason a card is still recognisable after it has been dragged: it is
   the colour the player will see on the tile. */
.rb-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--text-faint);
}
[data-rarity-column='common']    .rb-card::before { background: var(--rar-common); }
[data-rarity-column='uncommon']  .rb-card::before { background: var(--rar-uncommon); }
[data-rarity-column='rare']      .rb-card::before { background: var(--rar-rare); }
[data-rarity-column='epic']      .rb-card::before { background: var(--rar-epic); }
[data-rarity-column='legendary'] .rb-card::before { background: var(--rar-legendary); }
[data-rarity-column='exotic']    .rb-card::before { background: var(--rar-exotic); }

/* Grab hands only when the card can actually be dragged. Without write access
   the board renders identically and nothing has a drag affordance, which is the
   honest picture: the cursor is the first thing that promises a control works. */
[data-can-write] .rb-card { cursor: grab; }
[data-can-write] .rb-card:active { cursor: grabbing; }
.rb-card:hover { border-color: var(--border-strong); }
.rb-card:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.rb-card.is-dragging { opacity: 0.4; }
.rb-card.is-filtered { display: none; }

/* Moved and not saved yet. The accent, not amber: this is not a warning, it is
   "you did this one", and it goes the moment the card is put back where it
   started or the save goes through. */
.rb-card.is-changed {
  border-color: var(--accent-soft-bd);
  background: var(--accent-soft-bg);
}

.rb-card__face { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.rb-card__text { display: flex; flex-direction: column; min-width: 0; }
/* Both lines clip rather than push. The column is 150px and a client id like
   `hornet_gt_concept` is wider than that on its own, so without this ONE card
   widens its column and the six stop being equal - which is the whole layout.
   The full text is on the title attribute in the template either way. */
.rb-card__label, .rb-card__sub {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rb-card__label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.rb-card__sub { font-size: var(--fs-3xs); color: var(--text-muted); letter-spacing: 0; }

/* This family's items do not all agree. Rewritten by the browser on every move,
   because dragging one item out of a family CREATES a split that was not there
   when the page loaded. */
.rb-card__split {
  align-self: flex-start;
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
  padding: var(--sp-05) var(--sp-15);
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-bd);
  border-radius: var(--radius-xs);
}
/* A dashed left edge, so a split card is distinguishable from a graded one at a
   glance and not only by reading the line. */
.rb-card.is-split { border-left: 2px dashed var(--border-strong); }

/* The stored word is not one of the six, so the game is already showing
   something else. The one genuinely wrong state a card can be in, and dropping
   the card anywhere fixes it. */
.rb-card__problem {
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  color: var(--warn-text);
}

/* ⛔ NOBODY HAS DECIDED ABOUT THIS ONE YET. Not an error and not a warning: the
   card is sitting in the column the GAME defaults it to, which is a perfectly
   normal state for an item nobody has looked at - and the state all 97 paints are
   in on the day they join the board. Deliberately quiet (muted, dotted) rather
   than coloured: 97 orange cards would read as 97 problems, and the owner would
   stop reading them by the third screenful.

   `--unknown` is the OTHER thing, and it is louder on purpose: the rarity table
   could not be read at all, so the card cannot say whether anything is graded. */
.rb-card__note {
  align-self: flex-start;
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  padding: var(--sp-05) var(--sp-15);
  border-radius: var(--radius-xs);
}
.rb-card__note--ungraded {
  color: var(--text-muted);
  border: 1px dotted var(--border-strong);
}
.rb-card__note--unknown {
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
}

/* What a grouping MEANS, for a card whose name does not say it. A skin family is
   called "GT" and needs no sentence; a paint band is called "Cannot be bought"
   and the sentence under it is why that is a fact about the game rather than
   somebody's opinion. */
.rb-card__blurb {
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

/* How many items of this kind are still ungraded, on the kind chip itself. The
   one number that says how much of the job is left. */
.chip__count {
  margin-left: var(--sp-05);
  font-size: var(--fs-3xs);
  color: var(--text-muted);
}

.rb-card__toggle {
  display: inline-flex; align-items: center; gap: var(--sp-05);
  align-self: flex-start;
  padding: var(--sp-05) var(--sp-1);
  margin-left: calc(var(--sp-1) * -1);
  font: inherit;
  font-size: var(--fs-3xs);
  color: var(--text-link);
  background: none;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.rb-card__toggle:hover { color: var(--text-link-hover); background: var(--surface-hover); }
.rb-card__toggle:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* One row of a family, inside that family's well. Quieter than a family card,
   because it moves one thing and a family card moves eighteen. */
.rb-card--item { background: var(--surface-2); }

/* A card belonging to a kind the switcher is not showing. It stays exactly where
   it is in the DOM rather than being moved off the board: switching boards would
   otherwise shuffle 246 nodes and throw away the column scroll positions of the
   board being left behind, which is the reflow complaint wearing a different hat.
   `.is-filtered` above is the same trick for the search box. */
.rb-card.is-hidden-kind { display: none; }


/* == 20.5  THE WELL: a family opened in place  (added 2026-08-01) =========
   ⭐ THIS IS THE FIX FOR THE THING THE OWNER FILMED. Until today, opening a family
   parked its card off the board and threw its 18 items into whichever columns
   their own rarity put them in. Every other card shifted, and the card he had just
   clicked was no longer under his cursor: "dont make it jump positions like that."

   A family now opens INSIDE ITS OWN CARD. The rows are rendered in here by the
   server and never move again; opening is one `hidden` attribute coming off, which
   changes the height of one card and the position of nothing else on the board.

   The inset border is not decoration. It is the only thing left saying "these
   belong to the card above them" now that the rows are not being scattered into
   the columns to say it by position, so it is a real border with a real indent and
   not a hairline. */
.rb-well {
  display: block;
  margin-top: var(--sp-15);
  padding: var(--sp-15);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}
/* The sentence at the top of the well. It says how many items are in here and
   that one can be dragged out on its own, which is the one thing about this box
   that is not obvious from looking at it. */
.rb-well__head {
  margin: 0 0 var(--sp-15);
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  color: var(--text-faint);
}
.rb-well__items { display: flex; flex-direction: column; gap: var(--sp-1); }

/* Rows are tighter than cards: eighteen of them have to fit inside a card that is
   itself inside a 150px column, and the picture is the first thing to go. */
.rb-well .rb-card {
  padding: var(--sp-1);
  padding-top: calc(var(--sp-1) + 2px);
  gap: var(--sp-05);
}
.rb-well .tile__art--sm { display: none; }

/* ⛔ A ROW'S STRIPE COMES FROM ITS OWN TIER, NOT FROM THE COLUMN IT IS STANDING
   IN. Every other card on this board inherits its colour from the column, which is
   a rule a row cannot use: it is standing inside its family's card, so the column
   says what the FAMILY is. On a split family that would paint all eighteen rows
   the same colour and hide the very thing the owner opened the well to see.
   `data-tier` is written by the script on every move and drives both the stripe
   and the word below, so the two cannot end up disagreeing. */
.rb-well .rb-card::before { background: var(--text-faint); }
.rb-well .rb-card[data-tier='common']::before    { background: var(--rar-common); }
.rb-well .rb-card[data-tier='uncommon']::before  { background: var(--rar-uncommon); }
.rb-well .rb-card[data-tier='rare']::before      { background: var(--rar-rare); }
.rb-well .rb-card[data-tier='epic']::before      { background: var(--rar-epic); }
.rb-well .rb-card[data-tier='legendary']::before { background: var(--rar-legendary); }
.rb-well .rb-card[data-tier='exotic']::before    { background: var(--rar-exotic); }

/* The tier in words, on the row's own face. A row used to say which tier it was
   by which column it had been thrown into; it does not get thrown anywhere any
   more, so it has to say it. Seventeen rows reading "exotic" and one reading
   the tier IS the split, read from inside the card. */
.rb-card__tier {
  flex: none;
  margin-left: auto;
  font-size: var(--fs-3xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.rb-card[data-tier='common']    .rb-card__tier { color: var(--rar-common); }
.rb-card[data-tier='uncommon']  .rb-card__tier { color: var(--rar-uncommon); }
.rb-card[data-tier='rare']      .rb-card__tier { color: var(--rar-rare); }
.rb-card[data-tier='epic']      .rb-card__tier { color: var(--rar-epic); }
.rb-card[data-tier='legendary'] .rb-card__tier { color: var(--rar-legendary); }
.rb-card[data-tier='exotic']    .rb-card__tier { color: var(--rar-exotic); }

/* The chevron turns instead of being swapped for a different icon. One icon in the
   markup means the label and the arrow can never disagree about whether the well
   is open, and it costs nothing. */
.rb-card__toggle .icon { transition: transform var(--dur-fast) var(--ease); }
.rb-card.is-expanded > .rb-card__toggle .icon { transform: rotate(180deg); }


/* == 20.6  SELECTION: one family lit, the rest of the board dimmed ========
   ⭐ THE OTHER HALF OF THE SAME COMPLAINT: "it is hard to see which items are from
   that skin line so highlight it or evidentiate it". Clicking any card lights up
   its whole family - the card, every row in its well, and every column heading
   holding one of its items - and fades everything else back.

   The lit columns are the part that could not be built before. A family whose
   items are spread over three tiers lights three headings at once, each with its
   own count, which is a split made visible without moving a single card to show
   it. Section 20.7 is that heading.

   ⛔ THE TWO NUMBERS BELOW WERE MEASURED, NOT CHOSEN, AND THE FIRST GUESS WAS
   WRONG BY A LOT. Fading a card with `opacity` pulls its text AND its background
   toward the column behind it at the same rate, so the contrast between them
   collapses far faster than the card looks like it is fading. Measured on the real
   tokens, contrast of the item NAME against the card it sits on:

       opacity   0.45   0.50   0.55   0.60   0.65   0.70
       dark      3.91   4.52   5.21   5.96   6.78   7.67
       light     2.98   3.46   4.05   4.78   5.68   6.79

   The values that looked right on the mock were 0.5 dark and 0.45 light. In light
   that is 2.98:1 - under the 4.5:1 floor for body text and genuinely hard to read -
   so the owner would have had to clear the selection to read anything he had not
   selected, on a screen whose whole job is comparing one family against the rest.

   0.6 dark and 0.7 light, which hold the name at 5.96:1 and 4.78:1 and the id line
   under it at 3.85:1 and 3.02:1. Light needs the HIGHER number, which is the part
   worth remembering: dark text on a white card loses contrast to a fade quicker
   than light text on a dark one.

   The separation the eye actually reads comes from the rule under this one instead:
   the tier stripe on every unselected card drops to a third. That is pure
   decoration, so it can be faded hard for free, and killing the colour noise on 40
   cards is what makes the lit family jump out - not crushing the words. */
.rb-board.has-selection .rb-card:not(.is-selected) { opacity: 0.6; }
:root[data-theme='light'] .rb-board.has-selection .rb-card:not(.is-selected) {
  opacity: 0.7;
}
.rb-board.has-selection .rb-card:not(.is-selected)::before { opacity: 0.33; }
/* Pointing at a faded card, or tabbing into one, brings it all the way back.
   Dimming is a hint about what you are looking for, never a lock on what you are
   allowed to read. */
.rb-board.has-selection .rb-card:not(.is-selected):hover,
.rb-board.has-selection .rb-card:not(.is-selected):focus-within { opacity: 1; }
.rb-board.has-selection .rb-card:not(.is-selected):hover::before,
.rb-board.has-selection .rb-card:not(.is-selected):focus-within::before { opacity: 1; }
/* An unsaved change is never allowed to fade into the background: it is the one
   thing on this board that is lost if it is forgotten about. */
.rb-board.has-selection .rb-card.is-changed:not(.is-selected) { opacity: 0.85; }

/* The lit card itself. A ring rather than a thicker border, so nothing on the card
   moves by a pixel when it lights up - a 2px border would push every line of text
   in the card sideways, on the screen whose entire complaint is things moving. */
.rb-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-bd);
  background: var(--accent-soft-bg);
}
/* A lit card that ALSO has unsaved changes keeps the accent tint of both; the ring
   is what distinguishes them, so nothing needs to be said here beyond making sure
   the ring survives the .is-changed background above it in the file. */
.rb-card.is-selected.is-changed { border-color: var(--accent); }


/* == 20.7  The column heading, when a family is lit =======================
   "3 here" - how many of the LIT family's items are in this column. It counts
   ITEMS where the number beside it counts CARDS, which is why the two are worded
   differently: a bare second number would read as a correction to the first. */
.rb-col__holding {
  float: right;
  margin-right: var(--sp-1);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.rb-col.is-holding { border-color: var(--accent-soft-bd); }
.rb-col.is-holding .rb-col__head { background: var(--accent-soft-bg); }

/* Where the card you just dropped went. It earns its place because of the well:
   dragging a ROW into another column moves nothing on screen at all - the row
   stays inside its family's card and only its tier word changes - so without this
   the drop has no destination anybody can see. Reduced motion gets the border and
   not the fade; see 20.8. */
@keyframes rb-took {
  from { background: var(--accent-soft-bg); }
  to   { background: transparent; }
}
.rb-col.is-took { border-color: var(--accent); }
.rb-col.is-took .rb-col__body { animation: rb-took 700ms var(--ease); }


/* == 20.8  Narrow screens and reduced motion ==============================
   The board does not become a phone screen and does not pretend to. It keeps six
   columns and scrolls sideways; the columns simply get narrower and the page
   stops being the place to grade a whole catalogue. */
@media (max-width: 900px) {
  .rb-board { grid-auto-columns: minmax(132px, 1fr); }
  .rb-bar__search { width: 100%; max-width: none; }
  .rb-col__body { max-height: 52vh; }
  /* Below this the thumbnail is most of the card and the name has nowhere to go.
     The picture is the nice-to-have here; the name and the tier are not. */
  .rb-card .tile__art--sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rb-card, .rb-col { transition: none; }
  /* The drop pulse becomes a border that simply appears and goes. The FACT it
     carries - "it landed here" - is the point, and that fact does not need to
     move to be delivered. */
  .rb-col.is-took .rb-col__body { animation: none; }
  .rb-card__toggle .icon { transition: none; }
}


/* =============================================================================
   == 21  THE WISHLIST  (added 2026-08-01, phase 10)
   -----------------------------------------------------------------------------
   One screen: templates/catalog/wishlist.html, driven by static/js/wishlist.js.
   A list of things that do NOT exist in the game yet, grouped by how far along
   each one is.

   WHY IT IS NOT JUST `.rows` + `.row-item`
     It very nearly is, and that was the first attempt. A wish needs three things
     a row-item structurally cannot hold: its notes on a line of their own, an
     inline prompt ("what is it called in the game?") that appears under the row
     it belongs to, and an edit form. `.row-item` is a two-child flex row whose
     separator is `.row-item + .row-item`, so a third block child sits BESIDE the
     title instead of under it, and wrapping each row in a div to fix that breaks
     the separator for every row on the page.

     So `.wish` is the row: same padding, same hairline rule between siblings,
     same type scale. It adds nothing but the ability to stack blocks under the
     head. Everything inside it - badges, buttons, fields, banners - is the
     ordinary design system and nothing here restyles any of it.

   COLOUR
     None spent. Section 12 reserves amber and red for actions, and a wishlist has
     no dangerous action in it: the strongest thing on the screen is "not doing
     it", which is reversible and is recorded rather than destructive. Status is
     carried by the group heading a row sits under, which is free.
   ========================================================================== */
.wish { padding: var(--sp-3) var(--panel-pad); }
.wish + .wish { box-shadow: inset 0 1px 0 var(--border-subtle); }

.wish__head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.wish__main { min-width: 0; flex: 1 1 auto; }
.wish__side { flex: none; display: flex; align-items: center; gap: var(--sp-2); }

.wish__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}
/* The one line that says section, priority, where the art comes from and who
   wrote it. It wraps rather than truncating: on a list of thirty rows the source
   ("TLVK - turrets/vulcan") is the half somebody actually needs. */
.wish__meta {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  margin-top: var(--sp-05);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
}

/* Anything stacked under the head: the notes, the imported link, the reason a
   wish was declined, the buttons, the prompt, the edit form. */
.wish__extra { margin-top: var(--sp-2); }

/* `pre-wrap`, deliberately. The owner types these in a textarea and his line
   breaks are how he separates one thought from the next; collapsing them turns a
   short list of requirements into a paragraph. */
.wish__notes {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The row that closes the loop: an imported wish, and the item it became. A well
   rather than a plain line, because it is the one part of a wish that points at
   something real and it should read as a different KIND of thing from the note
   above it. */
.wish__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  text-decoration: none;
  color: inherit;
}
.wish__link:hover { border-color: var(--border-default); background: var(--surface-hover); }
.wish__link .tile__art { flex: none; }
.wish__link-main { min-width: 0; flex: 1 1 auto; }

/* The inline "one more thing" prompt. It is not a modal on purpose: the two
   answers it asks for - the game id, or why not - belong beside the wish they are
   about, and a dialog would hide the row while somebody tries to remember it. */
.wish__prompt {
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.wish__prompt[hidden], .wish__edit[hidden] { display: none; }

.wish__edit {
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

/* At simple density the row actions are still there and still work; they simply
   stop being four buttons in a line on a narrow screen. */
@media (max-width: 700px) {
  .wish__head { flex-direction: column; gap: var(--sp-2); }
  .wish__side { align-self: flex-start; }
}


/* =============================================================================
   == 22  THE BATTLE PASS SEASON EDITOR  (added 2026-08-01, phase 10)
   -----------------------------------------------------------------------------
   Two screens: templates/catalog/seasons.html (a list, and it needs almost
   nothing here) and templates/catalog/season_detail.html, driven by
   static/js/season-editor.js.

   WHY THE GRID IS A TABLE AND NOT CARDS
     Fifty rungs by two tracks IS a table, and the only reason to look at it is
     comparing one track against the other on the same line. Cards would put the
     free reward above the premium one, which is the one arrangement that makes
     the question unanswerable. So it is `.data.data--compact` - the ordinary
     table from section 14 - and everything below only makes a CELL able to hold
     four things (a picture, two controls and a sentence) without the row growing
     to the height of a paragraph.

   WHY THE TOTAL IS STICKY
     The grid is far taller than a screen. A running total you have to scroll
     back up to read is a total nobody reads, and the whole argument for building
     this screen rather than editing the JSON by hand is that the total is
     visible while you change things.

   COLOUR
     Almost none spent, and none of it new. Section 12 reserves amber and red for
     ACTIONS; a mistyped rung is not an action, it is a state, so the only colour
     on this screen is the existing `.text-warn` on a cell's own sentence plus a
     hairline of `--warn-bd` down the side of that cell. There is nothing on
     either screen that is irreversible, so nothing on either screen is red.
   ========================================================================== */

/* == 22.1  The running total ==============================================
   Three blocks side by side - free, premium, and what it takes to finish -
   wrapping rather than scrolling on a narrow screen, because unlike the grid
   these three are independent and a wrapped one is still readable. */
.bpe-total {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.bpe-total__block { min-width: 220px; flex: 1 1 220px; }
.bpe-total__title {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.bpe-total__blurb {
  display: block;
  font-size: var(--fs-3xs);
  color: var(--text-faint);
  margin-top: var(--sp-05);
}
.bpe-total__figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  margin-top: var(--sp-2);
}
/* The number first and big, its word underneath and quiet. A figure whose label
   is the same size as its value takes a second read to find the number, and
   these are read at a glance, fifty times an edit. */
.bpe-total__figure { display: flex; flex-direction: column; min-width: 0; }
.bpe-total__figure b {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.bpe-total__figure span {
  font-size: var(--fs-3xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* == 22.2  The grid ======================================================= */
.bpe__table { table-layout: fixed; }
/* Narrow and fixed, so the two track columns get everything else and stay the
   same width as each other - which is what makes them comparable down the page. */
.bpe__rung-head, .bpe__rung { width: 56px; }
.bpe__rung {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  vertical-align: top;
  padding-top: var(--sp-3);
}
.bpe__track-blurb {
  display: block;
  font-size: var(--fs-3xs);
  font-weight: var(--fw-regular);
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}
.bpe__cell { vertical-align: top; }
/* A rung the game server would refuse the file over. A hairline down the
   inside edge rather than a filled background: fifty rows of tinted cells while
   somebody is halfway through typing would make a normal working state look
   like an emergency. */
.bpe__cell--bad { box-shadow: inset 2px 0 0 var(--warn-bd); }

.bpe-cell { display: flex; align-items: flex-start; gap: var(--sp-2); }
.bpe-cell__art { flex: none; }
.bpe-cell__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  min-width: 0;
  flex: 1 1 auto;
}
/* Smaller than the design system's ordinary control on purpose, and this is the
   only place in the portal that does it. There are a hundred of each on this
   page: at the standard 34px row height the grid is eleven screens tall, and a
   season nobody can see the shape of is a season nobody checks. */
.bpe-cell__type {
  flex: 0 1 auto;
  min-width: 108px;
  height: 26px;
  padding: 0 var(--sp-5) 0 var(--sp-2);
  font-size: var(--fs-2xs);
}
.bpe-cell__value {
  flex: 1 1 90px;
  min-width: 90px;
  height: 26px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-2xs);
}
.bpe-cell__value[hidden] { display: none; }
/* What the rung PAYS, in the game's own words. The line as typed is in the box
   directly above it, so this is deliberately the other half. */
.bpe-cell__note {
  flex: 1 0 100%;
  font-size: var(--fs-3xs);
  color: var(--text-muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.bpe-cell__problem {
  font-size: var(--fs-3xs);
  line-height: var(--lh-snug);
  margin: var(--sp-1) 0 0;
  max-width: 46ch;
}
.bpe-cell__problem[hidden] { display: none; }

/* == 22.3  What the game server would say =================================
   Two lists, never mixed: a problem is something the server refuses the whole
   file over, and a warning is something it accepts and somebody should still
   know about. The quiet variant is the warnings, and its only difference is
   colour, because the shape of the two is identical and making them look like
   two kinds of thing would be a lie about the panel they share. */
.bpe-verdict {
  margin: 0;
  padding-left: var(--sp-4);
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  color: var(--text-secondary);
}
.bpe-verdict + .bpe-verdict { margin-top: var(--sp-3); }
.bpe-verdict li + li { margin-top: var(--sp-1); }
.bpe-verdict b { color: var(--text-primary); font-weight: var(--fw-medium); }
.bpe-verdict--quiet { color: var(--text-muted); }
.bpe-verdict[hidden] { display: none; }

/* == 22.4  The exported text ==============================================
   A `pre`, because it is JSON and its indentation is the readable part. Capped
   in height and scrolled: a fifty-rung season is about a hundred and twenty
   lines and pushing the sentence that says "this is not a deploy" off the top of
   the screen would defeat the panel. */
.bpe-export {
  margin-top: var(--sp-3);
  max-height: 420px;
  overflow: auto;
  padding: var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
  white-space: pre;
}

/* == 22.5  Narrow screens =================================================
   The grid keeps both tracks and scrolls sideways inside its own wrapper rather
   than wrapping, for the reason at the top of this section: a wrapped track is
   no longer beside its pair, which is the only thing the layout is for. The
   table-wrap from section 14 already does the scrolling; all this does is stop
   the columns collapsing to nothing on the way. */
@media (max-width: 900px) {
  .bpe__table { table-layout: auto; min-width: 720px; }
  .bpe-total { position: static; }
}


/* =============================================================================
   == 23  THE CASE ODDS EDITOR  (added 2026-08-01, phase 11)
   -----------------------------------------------------------------------------
   One screen: templates/catalog/container_editor.html, driven by
   static/js/case-editor.js.

   WHY THE TOTAL GETS THE ONLY LOUD COLOUR ON THE PAGE
     Section 12 reserves amber and red for ACTIONS, and almost nothing on this
     screen is one. The exception is the running total, and it earns it: a case
     that does not add up to exactly 100% is a file the game server REFUSES
     WHOLE, so the odds carry on being whatever they already were and every
     number the owner just typed does nothing. That is the one state on this
     screen that has to be impossible to miss, so it is the one that gets a
     colour, and Save is disabled underneath it rather than merely discouraged.

   WHY THE DROP TABLE IS A TABLE
     Same argument as the season grid in section 22. A drop table IS a table and
     the only reason to look at one is comparing the percentages down the column;
     cards would stack them and make the comparison impossible. So it is the
     ordinary `.data.data--compact` and everything below only makes a cell able to
     hold a control without the row growing to the height of a paragraph.

   WHY THE STARVATION WARNING IS AMBER AND NOT RED
     The game server ACCEPTS a file with a starved drop row and warns about it,
     because starvation depends on how items are graded on a different screen.
     Red would say "this cannot be saved", which would be a lie.
   ========================================================================== */

/* == 23.1  The running total - the centrepiece ============================
   Sticky for the same reason the season editor's is: the grid is taller than a
   screen, and a total you have to scroll back up to read is a total nobody
   reads. Unlike that one it is a JUDGEMENT and not just a figure, so it carries
   a sentence beside the numbers rather than only labels. */
.ce-total {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.ce-total__lead { flex: 1 1 260px; min-width: 0; }
.ce-total__title {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.ce-total__blurb {
  display: block;
  font-size: var(--fs-3xs);
  color: var(--text-muted);
  margin-top: var(--sp-05);
}
.ce-total__figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
}
.ce-total__case {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
/* The number first and big, its case underneath and quiet. Tabular figures so a
   column of them does not shuffle sideways as digits change under a cursor. */
.ce-total__case b {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
/* The case's name, and a link down to its own panel. It is a link because the
   first screenful is the only place that can tell somebody the other two cases
   exist: the owner reported he could not edit all three, and the reason was that
   one case fills a screen and nothing up here said there were more. */
.ce-total__jump {
  font-size: var(--fs-2xs);
  color: var(--text-link);
  white-space: nowrap;
}
.ce-total__jump:hover { color: var(--text-link-hover); text-decoration: underline; }
/* ⛔ THE ONE STATE ON THIS SCREEN THAT IS ALLOWED TO SHOUT. A case that does not
   total 100% means the whole file is refused, so the figure goes red, gets a
   border, and Save is disabled by the script at the same moment. */
.ce-total__case--bad {
  border-color: var(--danger-bd);
  background: var(--danger-bg);
}
.ce-total__case--bad b { color: var(--danger-text); }
.ce-total__fix { margin-top: var(--sp-1); align-self: flex-start; }
.ce-total__fix[hidden] { display: none; }

/* == 23.2  The drop table =================================================
   ⭐ FIXED LAYOUT, FIXED WIDTHS, AND IT DOES NOT STRETCH. Every value in this
   table is short and predictable - a dropdown of two words, a percentage of at
   most five characters, an amount of at most four digits - so there is nothing
   for the browser to guess at, and letting it guess is what produced the screen
   that came back with the first screenshot: one column spanning half the table
   to hold the word "1500", a horizontal scrollbar under a table that needs about
   830px, and the percentage box colliding with the cells beside it.

   `table.data` sets `width: 100%`, which is why the selector has to be as
   specific as it is: this table is a fixed number of pixels wide, the columns
   below add up to exactly that, and the space left over in a wide panel stays
   empty rather than being handed to whichever column asked last.

   ⛔ AND EVERY ROW HAS FIVE CELLS, ON EVERY DROP TYPE. It used to render two
   `<td class="ce__amount">` cells and hide whichever did not apply. A `<td>` set
   to `display: none` is REMOVED from its row, so every cell after it slid one
   column to the left, and a Gold Box row - which hid both - rendered four cells
   against six headings and put its remove button under "How much". There is one
   permanent amount cell now with three inline shapes inside it, so nothing can
   shift. Do not reintroduce a hideable `<td>` here.
   ========================================================================== */
table.data.ce__table {
  table-layout: fixed;
  width: 742px;              /* = the five columns below, and not a pixel more */
}
.ce__table td { vertical-align: middle; }

/* The five widths, each its widest real content plus padding: "Legendary",
   "Shot effect" in a dropdown, "Double Power x 25", "34 (+37 locked)". */
.ce__c-rarity  { width: 124px; }
.ce__c-type    { width: 148px; }
.ce__c-amount  { width: 274px; }
.ce__c-tickets { width: 120px; font-size: var(--fs-2xs); white-space: nowrap; }
.ce__row-actions { width: 76px; text-align: right; white-space: nowrap; }

/* == 23.2a  Row height - the portal's own small-control scale ==============
   Nine rows read as a set, so the set has to fit on a screen. These do not
   invent a size: `--control-h-sm` is the portal's existing small control (26px
   at full density, 30px at simple), so the rows follow the density switch in
   section 18 instead of fighting it. A row is that plus one 4px step. */
table.data.ce__table { --row-h-compact: calc(var(--control-h-sm) + var(--sp-1)); }
table.data.ce__table thead th { height: 28px; padding: 0 var(--sp-2); }
table.data.ce__table tbody td { padding: 0 var(--sp-2); }
.ce__table .input,
.ce__table .select { height: var(--control-h-sm); font-size: var(--fs-xs); }
.ce__table .select { padding-right: var(--sp-5); background-position: right var(--sp-1) center; }
.ce__table .icon-btn { width: var(--control-h-sm); height: var(--control-h-sm); }

/* The percentage box. Narrow on purpose - nothing legal in it is longer than
   "100.0" - with the sign outside so the number itself stays a plain number.
   The weight the file will hold is the box's own tooltip (see the template),
   not a visible figure beside every row. */
.ce__percent-cell { white-space: nowrap; }
.ce-percent { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; }
/* flex: 0 0 - the boxes keep their width instead of being shrunk by the flexbox
   default, which is what let the sign and the weight ride over the number. */
.ce__percent {
  flex: 0 0 66px;
  width: 66px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ce-percent__sign { flex: 0 0 auto; font-size: var(--fs-2xs); color: var(--text-muted); }

/* == 23.2c  The rarity dropdown wears its tier's colour ====================
   Rarity is the one column whose value IS a colour everywhere else - the
   board's six columns, the reveal in game - so the dropdown shows it too and a
   mixed table becomes scannable without reading a word. Text colour plus a
   left accent border, not a filled background: these are form controls, and a
   solid amber control reads as a warning state in this stylesheet. Common
   deliberately stays plain - it is the default, and colouring it would make
   six colours mean less than five do. */
.ce-rarity--uncommon  { color: var(--rar-uncommon);  border-left: 3px solid var(--rar-uncommon); }
.ce-rarity--rare      { color: var(--rar-rare);      border-left: 3px solid var(--rar-rare); }
.ce-rarity--epic      { color: var(--rar-epic);      border-left: 3px solid var(--rar-epic); }
.ce-rarity--legendary { color: var(--rar-legendary); border-left: 3px solid var(--rar-legendary); }
.ce-rarity--exotic    { color: var(--rar-exotic);    border-left: 3px solid var(--rar-exotic); }
/* The list the control drops down stays readable: options inherit the tier
   colour of the CLOSED control in some engines, and amber-on-white is not a
   list anybody can read. */
.ce-rarity option { color: var(--text); }

/* == 23.2b  "How much it pays" - one cell, three shapes, always its units ==
   The three are mutually exclusive and the type dropdown decides which. They are
   inline elements and not cells, so hiding one cannot move anything.

   ⛔ THE [hidden] RULE BELOW IS LOAD-BEARING. `display: flex` in this stylesheet
   is an author declaration and the browser's own `[hidden] { display: none }` is
   not, so without this an element the script "hid" carries on being laid out and
   all three shapes pile up in one cell. */
.ce__amount { white-space: nowrap; }
.ce-amount {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  max-width: 100%;
  min-width: 0;
}
.ce-amount[hidden] { display: none; }
.ce-amount__num { flex: 0 0 72px; width: 72px; text-align: right; }
/* The supply or case picker on a stack row. */
.ce-amount__pick { flex: 0 1 150px; width: 150px; min-width: 0; }
/* 13px and not 12px: this is the half of the cell that says what the number
   means, so it is reading text and obeys the 13px floor at the top of this file.
   12px in here is reserved for uppercase micro labels. */
.ce-amount__word {
  flex: 0 1 auto;
  min-width: 0;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Gold Box: a sentence rather than an empty cell, because an empty cell reads as
   something nobody has filled in yet. */
.ce-amount--fixed { color: var(--text-muted); font-size: var(--fs-2xs); }

/* == 23.3  The pools ======================================================
   A block per kind under its case, rather than a column in the table: a pool
   belongs to the CASE and not to one row, and putting it in the table would say
   the opposite. */
.ce-case__pools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}
.ce-pool { flex: 1 1 320px; min-width: 0; }
.ce-pool__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.ce-pool__title {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}
.ce-pool__now { font-size: var(--fs-3xs); color: var(--text-muted); }
.ce-pool__controls {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  flex-wrap: wrap;
}
.ce-pool__ids { margin-top: var(--sp-2); }
.ce-pool__ids[hidden] { display: none; }
.ce-pool__add { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }
.ce-pool__add input { flex: 1 1 auto; min-width: 0; }
.ce-pool__note {
  font-size: var(--fs-3xs);
  color: var(--text-faint);
  margin-top: var(--sp-1);
}

/* One named item in a pool. The chip carries its GRADE because that is what
   decides whether the pool can feed a drop row at all, so it is content rather
   than decoration and is not hidden behind a tooltip. */
.ce-pool__chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.ce-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  font-size: var(--fs-3xs);
}
.ce-chip em {
  font-style: normal;
  color: var(--text-faint);
}
/* An id the catalog was read WHOLE and did not contain. Only ever set when the
   list is complete - see the note in case-editor.js on why an incomplete list
   accuses nobody. */
.ce-chip--bad { border-color: var(--danger-bd); }
.ce-chip--bad em { color: var(--danger-text); }
.ce-chip__x {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 1;
}
.ce-chip__x:hover { color: var(--danger-text); }

/* == 23.3a  What a case is worth ==========================================
   The figure was there before and its SOURCE was not, which made it a number
   somebody might reasonably think they had set. The note says where it comes
   from in four words and the title carries the sum itself. */
.ce-case__worth { cursor: help; }
.ce-case__worth-note { color: var(--text-faint); }

/* == 23.4  The verdict and the diff ======================================= */
.ce-verdict, .ce-diff, .ce-case, .ce-history, .ce-ahead { margin-top: var(--sp-4); }
/* The total strip is sticky, so a case jumped to from it would otherwise land
   underneath it. */
.ce-case { scroll-margin-top: calc(var(--topbar-h) + var(--sp-16)); }
.ce-verdict[hidden], .ce-diff[hidden] { display: none; }
.ce-verdict__list, .ce-diff__list {
  margin: 0;
  padding-left: var(--sp-4);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
  color: var(--text-secondary);
}
.ce-verdict__list li + li, .ce-diff__list li + li { margin-top: var(--sp-1); }
.ce-verdict__list--quiet { color: var(--text-muted); }
.ce-verdict__list[hidden] { display: none; }
.ce-verdict__head {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-2xs);
  margin: var(--sp-3) 0 var(--sp-1);
}
.ce-history__why {
  font-size: var(--fs-3xs);
  margin: calc(var(--sp-1) * -1) 0 var(--sp-2) var(--sp-3);
}

/* The file, verbatim, for copying into git. `white-space: pre` and not pre-wrap:
   this block exists to be selected and pasted, and a wrapped line pastes with a
   line break the file does not have. */
.ce-file {
  max-height: 420px;
  overflow: auto;
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
  white-space: pre;
}
.ce-file[hidden] { display: none; }

/* == 23.4b  The six colours of a case, and its guarantees ==================
   One box per colour in the wiki's colour, an empty box being a colour the case
   never rolls. The line under each is the live ticket count for a new account. */
.ce-tiers {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border-subtle);
}
.ce-tier {
  display: flex; flex-direction: column; gap: var(--sp-1);
  min-width: 0;
  padding-left: var(--sp-2);
  border-left: 3px solid var(--rar, var(--border-default));
}
.ce-tier--common    { --rar: var(--rar-common); }
.ce-tier--uncommon  { --rar: var(--rar-uncommon); }
.ce-tier--rare      { --rar: var(--rar-rare); }
.ce-tier--epic      { --rar: var(--rar-epic); }
.ce-tier--legendary { --rar: var(--rar-legendary); }
.ce-tier--exotic    { --rar: var(--rar-exotic); }
.ce-tier--off { opacity: 0.6; border-left-style: dashed; }
.ce-tier .ce__percent { flex-basis: 82px; width: 82px; }
.ce-tier__name { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--rar); }
.ce-tier--common .ce-tier__name { color: var(--text-secondary); }
.ce-tier__meta {
  font-size: var(--fs-3xs); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ce-rules {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}
.ce-rules__block { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.ce-rule { display: flex; align-items: center; gap: var(--sp-1); }
.ce-rule .select, .ce-rules .input { height: var(--control-h-sm); font-size: var(--fs-xs); }
@media (max-width: 700px) {
  .ce-tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* == 23.4c  The case pages: a colour in its colour =========================
   portal/templates/catalog/_odds.html. A dot in the wiki colour beside the word,
   never a filled badge: six filled colours in a table is a rainbow, not a reading. */
.tier-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-weight: var(--fw-semibold); text-transform: capitalize;
}
.tier-badge::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-radius: var(--radius-full); background: var(--rar, var(--text-faint));
}
.tier-badge--common    { --rar: var(--rar-common); }
.tier-badge--uncommon  { --rar: var(--rar-uncommon); }
.tier-badge--rare      { --rar: var(--rar-rare); }
.tier-badge--epic      { --rar: var(--rar-epic); }
.tier-badge--legendary { --rar: var(--rar-legendary); }
.tier-badge--exotic    { --rar: var(--rar-exotic); }
.case-tier__lines {
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3);
  margin: 0; padding: 0; list-style: none; font-size: var(--fs-2xs);
}
.case-lock { color: var(--text-muted); font-size: var(--fs-3xs); cursor: help; }
.case-guarantees { margin: 0; padding: 0 0 0 var(--sp-4); font-size: var(--fs-xs); }
.case-guarantees li + li { margin-top: var(--sp-1); }
.case-tier + .case-tier { margin-top: var(--sp-4); }
.case-tier__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2);
  margin: 0 0 var(--sp-2); font-size: var(--fs-sm);
}

/* == 23.5  Narrow screens =================================================
   The drop table scrolls sideways inside its own wrapper rather than wrapping,
   for the same reason the season grid does: a wrapped row is no longer a row,
   and comparing the percentages down the column is the only thing the layout is
   for. It needs no min-width rule any more: the table is 832px at every width,
   so a panel narrower than that scrolls and a panel wider than that leaves the
   spare space alone. The total stops being sticky, because on a short screen a
   sticky bar this tall is most of the screen. */
@media (max-width: 900px) {
  .ce-total { position: static; }
}

/* ===========================================================================
   THE ROLES PAGE - departments as sections, roles as cards
   ===========================================================================
   Owner, 2026-09-04: "still looks not modern, hard to read. Add icons,
   categorise them, structure them." Eleven identical text rows gave the eye
   nothing to land on, so nothing was read. The page is now three shapes and no
   more: a stat strip, a section header per department, and a card per role.

   The rank colour lives on the role NAME and on one thin rule at the left edge
   of its section - never as a filled badge, or eleven cards become a rainbow
   and the colour stops meaning seniority. Every colour here is a --rank-*
   token, defined for both themes at the top of this file.  */

.dept { margin-top: var(--sp-5); }
.dept:first-of-type { margin-top: var(--sp-3); }

.dept__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--rank-grey-bd);
  margin-bottom: var(--sp-2);
}
.dept__head h2 { font-size: var(--fs-md); margin: 0; }
.dept__icon { display: inline-flex; color: var(--text-faint); }
.dept__count { margin-left: var(--sp-2); font-size: var(--fs-2xs); color: var(--text-faint); }

.dept[data-rank='gold']   .dept__head { border-left-color: var(--rank-gold-bd); }
.dept[data-rank='yellow'] .dept__head { border-left-color: var(--rank-yellow-bd); }
.dept[data-rank='silver'] .dept__head { border-left-color: var(--rank-silver-bd); }
.dept[data-rank='brown']  .dept__head { border-left-color: var(--rank-brown-bd); }
.dept[data-rank='gold']   .dept__icon { color: var(--rank-gold-text); }
.dept[data-rank='yellow'] .dept__icon { color: var(--rank-yellow-text); }
.dept[data-rank='silver'] .dept__icon { color: var(--rank-silver-text); }
.dept[data-rank='brown']  .dept__icon { color: var(--rank-brown-text); }

/* three across on a wide screen, one on a phone, and the browser picks the
   middle cases itself rather than us guessing two more breakpoints. */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-2);
}

.role-card {
  display: flex; flex-direction: column; gap: var(--sp-15);
  min-width: 0;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: inherit;
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
a.role-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong, var(--rank-grey-bd));
}

.role-card__name {
  display: flex; align-items: center; gap: var(--sp-15);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--rank-grey-text);
  min-width: 0;
}
.role-card__name span { min-width: 0; }
/* The role's own badge. 24px on a 48px source so it stays crisp, and a fixed box
   so a card never changes height when one role has art and its neighbour does not. */
.role-card__art { width: 24px; height: 24px; flex: 0 0 24px; object-fit: contain;
                  image-rendering: -webkit-optimize-contrast; }

.role-card__rank-icon { flex: none; opacity: 0.9; }

.role-card[data-rank='gold']   .role-card__name { color: var(--rank-gold-text); }
.role-card[data-rank='yellow'] .role-card__name { color: var(--rank-yellow-text); }
.role-card[data-rank='silver'] .role-card__name { color: var(--rank-silver-text); }
.role-card[data-rank='brown']  .role-card__name { color: var(--rank-brown-text); }
.role-card[data-rank='grey']   .role-card__name { color: var(--rank-grey-text); }

.role-card__desc {
  font-size: var(--fs-2xs);
  line-height: var(--lh-normal);
  color: var(--text-muted);
  flex: 1 1 auto;
}
.role-card__foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1);
  margin-top: var(--sp-1);
  padding-top: var(--sp-15);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}
.role-card__holders { margin-right: auto; }
.role-card__surface {
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (max-width: 520px) {
  .role-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------------------
   In-game slash commands (2026-09-06, owner: "i still don't know what /commands
   i can use in game"). A command is a thing you TYPE, so it is drawn as typed
   text - monospace, in a quiet pill - and never as another badge. The limits
   beside it are ordinary words, so the eye separates "what you type" from "how
   far it goes" without reading either.
   --------------------------------------------------------------------------- */
.cmds { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.cmd {
  display: inline-block;
  padding: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.cmd--quiet { border-style: dashed; color: var(--text-muted); }
.cmd-limit { font-size: var(--fs-xs); color: var(--text-muted); }

/* =============================================================================
   TIP - the explanation on hover (density rule 7, owner directive 2026-09-07)
   -----------------------------------------------------------------------------
   A small ? beside a control or a title. Hover or focus shows the sentence;
   nothing is printed on the face of the page. Pure CSS: works with the keyboard
   (the trigger is focusable) and with JS off. _partials/density.html::tip().
   ========================================================================== */
.tip { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; outline: none; }
.tip__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--border-default); background: var(--surface-sunken);
  color: var(--text-muted); font-size: 11px; font-weight: var(--fw-semibold); line-height: 1;
  cursor: help; user-select: none;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tip:hover .tip__btn, .tip:focus-visible .tip__btn, .tip:focus-within .tip__btn {
  border-color: var(--border-strong); color: var(--text-primary);
}
.tip__body {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: -4px;
  width: max-content; max-width: min(340px, 80vw);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); background: var(--surface-4);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: var(--fs-2xs); font-weight: var(--fw-regular); line-height: var(--lh-snug);
  color: var(--text-primary); text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
              visibility 0s linear var(--dur-fast);
}
.tip:hover .tip__body, .tip:focus-visible .tip__body, .tip:focus-within .tip__body {
  opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
}
.tip__body b { color: var(--text-primary); font-weight: var(--fw-medium); }
.tip--left .tip__body { right: auto; left: -4px; }

/* =============================================================================
   TAG - a quiet word beside a row, never a badge
   -----------------------------------------------------------------------------
   A badge is a STATE somebody may have to act on (amber "Needs their code"). A
   tag is a FACT that is simply true (this role applies in the game). They must
   not look alike, or the page cries wolf. Used by the Team list; the roles page
   says the same thing in its card footer with .role-card__surface.
   ========================================================================== */
.tag {
  display: inline-flex; align-items: center;
  padding: 0 var(--sp-15); height: 18px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-3xs); font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--text-faint); background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.tag--game { color: var(--accent-text); border-color: var(--accent-soft-bd); background: var(--accent-soft-bg); }
.tag--web  { color: var(--text-muted); }

/* =============================================================================
   SEG - a two- or three-way switch, drawn from real radios
   -----------------------------------------------------------------------------
   Moved here from operations.css on 2026-09-08, when the second screen needed it
   (Team: "In game only / Website too"). The real radios stay in the DOM for the
   keyboard, for screen readers and for the page scripts; the spans are what is
   drawn. A component used by two screens does not live in one screen's file.
   ========================================================================== */
/* Segmented radios (Closed | Open). The real radios stay in the DOM for the
   script and for the keyboard; the spans are what is drawn. */
.seg {
  display: inline-flex; flex: 0 0 auto; align-self: flex-start;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-sunken); overflow: hidden;
}
.seg__opt { position: relative; display: inline-flex; }
.seg__opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg__opt span {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: calc(var(--control-h-sm) - 2px); padding: 0 var(--sp-3);
  font-size: var(--fs-2xs); color: var(--text-muted); pointer-events: none;
}
.seg__opt + .seg__opt span { border-left: 1px solid var(--border-default); }
.seg__opt input:checked + span { background: var(--accent-soft-bg); color: var(--accent-text); font-weight: var(--fw-semibold); }
.seg__opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The player page's More button (owner 2026-11-03). */
.more-menu { position: relative; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu__list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column; min-width: 200px; padding: var(--sp-1); background: var(--bg-elevated, var(--surface, #141a24)); border: 1px solid var(--border-strong); border-radius: 6px; }
.more-menu__list .btn { justify-content: flex-start; }
