/* ═══════════════════════════════════════════════════════════════════════════
   BriefAudit — the application

   Loaded after genie.css, which holds the shared Evidite system: tokens, the
   top bar, buttons, the account menu and modal, and the legal pages. Nothing
   here is shared with another product.

   Brand, from the "Two Blues" Docket design in the Evidite Figma file: the
   deep blue #3D5A6B carries the bar, the selected control and the primary
   action; the pale blues #DFE7EE and #E7F1F7 fill the quieter controls and
   hold the brief itself; slate #313A44 sets the text; white holds content,
   and a warm #F5F3ED recesses a working surface. Larken sets headlines; Tenon
   sets everything else. Panels take a small radius, lines are fine, and icons
   are single colour and stroked.

   Ordered shell → library → Home → report.
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  --pill: #dfe7ee;
  --star: #cc8d74;
  --control-h: 44px;
  --rail-w: 68px;
  --rail-w-wide: 232px;
  --page-x: clamp(20px, 3.4vw, 56px);
}

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

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

/* The large panels: Home's recents and settings, the brief, the overview
   columns and the worksheets. */
.rounded { border-radius: var(--r-sm); }

/* ═══ SHELL ═══════════════════════════════════════════════════════════════ */
body {
  background: #fff;
  color: var(--on-paper);
  font-family: var(--f-sans);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
body .foot { display: none; }

/* ── top bar ─────────────────────────────────────────────────────────────
   The deep blue, with Docket's logomark and wordmark in white and the maker in sand. */
.top {
  min-height: var(--bar-h);
  padding: 0 clamp(18px, 2.4vw, 36px);
  background: var(--ink-800);
  border-bottom: 0;
  gap: 22px;
}
.top-brand { gap: 11px; color: #fff; }
.top-name { font-weight: 700; font-size: 1.8rem; }
.top-org {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--sand);
  padding-top: 4px;
}
.top-org a { color: inherit; border-bottom-color: transparent; }
.top-org a:hover { color: #fff; border-bottom-color: var(--on-ink-3); }

.app { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: auto; }
.view.is-on { display: flex; }

/* ── the rail ─────────────────────────────────────────────────────────────
   Where you are in BriefAudit. Narrow by default, with the name on hover;
   widened, it carries its labels. */
.rail {
  flex: none;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 0 18px;
  background: #fff;
  border-right: 1px solid var(--rule-soft);
  transition: width 0.2s var(--ease);
  z-index: 20;
}
body[data-rail="wide"] .rail { width: var(--rail-w-wide); }
.rail-group { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }

.rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.98rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s;
}
.rail-btn .ico { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--paper-raised); }
.rail-btn.is-on { background: var(--paper-raised); }
.rail-btn.is-on .ico { stroke-width: 1.9; }

.rail-label { white-space: nowrap; }
body:not([data-rail="wide"]) .rail-label {
  position: absolute;
  left: calc(100% + 10px);
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: var(--ink-800);
  color: var(--on-ink);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
}
/* Fades in on hover only. A fade out would also run on every label at once
   when the rail collapses, flashing all the tooltips. */
body:not([data-rail="wide"]) .rail-btn:hover .rail-label,
body:not([data-rail="wide"]) .rail-btn:focus-visible .rail-label {
  opacity: 1;
  transform: none;
  transition: opacity 0.14s, transform 0.14s var(--ease);
}

.rail-width { color: var(--on-paper-3); }
.rail-width .rail-ico-narrow { display: none; }
body[data-rail="wide"] .rail-width .rail-ico-wide { display: none; }
body[data-rail="wide"] .rail-width .rail-ico-narrow { display: block; }

/* ── page furniture ──────────────────────────────────────────────────── */
.page-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  /* As tall with a title alone (Trash, Settings) as with the controls beside it. */
  min-height: calc(var(--control-h) + 2 * 22px + 1px);
  padding: 22px var(--page-x);
  border-bottom: 1px solid var(--rule-soft);
}
.page-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 2.6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-acts { display: flex; align-items: center; gap: clamp(14px, 2vw, 40px); }
.section-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.2;
}

