/**
 * PSG Inspiration Generator
 *
 * Visual language extracted from the Greeva admin template
 * (client/greeva-v1.0/JS/src/assets/scss) and re-implemented in plain CSS so the
 * app stays zero-dependency. Greeva itself is Next 15 + React 19 + Bootstrap 5.3;
 * adopting it directly would mean a rewrite and 30-odd dependencies.
 *
 * Carried over: the color tokens, the borderless card on a soft ambient shadow,
 * the 250px inset-pill sidebar, the 70px topbar, and the radius and spacing scale.
 *
 * Type: DM Mono throughout for chrome and prose,
 * Alumni Sans for titles.
 */

/* ------------------------------------------------------------------ *
 * Fonts
 * ------------------------------------------------------------------ */

@font-face {
  font-family: 'DM Mono';
  src: url('/fonts/DMMono-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('/fonts/DMMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('/fonts/DMMono-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('/fonts/DMMono-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Alumni Sans';
  src: url('/fonts/AlumniSans-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */

:root {
  /* Greeva brand colors */
  --primary: #188ae2;
  --secondary: #6b5eae;
  --success: #31ce77;
  --info: #35b8e0;
  --warning: #fbcc5c;
  --danger: #f34943;
  --pink: #ff679b;
  --teal: #02bc9c;

  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* --sans is DM Mono too. The reference pages were set in a sans on the theory
     that long prose needs one, but it read as a different product bolted on, so
     the whole interface is one mono face. Kept as its own token because the prose
     roles are still worth naming separately from chrome. */
  --sans: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Alumni Sans', 'Barlow Condensed', Impact, sans-serif;

  --radius-sm: 0.25rem;
  --radius: 0.3rem;
  --radius-lg: 0.4rem;
  --radius-xl: 1rem;
  --radius-pill: 50rem;

  --sidenav-w: 250px;
  --topbar-h: 70px;

  --menu-item-font-size: 0.925rem;
  --menu-item-icon-size: 1.25rem;

  /* Skill baseline MOTION_INTENSITY 6: fluid CSS on a premium ease, transform
     and opacity only. No linear easing anywhere. */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: all 0.24s var(--ease);
  --stagger-step: 26ms;

  /* Chrome (sidebar + topbar) is dark in BOTH themes. A full-height bright rail
     is fatiguing to sit in front of, and the dark shell also frames the cream
     content area. These are deliberately NOT the per-theme text tokens, which
     are black-at-alpha in light mode and would vanish here. */
  --chrome-bg: #212121;
  --chrome-bg-2: #272727;
  --chrome-line: #363636;
  --chrome-text: #f2f5f8;
  --chrome-text-muted: #98a3b4;
  --chrome-label: #7f8a9c;
  /* One step quieter than --chrome-label, for a value that is real but means
     "none". Still legible against --chrome-bg; --chrome-line and --chrome-bg-2
     are not, they sit within 0.2:1 of the rail. */
  --chrome-faint: #58606d;
  --chrome-shadow: 0 0 35px 0 rgba(12, 13, 17, 0.55);

  --menu-bg: var(--chrome-bg);
  --menu-item-color: #b6c3d4;
  --menu-item-hover-color: #eaf3ff;
  --menu-item-hover-bg: #272727;
  --menu-item-active-color: #ffffff;
  --menu-item-active-bg: #121213;

  --topbar-bg: var(--chrome-bg-2);
  --topbar-item-color: #c4d1df;
  --topbar-search-bg: var(--chrome-bg);

  /* Board tile outline, by request. Theme-independent, so it lives in the base
     :root and is deliberately NOT redefined under either [data-theme] block —
     both themes inherit the same two colours. Defining these under
     [data-theme='light'] is what broke dark mode once: with no --tile-line in
     scope the border fell back to currentColor instead of the grey. */
  --tile-line: #d3d3d3;
  --tile-line-hover: #008cff;

  /* Uniform board-cover height, by request. One token because covers render in
     two places (Gallery grid, reference Examples) and they must not drift.
     Applied with object-fit: cover, so a cover is CROPPED to this height rather
     than squashed — the aspect ratio of the source image is preserved. Cropped
     from the TOP (object-position: top center), not the middle: the collection
     is mostly full-page site screenshots, and the hero is what identifies one. */
  --board-cover-h: 270px;
}

/* Light — Greeva's structure. The page ground is a neutral grey (#dadbdb, set by
   request); surfaces above it stay warm cream, so cards read as lit against it. */
:root[data-theme='light'] {
  --bg: #dadbdb;
  --surface: #fffdf8;
  --surface-2: #f2ece0;
  --surface-3: #e9e2d3;
  --line: #e4ddcd;
  --line-strong: #cdc4b0;
  /* Black at alpha rather than picked grays: the cream shows through, so every
     step stays warm automatically. Safe here because light-mode text always sits
     on an opaque surface. */
  --text: rgba(0, 0, 0, 0.9);
  --text-emphasis: rgba(0, 0, 0, 0.95);
  --text-muted: rgba(0, 0, 0, 0.66);
  --text-faint: rgba(0, 0, 0, 0.56);
  --label: rgba(0, 0, 0, 0.72);
  --code: #0f7391;


  --link: #0f6cb0;
  --success-text: #147a49;
  --warning-text: #8a5d06;
  --danger-text: #b3312c;

  --card-shadow: 0 0 35px 0 rgba(150, 126, 84, 0.09);
  --shadow-lg: 0 0 45px 0 rgba(120, 100, 66, 0.2);
  --input-bg: #fffdf8;

  /* Inverted button, used by the lightbox close. DARK on the light theme. */
  --btn-invert-bg: #212121;
  --btn-invert-bg-hover: #3b3b3b;
  --btn-invert-line: #212121;
  --btn-invert-fg: #f4f6f8;

  /* Tile hover lift. Same geometry as --shadow-lg at a higher opacity, kept
     separate so raising it cannot touch the lightbox and editor, which also
     use --shadow-lg. Per-theme on purpose: the dark ground needs more opacity
     than cream to read as the same lift. */
  --tile-shadow-hover: 0 0 45px 0 rgba(120, 100, 66, 0.34);

  /* Categorical series, light steps. Fixed slot order from the dataviz skill's
     validated palette; assigned by entity, never by rank, never cycled. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  /* Instrument surfaces, after the OP-1's inset display panel. */
  --panel: #efe8da;
  --panel-line: #ded4c2;
}

/* Dark — Greeva data-bs-theme="dark", on a black page ground.
   Text steps run lighter than Greeva's defaults: nearly all interface chrome is
   set in DM Mono, and mono needs more luminance than a sans to read as crisp. */
:root[data-theme='dark'] {
  --bg: #000000;
  --surface: #212121;
  --surface-2: #272727;
  --surface-3: #303030;
  --line: #3b3b3b;
  --line-strong: #4a4a4a;
  --text: rgba(255, 255, 255, 0.95);
  --text-emphasis: #ffffff;
  --text-muted: #a2b0c1;
  --text-faint: #808c9e;
  --label: #aab7c7;


  --link: #4fa8ee;
  --code: #35b8e0;
  --success-text: #31ce77;
  --warning-text: #fbcc5c;
  --danger-text: #ff7b85;

  --card-shadow: 0 0 35px 0 rgba(26, 27, 34, 0.5);
  --shadow-lg: 0 0 45px 0 rgba(0, 0, 0, 0.55);
  --tile-shadow-hover: 0 0 45px 0 rgba(0, 0, 0, 0.72);
  --input-bg: #1b1b1b;

  /* Inverted button, used by the lightbox close. LIGHT on the dark theme. */
  --btn-invert-bg: #f4f6f8;
  --btn-invert-bg-hover: #ffffff;
  --btn-invert-line: #f4f6f8;
  --btn-invert-fg: #1b1b1b;

  /* Dark steps are SELECTED for the dark band (OKLCH L 0.48-0.67, >= 3:1 on the
     card), not an automatic flip of the light values. */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --panel: #151515;
  --panel-line: #2e2e2e;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 0.875rem/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: var(--mono); color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link); text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--code); }
::selection { background: rgba(24, 138, 226, 0.3); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Titles */
h1, h2, h3, h4, h5, h6, .display {
  font-family: var(--display);
  font-weight: 600;
  color: var(--text-emphasis);
  letter-spacing: 0.005em;
  margin: 0;
}

/* Reference prose */
.prose, .prose p, .prose li, .tick li, .card p, .card dd, .ref__summary {
  font-family: var(--sans);
}

/* ------------------------------------------------------------------ *
 * Sidebar
 * ------------------------------------------------------------------ */

.sidenav {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidenav-w);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--menu-bg);
  border-right: 1px solid var(--chrome-line);
  box-shadow: var(--chrome-shadow);
  transition: transform 0.24s ease;
}

.sidenav__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  flex: none;
  padding: 0 18px;
  border-bottom: 1px solid var(--chrome-line);
  color: inherit;
}
.sidenav__brand:hover { text-decoration: none; }

/* Phoenix symbol, viewBox 322.71 x 428.63. Keeps its brand color in both themes. */
.sidenav__mark {
  height: 34px;
  width: auto;
  flex: none;
  display: block;
}
.sidenav__brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidenav__brand-text strong {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--chrome-text);
}
.sidenav__brand-text span {
  font-size: 0.66rem;
  color: var(--chrome-text-muted);
  letter-spacing: 0.02em;
}

/* Greeva inset pill: the item has side padding, the link fills what remains. */
.side-nav {
  padding: 12px 0 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}

.side-nav__title {
  padding: 14px 20px 6px;
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--chrome-label);
}

.side-nav-item { padding: 0 10px; }

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  border-radius: var(--radius);
  color: var(--menu-item-color);
  font-size: var(--menu-item-font-size);
  line-height: 1.35;
  white-space: nowrap;
  transition: var(--transition);
}
.side-nav-link:hover {
  background: var(--menu-item-hover-bg);
  color: var(--menu-item-hover-color);
  text-decoration: none;
}
.side-nav-link[aria-current='page'] {
  background: var(--menu-item-active-bg);
  color: var(--menu-item-active-color);
  font-weight: 500;
}

