/* Result view: scorecard, report prose, and the source registry. */

/* ═══ Tabs ═════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
  margin: var(--space-2) 0 var(--space-8);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--space-3) var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
}
.tab:hover { color: var(--text-primary); }
.tab[data-active="true"] {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Panels fill the pane. Only running prose needs a narrow measure, and it
   sets one itself. */
.panel { max-width: none; }

/* ═══ Scorecard ════════════════════════════════════════════════════════ */

.scorecard__head {
  display: flex;
  align-items: flex-end;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.scorecard__figure { display: flex; align-items: baseline; gap: var(--space-2); }
.scorecard__value {
  font-family: var(--font-serif);
  font-size: 64px;
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.scorecard__figure[data-tone="success"] .scorecard__value { color: var(--success); }
.scorecard__figure[data-tone="accent"]  .scorecard__value { color: var(--accent); }
.scorecard__figure[data-tone="warning"] .scorecard__value { color: var(--warning); }
.scorecard__figure[data-tone="muted"]   .scorecard__value { color: var(--text-tertiary); }

.scorecard__denom {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--text-tertiary);
}

.scorecard__caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 6px;
}
.scorecard__band {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}
.scorecard__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ── Dimensions ──
   The fill carries a faint-to-full ink gradient sized to the whole track
   (100cqw of the bar), not to itself, so a short bar shows only the faint end
   and a full one reaches deep ink: depth agrees with length without any
   per-value class from the renderer. Without container units the gradient
   simply spans the fill. */
.dims { display: flex; flex-direction: column; gap: var(--space-4); }

.dim {
  display: grid;
  grid-template-columns: 220px 1fr 72px;
  align-items: center;
  gap: var(--space-5);
}
.dim__label { font-size: var(--text-base); color: var(--text-secondary); font-weight: 500; }
.dim__bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-overlay);
  overflow: hidden;
  container-type: inline-size;
}
.dim__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--meter-low), var(--meter-high));
  background-size: 100cqw 100%;
  /* Bars grow on first paint; the delay is enough to read as deliberate
     rather than as a slow render. */
  transition: width var(--duration-slow) var(--ease-out);
}
.dim__value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}
/* Why each score: folded under its bar, readable on touch screens. */
.dim__why { grid-column: 1 / -1; margin-top: calc(-1 * var(--space-2)); }
.dim__why > summary {
  width: max-content;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.dim__why > summary::-webkit-details-marker { display: none; }
.dim__why > summary::before { content: "▸ "; }
.dim__why[open] > summary::before { content: "▾ "; }
.dim__rationale,
.dim__sources {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.dim__sources { color: var(--text-tertiary); font-size: var(--text-xs); }

/* ── Risks and opportunities ── */
.notes {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.notes__title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.notes__list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.notes__list li {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}
.notes__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent-ring);
}

/* ═══ Report prose ═════════════════════════════════════════════════════ */

.prose {
  /* Left-aligned so the report's left edge lines up with the scorecard and
     the tabs, but capped at a reading measure rather than the panel width.
     (Pixels, not `ch`: a CJK glyph is about twice the width of "0", so a
     ch-based measure would be half as wide in Chinese.) */
  max-width: 820px;
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.78;
  color: var(--text-secondary);
}

.prose h1 {
  font-size: var(--text-3xl);
  color: var(--text-primary);
  margin: 0 0 var(--space-6);
}
.prose h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin: var(--space-12) 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-default);
}
.prose h3 {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin: var(--space-8) 0 var(--space-3);
}
.prose h4 {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: var(--space-6) 0 var(--space-2);
}

.prose p { margin-bottom: var(--space-4); }
.prose strong { color: var(--text-primary); font-weight: 600; }

.prose ul, .prose ol { margin: 0 0 var(--space-5) var(--space-6); }
.prose li { margin-bottom: var(--space-2); padding-left: var(--space-1); }
.prose li::marker { color: var(--text-tertiary); }

.prose blockquote {
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-5);
  border-left: 3px solid var(--accent-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--accent-subtle);
  color: var(--text-primary);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-size: 0.82em;
}

/* Citations are the reason the report can be audited, so they are given a
   distinct treatment rather than blending into the sentence. */
.cite {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 0.12em;
  white-space: nowrap;
  margin: 0;
  cursor: pointer;
}
.cite:hover { border-color: var(--accent); }
.cite[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); }
.cite:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }

/* One citation card at a time, beside the chip on wide screens and as a
   bottom sheet on narrow ones. */
.cite-card {
  position: fixed;
  z-index: 60;
  width: min(380px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-sans);
}
.cite-card__close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: none;
  color: var(--text-tertiary);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}