/* ── controls ─────────────────────────────────────────────────────────── */
.btn {
  height: var(--control-h);
  padding: 0 20px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.95rem;
}
.btn .ico { width: 19px; height: 19px; }
.btn-dark { background: var(--ink-800); color: #fff; border-color: var(--ink-800); }
.btn-dark:not(:disabled):hover { background: var(--ink-700); }
.btn-dark:disabled { opacity: 0.45; }
.btn-line { background: #fff; color: var(--on-paper); border-color: var(--rule); }
.btn-line:hover { border-color: var(--on-paper-3); }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-risk { background: var(--bad); color: #fff; }
.btn-risk:hover { background: #8d2f15; }
.btn-quiet { height: auto; padding: 8px 12px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--on-paper-2);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--paper-raised); color: var(--on-paper); }
.icon-btn[aria-disabled="true"], .icon-btn:disabled { opacity: 0.35; pointer-events: none; }
.icon-btn-raised { background: rgba(255, 255, 255, 0.85); }

/* The star: an outline that fills when on. */
.star-btn[aria-pressed="true"] { color: var(--star); }
.star-btn[aria-pressed="true"] .ico { fill: currentColor; }

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(220px, 24vw, 420px);
}
.searchbox-wide { width: clamp(240px, 26vw, 476px); }
.searchbox-ico {
  position: absolute;
  left: 16px;
  width: 22px;
  height: 22px;
  color: var(--on-paper-3);
  pointer-events: none;
}
.searchbox input {
  width: 100%;
  height: var(--control-h);
  padding: 0 14px 0 52px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.92rem;
}
.searchbox input::placeholder { color: var(--on-paper-3); }
.searchbox input:focus { outline: none; border-color: var(--on-paper); }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none;
  height: 38px;
  padding: 0 38px 0 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper-2);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.select select:hover { border-color: var(--on-paper-3); color: var(--on-paper); }
.select-caret { position: absolute; right: 12px; pointer-events: none; color: var(--on-paper-3); }

/* Pills: the report's three screens and the library's shelves. */
.pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  height: 38px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: var(--on-paper);
  font: inherit;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.pill:hover { background: #d2d8e0; }
.pill.is-on { background: var(--accent); color: #fff; }
.pill.is-on:hover { background: var(--accent-deep); }
.pill[data-empty] { color: var(--on-paper-3); }

.link-act {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.link-act:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── menus ───────────────────────────────────────────────────────────── */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: 0 12px 32px rgba(49, 58, 68, 0.14);
}
.menu[hidden] { display: none; }
.menu-right { left: auto; right: 0; }
.menu-label {
  padding: 8px 10px 4px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-3);
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--paper-raised); outline: none; }
.menu-item[aria-disabled="true"] { color: var(--on-paper-3); pointer-events: none; }
.menu-item-risk { color: var(--bad); }
.menu-kind { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--on-paper-3); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--rule-soft); }

.empty-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--on-paper-3);
  font-size: 0.92rem;
}
.empty-note .ico { width: 22px; height: 22px; }

.alert { margin-top: 14px; }
.report-alert { margin: 18px var(--page-x) 0; }
.report-sample {
  margin: 18px var(--page-x) 0;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 0.88rem;
  color: var(--on-paper-2);
}
.report-sample[hidden], .star-btn[hidden], .menu-item[hidden], .menu-sep[hidden] { display: none; }

/* ═══ LIBRARY ═════════════════════════════════════════════════════════════ */
.library-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--page-x) 0;
}
.library-bar-end { justify-content: flex-end; }
.library-tools { display: flex; align-items: center; gap: 18px; }

.layout-toggle {
  display: flex;
  height: 38px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}
.layout-toggle button {
  display: grid;
  place-items: center;
  width: 38px;
  border: 0;
  background: none;
  color: var(--on-paper-3);
  cursor: pointer;
}
.layout-toggle button[aria-pressed="true"] { color: var(--on-paper); background: var(--paper-raised); }
.layout-toggle .ico { width: 20px; height: 20px; }

.library { padding: 30px var(--page-x) 48px; }
.library[data-layout="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
  align-content: start;
}
.library[data-layout="grid"] > .empty-note { grid-column: 1 / -1; }

