/* ==========================================================================
   Assay app: shell and components.
   Tokens and shared primitives come from ../assets/tokens.css.
   Colours ONLY through tokens.css variables (tints via color-mix), so a
   palette swap needs no edits here.
   ========================================================================== */

:root {
  --side-w: 248px;
  --top-h: 64px;
  --pad: clamp(16px, 3vw, 40px);
  --lrow-h: 40px;
  --margin-w: 236px;
  --gold-line: color-mix(in srgb, var(--gold) 45%, transparent);
  --red-line: color-mix(in srgb, var(--redline) 45%, transparent);
  --red-margin: color-mix(in srgb, var(--redline) 38%, transparent);
}

body { min-height: 100vh; }
body.has-drawer { overflow: hidden; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}
.frame { display: flex; flex-direction: column; min-width: 0; }
.main {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  padding: 32px var(--pad) 80px;
}
.main:focus { outline: none; }

/* ---------- sidebar ---------- */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 16px 14px;
  background: var(--ledger);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}
.side__head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 6px; }
.side__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border-radius: var(--r-ctl);
  color: var(--ink);
  text-decoration: none;
}
.side__logo img { width: 28px; height: 28px; }
.side__word { font: 700 23px/1 var(--font-display); letter-spacing: -0.03em; }
.side__close { display: none; }
.side__label { margin: 22px 0 6px; padding: 0 10px; }
.nav { display: grid; gap: 2px; }
.nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font: 500 15px/1.2 var(--font-body);
  text-decoration: none;
  transition: background-color var(--t-ui) var(--ease), color var(--t-ui) var(--ease);
}
.nav__link svg { width: 18px; height: 18px; flex: none; }
.nav__link:hover { background: var(--ledger-2); color: var(--ink); }
.nav__link[aria-current="page"] {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav__link[aria-current="page"] svg { color: var(--gold); }
.nav__count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-chip);
  border: 1px solid var(--red-line);
  background: var(--redline-wash);
  color: var(--redline-text);
  font: 500 12px/1 var(--font-mono);
  font-stretch: 87.5%;
}
.nav__count:empty { display: none; }

.desk {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--t-ui) var(--ease);
}
.desk:hover { border-color: var(--field-edge); }
.desk__name { font: 500 15px/1.3 var(--font-body); }
.desk__bar { height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.desk__bar > span { display: block; height: 100%; background: var(--gold); }
.desk__meta { font: 400 12px/1.4 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top-h);
  padding: 0 var(--pad);
  background: var(--ledger);
  border-bottom: 1px solid var(--rule);
}
.top__menu { display: none; }
.top__user { margin-left: auto; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  transition: background-color var(--t-ui) var(--ease);
}
.iconbtn:hover { background: var(--row-hover); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn--sm { width: 32px; height: 32px; }
.iconbtn--sm svg { width: 16px; height: 16px; }
.iconbtn[disabled] { opacity: 0.4; cursor: not-allowed; }
.iconbtn[disabled]:hover { background: transparent; }

.ws {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  max-width: 260px;
  padding: 0 10px 0 6px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: transparent;
  font: 500 15px/1 var(--font-body);
  color: var(--ink);
}
.ws:hover { background: var(--row-hover); }
.ws > svg { width: 14px; height: 14px; flex: none; color: var(--ink-2); }
.ws__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws__badge {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  color: var(--gold);
  font: 700 13px/1 var(--font-display);
}
.ws__badge--sm { width: 22px; height: 22px; font-size: 12px; }

.search { position: relative; flex: 1; max-width: 520px; min-width: 0; margin-left: 4px; }
.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}
.search__input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--sheet);
  color: var(--ink);
  font: 400 15px/1 var(--font-body);
  transition: border-color var(--t-ui) var(--ease);
}
.search__input::placeholder { color: var(--placeholder); opacity: 1; }
.search__input:hover { border-color: var(--field-edge); }
.search__input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.search__kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--ledger);
  color: var(--ink-2);
  font: 500 12px/1 var(--font-mono);
  pointer-events: none;
}
.search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  background: var(--sheet);
  border: 1px solid var(--field-edge);
  border-radius: var(--r-card);
}
.search__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-ctl);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
.search__item:hover, .search__item:focus-visible { background: var(--row-hover); }
.search__item .label { margin-left: auto; flex: none; }
.search__empty { padding: 10px; font-size: 14px; color: var(--ink-2); }

.user {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--sheet);
  color: var(--ink);
  font: 600 13px/1 var(--font-body);
  letter-spacing: 0.02em;
}
.user:hover { border-color: var(--field-edge); }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  min-width: 240px;
  padding: 6px;
  background: var(--sheet);
  border: 1px solid var(--field-edge);
  border-radius: var(--r-card);
}
.menu--right { left: auto; right: 0; }
.menu__head { padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--rule); }
.menu__name { font: 500 15px/1.3 var(--font-body); }
.menu__sub { font-size: 13px; color: var(--ink-2); }
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  font: 400 14px/1.2 var(--font-body);
  text-align: left;
  text-decoration: none;
}
.menu__item:hover { background: var(--row-hover); }
.menu__item > svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.menu__item .menu__check { margin-left: auto; color: var(--gold); }

/* ---------- page header ---------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
}
.page-head__text { display: grid; gap: 8px; min-width: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs__sep { color: var(--rule); }
.h1 { font: 700 clamp(28px, 2.6vw, 38px)/1.06 var(--font-display); letter-spacing: -0.02em; }
.h1:focus { outline: none; }
.h2 { font: 700 21px/1.15 var(--font-display); letter-spacing: -0.012em; }
.h2__n { margin-left: 6px; font: 500 14px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); letter-spacing: 0; }
.h3 { font: 600 15px/1.3 var(--font-body); }
.lede { max-width: 64ch; color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.meta { font: 400 13px/1.5 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.cut-t { color: var(--redline-text); }
.keep-t { color: var(--gold); }

.section { margin-top: 40px; }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 14px;
}
.section__head > div { display: grid; gap: 4px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 14px;
}
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- panels ---------- */
.panel {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
}
.panel__body { padding: 20px; }
.panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--rule);
}
.step-n { font: 500 12px/1 var(--font-mono); font-stretch: 87.5%; letter-spacing: 0.08em; color: var(--gold); }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--ledger);
}
.seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font: 500 14px/1 var(--font-body);
  transition: background-color var(--t-ui) var(--ease), color var(--t-ui) var(--ease);
}
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.seg__n { font: 500 12px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }

