/* Interchange Ledger — utilitarian parts-desk UI */
:root {
  --bg: oklch(96.6% 0.008 85);
  --surface: oklch(99% 0.005 85);
  --surface-2: oklch(93.5% 0.01 80);
  --ink: oklch(23% 0.015 60);
  --ink-2: oklch(38% 0.014 60);
  --muted: oklch(52% 0.014 65);
  --line: oklch(87% 0.012 75);
  --line-strong: oklch(76% 0.014 70);
  --accent: oklch(63% 0.175 48);
  --accent-ink: oklch(47% 0.15 44);
  --accent-wash: oklch(94% 0.04 60);
  --on-accent: oklch(99% 0.01 80);
  --ok: oklch(52% 0.12 152);
  --ok-wash: oklch(94% 0.04 150);
  --warn: oklch(56% 0.13 75);
  --warn-wash: oklch(94.5% 0.05 85);
  --bad: oklch(53% 0.18 27);
  --bad-wash: oklch(94.5% 0.035 25);
  --info: oklch(50% 0.11 250);
  --info-wash: oklch(94.5% 0.025 250);
  --violet: oklch(50% 0.13 300);
  --violet-wash: oklch(94.5% 0.03 300);
  --topbar: oklch(24% 0.014 60);
  --topbar-ink: oklch(92% 0.012 80);
  --topbar-muted: oklch(68% 0.012 70);
  --shadow: 0 1px 0 oklch(0% 0 0 / 0.04), 0 8px 24px -12px oklch(30% 0.03 60 / 0.25);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --r: 3px;
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(18.5% 0.009 60);
    --surface: oklch(22% 0.01 60);
    --surface-2: oklch(26% 0.011 60);
    --ink: oklch(92% 0.01 80);
    --ink-2: oklch(80% 0.011 75);
    --muted: oklch(66% 0.012 70);
    --line: oklch(31% 0.011 60);
    --line-strong: oklch(41% 0.012 60);
    --accent: oklch(72% 0.16 55);
    --accent-ink: oklch(78% 0.14 58);
    --accent-wash: oklch(30% 0.06 50);
    --on-accent: oklch(20% 0.02 50);
    --ok: oklch(74% 0.13 152);
    --ok-wash: oklch(29% 0.05 152);
    --warn: oklch(80% 0.13 85);
    --warn-wash: oklch(30% 0.05 80);
    --bad: oklch(70% 0.16 27);
    --bad-wash: oklch(29% 0.06 27);
    --info: oklch(74% 0.1 250);
    --info-wash: oklch(28% 0.04 250);
    --violet: oklch(74% 0.11 300);
    --violet-wash: oklch(29% 0.045 300);
    --topbar: oklch(14.5% 0.008 60);
    --shadow: 0 1px 0 oklch(100% 0 0 / 0.03), 0 10px 30px -12px oklch(0% 0 0 / 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--sans);
  font-variation-settings: "wdth" 100;
  font-feature-settings: "tnum" 1;
  overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--topbar);
  color: var(--topbar-ink);
  border-top: 3px solid var(--accent);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 24px; min-height: 52px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; flex-shrink: 0; }
.brand-mark { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 22px; height: 22px; }
.brand-mark i { display: block; background: var(--accent); }
.brand-mark i:last-child { background: transparent; border: 2px solid var(--topbar-ink); }
.brand-name { font-weight: 800; font-variation-settings: "wdth" 75; font-size: 18px; letter-spacing: 0.02em; text-transform: uppercase; }
.brand-name span { font-weight: 400; color: var(--topbar-muted); margin-left: 4px; }
.tabs { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  color: var(--topbar-muted); padding: 0 12px; display: flex; align-items: center;
  font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -0px; transition: color .15s;
}
.tabs a:hover { color: var(--topbar-ink); }
.tabs a.on { color: var(--topbar-ink); border-bottom-color: var(--accent); }
.jev-pill {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  color: var(--topbar-muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid oklch(40% 0.01 60); padding: 4px 9px; border-radius: 99px; text-decoration: none !important;
}
.jev-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(55% 0.01 60); }
.jev-pill.on { color: var(--topbar-ink); }
.jev-pill.on .dot { background: oklch(75% 0.15 150); box-shadow: 0 0 0 3px oklch(75% 0.15 150 / .2); }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 12px; padding-top: 8px; }
  .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; min-height: 40px; margin: 0 calc(-1 * var(--gutter)); padding: 0 calc(var(--gutter) - 12px); }
}