.menu-icon {
  width: var(--menu-item-icon-size);
  height: var(--menu-item-icon-size);
  flex: none;
  display: grid;
  place-items: center;
}
.menu-icon svg { width: 100%; height: 100%; display: block; }

/* Same guard as the reference list: label flush left, badge trails right. */
.side-nav-link > span:not(.menu-icon):not(.badge) { order: 1; flex: 1 1 auto; min-width: 0; text-align: left; }
.side-nav-link .badge {
  order: 2;
  flex: 0 0 auto;
  margin-left: auto;
  background: var(--chrome-bg-2);
  color: var(--chrome-text-muted);
}
.side-nav-link[aria-current='page'] .badge { color: var(--chrome-text); }
.side-nav-link .menu-icon { order: 0; }

.sidenav__foot {
  flex: none;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--chrome-line);
  font-size: 0.72rem;
  line-height: 1.85;
  color: var(--chrome-text-muted);
}
.sidenav__foot b { color: var(--chrome-text); font-weight: 500; }

.sidenav__backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(9, 10, 13, 0.6);
}
.sidenav__backdrop[hidden] { display: none; }

/* ------------------------------------------------------------------ *
 * Topbar
 * ------------------------------------------------------------------ */

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidenav-w);
  right: 0;
  height: var(--topbar-h);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: var(--chrome-shadow);
}