/* ── a brief, as a card ──────────────────────────────────────────────── */
.brief-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent-tint);
  transition: border-color 0.15s;
}
.brief-card:hover { border-color: var(--accent); }
.bc-head { display: flex; align-items: flex-start; gap: 8px; min-height: 44px; }
.bc-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* The name is the card's one link, stretched over all of it. */
.bc-name::after { content: ""; position: absolute; inset: 0; }
.bc-name:focus-visible { outline: none; }
.brief-card:has(.bc-name:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.bc-head .menu-wrap, .bc-foot .star-btn { position: relative; z-index: 2; }

.brief-card .thumb { aspect-ratio: 1.94; }
.bc-foot { display: flex; align-items: flex-end; gap: 8px; }
.bc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bc-when { font-size: 0.8rem; color: var(--on-paper-3); }
.bc-case {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brief-card:not(.is-starred) .bc-foot .star-btn { opacity: 0; }
.brief-card:hover .bc-foot .star-btn,
.brief-card .bc-foot .star-btn:focus-visible { opacity: 1; }

/* ── page one, as a picture ──────────────────────────────────────────── */
.thumb {
  position: relative;
  display: block;
  overflow: hidden;
  background: #fff;
}
.thumb img, .thumb-page {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* ── a brief, as a row ───────────────────────────────────────────────── */
.brief-table { display: flex; flex-direction: column; }
.brief-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) 40px minmax(170px, 0.9fr) 40px;
  align-items: center;
  gap: 16px;
  min-height: 84px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}
.brief-row-head { min-height: 56px; font-weight: 500; }
.br-name button {
  max-width: 100%;
  border: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.br-name button:hover { text-decoration: underline; text-underline-offset: 3px; }
.br-case, .br-when { color: var(--on-paper-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-row:not(.is-starred):not(:hover) .br-star .star-btn { opacity: 0; }
.br-menu { justify-self: end; }

/* ── Starred's two shelves ───────────────────────────────────────────── */
.shelf { padding: 22px var(--page-x) 0; }
.shelf-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-size: 1.55rem;
  cursor: pointer;
  list-style: none;
}
.shelf-title::-webkit-details-marker { display: none; }
.shelf-title .ico { transform: rotate(-90deg); transition: transform 0.15s var(--ease); }
.shelf[open] .shelf-title .ico { transform: none; }
.shelf .library { padding: 18px 0 24px; }
.shelf > .empty-note { padding: 14px 0 24px; }

/* ── screens not built yet ───────────────────────────────────────────── */
.placeholder {
  max-width: 520px;
  margin: clamp(48px, 12vh, 140px) auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  color: var(--on-paper-2);
}
.placeholder-ico { width: 34px; height: 34px; color: var(--on-paper-3); }
.placeholder-title { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; color: var(--on-paper); }
.placeholder .btn { margin-top: 8px; }

.settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding: 32px var(--page-x);
  align-content: start;
}
.setting {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 30px 34px;
  background: #fff;
  color: var(--on-paper-2);
  font-size: 0.92rem;
}
.setting .section-title { color: var(--on-paper); }

/* ═══ HOME ════════════════════════════════════════════════════════════════ */
.home-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: 36px;
  padding: 50px var(--page-x);
  align-items: stretch;
  min-height: 0;
  max-height: 720px;
}
.home-grid[hidden] { display: none; }
.home-intake { display: flex; flex-direction: column; min-height: 420px; }

.drop {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed var(--on-paper-3);
  border-radius: var(--r-sm);
  background: var(--paper-raised);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.drop[hidden] { display: none; }
.drop:hover, .drop[data-drag] { background: #e4e8ed; border-color: var(--on-paper); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-ico { width: 46px; height: 46px; color: var(--on-paper-2); margin-bottom: 18px; stroke-width: 1.25; }
.drop-title { font-size: 1.15rem; }
.drop-meta { font-size: 0.8rem; color: var(--on-paper-2); }

/* The sample brief, below the upload and only while nothing has been picked. */
.sample {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
}
.sample[hidden] { display: none; }
.sample-copy { flex: 1 1 260px; min-width: 0; }
.sample-title { font-size: 1rem; font-weight: 500; }
.sample-note { margin-top: 2px; font-size: 0.86rem; color: var(--on-paper-2); }
.sample-links { display: flex; gap: 16px; margin-top: 6px; font-size: 0.86rem; }
.sample-links a { color: var(--on-paper); text-decoration: underline; text-underline-offset: 2px; }
.sample-go { flex: none; }
.sample-error { flex: 1 0 100%; font-size: 0.86rem; color: var(--bad); }
.sample-error[hidden] { display: none; }

.picked {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px clamp(24px, 3vw, 48px);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
}
.picked[hidden] { display: none; }
.picked-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule-soft);
}
.picked-file > .ico { width: 24px; height: 24px; color: var(--on-paper-2); }
.picked-name { flex: 1; min-width: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-size { font-size: 0.82rem; color: var(--on-paper-3); }
.picked-note { margin-top: 16px; font-size: 0.88rem; color: var(--on-paper-2); max-width: 54ch; }
.btn-go {
  width: 100%;
  height: 50px;
  margin-top: 22px;
  font-size: 1rem;
  background: var(--ink-800);
  color: #fff;
}
.btn-go:not(:disabled):hover { background: var(--ink-700); }
.btn-go::after { display: none; }

.recents {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 34px clamp(22px, 2.6vw, 48px) 40px;
  background: var(--paper);
  min-height: 0;
}
.recents-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  min-height: 0;
}
.recent-cards > .empty-note { grid-column: 1 / -1; }
.recent-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.recent-card .thumb {
  aspect-ratio: 0.96;
  margin-bottom: 18px;
  background: #fff;
  outline: 1px solid transparent;
  transition: outline-color 0.15s;
}
.recent-card:hover .thumb { outline-color: var(--accent); }
.recent-name {
  font-size: 0.92rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recent-when { font-size: 0.78rem; color: var(--on-paper-3); }

/* ── a run in flight ─────────────────────────────────────────────────────
   Home gives way entirely to the run: what is being verified, and how far
   each stage has got. */
.run {
  width: min(680px, 100% - 2 * var(--page-x));
  margin: clamp(40px, 10vh, 110px) auto 48px;
}
.run[hidden] { display: none; }
.run-kicker {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
}
.run-dot {
  width: 20px;
  height: 20px;
  border: 1px solid var(--on-paper-3);
  border-radius: 50%;
  position: relative;
}
.run-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: run-pulse 1.4s var(--ease) infinite;
}
.run[data-done] .run-dot { background: var(--ink-800); border-color: var(--ink-800); }
.run[data-done] .run-dot::after { animation: none; background: #fff; inset: 6px; }
@keyframes run-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}
.run-subject {
  margin: 26px 0 30px;
  font-weight: 400;
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 38px clamp(22px, 2.6vw, 36px) 40px;
  border-radius: var(--r-sm);
  background: var(--paper-raised);
}
.step {
  --fill: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 20px;
  row-gap: 8px;
  align-items: center;
  color: var(--on-paper-3);
  transition: color 0.2s;
}
.step-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.step-dot .ico { width: 12px; height: 12px; stroke-width: 2.5; opacity: 0; color: #fff; }
.step-name { font-size: 1.02rem; }
.step-tag {
  min-width: 4ch;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.step-bar {
  grid-column: 2 / 4;
  height: 3px;
  border-radius: 2px;
  background: rgba(49, 58, 68, 0.1);
  overflow: hidden;
  display: none;
}
.step-fill {
  display: block;
  height: 100%;
  background: var(--on-paper-2);
  transform-origin: left center;
  transform: scaleX(var(--fill));
}
.step[data-at="now"] { color: var(--on-paper); }
.step[data-at="now"] .step-name { font-weight: 500; }
.step[data-at="now"] .step-dot { background: var(--on-paper-3); border-color: var(--on-paper-3); }
.step[data-at="now"] .step-bar { display: block; }
.step[data-at="done"] { color: var(--on-paper); }
.step[data-at="done"] .step-name { font-weight: 500; }
.step[data-at="done"] .step-dot { background: var(--on-paper-2); border-color: var(--on-paper-2); }
.step[data-at="done"] .step-dot .ico { opacity: 1; }

.run-note {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--on-paper-3);
}
.elapsed { font-variant-numeric: tabular-nums; }

/* ═══ REPORT ══════════════════════════════════════════════════════════════
   A fixed-height workspace: the brief beside the findings, each screen
   scrolling inside itself rather than the page. */
#view-report { overflow: hidden; }

.crumb {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 16px var(--page-x) -8px calc(var(--page-x) - 6px);
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--on-paper-2);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.crumb[hidden] { display: none; }
.crumb:hover { color: var(--on-paper); }
.crumb .ico { width: 20px; height: 20px; }

.report {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(270px, 27vw, 534px) minmax(0, 1fr);
  gap: 20px;
  padding: 24px clamp(18px, 2.4vw, 44px) 32px;
}
.report[data-brief="closed"] { grid-template-columns: 52px minmax(0, 1fr); }

/* ── the brief panel ─────────────────────────────────────────────────── */
.brief-panel {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 16px 30px 34px;
  background: var(--accent-tint);
}
.report[data-brief="closed"] .brief-panel { display: none; }
.bp-bar { display: flex; align-items: center; gap: 4px; margin: 0 -14px -10px -14px; }
.bp-spacer { flex: 1; }
.bp-thumb { position: relative; }
.bp-thumb .thumb {
  aspect-ratio: 1.7;
  background: #fff;
}
.bp-thumb .thumb[href] { cursor: zoom-in; }
.bp-menu { position: absolute; top: 10px; right: 10px; }

.bp-meta { display: flex; flex-direction: column; gap: 22px; }
.bp-row dt {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
  margin-bottom: 4px;
}
.bp-row dd { font-size: 1.02rem; line-height: 1.4; overflow-wrap: anywhere; }
.bp-row dd.bp-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.22;
}

.brief-tab {
  display: none;
  align-self: start;
  justify-items: center;
  height: 100%;
  padding-top: 20px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--accent-tint);
  color: var(--on-paper-3);
  cursor: pointer;
}
.brief-tab .ico { width: 26px; height: 26px; stroke-width: 1.25; }
.brief-tab:hover { color: var(--on-paper); }
.report[data-brief="closed"] .brief-tab { display: grid; }

