/* WOLF AI — Option B from the colour study, with the states the study left open.
   Rules that do not bend:
     --held   appears on held files and nothing else. Never on an error.
     --accent appears on citations and text links. Never on a button.
     --danger is for genuine errors, so that a held file never reads as a failure. */

:root {
  color-scheme: light;

  --ink: #1a1917;
  --ink-soft: #4d4a43;
  --muted: #6e6a62;
  --faint: #767065;
  --paper: #faf8f5;
  --surface: #ffffff;
  --sunk: #f4f1ec;
  --line: #e2ded7;
  --line-strong: #ccc6bb;

  --primary: #1a1917;
  --primary-text: #ffffff;
  --primary-hover: #2f2c28;
  --primary-active: #000000;

  --accent: #8f3f26;
  --accent-hover: #74321e;
  --accent-soft: #f6e9e3;

  --held: #7d4c15;
  --held-bg: #f7efe2;
  --held-line: #ddc9a4;

  --danger: #9a2b1c;
  --danger-bg: #fbeceb;
  --good: #2f5d3f;

  --highlight: #f3ede4;
  --mark: #f5e2a8;

  --ring: color-mix(in srgb, var(--primary) 55%, transparent);
  --shadow: 0 1px 2px rgba(26, 25, 23, .05), 0 4px 14px rgba(26, 25, 23, .05);

  --r: 3px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --rail: 76px;
  --tap: 40px;
  --fast: 130ms cubic-bezier(.2, 0, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --ink: #f2efe9;
    --ink-soft: #cfcabf;
    --muted: #a8a298;
    --faint: #948d82;
    --paper: #171614;
    --surface: #201e1b;
    --sunk: #1a1917;
    --line: #34312c;
    --line-strong: #4a463f;

    --primary: #f2efe9;
    --primary-text: #171614;
    --primary-hover: #ffffff;
    --primary-active: #d9d5cc;

    --accent: #e09274;
    --accent-hover: #eda98e;
    --accent-soft: #33241d;

    --held: #e0a961;
    --held-bg: #2e2517;
    --held-line: #574526;

    --danger: #e58a7c;
    --danger-bg: #33201d;
    --good: #8fbfa0;

    --highlight: #2a2620;
    --mark: #5c4a1e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --ink: #f2efe9; --ink-soft: #cfcabf; --muted: #a8a298; --faint: #948d82;
  --paper: #171614; --surface: #201e1b; --sunk: #1a1917;
  --line: #34312c; --line-strong: #4a463f;
  --primary: #f2efe9; --primary-text: #171614; --primary-hover: #ffffff; --primary-active: #d9d5cc;
  --accent: #e09274; --accent-hover: #eda98e; --accent-soft: #33241d;
  --held: #e0a961; --held-bg: #2e2517; --held-line: #574526;
  --danger: #e58a7c; --danger-bg: #33201d; --good: #8fbfa0;
  --highlight: #2a2620; --mark: #5c4a1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 660; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 25px; }
h2 { font-size: 19px; }
h3 { font-size: 14px; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
.sub { color: var(--muted); font-size: 13.5px; }
.cap { color: var(--faint); font-size: 12px; }
.hide { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

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

.app { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail); flex: 0 0 var(--rail);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s4) 0 var(--s3); gap: var(--s1);
  position: sticky; top: 0; height: 100vh; z-index: 20;
}
.rail .mark { width: 30px; height: 30px; color: var(--ink); margin-bottom: var(--s5); }
.rail .mark svg { width: 100%; height: 100%; display: block; }
.rail a, .rail button {
  width: 60px; padding: var(--s2) 0 6px; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; border-radius: var(--r);
  transition: background var(--fast), color var(--fast);
}
.rail i {
  width: 30px; height: 30px; display: grid; place-items: center; font-style: normal;
  border: 1px solid transparent; border-radius: var(--r); font-size: 15px;
}
.rail button:hover { color: var(--ink); background: var(--sunk); }
.rail button[aria-current='page'] { color: var(--ink); font-weight: 650; }
.rail button[aria-current='page'] i { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.rail .foot { margin-top: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.bar {
  display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5); min-height: 52px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 15;
}
.bar .back { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 2px; font-size: 13.5px; }
.bar .back:hover { color: var(--accent-hover); text-decoration: underline; }
.bar .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .grow { flex: 1; }
.bar .who { font-size: 12.5px; color: var(--muted); }

.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: var(--s6) var(--s5) 96px; }
.wrap.wide { max-width: 1140px; }
.center { width: 100%; max-width: 400px; margin: 7vh auto; padding: 0 var(--s4) var(--s7); }

/* ---------------------------------------------------------------- stepper */

.stepper {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  font-size: 11.5px; letter-spacing: .02em; color: var(--faint);
  border-bottom: 1px solid var(--line); padding-bottom: var(--s3); margin-bottom: var(--s5);
}
.stepper .s.on { color: var(--ink); font-weight: 650; }
.stepper .s.done { color: var(--muted); }
.stepper .sep { color: var(--line-strong); }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 8px 15px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast);
}
.btn:hover { border-color: var(--ink); background: var(--sunk); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.pri:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.pri:active { background: var(--primary-active); }
.btn.quiet { border-color: var(--line); color: var(--muted); }
.btn.quiet:hover { color: var(--ink); border-color: var(--line-strong); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); border-color: var(--line-strong); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-bg); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: var(--surface); border-color: var(--line-strong); }
.btn.link {
  border: 0; background: none; color: var(--accent); min-height: 0; padding: 2px 0;
  text-decoration: underline; text-underline-offset: 2px; font-weight: 500;
}
.btn.link:hover { color: var(--accent-hover); background: none; }
.btn.saved { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

label.f { display: block; margin-top: var(--s4); }
label.f .l {
  display: block; font-size: 11px; letter-spacing: .05em; color: var(--muted);
  text-transform: uppercase; font-weight: 600; margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; min-height: var(--tap);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); padding: 9px 12px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: var(--ink-soft); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
input[readonly] { background: var(--sunk); color: var(--muted); }
.hint { font-size: 12px; color: var(--faint); margin-top: 5px; }

.rule { display: flex; align-items: center; gap: 10px; margin: var(--s4) 0; color: var(--faint); font-size: 11px; }
.rule::before, .rule::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

.sso { display: flex; flex-direction: column; gap: 7px; }
.sso .btn { width: 100%; font-weight: 500; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); box-shadow: var(--shadow); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.trust { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin-top: var(--s4); font-size: 12.5px; color: var(--muted); }
.trust b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 6px; }
.trust ul { margin: 0; padding-left: 18px; }
.trust li { margin-bottom: 3px; }