/* Scoped so it outranks .btn-icon's `display: grid`, which is declared later. */
.topbar .topbar__toggle { display: none; }

.topbar__title { display: flex; flex-direction: column; min-width: 0; }
.topbar__title h1 {
  font-size: 1.62rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.topbar__title h1 { color: var(--chrome-text); }
.topbar__title span {
  font-size: 0.68rem;
  color: var(--chrome-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.i-menu, .i-menu::before, .i-menu::after {
  display: block;
  width: 17px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}
.i-menu { position: relative; }
.i-menu::before, .i-menu::after { content: ''; position: absolute; left: 0; }
.i-menu::before { top: -5px; }
.i-menu::after { top: 5px; }

.btn-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--chrome-line);
  border-radius: var(--radius);
  background: var(--topbar-search-bg);
  color: var(--topbar-item-color);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { color: var(--link); border-color: var(--primary); }
.btn-icon svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------------ *
 * Content shell
 * ------------------------------------------------------------------ */

.content {
  margin-left: var(--sidenav-w);
  padding: calc(var(--topbar-h) + 22px) 22px 80px;
  min-height: 100vh;
}

/* Text fills its container: no measure cap anywhere (requested). If long lines
   ever become tiring to read, reintroduce a cap here and on .card p / .tick li. */
.page-intro {
  font-family: var(--sans);
  font-size: 0.925rem;
  color: var(--text-muted);
  margin: 0 0 18px;
}

/* ------------------------------------------------------------------ *
 * Cards — Greeva: no border, ambient shadow
 * ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card > h2,
.card-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--label);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card > .card__hint {
  display: block;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -8px 0 12px;
}

.card p { margin: 0 0 11px; color: var(--text); line-height: 1.72; }
.card p:last-child { margin-bottom: 0; }


/* Asymmetric on purpose: equal halves read as a default, 1.35fr/1fr reads as a
   decision, and the left card carries denser content. */
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1.35fr 1fr; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* Collection and Reference sets read as a matched pair, so on desktop they share
   a height instead of each sizing to its own content. */
@media (min-width: 1101px) {
  .grid-2--match { align-items: stretch; }
  .grid-2--match > .card { height: 100%; margin-bottom: 0; }
  /* Those cards give up their bottom margin to match heights, so the next
     section supplies the gap. Desktop-only, or it doubles up when stacked. */
  .grid-2--match + .card { margin-top: 18px; }
}

/* ------------------------------------------------------------------ *
 * Controls
 * ------------------------------------------------------------------ */

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
}

/* The Gallery filter bar scrolls away with the content at EVERY width, by request.
   It matters most on tablet and phone: the bar wraps to several rows there, so pinned
   to the top it eats a large share of the viewport. No breakpoint on this rule for
   that reason.

   Scoped with a modifier rather than unsticking `.toolbar` outright, because the Build
   brief shares the class and its Copy/Download buttons are worth keeping in view while
   scrolling the markdown output. Must stay AFTER the base rule: same specificity, so
   source order decides. Nothing re-enables sticky at any breakpoint; the 640px rule
   only sets `top`, which is inert once position is static. */
.toolbar--static {
  position: static;
  z-index: auto;
}

.field {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 34px;
}
.field:focus-within { border-color: var(--primary); }
.field input, .field select {
  background: none;
  border: 0;
  outline: none;
  height: 32px;
  min-width: 0;
  font-size: 0.8rem;
}
.field input { width: 218px; }
.field select { cursor: pointer; padding-right: 2px; }
.field__label {
  font-size: 0.64rem;
  color: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: var(--transition);
}
.btn:hover { border-color: var(--primary); color: var(--link); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.btn--primary:hover { background: #1279c9; border-color: #1279c9; color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; }
/* Destructive actions. Quiet until hovered, so a delete never competes with the primary
   action, but unmistakable once you are on it. */
.btn--danger { border-color: var(--line-strong); color: var(--danger-text); }
.btn--danger:hover { background: var(--danger-text); border-color: var(--danger-text); color: #fff; }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn--sm { height: 29px; padding: 0 10px; font-size: 0.74rem; }
.btn--on {
  background: rgba(24, 138, 226, 0.14);
  border-color: var(--primary);
  color: var(--link);
}
/* The lightbox close button, inverted against the theme by request: light on dark,
   dark on light. Its tokens are defined per theme rather than here, since the whole
   point is that they flip.

   MUST sit after .btn:hover. .btn--close is specificity 0,1,0 and .btn:hover is
   0,2,0, so an unqualified modifier would lose its colour the moment you hover and
   fall back to --link. The :hover rule below matches that 0,2,0 and wins on order. */
.btn--close {
  background: var(--btn-invert-bg);
  border-color: var(--btn-invert-line);
  color: var(--btn-invert-fg);
}
.btn--close:hover {
  background: var(--btn-invert-bg-hover);
  border-color: var(--btn-invert-line);
  color: var(--btn-invert-fg);
}

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[disabled]:hover { border-color: var(--line); color: var(--text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.chip:hover { color: var(--text-emphasis); border-color: var(--line-strong); }
.chip--on {
  background: rgba(24, 138, 226, 0.16);
  border-color: rgba(24, 138, 226, 0.55);
  color: var(--link);
}
.chip--static { cursor: default; }
.chip--static:hover { border-color: transparent; color: var(--text-muted); }
.chip--on.chip--static:hover { border-color: rgba(24, 138, 226, 0.55); color: var(--link); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 500;
}
.badge--primary { background: rgba(24, 138, 226, 0.18); color: var(--link); }
.badge--warning { background: rgba(251, 204, 92, 0.18); color: var(--warning-text); }

.input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 11px;
  font-size: 0.8rem;
  outline: none;
  transition: var(--transition);
}
.input:focus { border-color: var(--primary); }
textarea.input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

.kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

/* ------------------------------------------------------------------ *
 * Lists, definition rows, vocabulary
 * ------------------------------------------------------------------ */

.tick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.tick li {
  padding-left: 19px;
  position: relative;
  color: var(--text);
  line-height: 1.68;
}
.tick li::before { content: '›'; position: absolute; left: 4px; color: var(--text-faint); font-family: var(--mono); }
.tick--do li::before { content: '+'; color: var(--success-text); }
.tick--dont li::before { content: '×'; color: var(--danger-text); }

.kv { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-top: 3px;
}
.kv dd { margin: 0; line-height: 1.7; }

.subhead {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--label);
  margin: 0 0 9px;
}

.vocab { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }

.fit { display: flex; align-items: flex-start; gap: 12px; }
.fit__badge {
  flex: none;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.fit--strong { background: rgba(49, 206, 119, 0.15); color: var(--success-text); }
.fit--situational { background: rgba(251, 204, 92, 0.16); color: var(--warning-text); }
.fit--avoid { background: rgba(243, 73, 67, 0.16); color: var(--danger-text); }

.note {
  border-left: 2px solid var(--warning);
  background: rgba(251, 204, 92, 0.07);
  padding: 11px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 10px;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text);
}
.note--info { border-color: var(--info); background: rgba(53, 184, 224, 0.07); }

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--sans);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

/* ------------------------------------------------------------------ *
 * Gallery
 * ------------------------------------------------------------------ */

.masonry { columns: 4 300px; column-gap: 26px; }
.masonry > * { break-inside: avoid; margin-bottom: 26px; }

/* --board-cover-h caps the BUTTON, not the image inside it. The tile is a column
   flexbox so the caption keeps its natural height and the image takes whatever is
   left above it, top-aligned. Putting the height on the image instead is what made
   tiles 306px and 320px tall: 270 of image plus a caption that wraps to two lines
   on boards carrying several design types. */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--board-cover-h);
  max-height: var(--board-cover-h);
  background: var(--surface);
  border: 2px solid var(--tile-line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  cursor: zoom-in;
  padding: 0;
  text-align: left;
  transition: var(--transition);
}
.tile:hover {
  border-color: var(--tile-line-hover);
  box-shadow: var(--tile-shadow-hover);
  transform: translateY(-2px);
}
.tile.is-selected { box-shadow: 0 0 0 2px var(--primary), var(--card-shadow); }
/* Fills the space above the caption. min-height: 0 is required — a flex item's
   default min-height is auto, which refuses to shrink below the image's intrinsic
   height and would push the button past 270px again. */
.tile img {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: cover;
  object-position: top center;
  background: var(--surface-2);
}

/* flex: none — the caption keeps its natural height (one line or two) and the
   image absorbs the difference, so the button stays exactly 270px either way. */
.tile__meta {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  font-size: 0.7rem;
  color: var(--text-faint);
}
.tile__meta b { color: var(--text); font-weight: 400; }
.tile__flags { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.tile__dot { width: 6px; height: 6px; border-radius: 99px; background: var(--success); }
.tile__dot--untagged { background: var(--warning); }

/* Overlay chrome sits on imagery: stays dark in both themes by design. */
.tile__badge {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(13, 14, 18, 0.78);
  backdrop-filter: blur(6px);
  font-size: 0.66rem;
  color: #dbe2ea;
}
/* Sits under the board badge, so a cover reads as "there are more behind this". */
.tile__count {
  position: absolute;
  top: 34px;
  left: 9px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(13, 14, 18, 0.62);
  backdrop-filter: blur(6px);
  font-size: 0.62rem;
  color: #c3ccd8;
}
.tile__star { position: absolute; top: 7px; right: 10px; font-size: 14px; color: var(--warning-text); }
/* Takes the image's place in the column, so a missing file leaves the button the
   same 270px as every other tile. */
.tile__missing {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 12px;
  text-align: center;
  color: var(--warning-text);
  font-size: 0.75rem;
}

/* Firecrawl page picker. Scrolls rather than growing without bound: a mapped site can
   return dozens of pages and the card sits in a column beside the results panel. */
.pagelist {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
}
.pagelist__row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  line-height: 1.45;
  cursor: pointer;
}
.pagelist__row:hover { background: var(--surface-2); }
.pagelist__row input { margin-top: 2px; flex: none; }
.pagelist__row strong { font-weight: 500; color: var(--text); }
.pagelist__row .side-meta { display: block; word-break: break-all; }

/* Boards */
.board {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.board__head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; flex-wrap: wrap; }
.board__title {
  font-family: var(--display);
  font-size: 1.24rem;
  font-weight: 600;
  color: var(--text-emphasis);
  letter-spacing: 0.01em;
}
.board__id { font-size: 0.7rem; color: var(--text-faint); }
.board__strip { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 5px; }
.board__strip img {
  height: 132px;
  width: auto;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
  background: var(--surface-2);
}
.board__strip img:hover { box-shadow: 0 0 0 2px var(--primary); }
.board__tags { margin-top: 12px; }

/* ------------------------------------------------------------------ *
 * Triage
 * ------------------------------------------------------------------ */

.triage { display: flex; flex-direction: column; gap: 16px; }

.triage__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  font-size: 0.76rem;
}
.triage__pos { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-emphasis); }
.triage__name { font-weight: 500; color: var(--text); }
.triage__spacer { margin-left: auto; }