/* ── the findings ────────────────────────────────────────────────────── */
.report-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.report-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
}
.report-acts { display: flex; align-items: center; gap: 14px; }
.split { display: flex; }
.split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-caret {
  width: 44px;
  padding: 0;
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.split-caret[aria-expanded="true"] .ico { transform: rotate(180deg); }

.panel { flex: 1; min-height: 0; }
.panel[hidden] { display: none; }

/* Count over title: "78 Citations", the figure in light, the word in bold. */
.count-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 2.2vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.count-n { font-weight: 300; color: var(--on-paper-2); }

/* ── overview ────────────────────────────────────────────────────────── */
/* Both columns share one set of rows (title, four categories, then a filler
   that runs the paper to the bottom), so each category sits level with its
   counterpart and is as tall as the taller of the two. The panel scrolls as
   one for the same reason: two scrollers would drift the rows apart again. */
.panel-overview:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto) 1fr;
  gap: clamp(12px, 2.2vh, 24px) 24px;
  overflow: auto;
}
.ov-col {
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  padding: clamp(24px, 3.6vh, 40px) clamp(20px, 2.2vw, 40px) 16px;
  background: var(--paper);
}
.ov-col .count-title { margin-bottom: clamp(4px, 0.4vh, 8px); }
.ov-cards { display: contents; }
.ov-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "k note" "n .";
  align-items: end;
  gap: clamp(8px, 1.6vh, 18px) 24px;
  padding: clamp(16px, 2.4vh, 26px) 26px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ov-card:hover { border-color: var(--on-paper-3); }