/* ---------- grid tables (role=table) ---------- */
.tbl {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
}
.tbl__scroll { overflow-x: auto; }
.tbl__scroll:focus-visible { outline-offset: -2px; }
.tbl__inner { min-width: var(--tbl-min, 0px); }
.tr {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  column-gap: 16px;
  min-height: 52px;
  padding: 8px 18px;
  border-top: 1px solid var(--rule);
}
.tr--head { min-height: 40px; padding-top: 0; padding-bottom: 0; border-top: 0; }
.tr--head .td { font: 500 12px/1.3 var(--font-mono); font-stretch: 87.5%; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.tr--link { transition: background-color var(--t-ui) var(--ease); }
.tr--link:hover { background: var(--row-hover); }
.td { min-width: 0; font-size: 14px; line-height: 1.35; }
.td--num { text-align: right; font-family: var(--font-mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; font-size: 13px; }
.td--mono { font-family: var(--font-mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; font-size: 13px; }
.td--end { display: flex; justify-content: flex-end; gap: 6px; }
.td__sub { display: block; margin-top: 3px; font: 400 12px/1.3 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowlink { color: var(--ink); font-weight: 500; text-decoration: none; }
.rowlink::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.rowlink:focus-visible { outline: none; }
.rowlink:focus-visible::after { outline: 2px solid var(--ink); outline-offset: -3px; border-radius: 4px; }
.tr .on-top { position: relative; z-index: 2; }
.tbl__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--rule);
}
.tbl__empty { padding: 36px 20px; text-align: center; border-top: 1px solid var(--rule); }
.tbl__empty p + p { margin-top: 4px; }

/* ---------- chips, meters, glyphs ---------- */
.chip--gold { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.chip--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: live 1.4s var(--ease) infinite;
}
@keyframes live { 50% { opacity: 0.25; } }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-chip);
  background: var(--ledger);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font: 500 12px/1 var(--font-mono);
  font-stretch: 87.5%;
}
.nugget { display: inline-block; width: 11px; height: 11px; flex: none; fill: var(--gold); vertical-align: -1px; }
.conf { display: flex; align-items: center; justify-content: flex-end; gap: 10px; font: 500 13px/1 var(--font-mono); font-stretch: 87.5%; }
.conf__bar { width: 56px; height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.conf__bar > span { display: block; height: 100%; background: var(--ink); }
.conf--low .conf__bar > span { background: var(--ink-2); }
.meter { height: 6px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--gold); transform-origin: left; transition: transform 600ms var(--ease); }
.meter--red > span { background: var(--redline); }
.cutpct { display: grid; grid-template-columns: 52px minmax(0, 72px); align-items: center; gap: 10px; font: 500 13px/1 var(--font-mono); font-stretch: 87.5%; color: var(--redline-text); }
.cutpct__bar { height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.cutpct__bar > span { display: block; height: 100%; background: var(--redline); }

/* ---------- states ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--field-edge);
  border-radius: var(--r-card);
  background: var(--ledger);
}
.empty__icon { width: 36px; height: 36px; color: var(--ink-2); }
.empty__title { font: 600 16px/1.3 var(--font-body); }
.empty__text { max-width: 46ch; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.empty .btn { margin-top: 6px; }
.state {
  display: grid;
  gap: 14px;
  justify-items: start;
  max-width: 720px;
  padding: 28px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.state--error { border-color: var(--red-line); }
.state__icon { width: 28px; height: 28px; color: var(--redline); }
.state__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--red-line);
  background: var(--redline-wash);
  border-radius: var(--r-card);
  font-size: 14px;
  line-height: 1.5;
}
.alert > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--redline-text); }
.alert strong { display: block; font-weight: 600; }
.codeline {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--ledger);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  font: 400 13px/1.5 var(--font-mono);
  font-stretch: 87.5%;
  white-space: pre;
}
.toast button.toast__link { padding: 0; border: 0; background: none; text-decoration: underline; cursor: pointer; font: inherit; font-weight: 500; }
.toast__mark { color: var(--sheet); }

/* ---------- summary strip ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.stat { display: grid; gap: 8px; align-content: start; min-width: 0; padding: 18px 20px 16px; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; }
.stat__value {
  font: 500 30px/1 var(--font-mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.stat__value--cut { color: var(--redline); }
.stat__value--gold { color: var(--gold-bright); }
.stat__sub { font: 400 13px/1.35 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the assay sheet (signature) ----------
   Dark ledger of wallet rows. Farm rows: pyrite text + redline strike.
   Kept rows: gold accent + nugget glyph. Margin: brace + red mono note. */
.ledger {
  --cols: 52px minmax(0, 1fr) 118px 112px 64px 84px;
  --strike-r: 104px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
}
.ledger__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
}
.ledger__file { display: flex; align-items: center; gap: 10px; min-width: 0; font: 500 13px/1.3 var(--font-mono); font-stretch: 87.5%; }
.ledger__file svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.ledger__file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger__dim { color: var(--ink-2); }
.ledger__head, .lrun { display: grid; grid-template-columns: minmax(0, 1fr) var(--margin-w); }
.ledger__mhead { display: flex; align-items: center; padding: 0 14px; border-left: 3px double var(--red-margin); }
.ledger__body { position: relative; }
.lrun__rows { min-width: 0; }
.lrow {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  column-gap: 14px;
  height: var(--lrow-h);
  padding: 0 16px;
  border-top: 1px solid var(--rule);
  font: 400 13px/1 var(--font-mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
  transition: color 300ms var(--ease) var(--draw-delay, 0ms), background-color 300ms var(--ease) var(--draw-delay, 0ms);
}
.lrow > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow--head { border-top: 0; font: 500 12px/1.3 var(--font-mono); font-stretch: 87.5%; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.lrow__idx { color: var(--ink-2); }
.lrow__amt { text-align: right; }
.lrow__st { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.lrow__seen { color: var(--ink-2); }
.ta-r { text-align: right; }

/* states are applied when the scan line passes (.is-drawn on the body) */
.lrow.is-cut .lrow__st { color: var(--redline-text); }
.lrow.is-kept .lrow__st { color: var(--gold); }
.lrow.is-review .lrow__st { color: var(--ink-2); }
.is-drawn .lrow.is-cut { color: var(--pyrite); background: color-mix(in srgb, var(--pyrite) 9%, transparent); }
.is-drawn .lrow.is-cut .lrow__idx, .is-drawn .lrow.is-cut .lrow__seen { color: var(--pyrite); }
.is-drawn .lrow.is-kept .lrow__addr { color: var(--ink); }
.is-drawn .lrow.is-kept .lrow__amt { color: var(--gold-bright); }
.lrow .nugget { opacity: 0; transform: scale(0.4); transition: opacity 240ms var(--ease) var(--draw-delay, 0ms), transform 240ms var(--ease) var(--draw-delay, 0ms); }
.is-drawn .lrow .nugget { opacity: 1; transform: none; }

.strike {
  position: absolute;
  left: 10px;
  top: 0;
  width: calc(100% - var(--strike-r));
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.lrun__margin {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 12px 6px 30px;
  border-left: 3px double var(--red-margin);
  background-image: repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px var(--lrow-h));
}
.brace { position: absolute; left: 6px; top: 0; overflow: visible; }
.brace--keep .redline-path { stroke: var(--gold); }
.brace--review .redline-path { stroke: var(--ink-2); }
.lnote {
  font: 500 12px/1.45 var(--font-mono);
  font-stretch: 87.5%;
  color: var(--redline-text);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 260ms var(--ease) var(--note-delay, 0ms), transform 260ms var(--ease) var(--note-delay, 0ms);
}
.lnote strong { font-weight: 600; }
.is-drawn .lnote { opacity: 1; transform: none; }
.lnote--keep { color: var(--gold); }
.lnote--review { color: var(--ink-2); }
.lnote--single { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnote--single::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 2px;
  margin-right: 8px;
  border-radius: 2px;
  background: currentColor;
  vertical-align: middle;
}
.lrun__sm { display: none; }
.ledger__scan {
  position: absolute;
  left: 0;
  right: var(--margin-w);
  top: 0;
  height: 1px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}
.ledger__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 10px 16px;
  border-top: 3px double var(--ink-2);
}
.pager { display: flex; align-items: center; gap: 6px; }
.pager__text { min-width: 15ch; text-align: center; font: 400 13px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.tally { font: 500 13px/1.4 var(--font-mono); font-stretch: 87.5%; }
.tally__keep { color: var(--gold); }
.tally__cut { color: var(--redline-text); }
.ledger__empty { padding: 36px 16px; text-align: center; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--rule); }

/* ---------- clusters table ---------- */
.tbl--clusters { --cols: 84px 80px 116px 76px 124px minmax(200px, 1fr) 96px; --tbl-min: 900px; }
.tbl--clusters .strike { width: 420px; }
.tr.is-cut .td--fade { color: var(--pyrite); }
.tr.is-kept .rowlink { color: var(--gold); }
.decision { display: inline-flex; align-items: center; gap: 6px; }
.tbl--scans { --cols: minmax(220px, 2.2fr) 104px 84px 150px 150px 112px; }
.tbl--lookups { --cols: minmax(150px, 1.4fr) 130px 110px 80px 100px 110px; --tbl-min: 720px; }
.tbl--keys { --cols: minmax(160px, 1.3fr) 170px minmax(140px, 1fr) 110px 110px 120px; --tbl-min: 860px; }
.tbl--invoices { --cols: 140px minmax(200px, 1fr) 110px 100px 110px 120px; --tbl-min: 820px; }
.tbl--traction { --cols: minmax(180px, 1.4fr) 150px 100px 110px 120px 110px; --tbl-min: 820px; }

/* ---------- drawer ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.scrim.is-open { opacity: 1; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  background: var(--sheet);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  transition: transform 240ms var(--ease);
}
.drawer.is-open { transform: none; }
.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--rule);
}
.drawer__titles { display: grid; gap: 6px; min-width: 0; }
.drawer__title { font: 700 26px/1.1 var(--font-display); letter-spacing: -0.015em; }
.drawer__title:focus { outline: none; }
.drawer__note { font: 500 13px/1.4 var(--font-mono); font-stretch: 87.5%; color: var(--redline-text); }
.drawer__body { flex: 1; overflow-y: auto; padding: 4px 24px 24px; overscroll-behavior: contain; }
.drawer__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 3px double var(--ink-2);
  background: var(--sheet);
}
.drawer__foot .btn--quiet { margin-left: auto; }
.ev { padding: 20px 0; border-top: 1px solid var(--rule); }
.ev:first-child { border-top: 0; }
.ev__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.ev__caption { margin-top: 10px; font: 400 12.5px/1.55 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.ev__none { padding: 14px 16px; border: 1px dashed var(--rule); border-radius: var(--r-ctl); font-size: 14px; color: var(--ink-2); }
.verdict {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--red-line);
  background: var(--redline-wash);
  border-radius: var(--r-card);
}
.verdict--keep { border-color: var(--gold-line); background: var(--moss-wash); }
.verdict--review { border-color: var(--rule); background: var(--ledger); }
.verdict__line { display: flex; align-items: center; gap: 8px; font: 600 16px/1.2 var(--font-mono); font-stretch: 87.5%; color: var(--redline-text); }
.verdict--keep .verdict__line { color: var(--gold-bright); }
.verdict--review .verdict__line { color: var(--ink); }
.verdict__text { font-size: 15px; line-height: 1.5; }
.dep { display: grid; grid-template-columns: minmax(0, 1fr) 96px 110px; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--rule); font: 400 13px/1.3 var(--font-mono); font-stretch: 87.5%; }
.dep:first-child { border-top: 0; }
.dep__n { text-align: right; }
.sig { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-top: 1px dashed var(--rule); font-size: 14px; line-height: 1.45; }
.sig:first-child { border-top: 0; }
.sig__name { font-weight: 500; }
.sig__none { color: var(--ink-2); }
.minirows { border: 1px solid var(--rule); border-radius: var(--r-ctl); overflow: hidden; }
.minirows .lrow { --cols: minmax(0, 1fr) 110px 70px; --strike-r: 86px; }
.minirows .lrow:first-child { border-top: 0; }

/* diagram motion: lines draw, dots pop, bars grow (final state under reduced motion) */
.dg-draw { stroke-dasharray: 1 2; stroke-dashoffset: 1; transition: stroke-dashoffset 420ms var(--ease) var(--d, 0ms); }
.is-drawn .dg-draw { stroke-dashoffset: 0; }
.dg-pop { opacity: 0; transition: opacity 260ms var(--ease) var(--d, 0ms); }
.is-drawn .dg-pop { opacity: 1; }
.dg-grow { transform: scaleY(0); transform-box: fill-box; transform-origin: 50% 100%; transition: transform 420ms var(--ease) var(--d, 0ms); }
.is-drawn .dg-grow { transform: none; }
.dg-gold { fill: var(--gold); }
.dg-box--red { stroke: var(--redline); }

/* ---------- new assay ---------- */
.newscan { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.newscan__main { display: grid; gap: 20px; min-width: 0; }
.newscan__aside { position: sticky; top: calc(var(--top-h) + 20px); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); }
.tab {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-2);
  font: 500 14px/1 var(--font-body);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.drop {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 250px;
  padding: 28px;
  text-align: center;
  border: 1.5px dashed var(--field-edge);
  border-radius: var(--r-card);
  background-color: var(--ledger);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, color-mix(in srgb, var(--rule) 70%, transparent) 27px 28px);
  transition: border-color var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease);
}
.drop.is-over { border-style: solid; border-color: var(--gold); background-color: var(--ledger-2); }
.drop__inner { display: grid; justify-items: center; gap: 8px; }
.drop__icon { width: 40px; height: 40px; color: var(--gold); }
.drop__title { font: 600 17px/1.3 var(--font-body); }
.drop__hint { max-width: 44ch; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.drop .btn { margin-top: 6px; }
.file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--gold-line);
  border-radius: var(--r-card);
  background: var(--ledger);
}
.file__icon { width: 28px; height: 28px; color: var(--gold); }
.file__name { font: 500 14px/1.3 var(--font-mono); font-stretch: 87.5%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__meta { font: 400 12.5px/1.5 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.file__count { font: 500 24px/1 var(--font-mono); font-stretch: 87.5%; color: var(--gold-bright); text-align: right; }
.file__count small { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.file__actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.recent { margin-top: 18px; }
.recent__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--rule); font: 400 13px/1.3 var(--font-mono); font-stretch: 87.5%; }
.recent__row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.opts { display: grid; gap: 8px; }
.opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  cursor: pointer;
  transition: border-color var(--t-ui) var(--ease);
}
.opt:hover { border-color: var(--field-edge); }
.opt:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.opt input { grid-row: span 2; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--gold); }
.opt__title { font: 500 15px/1.3 var(--font-body); }
.opt__title .mono { color: var(--ink-2); font-size: 13px; }
.opt__text { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font: 500 14px/1.3 var(--font-body); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.kv:first-child { border-top: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { font: 500 13px/1.4 var(--font-mono); font-stretch: 87.5%; text-align: right; overflow-wrap: anywhere; }
.aside-note { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.newscan__aside .btn--primary { width: 100%; margin-top: 16px; }

/* progress */
.progress { display: grid; gap: 16px; }
.progress__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.progress__pct { font: 500 28px/1 var(--font-mono); font-stretch: 87.5%; color: var(--gold-bright); }
.pline { position: relative; height: 3px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.pline__fill { position: absolute; inset: 0 auto 0 0; background: var(--gold); transition: width 420ms linear; }
.progress__step { font: 500 13px/1.4 var(--font-mono); font-stretch: 87.5%; color: var(--ink); }
.steps { display: grid; }
.steps__item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
.steps__mark { width: 14px; height: 14px; border: 1.5px solid var(--field-edge); border-radius: 3px; display: grid; place-items: center; }
.steps__mark svg { width: 12px; height: 12px; }
.steps__item.is-active { color: var(--ink); }
.steps__item.is-active .steps__mark { border-color: var(--gold); background: var(--moss-wash); }
.steps__item.is-done { color: var(--ink); }
.steps__item.is-done .steps__mark { border-color: var(--gold); background: var(--gold); color: var(--on-gold); }
.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.counter { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-ctl); background: var(--ledger); }
.counter__v { font: 500 22px/1 var(--font-mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; }

/* ---------- launch risk ---------- */
.lookup { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 20px; }
.lookup .field { flex: 1 1 360px; min-width: 0; }
.lookup .btn { margin-top: 26px; }
.riskwrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.riskwrap.has-json { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.riskcard__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px; border-bottom: 1px solid var(--rule); }
.riskcard__head > div { display: grid; gap: 6px; min-width: 0; }
.riskcard__sym { margin-left: 6px; font: 500 14px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.riskcard__mint { overflow-wrap: anywhere; }
.verdict-xl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border-radius: var(--r-chip);
  border: 1px solid var(--rule);
  font: 600 14px/1 var(--font-mono);
  font-stretch: 87.5%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.verdict-xl--high { color: var(--redline-text); background: var(--redline-wash); border-color: var(--red-line); }
.verdict-xl--medium { color: var(--ink); border-color: var(--ink-2); }
.verdict-xl--low { color: var(--gold-bright); background: var(--moss-wash); border-color: var(--gold-line); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { display: grid; gap: 8px; align-content: start; padding: 18px 20px; border-left: 1px solid var(--rule); min-width: 0; }
.metric:first-child { border-left: 0; }
.metric__v { font: 500 36px/1 var(--font-mono); font-stretch: 87.5%; letter-spacing: -0.02em; }
.metric__v--high { color: var(--redline); }
.metric__v--low { color: var(--gold-bright); }
.metric__sub { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.supply { display: grid; gap: 10px; padding: 18px 20px; border-top: 1px solid var(--rule); }
.stack { display: flex; gap: 2px; height: 12px; border-radius: 3px; overflow: hidden; }
.stack > span { display: block; height: 100%; }
.stack__team { background: var(--redline); }
.stack__early { background: var(--pyrite); }
.stack__rest { background: var(--gold); opacity: 0.75; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font: 400 12.5px/1.3 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.groups { padding: 6px 20px 14px; border-top: 1px solid var(--rule); }
.group { display: grid; grid-template-columns: 34px 90px 70px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--rule); font-size: 14px; }
.group:first-of-type { border-top: 0; }
.group__id { font: 600 13px/1 var(--font-mono); color: var(--redline-text); }
.riskcard__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px; border-top: 3px double var(--ink-2); }
.riskcard__foot .meta { margin-left: auto; }
.json { display: flex; flex-direction: column; min-width: 0; }
.json__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule); font: 500 13px/1 var(--font-mono); font-stretch: 87.5%; }
.json pre {
  flex: 1;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  background: var(--ledger);
  border-radius: 0 0 var(--r-card) var(--r-card);
  font: 400 13px/1.7 var(--font-mono);
  font-stretch: 87.5%;
  color: var(--ink);
}
.j-k { color: var(--ink-2); }
.j-s { color: var(--gold-bright); }
.j-n { color: var(--ink); font-weight: 600; }
.j-r { color: var(--redline-text); font-weight: 600; }

/* ---------- appeals ---------- */
.appeals { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.queue__head { display: grid; gap: 12px; padding: 16px; border-bottom: 1px solid var(--rule); }
.qitem {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--t-ui) var(--ease);
}
.qitem:first-child { border-top: 0; }
.qitem:hover { background: var(--row-hover); }
.qitem[aria-current="true"] { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--gold); }
.qitem:focus-visible { outline-offset: -3px; }
.qitem__wallet { font: 500 14px/1.3 var(--font-mono); font-stretch: 87.5%; }
.qitem__reason { grid-column: 1 / -1; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem__meta { grid-column: 1 / -1; font: 400 12px/1.3 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.adetail { min-width: 0; }
.adetail__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--rule); }
.adetail__head > div { display: grid; gap: 6px; min-width: 0; }
.adetail__addr { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); }
.facts > div { display: grid; gap: 6px; padding: 14px 20px; border-left: 1px solid var(--rule); min-width: 0; }
.facts > div:first-child { border-left: 0; }
.facts dd { font: 500 13px/1.3 var(--font-mono); font-stretch: 87.5%; }
.facts a { color: var(--ink); text-underline-offset: 3px; }
.adsec { display: grid; gap: 12px; padding: 18px 20px; border-top: 1px solid var(--rule); }
.adsec:first-of-type { border-top: 0; }
.quote { padding: 14px 16px; border-left: 3px solid var(--gold); background: var(--ledger); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; font-size: 16px; line-height: 1.55; }
.redact {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--sheet);
  border-radius: 4px;
  font: 500 12px/1.3 var(--font-mono);
  font-stretch: 87.5%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rc { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding: 10px 0; border-top: 1px dashed var(--rule); font-size: 14px; line-height: 1.45; }
.rc:first-child { border-top: 0; }
.rc__sig { font-weight: 500; }
.rc.is-pending { color: var(--ink-2); }
.decide { display: grid; gap: 12px; }
.decide__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.outcome { display: grid; gap: 10px; padding: 18px; border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--ledger); }
.outcome--restored { border-color: var(--gold-line); background: var(--moss-wash); }
.outcome__title { display: flex; align-items: center; gap: 10px; font: 600 18px/1.25 var(--font-body); }
.outcome__title svg { width: 20px; height: 20px; flex: none; }
.outcome--restored .outcome__title { color: var(--gold-bright); }
.logline { font: 400 12.5px/1.55 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.backlink { display: none; align-items: center; gap: 6px; margin: 14px 20px 0; color: var(--ink-2); font-size: 14px; text-decoration: none; }
.backlink svg { width: 16px; height: 16px; }
.backlink:hover { color: var(--ink); }

/* ---------- keys, usage, webhooks ---------- */
.keyval { display: inline-flex; align-items: center; gap: 4px; font: 400 13px/1 var(--font-mono); font-stretch: 87.5%; }
.usage { display: grid; gap: 16px; }
.usage__row { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 190px; align-items: center; gap: 16px; font-size: 14px; }
.usage__row .meta { text-align: right; }
.chart { display: grid; gap: 8px; margin-top: 22px; }
.chart__bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; border-bottom: 1px solid var(--ink-2); }
.chart__bar { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--pyrite); opacity: 0.8; transform-origin: bottom; transition: transform 500ms var(--ease) var(--d, 0ms); }
.chart__bar.is-today { background: var(--gold); opacity: 1; }
.chart__axis { display: flex; justify-content: space-between; font: 400 12px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ledger); border: 1px solid var(--gold-line); border-radius: var(--r-ctl); font: 400 13px/1.4 var(--font-mono); font-stretch: 87.5%; overflow-wrap: anywhere; }
.secret code { flex: 1 1 260px; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.hook { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; padding: 14px 18px; border-top: 1px solid var(--rule); }
.hook:first-child { border-top: 0; }
.hook__url { font: 500 13px/1.3 var(--font-mono); font-stretch: 87.5%; overflow-wrap: anywhere; }
.inline-form { display: grid; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.success { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--gold-line); background: var(--moss-wash); border-radius: var(--r-card); font-size: 14px; line-height: 1.5; }
.success > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--gold); }
.success strong { display: block; font-weight: 600; }