/* Shot beside tags on desktop. The shot column is fixed so the chip column does not
   reflow as covers change aspect between boards, which would move a chip out from
   under the cursor mid-pass. */
.triage__body { display: grid; gap: 18px; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .triage__body { grid-template-columns: 1fr; } }

.triage__shot {
  background: var(--surface);
  border: 2px solid var(--tile-line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
/* Same top crop as a gallery cover, taller, so a board looks like itself here. */
.triage__shot > img {
  display: block;
  width: 100%;
  height: 420px;
  object-fit: cover;
  object-position: top center;
  background: var(--surface-2);
}
.triage__strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.triage__strip img { height: 54px; width: auto; border-radius: var(--radius-sm); background: var(--surface-2); }

.triage__tags {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 16px 18px;
}

.triage__nav {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.triage__nav .btn--primary { margin-left: auto; }

/* ------------------------------------------------------------------ *
 * Compare
 * ------------------------------------------------------------------ */

/* auto-fit with a 320px floor: two picks get half the width each, four get a
   quarter, and on a narrow window they wrap rather than shrinking to nothing.
   No fixed column count, so the view does not need to know how many are picked. */
.compare { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.compare__item {
  margin: 0;
  background: var(--surface);
  border: 2px solid var(--tile-line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* Taller than a gallery tile because comparing is the whole point here, but the
   same top crop, so a board looks like itself in both places. */
.compare__shot {
  display: block;
  width: 100%;
  height: 60vh;
  min-height: 320px;
  padding: 0;
  border: 0;
  background: var(--surface-2);
  cursor: zoom-in;
}
.compare__shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.compare__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
}
.compare__meta strong { font-weight: 500; color: var(--text); }
.compare__meta .btn { margin-left: auto; }

/* ------------------------------------------------------------------ *
 * Reference hub
 * ------------------------------------------------------------------ */

.ref-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; align-items: start; }

/* The inner reference list is chrome, not content: dark in both themes, matching
   the main sidebar. Its item colours already came from the menu-* tokens, so a
   light panel underneath them was unreadable. */
.ref-list {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  background: var(--chrome-bg);
  border-radius: var(--radius);
  box-shadow: var(--chrome-shadow);
  padding: 8px;
  max-height: calc(100vh - var(--topbar-h) - 40px);
  overflow-y: auto;
}
.ref-list__group {
  padding: 12px 10px 5px;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--chrome-label);
}
.ref-list button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--menu-item-color);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.35;
  transition: var(--transition);
}
.ref-list button:hover { background: var(--menu-item-hover-bg); color: var(--menu-item-hover-color); }
.ref-list button[aria-current='true'] {
  background: var(--menu-item-active-bg);
  color: var(--menu-item-active-color);
  font-weight: 500;
}

/* The label always sits flush left and the count always trails right, whatever
   order the two spans are emitted in. `order` makes this independent of the DOM. */
.ref-list button > span { order: 1; flex: 1 1 auto; min-width: 0; text-align: left; }
.ref-list__count {
  order: 2;
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--chrome-label);
  text-align: right;
}
/* Unused entry. Quieter than a real count so a rail of zeros reads as absence
   rather than as data, but still legible. --chrome-* only, and NOT redefined per
   theme: this rail is chrome, dark in both themes, so a themed token would vanish
   in one of them. */