.ov-k { grid-area: k; align-self: start; font-weight: 700; font-size: 0.92rem; }
.ov-note { grid-area: note; align-self: start; font-size: 0.78rem; line-height: 1.45; color: var(--on-paper); max-width: 34ch; }
.ov-n {
  grid-area: n;
  font-weight: 300;
  font-size: clamp(1.8rem, 2.2vw, 2.5rem);
  line-height: 1;
  color: var(--on-paper-2);
  font-variant-numeric: tabular-nums;
}

/* ── the worksheet: list beside detail ───────────────────────────────── */
.panel:not(.panel-overview):not([hidden]) { display: flex; }
.worksheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.sheet-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 34px clamp(20px, 2.2vw, 40px) 0;
}
/* The note wraps; the tools keep their place beside it. */
.sheet-lede { flex: 1 1 auto; min-width: 0; }
.sheet-note { margin-top: 8px; font-size: 0.85rem; color: var(--on-paper-2); max-width: 70ch; }
.sheet-tools { flex: none; display: flex; align-items: center; gap: 12px; }
.sheet-tools .searchbox { width: clamp(220px, 22vw, 400px); }

.subtabs {
  flex: none;
  display: flex;
  gap: clamp(16px, 2.6vw, 48px);
  padding: 22px clamp(20px, 2.2vw, 40px) 0;
  box-shadow: inset 0 -1px var(--rule);
  overflow-x: auto;
}
.subtab {
  position: relative;
  padding: 10px 2px 14px;
  border: 0;
  background: none;
  color: var(--on-paper-2);
  font: inherit;
  font-size: 0.95rem;
  white-space: nowrap;
  cursor: pointer;
}
.subtab:hover { color: var(--on-paper); }
.subtab[aria-pressed="true"] { color: var(--on-paper); }
.subtab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--ink-800);
}
.subtab-n { margin-left: 4px; color: var(--on-paper-3); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 20px;
  padding: 12px clamp(14px, 1.6vw, 26px) 14px;
}
.index { min-height: 0; display: flex; }
.index-body { flex: 1; min-height: 0; display: flex; gap: 10px; }
.rows { flex: 1; min-height: 0; overflow: auto; }
.index-empty { padding: 28px 16px; color: var(--on-paper-2); font-size: 0.92rem; }