.cite-card__close:hover { color: var(--text-primary); }
.cite-card__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.cite-card__item { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); }
.cite-card__item + .cite-card__item { padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.cite-card__id {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding-top: 2px;
}
.cite-card__label {
  margin: 0;
  padding-right: var(--space-5);
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  overflow-wrap: anywhere;
}
.cite-card__meta,
.cite-card__missing { margin: var(--space-1) 0 0; color: var(--text-tertiary); font-size: var(--text-xs); }
.cite-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.cite-card__open,
.cite-card__show {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.cite-card__open::after { content: " ↗"; }
.cite-card__open:hover,
.cite-card__show:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .cite-card {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 55vh;
  }
}

/* The score sits above the report it qualifies: the report is written
   before scoring, so it cannot state the number itself. */
.report-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  max-width: 760px;
  margin: 0 auto var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.report-score__open {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.report-score__open:hover { text-decoration: underline; }

.table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.prose th {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.prose td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.prose tr:last-child td { border-bottom: none; }
.prose th + th, .prose td + td { border-left: 1px solid var(--border-subtle); }

/* ═══ Sources ══════════════════════════════════════════════════════════ */

.sources__title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: var(--space-10) 0 var(--space-3);
}
.sources__title:first-child { margin-top: 0; }

.sources__list { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }

.source {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
.source:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }

.source__id {
  flex-shrink: 0;
  align-self: flex-start;
  min-width: 34px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
}
.source__body { min-width: 0; }
.source__link {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.4;
}
.source__link:hover { color: var(--accent); }

.source__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.tier {
  padding: 0 7px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
}
.tier[data-tier="high"]   { background: var(--success-subtle); color: var(--success); }
.tier[data-tier="medium"] { background: var(--warning-subtle); color: var(--warning); }
.tier[data-tier="low"]    { background: var(--bg-overlay);     color: var(--text-tertiary); }
.source__age {
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--warning-subtle);
  color: var(--warning);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Saved-source browsing stays scoped here: retrieval diagnostics reuse the
   older source classes and must not acquire these controls or layout rules. */
.sources__disclosure, .sources__hint, .sources__status {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}
.sources__warning {
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--warning-subtle);
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.sources__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.sources__search-label {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.sources__search {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 10px var(--space-3);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
.sources__search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.sources__pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.sources--browser button:disabled { opacity: 0.5; }
.sources--browser .source__id { width: 3rem; overflow-wrap: anywhere; }
.sources--browser .source__body { flex: 1; overflow-wrap: anywhere; }
.sources--browser .source__meta { flex-wrap: wrap; color: var(--text-tertiary); }
.sources--browser .tier { max-width: 100%; }
.sources--browser span.source__link:hover { color: var(--text-primary); }
.source__excerpt {
  margin-top: var(--space-3);
  border-left: 2px solid var(--border-default);
  padding-left: var(--space-3);
}
.source__excerpt summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-1) 0;
}
.source__excerpt summary:hover { color: var(--accent); }
.source__summary-source, .source__excerpt-state, .source__fault {
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--text-tertiary);
  margin: var(--space-2) 0;
}
.source__fault { color: var(--warning); }
.source__text {
  /* Render the exact saved string, not Markdown or normalized paragraphs. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin: var(--space-3) 0;
}

/* ═══ Misc ═════════════════════════════════════════════════════════════ */

/* Reader feedback: one block under the tabs, for a delivered report only. */
.feedback {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.feedback__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.feedback__choices,
.feedback__parts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.feedback__parts { margin-top: var(--space-3); }
.feedback__parts-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-right: var(--space-1);
}
.feedback .btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.feedback__status {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.empty-note {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-base);
}

.skeleton {
  height: 180px;
  background: linear-gradient(90deg,
    var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-lg);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@media (max-width: 720px) {
  .dim { grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-3); }
  .dim__bar { grid-column: 1 / -1; grid-row: 2; }
  .dim__value { text-align: right; }
  .scorecard__head { flex-wrap: wrap; gap: var(--space-3) var(--space-5); }
  .scorecard__value { font-size: 48px; }
  .prose { font-size: 16px; }
}

/* ── Citation check ────────────────────────────────────────────────────
 * The three counts sit side by side deliberately. "0 unsupported" on its own
 * reads as a clean bill of health; beside a large "could not be checked" it
 * means the screen mostly did not run, which is what a reader needs in order
 * to know what the first number is worth. So none of them is styled as a
 * headline the others hang off.
 */

.grounding__lede {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
}

.grounding__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.grounding__stat {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
}

.grounding__stat--warn  { border-color: var(--warning); background: var(--warning-subtle); }
.grounding__stat--muted { color: var(--text-tertiary); }

.grounding__value {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.grounding__stat--muted .grounding__value { color: var(--text-secondary); }

.grounding__label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.grounding__domains {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-4);
}

.grounding__list { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }

.grounding__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--border-strong);
}