.ref-list__count--none {
  color: var(--chrome-faint);
  font-variant-numeric: tabular-nums;
}

/* Controls sitting on the dark rail need chrome colours too. */
.ref-list .btn {
  background: var(--chrome-bg-2);
  border-color: var(--chrome-line);
  color: var(--chrome-text);
}
/* --link is a per-theme text variant tuned against cream: 2.96:1 on this dark rail.
   Chrome surfaces only ever get theme-independent :root colours. */
.ref-list .btn:hover { border-color: var(--primary); color: var(--chrome-text); }
.ref-list .badge { background: var(--chrome-bg-2); color: var(--chrome-text-muted); }

.ref { min-width: 0; }
.ref__head { margin-bottom: 20px; }
.ref__title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 7px; }
.ref__title h1 {
  font-size: 2.55rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.005em;
}
.ref__aka { font-size: 0.72rem; color: var(--text-faint); }
.ref__summary { margin: 0; font-size: 1rem; line-height: 1.62; color: var(--text-muted); }

.ref__examples { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
.ref__examples img {
  width: 100%;
  height: var(--board-cover-h);
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
  display: block;
  background: var(--surface-2);
  transition: var(--transition);
}
.ref__examples img:hover { box-shadow: 0 0 0 2px var(--primary); }

/* ------------------------------------------------------------------ *
 * Import
 * ------------------------------------------------------------------ */

.import-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 350px) minmax(0, 1fr); align-items: start; }