/* ---------- layout ---------- */
.view { max-width: 1280px; margin: 0 auto; padding: clamp(18px, 3vw, 36px) var(--gutter) 80px; outline: none; }
/* `backwards`, not `both`: a retained transform would make every section its own
   stacking context and later sections would paint over autocomplete dropdowns. */
.view > * { animation: rise .32s cubic-bezier(.22, 1, .36, 1) backwards; }
.view > :focus-within { position: relative; z-index: 10; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view > *, * { animation: none !important; transition: none !important; } }

.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.page-title { font-size: clamp(24px, 3.2vw, 34px); font-variation-settings: "wdth" 80; font-weight: 800; letter-spacing: -0.01em; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 0; }
.section-head h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; font-variation-settings: "wdth" 85; }
.section-head .count { color: var(--muted); font-size: 13px; }
.section-head .spacer { flex: 1; }
.hint { color: var(--muted); font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }

/* ---------- controls ---------- */
input, textarea, select, button { font: inherit; color: inherit; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.input, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 8px 10px; min-height: 38px; transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 650; font-size: 14px;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { padding: 0; width: 34px; min-height: 34px; }

/* ---------- search ---------- */
.search-hero { max-width: 860px; }
.search-hero h1 { font-size: clamp(30px, 5vw, 54px); line-height: 1; font-variation-settings: "wdth" 72; font-weight: 800; letter-spacing: -0.015em; }
.search-hero h1 em { font-style: normal; color: var(--accent-ink); }
.search-hero p { color: var(--ink-2); margin: 12px 0 22px; max-width: 60ch; }
.search-box { position: relative; }
.search-box .input.big {
  min-height: 58px; font-size: clamp(17px, 2.2vw, 21px); padding: 0 16px 0 48px; border-width: 2px; border-color: var(--ink);
  font-family: var(--mono); letter-spacing: .01em;
}
.search-box .input.big::placeholder { font-family: var(--sans); }
.search-box .glyph { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; pointer-events: none; color: var(--muted); }
.search-box.compact .input.big { min-height: 44px; font-size: 16px; padding-left: 42px; border-width: 1px; border-color: var(--line-strong); }
.search-box.compact .glyph { left: 14px; width: 16px; }
.lookup-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.lookup-bar .search-box { flex: 1; max-width: 560px; }

.ac {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  list-style: none; margin: 0; padding: 4px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow);
}
.ac li { padding: 8px 10px; border-radius: 2px; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; }
.ac li.on { background: var(--accent-wash); }
.ac li .pn { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.ac li .sub { grid-column: 1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac li .alts { grid-row: 1 / span 2; grid-column: 2; }
.ac li.ac-msg { display: block; cursor: default; color: var(--muted); font-size: 13px; }
.ac li.ac-msg.err { color: var(--bad); }
.ac.small li .pn { font-size: 13px; }

/* ---------- landing ---------- */
.landing-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); margin-top: 44px; }
@media (max-width: 860px) { .landing-grid { grid-template-columns: 1fr; } }
.how { counter-reset: step; margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.how li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.how li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 12px; color: var(--accent-ink); font-weight: 700; padding-top: 2px; }
.how b { display: block; font-size: 14.5px; }
.how span { color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--ink); text-decoration: none !important;
}
a.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip small { font-family: var(--sans); color: var(--muted); font-size: 11.5px; }

