/* ==========================================================================
   DE Forge — design system

   Reads as instrument panel rather than dashboard: near-black ground, one
   accent per environment, restrained motion, and typography that treats data
   as the subject. No framework, no build step.
   ========================================================================== */

:root {
  /* ground */
  --bg:        #07080c;
  --bg-2:      #0b0d13;
  --panel:     #0f1219;
  --panel-2:   #141824;
  --raised:    #1a1f2e;
  --line:      #232838;
  --line-soft: #1a1e2a;

  /* ink */
  --ink:       #e9ecf5;
  --ink-2:     #a8b0c7;
  --ink-3:     #6d7690;
  --ink-4:     #464e63;

  /* signal */
  --ok:        #45dfa0;
  --warn:      #ffb454;
  --bad:       #ff5f6d;
  --info:      #6ec8ff;
  --gold:      #ffd166;

  /* accent — overridden per environment via --hue */
  --hue: 250;
  --accent:       hsl(var(--hue) 88% 66%);
  --accent-dim:   hsl(var(--hue) 70% 46%);
  --accent-glow:  hsl(var(--hue) 90% 60% / 0.22);
  --accent-wash:  hsl(var(--hue) 60% 50% / 0.09);

  --r-sm: 8px;
  --r:    13px;
  --r-lg: 20px;

  --shadow-1: 0 1px 2px rgb(0 0 0 / .5), 0 4px 16px rgb(0 0 0 / .35);
  --shadow-2: 0 2px 6px rgb(0 0 0 / .5), 0 18px 48px rgb(0 0 0 / .5);

  --sans: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui,
          -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI Semibold", var(--sans);
  --mono: "Cascadia Code", "JetBrains Mono", "SF Mono", "Consolas",
          ui-monospace, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  /* one very soft light source, top-left. keeps the near-black from reading flat */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1200px 700px at 8% -8%, hsl(var(--hue) 70% 40% / .16), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, hsl(calc(var(--hue) + 60) 60% 40% / .07), transparent 60%);
  transition: background 700ms var(--ease);
}