.cand-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.cand {
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: var(--transition);
}
.cand:hover { box-shadow: var(--shadow-lg); }
.cand.is-on { box-shadow: 0 0 0 2px var(--primary); }
.cand img { display: block; width: 100%; height: 116px; object-fit: cover; background: var(--surface-3); }
.cand__meta { padding: 6px 8px; font-size: 0.64rem; color: var(--text-faint); word-break: break-all; }

/* ------------------------------------------------------------------ *
 * Brief
 * ------------------------------------------------------------------ */

.brief-out {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.775rem;
  line-height: 1.75;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow: auto;
}

/* ------------------------------------------------------------------ *
 * Lightbox — above the 1000-level sidebar
 * ------------------------------------------------------------------ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  background: rgba(8, 9, 12, 0.95);
  backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }

.lightbox__stage { display: grid; place-items: center; padding: 24px; min-width: 0; position: relative; }
.lightbox__stage img { max-width: 100%; max-height: calc(100vh - 48px); border-radius: var(--radius); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: rgba(37, 38, 48, 0.92);
  border: 1px solid #37394d;
  color: #dee2e6;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}
.lightbox__nav:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

.lightbox__side {
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.side-block h3 {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--label);
  margin: 0 0 9px;
}
.side-meta { font-size: 0.7rem; line-height: 1.75; color: var(--text-faint); word-break: break-all; margin: 0; }

/* ------------------------------------------------------------------ *
 * Toasts
 * ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 9px 17px;
  font-size: 0.775rem;
  color: var(--text-emphasis);
  box-shadow: var(--shadow-lg);
}
.toast--bad { border-left-color: var(--danger); color: var(--danger-text); }

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1200px) {
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidenav { transform: translateX(-100%); }
  body.sidenav-open .sidenav { transform: none; }
  .topbar { left: 0; }
  .topbar .topbar__toggle { display: grid; }
  .content { margin-left: 0; }
  .ref-layout { grid-template-columns: 1fr; }
  .ref-list { position: static; max-height: none; }
  .lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lightbox__side { border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; }
}

@media (max-width: 640px) {
  .content { padding: calc(var(--topbar-h) + 16px) 14px 70px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar__title h1 { font-size: 1.3rem; }
  .toolbar { top: var(--topbar-h); }
  .field input { width: 100%; }
  .masonry { columns: 1; }
}


/* ------------------------------------------------------------------ *
 * Motion, states, and skeletons
 * ------------------------------------------------------------------ */

/* Tactile press: a physical push on every actionable surface. */
.chip:active { transform: scale(0.97); }
.tile:active { transform: scale(0.988); }
.btn-icon:active { transform: translateY(1px); }
.ref-list button:active { transform: translateX(1px); }
.cand:active { transform: scale(0.985); }

/* Staggered mount. --i is set per item; capped so a 72-tile grid still lands fast. */
@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.stagger {
  animation: rise 0.42s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 22) * var(--stagger-step));
}

/* Skeletons: shaped like the content they replace, with a travelling sheen. */
@keyframes sheen { to { background-position: 200% 0; } }

/* Progress ring for long work. Sized to sit inline with button text. */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Respect the reduced-motion preference: fall back to a pulse rather than a spin. */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.3; } }
}

/* The live progress line while a capture batch runs. */
.progress {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.76rem;
  color: var(--text);
}
.progress__bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress__fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transition: width 0.3s var(--ease);
}

.sk {
  display: block;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 45%, transparent 90%),
    var(--surface-2);
  background-size: 200% 100%, auto;
  animation: sheen 1.5s linear infinite;
}
:root[data-theme='light'] .sk {
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.85) 45%, transparent 90%),
    var(--surface-3);
  background-size: 200% 100%, auto;
}
.sk-rows { display: flex; flex-direction: column; gap: 9px; }
.sk-card { display: flex; flex-direction: column; gap: 14px; }
.sk-screen { animation: rise 0.3s var(--ease) both; }