.err, .ok {
  display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--r);
  font-size: 13px; margin-top: var(--s3); border: 1px solid;
}
.err { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.ok { color: var(--good); background: color-mix(in srgb, var(--good) 8%, transparent); border-color: color-mix(in srgb, var(--good) 28%, transparent); }

/* ---------------------------------------------------------------- chips (screens 13, 14, 15) */

.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: var(--s4) 0 var(--s3); }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  border-radius: 100px; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.chip:hover { color: var(--ink); border-color: var(--ink-soft); }
.chip[aria-pressed='true'] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
.chip .n { font-variant-numeric: tabular-nums; }
.chip.held { color: var(--held); border-color: var(--held-line); background: var(--held-bg); font-weight: 650; }
.chip.held[aria-pressed='true'] { background: var(--held); color: var(--surface); border-color: var(--held); }
.chip.held.zero { color: var(--muted); background: var(--surface); border-color: var(--line-strong); font-weight: 400; }
.chips .push { margin-left: auto; }

.holdchip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--held-bg); color: var(--held); border: 1px solid var(--held-line);
  font-size: 11.5px; padding: 2px 8px; border-radius: 100px; white-space: nowrap;
}

/* ---------------------------------------------------------------- matters */

.mrow {
  display: flex; align-items: center; gap: var(--s4); width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  padding: 14px var(--s4); cursor: pointer;
  transition: background var(--fast);
}
.mrow:first-of-type { border-radius: var(--r) var(--r) 0 0; }
.mrow:last-of-type { border-bottom: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.mrow:hover { background: var(--sunk); }
.mrow .nm { font-weight: 620; }
.mrow .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------------- drop zone */

.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r);
  background: var(--surface); padding: var(--s7) var(--s5); text-align: center;
  transition: border-color var(--fast), background var(--fast);
}
.drop.hot { border-color: var(--primary); background: var(--highlight); }
.drop .big { font-size: 16px; font-weight: 620; }

/* ---------------------------------------------------------------- counts strip (screens 9, 10) */