/* ---------- part detail ---------- */
.part-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 40px; align-items: start; padding-bottom: 22px; }
@media (max-width: 860px) { .part-head { grid-template-columns: 1fr; } }
.part-head .pn-title { font-family: var(--mono); font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin: 6px 0 6px; word-break: break-all; }
.part-head .desc { font-size: 17px; color: var(--ink-2); margin: 0 0 14px; }
.attrs { display: flex; flex-wrap: wrap; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); width: fit-content; max-width: 100%; }
.attrs div { padding: 6px 12px; border-right: 1px solid var(--line); }
.attrs div:last-child { border-right: 0; }
.attrs dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.attrs dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.usage { display: grid; grid-template-columns: repeat(3, auto); gap: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); }
.usage > div { padding: 12px 18px; border-right: 1px solid var(--line); min-width: 110px; }
.usage > div:last-child { border-right: 0; }
.usage b { display: block; font-size: 26px; font-variation-settings: "wdth" 80; font-weight: 750; line-height: 1.1; }
.usage span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.usage .rate b { display: inline; font-size: inherit; font-weight: 750; }
.usage .rate { grid-column: 1 / -1; border-top: 1px solid var(--line); border-right: 0; padding: 8px 18px; font-size: 13px; color: var(--ink-2); }
@media (max-width: 520px) { .usage { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; } .usage > div { min-width: 0; padding: 10px 12px; } .usage b { font-size: 21px; } }

/* ---------- data tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 10px 10px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--bg);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr.row:hover { background: color-mix(in oklch, var(--surface-2) 60%, transparent); }
table.data tr.clickable { cursor: pointer; }
.rank { font-family: var(--mono); color: var(--muted); font-size: 12.5px; width: 28px; }
.cell-part .pn { font-family: var(--mono); font-weight: 700; font-size: 14.5px; }
.cell-part .sub { color: var(--muted); font-size: 12.5px; display: block; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-part .xcat { color: var(--warn); font-weight: 600; }

.meter-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.meter { position: relative; flex: 1; height: 10px; background: var(--surface-2); border-radius: 1px; overflow: hidden; min-width: 70px; }
.meter i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); background: var(--accent); transform-origin: left; animation: grow .6s cubic-bezier(.22, 1, .36, 1) both; }
.meter::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--surface) calc(10% - 2px) 10%); pointer-events: none; }
.meter.lo i { background: var(--line-strong); }
.meter.mid i { background: color-mix(in oklch, var(--accent) 60%, var(--line-strong)); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.meter-cell b { font-family: var(--mono); font-size: 13px; width: 3.2em; text-align: right; }

.ev { display: inline-flex; gap: 10px; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.ev span { display: inline-flex; align-items: center; gap: 3px; }
.ev .f { color: var(--ink); }
.ev .r { color: var(--ink-2); }
.ev .n { color: var(--bad); font-weight: 700; }
.ev .z { color: var(--line-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 2px; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; line-height: 18px; white-space: nowrap; border: 1px solid transparent;
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.m-notes { background: var(--info-wash); color: var(--info); }
.m-pairing { background: var(--ok-wash); color: var(--ok); }
.m-jev { background: var(--violet-wash); color: var(--violet); }
.m-transitive { background: transparent; color: var(--muted); border-color: var(--line-strong); border-style: dashed; }
.m-other { background: var(--surface-2); color: var(--ink-2); }
.pill-count { font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 2px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill-count.hot { background: var(--accent-wash); color: var(--accent-ink); }

.attr-match { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.attr-match.full { color: var(--ok); font-weight: 700; }
.attr-match.part { color: var(--warn); }
.attr-match.none { color: var(--bad); }
.attr-match.na { color: var(--muted); }

.ev-btn { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.ev-btn .car { display: inline-block; transition: transform .15s; }
.ev-btn[aria-expanded="true"] .car { transform: rotate(90deg); }
tr.evidence > td { background: var(--surface-2); padding: 0; }
.ev-list { list-style: none; margin: 0; padding: 6px 10px 10px 48px; display: grid; gap: 0; }
.ev-list li { display: grid; grid-template-columns: 110px 92px 110px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-strong); font-size: 13px; align-items: baseline; }
.ev-list li:last-child { border-bottom: 0; }
.ev-list .ext { font-family: var(--mono); font-weight: 700; }
.ev-list .muted { color: var(--muted); }
.ev-list .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ev-head { padding: 10px 10px 0 48px; font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody { display: block; }
  table.data.stack tr.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.data.stack tr.row td { border: 0; padding: 0; }
  table.data.stack tr.row td[data-l]::before { content: attr(data-l); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
  table.data.stack td.rank { grid-row: 1; }
  table.data.stack td.cell-part { grid-column: 2 / -1; }
  table.data.stack td.c-score { grid-column: 1 / -1; }
  table.data.stack td.c-ev { grid-column: 1 / 3; }
  table.data.stack td.c-methods { grid-column: 1 / 3; }
  table.data.stack td.c-attr { grid-column: 3; text-align: right; }
  table.data.stack td.c-btn { grid-column: 3; grid-row: 4; text-align: right; }
  table.data.stack tr.evidence { display: block; }
  table.data.stack tr.evidence > td { display: block; }
  .ev-list { padding-left: 10px; }
  .ev-head { padding-left: 10px; }
  .ev-list li { grid-template-columns: auto auto; }
  .ev-list li .trunc { grid-column: 1 / -1; }
  .cell-part .sub { max-width: none; }
}

/* ---------- states ---------- */
.state { padding: 36px 20px; text-align: left; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); margin-top: 14px; }
.state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.state.err { border-color: color-mix(in oklch, var(--bad) 50%, transparent); background: var(--bad-wash); color: var(--ink-2); }
.state.err b { color: var(--bad); }
.state code { background: var(--surface-2); padding: 1px 5px; border-radius: 2px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 28px 0; font-size: 14px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { height: 14px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 2px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r); font-size: 14px; }
.notice.ok { background: var(--ok-wash); color: var(--ok); }
.notice.ok b { color: var(--ink); }
.notice.err { background: var(--bad-wash); color: var(--bad); }