/* ---------- billing, traction ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan { display: grid; gap: 10px; align-content: start; padding: 20px; }
.plan__price { font: 500 22px/1.15 var(--font-mono); font-stretch: 87.5%; }
.plan__price small { font-size: 13px; color: var(--ink-2); font-weight: 400; }
.plan__text { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.plan__foot { display: grid; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 3px double var(--rule); font-size: 14px; }
.report { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; }
.report__main { display: grid; gap: 14px; padding: 20px; min-width: 0; }
.report__side { display: grid; gap: 12px; align-content: start; padding: 20px; border-left: 1px solid var(--rule); }
.report__verdict { font: 600 22px/1.2 var(--font-body); }
.findings { display: grid; gap: 8px; }
.findings li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; font-size: 15px; line-height: 1.5; }
.findings li::before { content: ""; width: 6px; height: 6px; margin-top: 9px; border-radius: 1px; background: var(--gold); }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  .ledger { --cols: 52px minmax(0, 1fr) 112px 64px 84px; --margin-w: 204px; }
  .ledger .hide-lg { display: none; }
  .newscan { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .newscan { grid-template-columns: 1fr; }
  .newscan__aside { position: static; }
  .riskwrap.has-json { grid-template-columns: 1fr; }
  .appeals { grid-template-columns: 1fr; }
  .appeals.has-detail .queue { display: none; }
  .appeals:not(.has-detail) .adetail { display: none; }
  .backlink { display: inline-flex; }
  .report { grid-template-columns: 1fr; }
  .report__side { border-left: 0; border-top: 1px solid var(--rule); }
  .plans { grid-template-columns: 1fr; }
  .tbl--scans { --cols: minmax(200px, 1fr) 96px 150px 140px; }
  .tbl--scans .hide-md { display: none; }
}
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 110;
    width: min(300px, 86vw);
    height: 100%;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 240ms var(--ease), visibility 0s linear 240ms;
  }
  .side.is-open { transform: none; visibility: visible; transition: transform 240ms var(--ease), visibility 0s; }
  .side__close { display: inline-grid; }
  .scrim--nav { z-index: 105; }
  .top__menu { display: inline-grid; margin-left: -8px; }
  .main { padding-top: 24px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-left: 0; border-top: 1px solid var(--rule); }
  .metric:first-child { border-top: 0; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div:nth-child(3) { border-left: 0; }
  .facts > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 759px) {
  .ledger { --cols: 44px minmax(0, 1fr) 92px 72px; --strike-r: 92px; }
  .ledger .hide-sm { display: none; }
  .ledger__head, .lrun { grid-template-columns: minmax(0, 1fr); }
  .ledger__mhead, .lrun__margin { display: none; }
  .ledger__scan { right: 0; }
  .lrun__sm { display: block; padding: 8px 16px; border-top: 1px solid var(--rule); background: var(--ledger); }
  .lrow { padding: 0 12px; column-gap: 10px; }
  .tbl--scans { --cols: minmax(0, 1fr) 84px 112px; }
  .tbl--scans .hide-sm { display: none; }
  .tr { padding-left: 14px; padding-right: 14px; column-gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr; }
  .usage__row { grid-template-columns: 1fr; gap: 8px; }
  .usage__row .meta { text-align: left; }
  .rc, .sig { grid-template-columns: 1fr; }
  .group { grid-template-columns: 30px 80px minmax(0, 1fr); }
  .group__why { grid-column: 2 / -1; }
  .dep { grid-template-columns: minmax(0, 1fr) 80px; }
  .dep .meter { display: none; }
  .drawer__head, .drawer__body, .drawer__foot { padding-left: 16px; padding-right: 16px; }
  .file { grid-template-columns: auto minmax(0, 1fr); }
  .file__count { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 599px) {
  .ws__name, .search__kbd { display: none; }
  .ws { padding-right: 6px; }
  .search__input { padding-right: 12px; }
  .h1 { font-size: 28px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 24px; }
  .page-head__actions { width: 100%; }
  .riskcard__foot .meta { margin-left: 0; width: 100%; }
  .lookup .btn { margin-top: 0; width: 100%; }
}

/* ---------- small additions referenced by app.js ---------- */
.select--sm { width: auto; min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.h2--mono { font-family: var(--font-mono); font-stretch: 87.5%; font-weight: 600; letter-spacing: 0; }
.h2--mono:focus { outline: none; }
.groups__h { padding: 12px 0 4px; }
.btn--danger { border-color: var(--red-line); color: var(--redline-text); background: var(--redline-wash); }
.btn--danger:hover { border-color: var(--redline); }
.key-panel { margin-bottom: 20px; }
.pay { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.tr[aria-current="true"] { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--gold); }
.alert .codeline { margin-top: 10px; }
.state__icon--muted { color: var(--ink-2); }
.file__text { min-width: 0; }
.inline-form + .panel { margin-top: 16px; }
.riskwrap > .empty, .riskwrap > .state { max-width: none; }
@media (max-width: 759px) {
  .tbl--scans .cutpct { grid-template-columns: 1fr; }
  .tbl--scans .cutpct__bar { display: none; }
  .ledger__foot { flex-direction: column; align-items: flex-start; }
}

/* ---------- fixes: mobile-only shell buttons, strike stops before status ---------- */
.iconbtn.side__close, .iconbtn.top__menu { display: none; }
@media (max-width: 899px) { .iconbtn.side__close, .iconbtn.top__menu { display: inline-grid; } }
.ledger { --strike-r: 118px; }
.minirows .lrow { --strike-r: 100px; }
@media (max-width: 1279px) { .ledger { --strike-r: 118px; } }
@media (max-width: 759px) { .ledger { --strike-r: 100px; } }

/* ==========================================================================
   Self-serve: Sign in with Solana, wallet in the top bar, costs before
   paid actions, billing (USDC balance, free tier, ledger, keys), top-up.
   ========================================================================== */

/* ---------- top bar: balance, top up, account ---------- */
.top__wallet { flex: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.bal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--t-ui) var(--ease);
}
.bal:hover { border-color: var(--field-edge); }
.bal__v { font: 500 14px/1 var(--font-mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; color: var(--gold-bright); }
.bal__u { font: 500 12px/1 var(--font-mono); font-stretch: 87.5%; letter-spacing: 0.04em; color: var(--ink-2); }
.btn.top__topup { min-height: 40px; }
.acct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px 0 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--sheet);
  color: var(--ink);
  font: 500 13px/1 var(--font-mono);
  font-stretch: 87.5%;
  white-space: nowrap;
  transition: border-color var(--t-ui) var(--ease);
}
.acct:hover { border-color: var(--field-edge); }
.acct__chev { width: 14px; height: 14px; flex: none; color: var(--ink-2); }
.menu__addr { font: 500 14px/1.3 var(--font-mono); font-stretch: 87.5%; }