.row {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.row:hover { background: rgba(255, 255, 255, 0.55); }
.row[aria-current="true"] { background: #fff; }
.row[aria-current="true"] .row-title,
.row[aria-current="true"] .row-quote { font-weight: 500; }
.row-n { color: var(--on-paper-2); font-variant-numeric: tabular-nums; }
.row[aria-current="true"] .row-n { color: var(--on-paper); font-weight: 500; }
.row-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.row-title { line-height: 1.35; }
.row-quote {
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-src { font-size: 0.8rem; color: var(--on-paper-2); }
.row-cite { color: var(--on-paper-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* A long verdict wraps inside its column rather than running under the cite. */
.row-main .chip { max-width: 100%; white-space: normal; }
/* Inside a bucket the chip would only repeat the tab; in All it is the verdict. */
.workspace:not([data-filter="all"]) .row .chip { display: none; }

/* The spine: every finding as a tick, in the order shown — a map of the
   whole list beside the part of it in view. */
.spine {
  flex: none;
  width: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 0;
  border-radius: 4px;
  background: rgba(49, 58, 68, 0.06);
  cursor: pointer;
}
.tick { flex: 1; min-height: 1px; max-height: 10px; border-radius: 1px; background: var(--mute); opacity: 0.55; }
.tick[data-v="verified"]   { background: var(--ok); }
.tick[data-v="partial"]    { background: var(--warn); }
.tick[data-v="unverified"] { background: var(--bad); }
.tick[data-off] { opacity: 0.15; }
.tick[data-cur] { opacity: 1; box-shadow: 0 0 0 1px var(--ink-800); }

/* ── the detail pane ─────────────────────────────────────────────────── */
.detail-wrap {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-sm);
}
.detail-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 clamp(20px, 2vw, 28px);
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--rule-soft);
}
.detail-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.detail-head .d-n {
  font-family: var(--f-display);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pager { display: flex; align-items: center; gap: 6px; }
.pager-at { margin-right: 6px; font-size: 0.8rem; color: var(--on-paper-2); font-variant-numeric: tabular-nums; }
.pager-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--on-paper);
  cursor: pointer;
}
.pager-btn .ico { width: 15px; height: 15px; }
.pager-btn:hover:not(:disabled) { border-color: var(--on-paper-2); }
.pager-btn:disabled { color: var(--on-paper-3); cursor: default; }

.detail {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px clamp(20px, 2vw, 28px) 34px;
  font-size: 0.92rem;
}
.detail:focus { outline: none; }
.detail .back { display: none; margin-bottom: 18px; }
.detail-blank {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--on-paper-3);
  text-align: center;
}
/* the logomark, muted: the deep blue faded toward the pane */
.detail-blank-mark { width: 26px; height: 25px; color: var(--accent); opacity: 0.3; }

.d-lede {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule-soft);
}
.d-title { font-size: 1.12rem; font-weight: 500; line-height: 1.35; }
.d-cite-line { margin-top: 10px; color: var(--on-paper-2); font-size: 0.95rem; }
.d-guidance { font-size: 0.8rem; line-height: 1.55; color: var(--on-paper-2); max-width: 72ch; }
/* With the brief panel closed there is room to set the guidance beside the
   name, as the wireframe does. */
.report[data-brief="closed"] .d-lede { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 24px; }

.d-block { padding: 22px 0; border-bottom: 1px solid var(--rule-soft); }
.d-block:last-child { border-bottom: 0; }
.d-label {
  margin-bottom: 12px;
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--on-paper-3);
}
.d-lede .d-label { margin-bottom: 6px; }
.d-raw { font-size: 0.98rem; line-height: 1.5; overflow-wrap: anywhere; }
.d-raw mark { background: var(--bad-tint); color: var(--bad); border-radius: 2px; padding: 0 2px; }
.d-none { color: var(--on-paper-2); line-height: 1.55; }
.d-prov { margin-top: 10px; font-size: 0.78rem; color: var(--on-paper-2); }
.d-prov code { font-family: inherit; }

.d-nt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
  padding: 12px 16px;
  border-left: 3px solid var(--bad);
  background: var(--bad-tint);
  color: #7d2a12;
  font-size: 0.88rem;
}
.d-nt b { text-transform: capitalize; }
.d-goodlaw { margin-top: 16px; font-size: 0.8rem; line-height: 1.55; color: var(--on-paper-2); max-width: 72ch; }