/* Composed empty and error states. */
.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 46px 34px 50px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  animation: rise 0.34s var(--ease) both;
}
.state__mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--text-faint);
}
.state__title {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-emphasis);
}
.state__body {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.state__action { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.state--error .state__mark { background: rgba(243, 73, 67, 0.13); color: var(--danger-text); }
.state--error .state__body { font-family: var(--mono); font-size: 0.8rem; }

/* Respect the OS setting: every animation above is decorative. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .sk { animation: none; }
}

/* Wireframe block sequence: numbered steps, the order being the content. */
.seq { list-style: none; margin: 0; padding: 0; counter-reset: seq; }
.seq__step {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.seq__step:first-child { border-top: 0; padding-top: 0; }
.seq__num {
  flex: none;
  width: 30px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--link);
  padding-top: 3px;
}
.seq__block {
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-emphasis);
  margin: 0 0 3px;
  letter-spacing: 0.01em;
}
.seq__does {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.68;
  color: var(--text);
  margin: 0;
}

/* ------------------------------------------------------------------ *
 * Taxonomy editor
 * ------------------------------------------------------------------ */

.editor { position: fixed; inset: 0; z-index: 1300; }
.editor[hidden] { display: none; }

.editor__scrim {
  position: absolute; inset: 0;
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: blur(3px);
}

.editor__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.34s var(--ease) both;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.editor__head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.editor__head h2 {
  font-family: var(--display);
  font-size: 1.62rem;
  font-weight: 600;
  color: var(--text-emphasis);
  line-height: 1.1;
}

.editor__body { flex: 1; overflow-y: auto; padding: 6px 20px 20px; }
.editor__section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.editor__section:last-child { border-bottom: 0; }
.editor__section .field-block { margin-bottom: 14px; }
.editor__section .field-block:last-child { margin-bottom: 0; }
.editor__section .field-block label {
  font-size: 0.64rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--label);
}
.editor__section .field-block { display: flex; flex-direction: column; gap: 6px; }

.editor__foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

@media (max-width: 640px) {
  .editor__panel { width: 100%; border-left: 0; }
}

/* ------------------------------------------------------------------ *
 * Overview data tables
 *
 * Only the Overview page uses these. Every other page is reference reading;
 * this one is the dashboard, so it gets rows, aligned numerals and the accent
 * palette. Keep the tone classes here rather than spreading colour elsewhere.
 * ------------------------------------------------------------------ */