.grounding__item--ungrounded { border-left-color: var(--warning); }

.grounding__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
}

.grounding__claim { font-size: var(--text-sm); color: var(--text-primary); }

.grounding__why {
  grid-column: 2;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* The code-derived boundary sits ahead of both the heuristic checks and the
 * score. It is a statement about what this run was allowed to decide, not a
 * quality verdict, so it uses the neutral accent rather than warning colors. */
.decision-applicability {
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
}

.decision-applicability__title {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.decision-applicability__detail {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin: var(--space-2) 0 0;
}

.decision-applicability__detail code {
  color: var(--text-primary);
  font-size: 0.92em;
}


/* ── Automated checks ──────────────────────────────────────────────────
 * Above the tabs, so the flags are read before the number they qualify.
 *
 * The verdict tints the border, not the whole panel. A red block over a
 * finished assessment reads as "this run failed", which is not what any of
 * these findings mean — the run succeeded and something about its output is
 * worth a second look.
 */
.reliability {
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
}
.reliability[data-tone="risk"]  { border-left-color: var(--danger); }
.reliability[data-tone="warn"]  { border-left-color: var(--warning); }
.reliability[data-tone="ok"]    { border-left-color: var(--success); }
.reliability[data-tone="muted"] { border-left-color: var(--border-strong); }

/* The decision brief: the verdict and the four things a decision needs,
   before the tabs. Same card as the reliability block, so the two read as
   one layer above the detail. */
.brief {
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}
.brief[data-tone="success"] { border-left-color: var(--success); }
.brief[data-tone="accent"]  { border-left-color: var(--accent); }
.brief[data-tone="warning"] { border-left-color: var(--warning); }
.brief[data-tone="muted"]   { border-left-color: var(--border-strong); }
.brief__head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.brief__title {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brief__verdict { color: var(--text-primary); font-size: var(--text-md); }
.brief__readiness { color: var(--text-secondary); font-size: var(--text-sm); }
.brief__lines { margin-top: var(--space-2); }
.brief__line { margin: 0 0 var(--space-1); font-size: var(--text-sm); color: var(--text-secondary); }
.brief__summary q { color: var(--text-primary); }
.brief__label {
  display: block;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.brief__summary .brief__label { display: inline; margin: 0; }
.brief__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-3);
}
@media (max-width: 720px) { .brief__cards { grid-template-columns: 1fr; } }
.brief__card { font-size: var(--text-sm); color: var(--text-primary); }
.brief__text { margin: 0; }
.brief__empty { color: var(--text-tertiary); }
.brief__changers { margin-top: var(--space-3); }
.brief__changer-list { margin: 0; padding-left: 1.2em; font-size: var(--text-sm); color: var(--text-primary); }
.brief__changer { margin: 0 0 var(--space-1); }
.brief__note { margin: var(--space-3) 0 0; font-size: var(--text-xs); color: var(--text-tertiary); }

.reliability__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
}
.reliability__head::-webkit-details-marker { display: none; }
.reliability__toggle {
  margin-left: auto;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
}
.reliability__toggle::after { content: " ▸"; }
.reliability[open] .reliability__toggle::after { content: " ▾"; }

.reliability__title {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reliability__verdict {
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
}

/* The citation counts take a line of their own under the verdict, still in
   the summary, so they are read before anyone opens the rows. */
.reliability__numbers {
  order: 1;
  flex-basis: 100%;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.reliability__note {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  margin: var(--space-2) 0 0;
}

.reliability__rows {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: var(--space-3) 0 0;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: var(--space-2);
}

.reliability__row {
  display: grid;
  grid-template-columns: minmax(150px, max-content) 1fr;
  gap: var(--space-4);
  align-items: baseline;
  font-size: var(--text-sm);
}

.reliability__label { color: var(--text-tertiary); }
.reliability__detail { color: var(--text-secondary); }
.reliability__row[data-tone="risk"] .reliability__detail { color: var(--danger); }
.reliability__row[data-tone="warn"] .reliability__detail { color: var(--warning); }

@media (max-width: 640px) {
  .reliability__row { grid-template-columns: 1fr; gap: 2px; }
}

/* ── Report audit ── One card per narrow check, so each reads as a unit. */
.audit-section {
  margin-bottom: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.audit-section h3 {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.audit-section p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-1);
}
.audit-section p:last-child { margin-bottom: 0; }

/* ── Report vs scorecard ─────────────────────────────────────────────── */

.consistency__clear {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.consistency__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.consistency__item {
  border-left: 2px solid var(--border-strong);
  padding-left: var(--space-3);
}
.consistency__item--blocker { border-left-color: var(--danger); }
.consistency__item--warning { border-left-color: var(--warning); }

.consistency__detail {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* The quoted sentence is the point of the finding: a phrase table decided
 * this, and a reader has to be able to overrule it by reading the words. */
.consistency__excerpt {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.consistency__excerpt-label {
  display: block;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  margin-bottom: var(--space-1);
}

.gate__sub--retention {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* The market disclosure folds to one line that says whether the cap moved
   the score; it opens by itself when it did. */
.scorecard__market-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  cursor: pointer;
  list-style: none;
}
.scorecard__market-summary::-webkit-details-marker { display: none; }
.scorecard__market-summary .notes__title { margin-bottom: 0; }
.scorecard__market-status { color: var(--text-secondary); font-size: var(--text-sm); }
.scorecard__market-status::after { content: " ▸"; color: var(--accent); }
.scorecard__market-caveat[open] .scorecard__market-status::after { content: " ▾"; }
.scorecard__market-caveat[open] > .scorecard__market-summary { margin-bottom: var(--space-3); }

/* The market-size figures, each under the market its source names. A reading
   aid inside the folded disclosure: compact, and never louder than the score. */
.market-estimates { margin: var(--space-3) 0; }
.market-estimates__lede { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.market-estimates__group + .market-estimates__group { margin-top: var(--space-3); }
.market-estimates__scope {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.market-estimates__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.market-estimates__table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 0 var(--space-3) var(--space-1) 0;
  border-bottom: 1px solid var(--border);
}
.market-estimates__table td {
  padding: var(--space-1) var(--space-3) var(--space-1) 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.market-estimates__figure { white-space: nowrap; }
.market-estimates__note { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--text-tertiary); }

/* ── Comparing two runs ────────────────────────────────────────────── */

.compare__heads {
  display: grid;
  grid-template-columns: minmax(10ch, 0.6fr) 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-6);
}
.compare__run {
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  min-width: 0;
}
.compare__topic {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  margin-bottom: var(--space-2);
}
.compare__topic:hover { color: var(--accent); }
.compare__meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; font-size: var(--text-sm); color: var(--text-secondary); }
.compare__table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.compare__table th, .compare__table td {
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.compare__table thead th { color: var(--text-tertiary); font-weight: 500; font-size: var(--text-sm); }
.compare__table tbody th { font-weight: 500; color: var(--text-secondary); }
.compare__table td { text-align: right; white-space: nowrap; }
.compare__row--overall th, .compare__row--overall td { font-weight: 600; color: var(--text-primary); }
.compare__delta[data-sign="up"]   { color: var(--success); }
.compare__delta[data-sign="down"] { color: var(--danger); }
.compare__delta[data-sign="same"] { color: var(--text-tertiary); }
.compare__briefs { margin-top: var(--space-8); display: flex; flex-direction: column; gap: var(--space-4); }
.compare__brief-row {
  display: grid;
  grid-template-columns: minmax(10ch, 0.6fr) 1fr 1fr;
  gap: var(--space-4);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
.compare__brief-label { color: var(--text-tertiary); font-size: var(--text-sm); padding-top: 2px; }
.compare__brief-cell { color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) {
  /* Two columns on a phone: the run cards side by side, the row label above its pair. */
  .compare__heads { grid-template-columns: 1fr 1fr; }
  .compare__corner { display: none; }
  .compare__brief-row { grid-template-columns: 1fr 1fr; }
  .compare__brief-label { grid-column: 1 / -1; padding-top: 0; }
}

/* The picker for a second run. */
.picker {
  width: min(34rem, calc(100vw - 2 * var(--space-5)));
  max-height: min(80vh, 40rem);
  padding: var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}
.picker::backdrop { background: var(--scrim); }
.picker__title { font-family: var(--font-serif); font-size: var(--text-xl); margin-bottom: var(--space-2); }
.picker__intro { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.picker__list { list-style: none; margin: 0 0 var(--space-4); padding: 0; max-height: 50vh; overflow-y: auto; }
.picker__choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.picker__choice:hover, .picker__choice:focus-visible { background: var(--bg-hover); }
.picker__topic { font-weight: 500; overflow-wrap: anywhere; }
.picker__meta { font-size: var(--text-xs); color: var(--text-tertiary); }
.picker__actions { display: flex; justify-content: flex-end; }