/* The canonical record: submitted against canonical, field by field. */
.record { border: 1px solid var(--rule-soft); }
.fields { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.fields thead th {
  padding: 9px 14px;
  background: var(--sand);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}
.fields thead th:last-child, .fields .f-mark { text-align: right; }
.fields tbody th, .fields td {
  padding: 10px 14px;
  border-top: 1px solid var(--rule-soft);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.fields tbody th { font-weight: 400; color: var(--on-paper-2); white-space: nowrap; }
.f-mark { white-space: nowrap; font-weight: 500; }
.f-mark .ico { width: 13px; height: 13px; margin-right: 3px; vertical-align: -2px; stroke-width: 2.25; }
tr[data-v="match"] .f-mark { color: var(--ok); }
tr[data-v="mismatch"] .f-mark { color: var(--bad); }
tr[data-v="mismatch"] td:nth-child(3) { color: var(--bad); }
tr[data-v="partial"] .f-mark { color: var(--warn); }
.record-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 14px;
  border-top: 1px solid var(--rule-soft);
  background: var(--paper);
  font-size: 0.72rem;
  color: var(--on-paper-2);
}
.record-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--on-paper); }
.record-foot svg { width: 13px; height: 13px; }

/* A similarly named case (docs/name-fallback.md): the record named as a heading,
   its court, date and docket on one line, then its citation, docket and date
   beside the brief's, what it fits on, and the way to the opinion. Amber rule
   where it fits on more than name and court (a possible match), neutral where
   it doesn't. */
.pm { padding-left: 14px; border-left: 2px solid var(--rule); }
.pm[data-fits="1"] { border-left-color: var(--warn-line); }
.pm-cited { font-size: 0.82rem; color: var(--on-paper-2); }
.pm-compare { margin-top: 10px; border-collapse: collapse; font-size: 0.78rem; }
.pm-compare th, .pm-compare td { padding: 3px 12px 3px 0; text-align: left; vertical-align: top; }
.pm-compare thead th { font-size: 0.7rem; font-weight: 500; color: var(--on-paper-3); }
.pm-compare tbody th { font-weight: 500; color: var(--on-paper-2); }
.pm-compare td { color: var(--on-paper); }
.pm-compare .pm-mark { color: var(--on-paper-3); }
.pm-compare tr[data-fits="1"] .pm-mark { color: var(--warn); font-weight: 500; }
.pm-more > summary { cursor: pointer; padding: 10px 0; font-size: 0.78rem; color: var(--on-paper-2); }
.pm-name { font-family: var(--f-display); font-size: 1.12rem; line-height: 1.35; color: var(--on-paper); }
.pm-meta { margin-top: 4px; font-size: 0.82rem; color: var(--on-paper-2); }
.pm-note { margin-top: 8px; font-size: 0.78rem; font-weight: 500; color: var(--on-paper); }
.pm-diff { margin-top: 6px; font-size: 0.78rem; color: var(--on-paper-2); }
.pm-suggest { margin-top: 8px; font-size: 0.82rem; color: var(--on-paper); }
.pm-suggest-label { display: block; font-size: 0.72rem; color: var(--on-paper-2); margin-bottom: 2px; }
.pm-links { margin-top: 8px; font-size: 0.75rem; }
.pm-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--on-paper); }
.pm-links svg { width: 13px; height: 13px; }
.pm-caveat {
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--on-paper-3);
  max-width: 72ch;
}
.d-block:has(+ .pm-caveat) { border-bottom: 0; padding-bottom: 0; }

/* How other courts cite a WL number (IN-55): a case as the citing courts name
   it, then the opinions that cite it so. Evidence, not a match: a neutral rule
   where a possible match has an amber one. */
.ca { padding-left: 14px; border-left: 2px solid var(--rule); }
.ca + .ca { margin-top: 16px; }
.ca-differs { margin-top: 6px; font-size: 0.78rem; font-weight: 500; color: var(--warn); }
.ca-by { margin-top: 8px; font-size: 0.78rem; line-height: 1.5; color: var(--on-paper-2); }
.ca-by a { color: var(--on-paper); }
.ca-other { margin-top: 16px; font-size: 0.75rem; line-height: 1.5; color: var(--on-paper-2); }

/* Verdict chips: the finer status the pipeline reported. */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--mute-line);
  border-radius: 999px;
  background: var(--mute-tint);
  color: var(--mute);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.chip-verified   { border-color: var(--ok-line);   background: var(--ok-tint);   color: var(--ok); }
.chip-partial    { border-color: var(--warn-line); background: var(--warn-tint); color: var(--warn); }
.chip-unverified { border-color: var(--bad-line);  background: var(--bad-tint);  color: var(--bad); }