.dtable {
  /* Inset for the first and last columns, so row text does not run into the card
     edge. Applied to thead and tbody by the same pair of rules below, which is why
     a header cannot drift out of line with its own column. */
  --dtable-edge: 12px;
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.dtable th:first-child,
.dtable td:first-child { padding-left: var(--dtable-edge); }
.dtable th:last-child,
.dtable td:last-child { padding-right: var(--dtable-edge); }

.dtable thead th {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  text-align: left;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dtable thead th.num { text-align: right; }

.dtable tbody th {
  font-weight: 400;
  text-align: left;
  color: var(--text);
  padding: 9px 10px;
  white-space: nowrap;
}
.dtable tbody td { padding: 9px 10px; color: var(--text); vertical-align: middle; }

.dtable tbody tr + tr th,
.dtable tbody tr + tr td { border-top: 1px solid var(--line); }

/* Numbers align on the right and use tabular figures so columns line up. */
.dtable .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dtable__clickable { cursor: pointer; transition: var(--transition); }
.dtable__clickable:hover th,
.dtable__clickable:hover td { color: var(--text-emphasis); background: var(--surface-2); }
.dtable__clickable:hover th:first-child { box-shadow: inset 2px 0 0 0 var(--primary); }

/* Value tones */
.num--success { color: var(--success-text); }
.num--warning { color: var(--warning-text); }
.num--danger { color: var(--danger-text); }
.num--primary { color: var(--link); }
.num--teal { color: var(--teal); }
.num--muted { color: var(--text-faint); }


/* Category tag. Colour is categorical identity; the text inside is the direct
   label that the skill's relief rule requires. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface-2);
}
.tag::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--tag-color, var(--series-1));
}
.tag--s1 { --tag-color: var(--series-1); }
.tag--s2 { --tag-color: var(--series-2); }
.tag--s3 { --tag-color: var(--series-3); }
.tag--s4 { --tag-color: var(--series-4); }
.tag--s5 { --tag-color: var(--series-5); }
.tag--s6 { --tag-color: var(--series-6); }

@media (max-width: 640px) {
  .dtable { font-size: 0.74rem; }
  .dtable tbody th, .dtable tbody td { padding: 7px 6px; }
}

/* ------------------------------------------------------------------ *
 * Overview instrument panel
 *
 * Visual language from the Teenage Engineering TX-6 and OP-1: knobs with a tick
 * scale and a single pointer, segmented LCD meters, an inset display panel,
 * monochrome hardware with colour only where it means something.
 * ------------------------------------------------------------------ */

/* The panel reads as milled into the card face: a dark inner shadow plus a
   1px light top edge and dark bottom edge. */
.dial-row {
  display: flex;
  flex-wrap: wrap;
  /* Even gaps including the edges, so the knobs sit distributed across the panel
     rather than packed left. gap is the wrap fallback, not the spacing. */
  justify-content: space-evenly;
  gap: 22px 0;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.04);
}
/* The lead panel holds one knob, so it hugs it rather than stretching. */
.dial-row--lead {
  gap: 18px;
  padding: 20px 16px;
  margin-bottom: 0;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.dial-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dial-row--lead .btn { white-space: nowrap; }

/* Dial beside the numbers: the panel takes its natural width, the table takes
   the rest. Collapses to stacked on narrow viewports. */
.split {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .dial-row--lead { height: auto; }
}

.dial { text-align: center; width: var(--dial-size); }

/* Knob sits above the panel, so it casts. Kept tight and tinted, not a glow. */
.knob {
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}
.knob__tick { fill: var(--line-strong); transition: fill 0.3s var(--ease); }
.knob__tick--complete { fill: var(--success); }
.knob__tick--partial { fill: var(--warning); }
.knob__tick--s1 { fill: var(--series-1); }
.knob__tick--s2 { fill: var(--series-2); }
.knob__tick--s3 { fill: var(--series-3); }

.knob__body {
  fill: url(#knobFaceDark);
  stroke: none;
}
/* The rim is the machined edge: light at the top, dark at the bottom. */
.knob__rim {
  fill: none;
  stroke: url(#knobRimDark);
  stroke-width: 1.6;
}
.knob__pointer {
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke: var(--text-faint);
  /* Defined in index.html's shared defs, not here. One filter serves both themes:
     it shades the pointer's own colour rather than the knob face beneath it. */
  filter: url(#knobPointerInner);
}
.knob__pointer--complete { stroke: var(--success); }
.knob__pointer--partial { stroke: var(--warning); }
.knob__pointer--s1 { stroke: var(--series-1); }
.knob__pointer--s2 { stroke: var(--series-2); }
.knob__pointer--s3 { stroke: var(--series-3); }

.dial__readout {
  margin-top: -6px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
}
.dial__num {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-emphasis);
}
.dial__num--none { color: var(--text-faint); }
.dial__pc { font-family: var(--mono); font-size: 0.66rem; color: var(--text-faint); }
.dial-row--lead .dial__num { font-size: 1.7rem; }

.dial__label {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--label);
  margin-top: 6px;
  line-height: 1.3;
}
.dial__sub {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  margin-top: 1px;
}

/* Segmented meter. The gaps between segments are the mark spec's surface gap. */
.meter { display: flex; gap: 2px; align-items: center; height: 12px; }
.meter__seg {
  flex: 1;
  height: 100%;
  min-width: 2px;
  border-radius: 1px;
  background: var(--line);
  opacity: 0.55;
}
.meter__seg--on {
  background: var(--series-1);
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: segIn 0.35s var(--ease) both;
}
/* Unlit segments are recessed into the track. */
.meter__seg { box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35); }
@keyframes segIn { from { opacity: 0; transform: scaleY(0.4); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .dial-row { gap: 14px; padding: 14px; }
}

/* Light mode: white knobs on a warm panel, after the OP-1. The dark-mode knob
   body is lighter than its panel; inverting that here keeps the same read. */
/* The white face barely differs from the panel (1.2:1), so the edge does the
   work: a definite stroke, which is the mark spec's ring doing its job. */
:root[data-theme='light'] .knob__body { fill: url(#knobFaceLight); }
:root[data-theme='light'] .knob__rim { stroke: url(#knobRimLight); stroke-width: 2.2; }
/* Depth in light mode has to come from the edge and the cast shadow, never the
   face: the face centre is already #ffffff so it can only darken, and the pointer
   rides on the face (the green tone is already at 2.68:1 there). The rim spans
   r 28.1-30.3 at this width, clear of the pointer tip at r 27. */
:root[data-theme='light'] .knob {
  filter:
    drop-shadow(0 1px 1px rgba(120, 104, 78, 0.34))
    drop-shadow(0 3px 6px rgba(120, 104, 78, 0.30));
}
:root[data-theme='light'] .dial-row {
  box-shadow:
    inset 0 2px 5px rgba(140, 122, 92, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.7);
}
/* Unlit ticks only. The --s1/--s2/--s3 and status selectors below must repeat at
   this specificity or this rule greys out the lit ticks too. */
:root[data-theme='light'] .knob__tick { fill: #bdb3a0; }
:root[data-theme='light'] .knob__tick--complete { fill: var(--success-text); }
:root[data-theme='light'] .knob__tick--partial { fill: var(--warning-text); }
:root[data-theme='light'] .knob__tick--s1 { fill: var(--series-1); }
:root[data-theme='light'] .knob__tick--s2 { fill: var(--series-2); }
:root[data-theme='light'] .knob__tick--s3 { fill: var(--series-3); }
:root[data-theme='light'] .knob__pointer--complete { stroke: var(--success-text); }
:root[data-theme='light'] .knob__pointer--partial { stroke: var(--warning-text); }
/* Unlit segments only. The --on rule must repeat at this specificity or the lit
   segments lose their colour, which is exactly what happened. */
:root[data-theme='light'] .meter__seg { background: var(--line-strong); opacity: 0.5; }
:root[data-theme='light'] .meter__seg--on { background: var(--series-1); opacity: 1; }