.strip { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.strip > div { flex: 1; min-width: 96px; padding: 11px var(--s4); border-right: 1px solid var(--line); }
.strip > div:last-child { border-right: 0; }
.strip .n { font-size: 20px; font-weight: 660; }
.strip .k { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.strip .held { background: var(--held); color: var(--surface); }
.strip .held .k { color: color-mix(in srgb, var(--surface) 80%, transparent); }

.bar-track { height: 6px; background: var(--line); border-radius: 100px; overflow: hidden; margin: var(--s4) 0 var(--s2); }
.bar-track > i { display: block; height: 100%; background: var(--primary); transition: width var(--fast); }

/* ---------------------------------------------------------------- exceptions */

.exc { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.exc .r { display: flex; align-items: center; gap: var(--s3); padding: 13px var(--s4); border-bottom: 1px solid var(--line); }
.exc .r:last-child { border-bottom: 0; }
.exc .t { font-weight: 620; }
.exc .d { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.exc .grow { flex: 1; }

/* ---------------------------------------------------------------- ask / results */

.askbar { display: flex; gap: var(--s2); }
.askbar input { flex: 1; min-height: 44px; }
.scope { font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 9px 0 var(--s3); margin-bottom: var(--s4); }
.scope .held-n { color: var(--held); font-weight: 600; }

.answer {
  border: 1px solid var(--ink); border-radius: var(--r); background: var(--surface);
  padding: var(--s4) var(--s5); margin: var(--s4) 0;
}
.answer .lbl { font-size: 10.5px; letter-spacing: .09em; font-weight: 700; color: var(--muted); margin-bottom: var(--s2); }
.answer p { margin-bottom: 8px; font-size: 15.5px; line-height: 1.65; }
.answer p:last-child { margin-bottom: 0; }
.answer .foot { margin-top: var(--s3); padding-top: var(--s2); border-top: 1px dotted var(--line); font-size: 12px; color: var(--faint); }

.cite {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: 11px; font-weight: 650; padding: 0 6px; margin: 0 2px;
  border-radius: 100px; cursor: pointer; vertical-align: 1px; white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.cite:hover { background: var(--accent); color: var(--surface); }

.psg { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: var(--s3); }
.psg.lit { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.psg .h { display: flex; gap: var(--s2); align-items: baseline; padding: var(--s3) var(--s4) 0; font-size: 12.5px; flex-wrap: wrap; }
.psg .h .no { font-weight: 700; }
.psg .h .dt { color: var(--muted); }
.psg .h .grow { flex: 1; }
.psg .q {
  padding: 10px var(--s3); margin: var(--s2) var(--s4) var(--s3);
  font-size: 14px; line-height: 1.6; background: var(--highlight);
  border-left: 2px solid var(--accent); border-radius: 0 var(--r) var(--r) 0;
}
.psg .acts { padding: 0 var(--s4) var(--s3); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
mark { background: var(--mark); color: var(--ink); padding: 0 2px; border-radius: 2px; }

/* ---------------------------------------------------------------- lists */

.filelist { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.filelist .r { display: flex; gap: var(--s3); padding: 11px var(--s4); border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: center; }
.filelist .r:last-child { border-bottom: 0; }
.filelist .r:hover { background: var(--sunk); }
.filelist .r .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .r .no { min-width: 82px; color: var(--faint); font-size: 12px; }

.overview { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: var(--s4); }
.overview .k { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.overview dl { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s3); margin: var(--s3) 0 0; font-size: 13.5px; }
.overview dt { color: var(--ink); font-weight: 620; }
.overview dd { margin: 0; color: var(--muted); }
.overview dd b { color: var(--ink); font-weight: 620; }

.act { font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 10px 0; }
.act:last-child { border-bottom: 0; }
.act b { color: var(--ink); font-weight: 620; }

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center;
  align-items: flex-start; padding: 7vh var(--s4) var(--s5); overflow: auto;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  animation: fade var(--fast);
}
.modal .box {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  max-width: 640px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: rise var(--fast);
}
.modal .box > header {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); background: var(--sunk);
  font-size: 13px; border-radius: var(--r) var(--r) 0 0;
}
.modal .box > header b { font-weight: 650; }
.modal .box > header .grow { flex: 1; }
.modal .body { padding: var(--s5); }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } }

/* ---------------------------------------------------------------- misc */

.corpus { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s3); }
.src {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  padding: var(--s3) var(--s4); font-size: 13px;
}
.src .t { font-weight: 620; }
.src .m { color: var(--faint); font-size: 11.5px; margin-top: 4px; }
.src.failed { opacity: .6; }

.split { display: flex; gap: var(--s5); flex-wrap: wrap; }
.split > * { flex: 1; min-width: 270px; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line-strong); border-top-color: var(--ink); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg) } }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .rail {
    width: 100%; height: auto; flex-direction: row; justify-content: center; gap: var(--s5);
    border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 0;
    position: sticky; top: 0;
  }
  .rail .mark { margin: 0 var(--s3) 0 0; width: 24px; height: 24px; align-self: center; }
  .rail a, .rail button { flex-direction: row; gap: 7px; width: auto; padding: 6px 10px; }
  .rail .foot { margin: 0; }
  .bar { padding: 0 var(--s4); }
  .wrap { padding: var(--s5) var(--s4) 80px; }
  h1 { font-size: 21px; }
}