/* Cross-links between the two axes, and out to a source. */
.jumps { display: flex; flex-direction: column; gap: 8px; }
.jump {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--on-paper);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.jump:hover { border-color: var(--on-paper-3); }
.jump svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.jump-q { line-height: 1.45; }

/* The quotation compared with its source, reading by reading. */
.qp { display: flex; flex-direction: column; gap: 12px; }
.qp-reading { display: flex; flex-direction: column; gap: 10px; }
.qp-reading + .qp-reading { padding-top: 14px; border-top: 1px dashed var(--rule); }
.qp-side { padding: 14px 16px; border-radius: var(--r-sm); background: var(--paper); }
.qp-side[data-side="canonical"] { background: #fff; border: 1px solid var(--rule-soft); }
.qp-k {
  display: block;
  margin-bottom: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-3);
}
.qp-t { font-family: var(--f-display); font-size: 1.02rem; line-height: 1.55; }
.q-del { background: var(--bad-tint); color: var(--bad); font-weight: 700; }
.q-ins { background: var(--ok-tint); color: var(--ok); font-weight: 700; }

.first-use { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.first-use-k { font-size: 0.75rem; color: var(--on-paper-3); }
.tally-pct { color: var(--on-paper-3); }

/* ── dialogs ─────────────────────────────────────────────────────────── */
.confirm {
  margin: auto;
  max-width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  box-shadow: 0 24px 60px rgba(49, 58, 68, 0.28);
}
.confirm::backdrop { background: rgba(38, 45, 53, 0.45); }
.confirm-inner { display: flex; flex-direction: column; gap: 14px; padding: 30px 30px 26px; }
.confirm h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.2; }
.confirm p { font-size: 0.92rem; color: var(--on-paper-2); }
.confirm-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ═══ RESPONSIVE ══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  /* One column in a scrolling pane: each row is as tall as its content. A row
     sized to the remaining height (minmax(0, 1fr)) collapsed under a tall brief
     panel, and the findings were drawn over it. */
  .report { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; overflow: auto; }
  .report[data-brief="closed"] { grid-template-columns: minmax(0, 1fr); }
  .brief-panel { min-height: auto; overflow: visible; display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); column-gap: 28px; }
  .bp-bar { grid-column: 1 / -1; }
  .report[data-brief="closed"] .brief-tab { height: auto; padding: 10px; justify-self: start; }
  /* Stacked, the columns no longer sit side by side, so each keeps its own rows. */
  .panel-overview:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; overflow: visible; }
  .ov-col { grid-row: auto; display: flex; flex-direction: column; gap: clamp(16px, 2.6vh, 32px); padding-bottom: 40px; }
  .ov-col .count-title { margin-bottom: 0; }
  .ov-cards { display: flex; flex-direction: column; gap: clamp(12px, 2.2vh, 24px); }
  .report-main { min-height: 640px; }
}

@media (max-width: 980px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); max-height: none; }
  .home-intake { min-height: 300px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace .detail-wrap { display: none; }
  .workspace[data-view="detail"] .index { display: none; }
  .workspace[data-view="detail"] .detail-wrap { display: flex; }
  .workspace[data-view="detail"] .back { display: inline-flex; }
  .page-head { flex-wrap: wrap; }
  /* One pane, list or detail, at its natural height: the report pane is the one
     scroller, so a phone's height is not split among nested scrolling boxes. */
  .report-main { min-height: 0; }
  .panel:not(.panel-overview):not([hidden]), .worksheet, .workspace, .index, .index-body,
  .rows, .detail-wrap, .detail { min-width: 0; min-height: auto; overflow: visible; }
  .workspace, .detail { flex: none; }
  .spine { display: none; }
}

@media (max-width: 720px) {
  :root { --rail-w: 56px; }
  .rail-group { padding: 0 8px; }
  .recent-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brief-panel { grid-template-columns: minmax(0, 1fr); }
  .brief-row { grid-template-columns: minmax(0, 1fr) 40px 40px; }
  .br-case, .br-when, .brief-row-head span:nth-child(2), .brief-row-head span:nth-child(4) { display: none; }
  .ov-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "k" "note" "n"; }
  .top-org { display: none; }
  .sheet-head, .sheet-tools { flex-wrap: wrap; }
  .report-acts { flex-wrap: wrap; }
  .sheet-tools { flex: 1 1 100%; }
  .sheet-tools .searchbox { flex: 1 1 auto; width: auto; min-width: 0; }
}