/* ---------- forms: new report ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .w2 { grid-column: span 2; }
.form-grid .w4 { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .w2, .form-grid .w4 { grid-column: 1 / -1; } }
.lines-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; }
@media (max-width: 860px) { .lines-grid { grid-template-columns: 1fr; } }
.lines { border-top: 2px solid var(--ink); }
.lines-head { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 0 6px; }
.lines-head h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; font-variation-settings: "wdth" 85; }
.lines-head .hint { font-size: 12.5px; }
.line-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 74px 34px; gap: 8px; align-items: center; padding: 5px 0; }
.line-row .idx { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.line-row .ref-wrap { position: relative; }
.line-row .input { font-family: var(--mono); font-size: 14px; }
.line-row .qty { text-align: right; }
.line-row .rm { color: var(--muted); font-size: 18px; line-height: 1; }
.line-row .rm:hover { color: var(--bad); }
.line-add { margin: 6px 0 0 30px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-actions .spacer { flex: 1; }
.form-err { color: var(--bad); font-size: 14px; }

.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.side h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; font-variation-settings: "wdth" 85; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.drop {
  display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px 16px; margin-top: 14px; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-wash); }
.drop b { font-size: 14.5px; }
.drop span { font-size: 12.5px; color: var(--muted); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-file { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-family: var(--mono); font-size: 13px; }
.upload-file span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-result { margin-top: 14px; }
.kv-strip { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 10px; }
.kv-strip > div { flex: 1; padding: 10px 14px; border-right: 1px solid var(--line); }
.kv-strip > div:last-child { border-right: 0; }
.kv-strip b { display: block; font-size: 22px; font-variation-settings: "wdth" 80; font-weight: 750; }
.kv-strip span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.err-list { max-height: 220px; overflow-y: auto; font-size: 12.5px; border: 1px solid var(--line); border-radius: var(--r); }
.err-list div { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.err-list div:last-child { border-bottom: 0; }
.err-list .ln { font-family: var(--mono); color: var(--muted); }
.sample { margin-top: 14px; font-size: 12px; }
.sample summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.sample pre { background: var(--surface); border: 1px solid var(--line); padding: 10px; border-radius: var(--r); overflow-x: auto; font-size: 11.5px; line-height: 1.5; }

/* ---------- report detail ---------- */
.result-anchor { scroll-margin-top: 80px; }
.rd-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 30px; padding-bottom: 16px; }
.rd-head .ext { font-family: var(--mono); font-size: clamp(24px, 3.4vw, 34px); font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); }
.meta > div { padding: 6px 14px; border-right: 1px solid var(--line); }
.meta > div:last-child { border-right: 0; }
.meta dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.meta dd { margin: 0; font-weight: 600; font-size: 14px; }
.narrative { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.narrative > div { padding: 14px 18px 14px 0; }
.narrative > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.narrative p { margin: 4px 0 0; white-space: pre-wrap; }
@media (max-width: 760px) { .narrative { grid-template-columns: 1fr; } .narrative > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }
.tally { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 18px 0 0; font-size: 13px; color: var(--ink-2); }
.tally span { display: inline-flex; align-items: center; gap: 6px; }
.tally i { width: 10px; height: 10px; border-radius: 1px; display: inline-block; }

.pv { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
@media (max-width: 860px) { .pv { grid-template-columns: 1fr; } }
.pv-col h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; font-variation-settings: "wdth" 85; padding-bottom: 8px; border-bottom: 2px solid var(--ink); display: flex; justify-content: space-between; }
.pv-col h3 span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 13px; }
.ln { list-style: none; margin: 0; padding: 0; }
.ln li { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.ln li .bar { grid-row: 1 / span 2; align-self: stretch; border-radius: 1px; background: var(--line); }
.ln li .main { min-width: 0; }
.ln li .pn { font-family: var(--mono); font-weight: 700; font-size: 14.5px; }
.ln li .d { color: var(--ink-2); font-size: 13px; }
.ln li .raw { grid-column: 2 / -1; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.ln li .raw code { color: var(--ink-2); background: var(--surface-2); padding: 0 5px; border-radius: 2px; }
.ln li .right { display: flex; flex-direction: column; align-items: end; gap: 4px; }
.ln li .qty { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.ln li.dropped .pn, .ln li.dropped .d { text-decoration: line-through; text-decoration-color: var(--bad); color: var(--muted); }
.st { font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; padding: 1px 6px; border-radius: 2px; line-height: 17px; }
.s-kept { --c: var(--line-strong); }
.s-kept .st { color: var(--muted); background: var(--surface-2); }
.s-substituted, .s-substitute { --c: var(--accent); }
.s-substituted .st, .s-substitute .st { color: var(--accent-ink); background: var(--accent-wash); }
.s-added { --c: var(--ok); }
.s-added .st { color: var(--ok); background: var(--ok-wash); }
.s-dropped { --c: var(--bad); }
.s-dropped .st { color: var(--bad); background: var(--bad-wash); }
.s-unresolved { --c: var(--warn); }
.s-unresolved .st { color: var(--warn); background: var(--warn-wash); }
.ln li .bar { background: var(--c, var(--line)); }
.tally i.s-kept { background: var(--line-strong); }
.tally i.s-substituted { background: var(--accent); }
.tally i.s-added { background: var(--ok); }
.tally i.s-dropped { background: var(--bad); }
.tally i.s-unresolved { background: var(--warn); }
.conf { font-family: var(--mono); font-size: 11.5px; }
.conf.low { color: var(--warn); font-weight: 700; }
.conf.bad { color: var(--bad); font-weight: 700; }

.subs { list-style: none; margin: 0; padding: 0; }
.subs li { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.subs .pn { font-family: var(--mono); font-weight: 700; }
.subs .d { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subs .arrow { color: var(--accent); font-size: 20px; text-align: center; font-family: var(--mono); }
.subs li.neg .arrow { color: var(--bad); }
.subs .how-col { display: flex; flex-direction: column; align-items: end; gap: 5px; min-width: 150px; }
.subs .how-col .meter-cell { min-width: 140px; width: 150px; }
.subs .neg-note { font-size: 11.5px; color: var(--bad); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 640px) {
  .subs li { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); }
  .subs .how-col { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; }
}

/* ---------- reports list ---------- */
.list-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.list-tools .search-box { flex: 1; min-width: 220px; max-width: 460px; }
.list-tools .total { color: var(--muted); font-size: 13px; }
table.data td .ext { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
table.data td.sym { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
table.data td.date { font-family: var(--mono); font-size: 13px; white-space: nowrap; color: var(--ink-2); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  table.data.rl thead { display: none; }
  table.data.rl, table.data.rl tbody { display: block; }
  table.data.rl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.data.rl td { border: 0; padding: 0; }
  table.data.rl td.sym { grid-column: 1 / -1; max-width: none; }
  table.data.rl td.hide-sm { display: none; }
}

/* ---------- insights ---------- */
.ledger { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.ledger > div { padding: 14px 16px 16px 0; }
.ledger > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.ledger b { display: block; font-size: clamp(22px, 2.6vw, 30px); font-variation-settings: "wdth" 78; font-weight: 750; letter-spacing: -0.01em; line-height: 1.1; }
.ledger span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ledger .warnv { color: var(--warn); }
@media (max-width: 900px) {
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger > div:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
  .ledger > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger > div { padding-left: 12px !important; border-left: 1px solid var(--line) !important; border-top: 0 !important; }
  .ledger > div:nth-child(odd) { padding-left: 0 !important; border-left: 0 !important; }
  .ledger > div:nth-child(n + 3) { border-top: 1px solid var(--line) !important; }
}
.ins-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 960px) { .ins-grid { grid-template-columns: 1fr; } }
.stack-bar { display: flex; height: 16px; border-radius: 1px; overflow: hidden; background: var(--surface-2); margin: 14px 0 10px; }
.stack-bar i { display: block; height: 100%; }
.stack-bar i + i { border-left: 2px solid var(--bg); }
.legend { display: grid; gap: 0; }
.legend div { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.legend i { width: 10px; height: 10px; border-radius: 1px; }
.legend .v { font-family: var(--mono); font-size: 13px; }
.legend .p { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 4.5em; text-align: right; }
.c-notes { background: var(--info); }
.c-pairing { background: var(--ok); }
.c-jev { background: var(--violet); }
.c-other { background: var(--muted); }
.jev-panel { padding: 18px; margin-top: 14px; display: grid; gap: 10px; }
.jev-panel .status { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; }
.jev-panel .status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.jev-panel.on .status .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in oklch, var(--ok) 20%, transparent); }
.jev-panel p { margin: 0; color: var(--ink-2); font-size: 14px; }
.jev-panel ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; display: grid; gap: 3px; }
.jev-panel code { background: var(--surface-2); padding: 1px 5px; border-radius: 2px; }
.pair-row td .pair { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pair-row .arrow { color: var(--accent); font-family: var(--mono); }
.sup { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 110px; }
.sup .meter { max-width: 80px; }
.sup b { font-family: var(--mono); font-size: 13px; min-width: 2.5em; text-align: right; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0; border-top: 2px solid var(--ink); margin-top: 0; }
.metrics > div { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--line); }
.metrics b { display: block; font-size: 26px; font-variation-settings: "wdth" 78; font-weight: 750; }
.metrics span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; word-break: break-word; }
.metrics .good b { color: var(--ok); }
.metrics .badv b { color: var(--bad); }
.metrics-extra { margin-top: 18px; }