/* wallet marks: generic pictograms on a touchstone tile */
.wmark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--ledger);
  color: var(--ink);
}
.wmark svg { width: 20px; height: 20px; }
.wmark--sm { width: 26px; height: 26px; border-radius: 6px; }
.wmark--sm svg { width: 16px; height: 16px; }

/* busy buttons: a wallet prompt is open */
.spin {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { opacity: 1; cursor: progress; }

/* ---------- #/signin: the gate (no shell) ---------- */
body.is-gate .side,
body.is-gate .top,
body.is-gate .scrim--nav { display: none; }
body.is-gate .app { grid-template-columns: minmax(0, 1fr); }
body.is-gate .main { max-width: none; padding: 0; }
.gate { display: flex; flex-direction: column; min-height: 100vh; padding: 16px var(--pad) 56px; }
.gate__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 1200px; margin: 0 auto; }
.gate__back svg { width: 16px; height: 16px; }
.gate__grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 620px);
  justify-content: center;
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: clamp(20px, 4vh, 48px);
}
.gate__card { display: grid; gap: 18px; padding: clamp(20px, 3vw, 32px); }
.gate__h1 { font-size: clamp(30px, 3vw, 40px); }
.gate__lede { font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.gate__step { display: grid; gap: 14px; }
.gate__sh:focus { outline: none; }
.gate__actions { display: grid; gap: 10px; }
.btn--block { width: 100%; }
.gate__note { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.gate__facts { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--rule); }
.gate__facts li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.gate__facts li::before { content: ""; width: 6px; height: 6px; margin-top: 7px; border-radius: 1px; background: var(--gold); }
.gate__facts strong { font-weight: 600; color: var(--ink); }
.gate__agent { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.gate__agent a { color: var(--ink); text-underline-offset: 3px; }
.si-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.si-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rule);
  font: 500 12px/1.3 var(--font-mono);
  font-stretch: 87.5%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.si-steps li.is-active { color: var(--ink); border-bottom-color: var(--gold); }
.si-steps li.is-done { border-bottom-color: var(--gold-line); }

.wopts { display: grid; gap: 8px; }
.wopt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--ledger);
  color: var(--ink);
  font: 500 16px/1.2 var(--font-body);
  text-align: left;
  transition: border-color var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease);
}
.wopt:hover { border-color: var(--field-edge); background: var(--ledger-2); }
.wopt > svg { width: 18px; height: 18px; color: var(--ink-2); }
.wopt__meta { display: inline-flex; align-items: center; gap: 8px; font: 400 12.5px/1 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.wopt.is-on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wopt[aria-disabled="true"] { cursor: progress; }
.wopt[aria-disabled="true"]:not(.is-on) { opacity: 0.5; }
/* not installed: the row is the install link */
.wopt--off { background: transparent; border-style: dashed; color: var(--ink-2); text-decoration: none; }
.wopt--off .wopt__name { color: var(--ink-2); }
.wopt--off:hover { background: var(--ledger); }
.wopt__install { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.gate__demo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--gold-bright); }
.linkbtn[aria-disabled="true"] { cursor: progress; text-decoration: none; }