.knit { white-space: nowrap; }
.psg .h .ttl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.scopechips { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; margin: 0 4px; }
.scopechips .chip { cursor: default; }
.scopechips select { width: auto; min-height: 28px; padding: 2px 8px; font-size: 12.5px; border-radius: 100px; }
.knit .cite { margin-right: 0; }

/* ================================================================ type
   Geist + Geist Mono, self-hosted: no third-party request from a page that
   holds case evidence, and no render-blocking round trip. */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/geist-mono.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
  font-style: normal;
}

:root {
  --font-sans: 'Geist', ui-sans-serif, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

body { font-family: var(--font-sans); }

/* Identifiers and quantities are data, not prose — they get the mono face and
   never reflow as their values change. */
.strip .n,
.chip .n,
.filelist .no,
.filelist .r .cap,
.psg .h .dt,
.psg .h .no,
.cite,
.mrow .meta,
.overview dd,
code {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.cite { font-weight: 500; }
.mrow .meta { font-size: 12px; }

/* ================================================================ layout

   Screens 1–2 · the promise sits beside the form on a wide viewport rather than
   stacked under it, so the first thing an attorney reads is what the account holds. */

.auth { display: grid; gap: var(--s6); align-items: start; }
@media (min-width: 1024px) {
  .center { max-width: 1000px; margin: 11vh auto; }
  .auth { grid-template-columns: 1fr 400px; gap: var(--s7); }
  .auth .pitch { padding-top: var(--s3); }
  .auth .pitch h1 { font-size: 34px; max-width: 16ch; margin-top: var(--s5); }
  .auth .pitch .trust { margin-top: var(--s5); }
}
.auth .pitch .logo { display: block; height: 30px; color: var(--ink); }

/* Screen 13 · the pile is described beside the work, not above it. */
.matter-grid { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 1100px) {
  .matter-grid { grid-template-columns: minmax(0, 1.85fr) minmax(280px, 1fr); gap: var(--s6); }
  .matter-grid > aside { position: sticky; top: 76px; display: grid; gap: var(--s4); }
}

/* ================================================================ states */

.skel {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  padding: var(--s4); margin-bottom: var(--s3);
}
.skel i {
  display: block; height: 11px; border-radius: 100px; margin-bottom: 9px;
  background: linear-gradient(90deg, var(--sunk) 0%, var(--line) 40%, var(--sunk) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel i:last-child { margin-bottom: 0; }
@keyframes shimmer { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .skel i { animation: none; background: var(--sunk); } }

/* Results and rows arrive in sequence, once, on the way in. */
.psg, .filelist .r, .mrow, .src {
  animation: rise-in 320ms cubic-bezier(.16, 1, .3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes rise-in { from { opacity: 0; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .psg, .filelist .r, .mrow, .src { animation: none; } }

/* Fewer boxes: a list is one surface with rules between rows, not a stack of cards. */
.filelist { box-shadow: var(--shadow); }
.filelist .r { transition: background var(--fast); }


/* ---------------------------------------------------------------- grid repair
   A grid child defaults to min-width:auto, so one nowrap cell can push a whole
   column past the viewport. Every track here is allowed to shrink instead. */

.matter-grid > *, .matter-grid > aside { min-width: 0; }
@media (min-width: 1180px) {
  .matter-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}

/* A row keeps the filename readable first and lets its metadata wrap underneath. */
.filelist .r { flex-wrap: wrap; row-gap: 4px; }
.filelist .r > .nm { flex: 1 1 220px; min-width: 150px; }
.filelist .r > .no { flex: 0 0 auto; }
.holdchip { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }

.overview dl { grid-template-columns: auto minmax(0, 1fr); }
.overview dd { overflow-wrap: anywhere; }
.overview .k + .cap { max-width: 40ch; }

/* The evidence-batch list in the aside stacks rather than squeezing. */
.batchlist { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.batchlist > div { padding: 11px var(--s4); border-bottom: 1px solid var(--line); }
.batchlist > div:last-child { border-bottom: 0; }
.batchlist .nm { font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.batchlist .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); margin-top: 3px; overflow-wrap: anywhere; }
aside code { overflow-wrap: anywhere; display: inline-block; max-width: 100%; }