::selection { background: hsl(var(--hue) 80% 60% / .3); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #303752; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 620; letter-spacing: -.018em; margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.06rem; }
h4 { font-size: .93rem; }
p  { margin: 0 0 .85em; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; font-variant-ligatures: none; }

/* ============================ layout ============================ */
#app { position: relative; z-index: 1; display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 14px; gap: 4px;
  background: linear-gradient(180deg, rgb(10 12 18 / .9), rgb(7 8 12 / .92));
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--accent), hsl(calc(var(--hue) + 40) 80% 50%));
  box-shadow: 0 0 0 1px hsl(var(--hue) 80% 70% / .35), 0 6px 18px var(--accent-glow);
  display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  font-size: 14px; color: #05060a;
}
.brand-name { font-family: var(--display); font-weight: 680; letter-spacing: -.03em; font-size: 1.05rem; }
.brand-sub { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); margin-top: -3px; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--ink-2); cursor: pointer; border: 1px solid transparent;
  font-size: .9rem; transition: background 140ms var(--ease), color 140ms var(--ease);
  user-select: none;
}
.nav-item:hover { background: rgb(255 255 255 / .035); color: var(--ink); }
.nav-item.on {
  background: linear-gradient(90deg, var(--accent-wash), transparent 85%);
  border-color: hsl(var(--hue) 60% 55% / .22); color: var(--ink);
}
.nav-item.on .nav-ico { color: var(--accent); }
.nav-ico { width: 17px; text-align: center; color: var(--ink-4); font-size: .95rem; flex: none; }
.nav-badge {
  margin-left: auto; font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: var(--accent-dim); color: #05060a;
}
.nav-badge.quiet { background: var(--line); color: var(--ink-3); }
.nav-group { font-size: .64rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--ink-4); padding: 16px 10px 6px; }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.lvl-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line-soft); cursor: pointer; }
.lvl-chip:hover { border-color: var(--line); }
.lvl-num {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-family: var(--display); font-weight: 720; font-size: 1rem;
  background: radial-gradient(circle at 30% 25%, hsl(var(--hue) 70% 34%), #10131c);
  border: 1px solid hsl(var(--hue) 60% 50% / .4); color: var(--ink);
}
.lvl-meta { min-width: 0; }
.lvl-title { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl-xp { font-size: .68rem; color: var(--ink-3); font-family: var(--mono); }

main { min-width: 0; padding: 30px 38px 80px; max-width: 1500px; }
.view { animation: rise 340ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 240px; }
.eyebrow { font-size: .68rem; letter-spacing: .19em; text-transform: uppercase; color: var(--accent);
  font-weight: 700; margin-bottom: 5px; }
.sub { color: var(--ink-2); font-size: .95rem; margin-top: 4px; }

/* ============================ primitives ============================ */
.card {
  background: linear-gradient(168deg, var(--panel-2), var(--panel) 62%);
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.card.pad-lg { padding: 24px 26px; }
.card.flat { background: var(--panel); box-shadow: none; }
.card.hl { border-color: hsl(var(--hue) 55% 50% / .35); }
.card.hl::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .8;
}
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 7px; }
.spread { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 18px; } .mt-s { margin-top: 10px; } .mt-l { margin-top: 30px; }
.muted { color: var(--ink-3); } .dim { color: var(--ink-2); }
.tiny { font-size: .74rem; } .small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hide { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--raised); color: var(--ink);
  font-family: inherit; font-size: .875rem; font-weight: 560; cursor: pointer;
  transition: transform 90ms var(--ease), background 140ms, border-color 140ms, box-shadow 140ms;
}
.btn:hover { background: #212739; border-color: #333b54; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  border-color: transparent; color: #05070c; font-weight: 680;
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: rgb(255 255 255 / .04); }
.btn.danger { border-color: hsl(354 70% 45% / .5); color: #ffb3b9; background: hsl(354 60% 30% / .25); }
.btn.sm { padding: 5px 11px; font-size: .8rem; border-radius: 8px; }
.btn.wide { width: 100%; justify-content: center; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 30px;
  font-size: .72rem; font-weight: 620; letter-spacing: .01em;
  background: var(--raised); border: 1px solid var(--line); color: var(--ink-2);
}
.pill.accent { background: var(--accent-wash); border-color: hsl(var(--hue) 60% 55% / .35); color: var(--accent); }
.pill.ok   { background: hsl(157 60% 30% / .3); border-color: hsl(157 55% 45% / .4); color: var(--ok); }
.pill.warn { background: hsl(35 70% 34% / .28); border-color: hsl(35 70% 50% / .4); color: var(--warn); }
.pill.bad  { background: hsl(354 65% 34% / .28); border-color: hsl(354 65% 50% / .4); color: var(--bad); }
.pill.info { background: hsl(203 70% 34% / .25); border-color: hsl(203 70% 50% / .35); color: var(--info); }
.pill.gold { background: hsl(44 75% 34% / .28); border-color: hsl(44 75% 55% / .4); color: var(--gold); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .85rem; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }

.meter { height: 6px; border-radius: 20px; background: #171b28; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 900ms var(--ease); }
.meter.ok > i   { background: linear-gradient(90deg, #1f8a63, var(--ok)); }
.meter.warn > i { background: linear-gradient(90deg, #a06b17, var(--warn)); }
.meter.bad > i  { background: linear-gradient(90deg, #8e2833, var(--bad)); }
.meter.thin { height: 4px; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-n { font-family: var(--display); font-size: 1.62rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat-l { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); }

/* ============================ dashboard ============================ */
.hero {
  display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 20px; align-items: stretch;
}
@media (max-width: 1080px) { .hero { grid-template-columns: 1fr; } }

.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { width: 108px; height: 108px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .bg  { stroke: #171b28; }
.ring .fg  { stroke: url(#ringgrad); stroke-linecap: round;
  transition: stroke-dashoffset 1200ms var(--ease); filter: drop-shadow(0 0 6px var(--accent-glow)); }
.ring-mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-mid b { display: block; font-family: var(--display); font-size: 1.8rem; font-weight: 760; line-height: 1; }
.ring-mid span { font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); }

.mission-card {
  cursor: pointer; transition: transform 180ms var(--ease), border-color 180ms, box-shadow 180ms;
}
.mission-card:hover { transform: translateY(-3px); border-color: hsl(var(--hue) 50% 50% / .4); box-shadow: var(--shadow-2); }
.mission-card.locked { opacity: .52; cursor: default; }
.mission-card.locked:hover { transform: none; border-color: var(--line-soft); box-shadow: var(--shadow-1); }
.mission-card.done { border-color: hsl(157 40% 40% / .3); }
.mc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.mc-title { font-family: var(--display); font-size: 1.08rem; font-weight: 640; letter-spacing: -.02em; }
.mc-tag { color: var(--ink-2); font-size: .87rem; margin-top: 3px; }
.mc-foot { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-size: .74rem; color: var(--ink-4); }

.act-band { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.act-band .n { font-family: var(--display); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; }
.act-band .ln { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* heat map */
.heat { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: center; }
.heat-row { display: contents; }
.heat-bar { height: 16px; border-radius: 5px; background: #141826; position: relative; overflow: hidden; }
.heat-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 5px;
  background: linear-gradient(90deg, hsl(var(--hue) 70% 34%), var(--accent)); }
.heat-lbl { font-size: .8rem; color: var(--ink-2); }
.heat-n { font-family: var(--mono); font-size: .72rem; color: var(--ink-4); }

/* ============================ skills ============================ */
.skill-card {
  padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-soft);
  background: var(--panel); transition: border-color 160ms, transform 160ms var(--ease);
}
.skill-card:hover { border-color: var(--line); transform: translateY(-2px); }
.skill-card.stale { border-color: hsl(35 60% 45% / .35); }
.sk-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sk-name { font-weight: 620; font-size: .95rem; }
.sk-lvl { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pips { display: flex; gap: 3px; margin: 8px 0 6px; }
.pip { height: 4px; flex: 1; border-radius: 4px; background: #1b2030; }
.pip.on { background: linear-gradient(90deg, var(--fam), var(--fam2)); }

.graph-wrap { position: relative; }
.graph-wrap svg { width: 100%; height: auto; display: block; }
.gnode { cursor: pointer; transition: opacity 200ms; }
.gnode circle { transition: r 220ms var(--ease), fill 220ms; }
.gnode:hover circle.hit { fill: rgb(255 255 255 / .07); }
.gedge { stroke: #232838; stroke-width: 1; }
.gedge.lit { stroke: var(--accent); stroke-width: 1.6; }
.glabel { font-size: 9.5px; fill: var(--ink-3); font-family: var(--sans); }
.gnode.act .glabel { fill: var(--ink); }

/* ============================ workbench ============================ */
.bench { display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; }
.editor {
  position: relative; border: 1px solid var(--line); border-radius: var(--r);
  background: #0a0c12; overflow: hidden; font-family: var(--mono); font-size: 13px; line-height: 1.62;
}
.editor:focus-within { border-color: hsl(var(--hue) 55% 55% / .5); box-shadow: 0 0 0 3px var(--accent-glow); }
.ed-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: #0d1017; border-bottom: 1px solid var(--line-soft); font-family: var(--sans); font-size: .76rem; }
.ed-bar .tag { color: var(--ink-4); letter-spacing: .1em; text-transform: uppercase; font-size: .64rem; }
.ed-body { position: relative; display: grid; grid-template-columns: auto 1fr; }
.ed-gutter { padding: 10px 8px 10px 12px; text-align: right; color: var(--ink-4); white-space: pre;
  user-select: none; background: #090b10; border-right: 1px solid var(--line-soft); min-width: 42px; }
.ed-scroll { position: relative; overflow: auto; max-height: 46vh; }
.ed-hl, .ed-ta {
  margin: 0; padding: 10px 14px; border: 0; white-space: pre; overflow-wrap: normal;
  font: inherit; letter-spacing: 0; tab-size: 4;
}
.ed-hl { position: absolute; inset: 0; pointer-events: none; color: var(--ink); }
.ed-ta {
  position: relative; width: 100%; min-height: 100%; background: transparent; color: transparent;
  caret-color: var(--accent); resize: none; outline: none; display: block;
}
.ed-ta::placeholder { color: var(--ink-4); }
/* token colours */
.t-kw { color: #c58fff; font-weight: 600; }
.t-fn { color: #6ec8ff; }
.t-str { color: #8ee7a5; }
.t-num { color: #ffc46b; }
.t-com { color: #5a6478; font-style: italic; }
.t-op  { color: #93a0bd; }
.t-id  { color: #e9ecf5; }

.results { border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.res-bar { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: #0d1017;
  border-bottom: 1px solid var(--line-soft); font-size: .76rem; color: var(--ink-3); }
.res-scroll { overflow: auto; max-height: 42vh; }
table.data { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12.2px; }
table.data th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 7px 12px; white-space: nowrap;
  background: #12151f; color: var(--ink-2); font-weight: 620; border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
}
table.data td { padding: 5px 12px; border-bottom: 1px solid #12151d; white-space: nowrap; color: var(--ink); }
table.data tr:hover td { background: rgb(255 255 255 / .022); }
table.data td.null { color: var(--ink-4); font-style: italic; }
table.data td.num { text-align: right; }

pre.plain, pre.plan {
  margin: 0; padding: 14px 16px; background: #0a0c12; border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: auto; max-height: 50vh; color: var(--ink-2);
  font-family: var(--mono); font-size: 12.2px; line-height: 1.6; white-space: pre;
}

/* ============================ steps ============================ */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
  border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--panel);
  overflow: hidden; transition: border-color 180ms;
}
.step.open { border-color: hsl(var(--hue) 45% 50% / .4); background: var(--panel-2); }
.step.passed { border-color: hsl(157 40% 38% / .35); }
.step.locked { opacity: .5; }
.step-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; user-select: none; }
.step-num {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-size: .74rem; font-weight: 700;
  background: #171c29; color: var(--ink-3); border: 1px solid var(--line);
}
.step.passed .step-num { background: hsl(157 50% 26%); color: var(--ok); border-color: hsl(157 45% 40% / .5); }
.step.open .step-num { background: var(--accent-dim); color: #06080d; border-color: transparent; }
.step-title { font-weight: 600; font-size: .95rem; flex: 1; min-width: 0; }
.step-kind { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-4); }
.step-body { padding: 0 16px 18px; border-top: 1px solid var(--line-soft); }
.step-body > *:first-child { margin-top: 16px; }

.prose { color: var(--ink); font-size: .93rem; }
.prose h1,.prose h2,.prose h3 { margin: 1.3em 0 .5em; }
.prose h1 { font-size: 1.24rem; } .prose h2 { font-size: 1.1rem; } .prose h3 { font-size: .99rem; }
.prose p { margin: 0 0 .8em; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.35em; }
.prose li { margin: .22em 0; }
.prose code { background: #161a26; padding: 1px 5px; border-radius: 5px; color: #b9e6ff; border: 1px solid #1f2434; }
.prose pre { background: #0a0c12; border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 12px 14px; overflow: auto; }
.prose pre code { background: none; border: 0; padding: 0; color: var(--ink-2); }
.prose blockquote {
  margin: .9em 0; padding: 10px 16px; border-left: 2px solid var(--accent);
  background: var(--accent-wash); border-radius: 0 10px 10px 0; color: var(--ink-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { border-collapse: collapse; margin: .8em 0; font-size: .88rem; width: 100%; }
.prose th, .prose td { border: 1px solid var(--line-soft); padding: 6px 10px; text-align: left; }
.prose th { background: #12151f; color: var(--ink-2); font-weight: 620; }
.prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.5em 0; }
.prose strong { color: #fff; font-weight: 650; }
.prose em { color: var(--ink); }

/* checks */
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px;
  background: #10131c; border: 1px solid var(--line-soft); font-size: .86rem; }
.check.pass { border-color: hsl(157 40% 35% / .35); }
.check.fail { border-color: hsl(354 50% 42% / .35); }
.check.info { opacity: .8; }
.check .ic { flex: none; width: 16px; text-align: center; font-weight: 700; }
.check.pass .ic { color: var(--ok); } .check.fail .ic { color: var(--bad); } .check.info .ic { color: var(--info); }
.check .detail { color: var(--ink-2); display: block; margin-top: 3px; font-size: .84rem; }

.hint {
  border-left: 2px solid var(--warn); background: hsl(35 60% 30% / .13); padding: 11px 15px;
  border-radius: 0 10px 10px 0; margin: 8px 0; font-size: .9rem; color: var(--ink);
}
.hint .lbl { font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--warn);
  font-weight: 700; display: block; margin-bottom: 3px; }

.mentor {
  border: 1px solid hsl(var(--hue) 45% 50% / .3); background:
    linear-gradient(160deg, hsl(var(--hue) 45% 30% / .16), transparent 70%);
  border-radius: var(--r); padding: 16px 18px; margin: 12px 0;
}
.mentor .who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

textarea.doc, input.txt, select.txt, textarea.txt {
  width: 100%; background: #0a0c12; color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; font-family: var(--sans); font-size: .93rem;
  line-height: 1.62; resize: vertical; outline: none;
}
textarea.doc { min-height: 340px; font-family: var(--mono); font-size: 12.8px; }
textarea.doc:focus, input.txt:focus, textarea.txt:focus, select.txt:focus {
  border-color: hsl(var(--hue) 55% 55% / .5); box-shadow: 0 0 0 3px var(--accent-glow);
}
label.fl { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin: 12px 0 5px; font-weight: 620; }

/* choice */
.opt {
  display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--line-soft); background: var(--panel); transition: border-color 150ms, background 150ms;
}
.opt:hover { border-color: var(--line); background: var(--panel-2); }
.opt.sel { border-color: var(--accent); background: var(--accent-wash); }
.opt .dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); flex: none; margin-top: 3px; }
.opt.sel .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.opt.revealed { cursor: default; }
.opt-why { margin-top: 8px; font-size: .87rem; color: var(--ink-2); border-top: 1px dashed var(--line);
  padding-top: 8px; }
.opt-score { font-family: var(--mono); font-size: .74rem; }

/* triage */
.triage-item { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--panel); }
.bucket-row { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.bucket {
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line); background: var(--raised);
  font-size: .76rem; cursor: pointer; color: var(--ink-2); user-select: none; transition: all 140ms;
}
.bucket:hover { border-color: #39415c; color: var(--ink); }
.bucket.sel { background: var(--accent); border-color: transparent; color: #06080d; font-weight: 660; }

/* ============================ environment ============================ */
.env-grid { display: grid; grid-template-columns: 288px minmax(0,1fr); gap: 18px; align-items: start; }
@media (max-width: 1180px) { .env-grid { grid-template-columns: 1fr; } }

.tree { font-size: .86rem; }
.tree-schema { margin-bottom: 10px; }
.tree-schema > .lbl { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 8px;
  cursor: pointer; color: var(--ink-2); font-family: var(--mono); font-size: .8rem; }
.tree-schema > .lbl:hover { background: rgb(255 255 255 / .04); }
.tree-tbl { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px 4px 24px; border-radius: 8px;
  cursor: pointer; color: var(--ink-2); }
.tree-tbl:hover { background: rgb(255 255 255 / .045); color: var(--ink); }
.tree-tbl.on { background: var(--accent-wash); color: var(--ink); }
.tree-tbl .n { margin-left: auto; font-family: var(--mono); font-size: .68rem; color: var(--ink-4); }
.tree-tbl .nm { font-family: var(--mono); font-size: .79rem; }
.col-row { display: flex; gap: 10px; padding: 4px 8px; border-radius: 7px; align-items: baseline; cursor: pointer; }
.col-row:hover { background: rgb(255 255 255 / .04); }
.col-row .ty { font-family: var(--mono); font-size: .68rem; color: var(--ink-4); margin-left: auto; }

.artifact-item {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--panel); cursor: pointer;
  transition: border-color 150ms, transform 150ms var(--ease);
}
.artifact-item:hover { border-color: var(--line); transform: translateX(2px); }
.artifact-item.locked { opacity: .42; cursor: not-allowed; }
.artifact-item.read { background: transparent; }
.a-ico { width: 26px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center;
  font-size: .78rem; background: #171c29; border: 1px solid var(--line); }
.a-name { font-weight: 570; font-size: .89rem; }
.a-meta { font-size: .73rem; color: var(--ink-4); font-family: var(--mono); }

.chat { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.msg { display: flex; gap: 11px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.av { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; font-family: var(--mono);
  background: linear-gradient(150deg, #232a3d, #151926); border: 1px solid var(--line); color: var(--ink-2); }
.msg.me .av { background: linear-gradient(150deg, var(--accent-dim), hsl(var(--hue) 50% 30%)); color: #06080d; }
.bub { max-width: 74ch; padding: 10px 14px; border-radius: 14px; background: var(--panel-2);
  border: 1px solid var(--line-soft); font-size: .9rem; }
.msg.me .bub { background: var(--accent-wash); border-color: hsl(var(--hue) 50% 50% / .3); }
.bub .meta { font-size: .68rem; color: var(--ink-4); margin-bottom: 4px;
  display: flex; gap: 8px; align-items: center; }
.coach { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .82rem; color: var(--warn); }

.person-tab {
  display: flex; gap: 9px; align-items: center; padding: 8px 12px; border-radius: 11px;
  border: 1px solid var(--line-soft); background: var(--panel); cursor: pointer; transition: all 150ms;
}
.person-tab:hover { border-color: var(--line); }
.person-tab.on { border-color: hsl(var(--hue) 50% 50% / .5); background: var(--accent-wash); }
.person-tab .nm { font-size: .85rem; font-weight: 580; }
.person-tab .rl { font-size: .7rem; color: var(--ink-4); }

.finding {
  padding: 12px 15px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--panel);
  border-left-width: 3px;
}
.finding.confirmed { border-left-color: var(--ok); }
.finding.unproven { border-left-color: var(--ink-4); }
.finding.red_herring { border-left-color: var(--warn); }
.finding.duplicate, .finding.premature { border-left-color: var(--info); }

/* ============================ misc ============================ */
.ach {
  display: flex; gap: 11px; align-items: center; padding: 11px 13px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--panel);
}
.ach.locked { opacity: .4; }
.ach-ico { width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 1rem; background: #161b28; border: 1px solid var(--line); }
.ach.t-gold .ach-ico { background: hsl(44 60% 26%); border-color: hsl(44 70% 50% / .5); color: var(--gold); }
.ach.t-silver .ach-ico { background: #21262f; border-color: #4a5468; color: #cdd6e8; }
.ach.t-black .ach-ico { background: linear-gradient(150deg, #2b1d3f, #0d0a14); border-color: #6b4fa0; color: #d6bcff; }

.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex;
  flex-direction: column; gap: 9px; align-items: flex-end; }
.toast {
  padding: 11px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); font-size: .88rem; max-width: 380px;
  animation: toastin 320ms var(--ease) both;
}
.toast.ok { border-color: hsl(157 45% 42% / .5); }
.toast.bad { border-color: hsl(354 55% 45% / .5); }
.toast.xp { border-color: hsl(var(--hue) 55% 55% / .5); }
.toast b { color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateX(18px) scale(.97); } to { opacity: 1; transform: none; } }

.modal-host { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: rgb(3 4 7 / .7); backdrop-filter: blur(6px); animation: fade 200ms var(--ease) both; padding: 24px; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(920px, 100%); max-height: 88vh; overflow: auto; border-radius: var(--r-lg);
  background: linear-gradient(170deg, #151925, #0d1017 70%); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); padding: 26px 30px; animation: rise 280ms var(--ease) both;
}
.modal-x { position: sticky; top: 0; float: right; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-4); }
.empty .big { font-size: 1.9rem; margin-bottom: 8px; opacity: .55; }

.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 10px 10px 0 0; cursor: pointer; color: var(--ink-3);
  font-size: .88rem; border: 1px solid transparent; border-bottom: none; user-select: none; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); background: var(--panel-2); border-color: var(--line-soft);
  box-shadow: inset 0 2px 0 var(--accent); }

.jentry { padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--panel); }
.jentry.pinned { border-color: hsl(44 60% 45% / .35); }
.jkind { font-size: .62rem; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

.flash { animation: flash 900ms var(--ease); }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  35% { box-shadow: 0 0 0 8px var(--accent-glow); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ==========================================================================
   Accounts — sign-in screen, account chip, roster
   The sign-in screen is the first thing anyone sees on a hosted install, so it
   gets the same instrument-panel treatment as the app rather than a bare form.
   ========================================================================== */
body.auth-mode .rail { display: none; }
body.auth-mode #app { grid-template-columns: 1fr; }

.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px; padding: 40px 20px;
  background:
    radial-gradient(900px 520px at 50% -10%, var(--accent-wash), transparent 70%),
    var(--bg);
}
.auth-card {
  width: min(430px, 100%); padding: 30px 30px 26px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-title { font-family: var(--display); font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
.auth-sub { color: var(--ink-2); font-size: .92rem; margin: 6px 0 18px; line-height: 1.5; }
.auth-err {
  margin-top: 12px; padding: 9px 12px; border-radius: var(--r-sm); font-size: .87rem;
  background: hsl(354 65% 34% / .22); border: 1px solid hsl(354 65% 50% / .4); color: #ffb3b9;
}
.auth-alt { margin-top: 18px; text-align: center; font-size: .87rem; color: var(--ink-3); }
.auth-alt a { color: var(--accent); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-quote { color: var(--ink-4); font-size: .82rem; font-style: italic; letter-spacing: .02em; }

.acct-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; margin-bottom: 8px;
  border-radius: 11px; border: 1px solid transparent; cursor: pointer;
  transition: border-color 140ms var(--ease), background 140ms var(--ease);
}
.acct-chip:hover { border-color: var(--line); background: var(--panel-2); }
.acct-dot {
  width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-wash); border: 1px solid hsl(var(--hue) 60% 55% / .35);
  color: var(--accent); font-size: .78rem; font-weight: 700;
}
.acct-who {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .86rem; color: var(--ink-2);
}
.acct-out { margin-left: auto; color: var(--ink-4); font-size: .95rem; }
.acct-out:hover { color: var(--bad); }
.acct-box { padding: 13px 15px; border-radius: var(--r); background: var(--panel-2);
  border: 1px solid var(--line-soft); }
.acct-name { font-family: var(--display); font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.pill.quiet { background: var(--raised); border-color: var(--line); color: var(--ink-3); }