.who { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--gold-line); border-radius: var(--r-card); background: var(--moss-wash); }
.who > div { flex: 1; min-width: 0; display: grid; gap: 4px; }
.who__addr { font-size: 15px; font-weight: 500; }
.who__change { flex: none; }
.siwsbox { display: grid; gap: 8px; }
.siws {
  margin: 0;
  padding: 14px 16px;
  background: var(--ledger);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  font: 400 12.5px/1.7 var(--font-mono);
  font-stretch: 87.5%;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.siws__k { color: var(--ink-2); }
.siws__dom { color: var(--gold-bright); }

/* the assay sheet beside the card (signature element) */
.gate__sheet { min-width: 0; }
.gate__ledger { --cols: 40px minmax(0, 1fr) 84px 64px; --margin-w: 268px; --strike-r: 84px; }
.gate__ledger .hide-lg, .gate__ledger .hide-sm { display: none; }
.gate__ledger .lnote { font-size: 11px; }

/* ---------- costs before paid actions ---------- */
.cost { font: 400 13px/1.5 var(--font-mono); font-stretch: 87.5%; color: var(--ink-2); }
.cost strong { font-weight: 600; color: var(--ink); }
.lookup__cost { flex: 1 1 100%; }
.pay-slot { margin-top: 16px; }
.alert__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.newscan__aside .alert__actions .btn { width: auto; margin-top: 0; }
.newscan__aside .alert { margin-top: 14px; }
#nw-cost { margin-top: 4px; }
.newscan__aside .cost { margin-top: 6px; }
.costline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0 2px; border-top: 3px double var(--ink-2); font-size: 14px; }
.costline span { color: var(--ink-2); }
.costline strong { font: 500 16px/1.3 var(--font-mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; color: var(--gold-bright); }
.kv--total { margin-top: 2px; border-top: 3px double var(--ink-2); }
.kv--total dd { font-size: 15px; color: var(--gold-bright); }
.kv__sub { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.riskcard__paid .mono { color: var(--ink); }
.demo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip--link { height: 32px; padding: 0 12px; color: var(--ink); text-decoration: none; transition: border-color var(--t-ui) var(--ease), background-color var(--t-ui) var(--ease); }
.chip--link:hover { border-color: var(--ink); background: var(--row-hover); }
.chip__sym { color: var(--ink-2); }

/* ---------- #/billing ---------- */
.bill { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.balcard__body { display: grid; gap: 14px; align-content: start; }
.balcard__v {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font: 500 44px/1 var(--font-mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--gold-bright);
}
.balcard__u { font-size: 16px; letter-spacing: 0.04em; color: var(--ink-2); }
.topups { display: grid; gap: 8px; }
.topups__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.freecard__body { display: grid; gap: 18px; align-content: start; }
.freerow { display: grid; gap: 8px; }
.freerow__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 15px; }
.freerow__top .mono { font-size: 13px; color: var(--ink-2); }
.freerow__top strong { font-weight: 600; color: var(--gold-bright); }
.freerow--plain { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 15px; }
.tbl--ledger { --cols: 112px minmax(260px, 1fr) 104px 150px 136px; --tbl-min: 840px; }
.tbl--ledger .td__sub { white-space: normal; }
.tbl--pkeys { --cols: minmax(170px, 1fr) 190px 190px 110px 150px; --tbl-min: 840px; }
.tbl--pkeys .td__sub { white-space: normal; }
.rcpt { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.section__head > .tools--row { display: flex; }
.prices { display: grid; }
.prices li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 9px 0; border-top: 1px dashed var(--rule); font-size: 14px; }
.prices li:first-child { border-top: 0; }
.prices li > .mono { margin-left: auto; font-size: 13px; text-align: right; color: var(--ink); }
.plan--you { border-color: var(--gold-line); }
.doors .plan__price { font: 700 21px/1.2 var(--font-display); letter-spacing: -0.012em; }
.doors .plan__price small { display: block; margin-top: 4px; font: 400 13px/1.4 var(--font-mono); font-stretch: 87.5%; letter-spacing: 0; color: var(--ink-2); }
.doors .plan__foot .btn { justify-self: start; }
.plan__links { display: flex; flex-wrap: wrap; gap: 4px; }
.doors .chip { justify-self: start; }

/* ---------- top-up drawer ---------- */
.drawer--sm { width: min(460px, 100%); }
.topup { display: grid; gap: 18px; align-content: start; padding-top: 20px; }
.tu-need { padding: 12px 14px; border: 1px solid var(--gold-line); border-radius: var(--r-ctl); background: var(--moss-wash); font-size: 14px; line-height: 1.5; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .ws__name, .search__kbd { display: none; }
  .ws { padding-right: 6px; }
  .search__input { padding-right: 12px; }
}
@media (max-width: 1100px) {
  .bill { grid-template-columns: 1fr; }
}
@media (max-width: 1199px) {
  .gate__grid { grid-template-columns: minmax(0, 460px); }
  .gate__sheet { display: none; }
}
@media (max-width: 759px) {
  .acct { padding: 0 6px; }
  .acct__addr { display: none; }
  .btn.top__topup { width: 40px; padding: 0; }
  .top__topup-t { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 599px) {
  .top { gap: 8px; }
  .top__ws { display: none; }
  /* search folds into its icon and opens across the bar when focused */
  .search { flex: 0 0 40px; margin-left: 0; }
  .search__input { padding: 0 0 0 38px; }
  .search:not(:focus-within) .search__input { color: transparent; cursor: pointer; }
  .search:not(:focus-within) .search__input::placeholder { color: transparent; }
  .search:focus-within { position: absolute; top: 12px; left: var(--pad); right: var(--pad); z-index: 5; max-width: none; margin: 0; }
  .search:focus-within .search__input { padding-right: 12px; }
  .balcard__v { font-size: 36px; }
  .gate { padding-top: 12px; }
  .gate__card { padding: 20px; }
}
@media (max-width: 380px) {
  .bal { padding: 0 10px; }
  .bal__u { display: none; }
}

/* ==========================================================================
   Beta build: the live launch-risk card, this tab's lookups, the demo
   workspace label, the X link. No balances, no top-ups, no keys.
   ========================================================================== */
.section--first { margin-top: 0; }
.side__x {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font: 500 13px/1 var(--font-mono);
  font-stretch: 87.5%;
  text-decoration: none;
  transition: background-color var(--t-ui) var(--ease), color var(--t-ui) var(--ease);
}
.side__x svg { width: 16px; height: 16px; flex: none; }
.side__x:hover { background: var(--ledger-2); color: var(--ink); }
.desk:not([hidden]) + .side__x { margin-top: 0; }
.ws--demo .ws__name { display: inline; }
.gate__cap { margin-bottom: 10px; }

/* the live card */
.riskcard__summary { padding: 16px 20px; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.5; }
.verdict-xl--none { color: var(--ink-2); border-color: var(--rule); }
.riskfacts { border-top: 1px solid var(--rule); border-bottom: 0; }
.riskfacts dd { overflow-wrap: anywhere; }
.rsec { display: grid; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--rule); }
.rsec .h2__n { margin-left: 8px; }
.rsec a { color: var(--ink); text-underline-offset: 3px; }
.rflags { display: grid; gap: 8px; }
.rflags li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 14px; line-height: 1.45; }
.rflags svg { width: 16px; height: 16px; margin-top: 2px; color: var(--redline-text); }
.rlist { display: grid; }
.rlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 4px 16px; padding: 8px 0; border-top: 1px dashed var(--rule); font-size: 14px; }
.rlist li:first-child { border-top: 0; }
.rlist li > .mono:last-child { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.rlist__note { font-size: 13px; color: var(--ink-2); }
.rcov p:last-child { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.riskload { justify-items: start; }
.riskload__line { display: inline-flex; align-items: center; gap: 10px; color: var(--gold-bright); }
.json pre { white-space: pre; }
.tbl--lookups { --cols: minmax(150px, 1.4fr) 116px 78px 94px 156px 92px; --tbl-min: 760px; }
.keyless .codeline { width: min(100%, 560px); text-align: left; }
@media (max-width: 759px) {
  .rlist li { grid-template-columns: minmax(0, 1fr) auto; }
  .rlist__note { grid-column: 1 / -1; order: 3; }
  .riskcard__foot .btn { flex: 1 1 auto; }
}
@media (max-width: 599px) {
  .top__ws:not([hidden]) { display: block; }
  .ws--demo .ws__rest { display: none; }
  .riskcard__summary, .rsec { padding-left: 16px; padding-right: 16px; }
}
