/* styles.css — AI Model Bias design system: tokens, components, print, mobile */

/* ─── 1. Custom properties ─────────────────────────────────────────────────── */
:root {
  --paper: #f6f1e8;
  --paper-2: #efe9dd;
  --paper-3: #e6dfd0;
  --rule: #d8cfbb;
  --rule-strong: #b8ad96;
  --ink: #1a1714;
  --ink-2: #2e2823;
  --ink-3: #5a5048;
  --ink-4: #857a6e;
  --red: #b3261e;
  --red-deep: #7a1a14;
  --red-soft: #e8c9c5;
  --ok: #2c6e3f;
  --warn: #a06a14;
  --crit: #9b2418;

  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Mono", monospace;

  --max-width: 1320px;
  --page-padding: 32px;
  --reading-col: 720px;
  --radius: 4px;
  --radius-lg: 8px;

  --transition: 150ms ease;
}

/* ─── 2. Reset + base ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--ink-2);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--ink);
}

ul,
ol {
  padding-left: 1.4em;
}
p {
  margin: 0 0 0.9em;
}
p:last-child {
  margin-bottom: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ─── 3. Skip link ────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus {
  left: 16px;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

/* ─── 4. Focus styles ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--red-soft);
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ─── 5. Typography utilities ─────────────────────────────────────────────── */
.serif {
  font-family: var(--font-serif);
}
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
.kicker {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}
.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.helper {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
  margin: 4px 0 0;
}
.error-text {
  font-size: 12px;
  color: var(--crit);
  margin: 4px 0 0;
}
.warning-banner--local {
  background: #fffbe6;
  border: 1px solid #f0c040;
  border-radius: 4px;
  color: #7a5c00;
  font-size: 12px;
  margin-top: 6px;
  padding: 6px 10px;
}
.local-run-banner {
  background: #fffbe6;
  border: 1px solid #f0c040;
  border-radius: 4px;
  color: #7a5c00;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 14px;
  text-align: center;
}

/* Pre-flight banner: same warning-red palette as report-incomplete-banner so
   the user immediately recognizes the severity and the offending model list
   reads cleanly. Distinct from generic run-error-banner so a bad-model fail
   doesn't look identical to a transient upstream outage. */
.run-error-banner--preflight {
  background: #fde8e6;
  border: 1px solid var(--crit);
  border-radius: var(--radius);
  color: var(--crit);
  padding: 16px 20px;
  margin: 16px 0;
}
.run-error-banner__title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 8px;
}
.run-error-banner__list {
  list-style: disc;
  padding-left: 24px;
  margin: 8px 0 12px;
  font-size: 14px;
}
.run-error-banner__list code {
  color: var(--ink);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  font-family: var(--font-serif);
  color: var(--ink);
}
h1 {
  font-size: 44px;
  line-height: 1.05;
  font-weight: 600;
}
h2 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 600;
}
h3 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
}
h4 {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
}

/* Visually hidden (accessible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── 6. Layout ───────────────────────────────────────────────────────────── */
.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#main {
  flex: 1;
}

.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

/* ─── 7. Masthead ─────────────────────────────────────────────────────────── */
.app-masthead {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 100;
}
.masthead__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
.masthead__brand {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.masthead__brand:hover {
  color: var(--red);
}
.masthead__brand span {
  color: var(--red);
}
.masthead__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.masthead__nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition:
    color var(--transition),
    background var(--transition);
}
.masthead__nav-link:hover {
  color: var(--ink);
  background: var(--paper-3);
}
.masthead__nav-link[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  background: var(--paper-3);
}

/* ─── 8. Stepper ──────────────────────────────────────────────────────────── */
.stepper-bar {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
}
.stepper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  display: flex;
  list-style: none;
  margin-top: 0;
  margin-bottom: 0;
  gap: 0;
}
.stepper__step {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  gap: 6px;
  white-space: nowrap;
}
.stepper__step::after {
  content: "›";
  margin-left: 12px;
  color: var(--rule-strong);
}
.stepper__step:last-child::after {
  display: none;
}
.stepper__step--active {
  color: var(--red);
  font-weight: 700;
}
.stepper__step--done {
  color: var(--ok);
}
.stepper__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  background: var(--rule);
  color: var(--ink-3);
  flex-shrink: 0;
}
.stepper__step--active .stepper__num {
  background: var(--red);
  color: var(--paper);
}
.stepper__step--done .stepper__num {
  background: var(--ok);
  color: var(--paper);
}

/* ─── 9. Privacy pill + modal ─────────────────────────────────────────────── */
.privacy-pill {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition:
    background var(--transition),
    color var(--transition);
}
.privacy-pill:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(26, 23, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 36px 40px 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  position: relative;
}
.modal-content__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition:
    color var(--transition),
    background var(--transition);
}
.modal-content__close:hover {
  color: var(--ink);
  background: var(--paper-3);
}
.modal-content h2 {
  font-size: 22px;
  margin-bottom: 16px;
}
.modal-content ul {
  margin: 12px 0;
}
.modal-content li {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── 10. Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover:not(:disabled) {
  background: var(--ink-2);
}

.btn--secondary {
  background: var(--paper-3);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--rule);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-3);
  border: 1px solid var(--rule);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--paper-3);
  color: var(--ink);
}

.btn--danger {
  background: var(--red-deep);
  color: var(--paper);
}
.btn--danger:hover:not(:disabled) {
  background: var(--red);
}

.btn--sm {
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
}

.btn--full {
  width: 100%;
}

/* ─── 11. Form elements ──────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.input,
.select,
textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  appearance: none;
}
.input:focus,
.select:focus,
textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--red-soft);
}
.input::placeholder {
  color: var(--ink-4);
}
.input--key {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a5048' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.input[aria-invalid="true"] {
  border-color: var(--crit);
}

.key-input-group {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.key-input-group .input {
  flex: 1;
  min-width: 0;
}

.model-select-group {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.model-select-group .select {
  flex: 1;
  min-width: 180px;
}

/* ─── 12. Connection status indicators ────────────────────────────────────── */
.connection-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.status--ok {
  background: #d4eddc;
  color: var(--ok);
}
.status--fail {
  background: #fde8e6;
  color: var(--crit);
}
.status--checking {
  background: var(--paper-3);
  color: var(--ink-3);
}
.status--unverified {
  background: #fff8e1;
  color: #b45309;
}
.status--unchecked {
  background: var(--paper-3);
  color: var(--ink-4);
}

/* ─── 13. Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
}
.badge--beta {
  background: #fef3c7;
  color: #92400e;
}
.badge--incomplete {
  background: #fde8e6;
  color: var(--crit);
}
.badge--version {
  background: var(--paper-3);
  color: var(--ink-3);
  border: 1px solid var(--rule);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* ─── 14. Overview / landing page ───────────────────────────────────────── */
.overview-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px var(--page-padding) 120px;
}
.overview-page__hero {
  max-width: var(--reading-col);
  margin-bottom: 64px;
}
.overview-page__eyebrow {
  margin-bottom: 12px;
  display: block;
}
.overview-page__title {
  font-size: 52px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--ink);
}
.overview-page__title span {
  color: var(--red);
}
.overview-page__lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 560px;
  margin-bottom: 36px;
}
.overview-page__ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}
.overview-page__ctas .btn {
  font-size: 15px;
  padding: 12px 28px;
}
.overview-page__features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 64px;
}
.feature-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}
.feature-card__number {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 8px;
}
.feature-card__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.feature-card__text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-3);
}

.overview-page__privacy-bar {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 48px;
  max-width: var(--reading-col);
}

/* ─── 15. Setup screens (shared) ─────────────────────────────────────────── */
.setup-screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px var(--page-padding);
}
.setup-screen__title {
  margin-bottom: 6px;
}
.setup-screen__subtitle {
  font-size: 15px;
  color: var(--ink-3);
  margin-bottom: 40px;
}

/* ─── 16. Connect & Select screen ───────────────────────────────────────── */
.connect-screen {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px;
  align-items: start;
}
.provider-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.provider-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.provider-card--beta {
  border-color: #fbbf24;
}
.provider-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.provider-card__name {
  font-size: 16px;
  margin: 0;
}
.provider-card__key-row {
  margin-bottom: 14px;
}
.provider-card__model-row {
  margin-top: 12px;
}

.connect-sidebar {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  position: sticky;
  top: 80px;
}
.sidebar__title {
  font-size: 16px;
  margin-bottom: 16px;
}
.sidebar__empty {
  font-size: 13px;
  color: var(--ink-4);
}

.panel-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.panel-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.panel-list__item:last-child {
  border-bottom: none;
}
.panel-list__role {
  flex-shrink: 0;
}
.panel-list__model {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-display {
  background: var(--paper-3);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
}
.target-display .kicker {
  display: block;
  margin-bottom: 4px;
}
.target-display p {
  margin: 0;
  font-weight: 600;
}

.sidebar__privacy {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}

/* ─── 17. Configure screen ─────────────────────────────────────────────── */
.configure-screen {
  max-width: 760px;
}
.settings-section {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.settings-section summary,
.settings-section__header {
  padding: 18px 20px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-section details[open] summary {
  border-bottom: 1px solid var(--rule);
}
.settings-section__body {
  padding: 20px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.setting-row__label {
  flex: 1;
  font-size: 14px;
}
.setting-row__label small {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
}
.setting-row__control {
  flex-shrink: 0;
  min-width: 120px;
}
.setting-row__control .input,
.setting-row__control .select {
  width: auto;
}

.cost-estimate {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cost-estimate__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.cost-estimate__value {
  font-size: 15px;
  font-family: var(--font-serif);
  font-weight: 600;
}
.cost-estimate__note {
  font-size: 11px;
  color: var(--ink-3);
}

/* ─── 17a. Budget slider + summary (Configure → Run settings) ─────────── */
.budget-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 220px;
}
.budget-slider__row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.budget-slider__range {
  flex: 1;
  min-width: 140px;
  accent-color: var(--ink-2);
}
.budget-slider__readout {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-width: 90px;
  text-align: right;
}
.budget-slider__bounds {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.budget-summary {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
}
.budget-summary__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.budget-summary__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
}
.budget-summary__badge--ok {
  background: #d8e8d8;
  color: var(--ok);
}
.budget-summary__badge--tight {
  background: #f5e7c8;
  color: var(--warn);
}
.budget-summary__badge--fail {
  background: var(--red-soft);
  color: var(--crit);
}
.budget-summary__rationale {
  color: var(--ink-3);
  font-size: 12px;
}
.budget-summary__details {
  margin-top: 8px;
}
.budget-summary__details summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-3);
  user-select: none;
}
.budget-summary__details-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.budget-summary__details-body dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 2px;
  margin: 0;
}
.budget-summary__details-body dt {
  font-weight: 600;
  color: var(--ink-2);
}
.budget-summary__details-body dd {
  margin: 0;
  font-family: var(--font-mono);
}

.budget-banner {
  margin-top: 10px;
  background: #fde8e6;
  border: 1px solid var(--crit);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  color: var(--ink-2);
}
.budget-banner__title {
  font-weight: 700;
  color: var(--crit);
  margin-bottom: 4px;
  font-size: 13px;
}
.budget-banner__numbers {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.budget-banner__suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.budget-banner__suggestion {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--ink);
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}
.budget-banner__suggestion:hover,
.budget-banner__suggestion:focus-visible {
  background: var(--paper-2);
}
.budget-banner__suggestion-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.dimension-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.dimension-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.dimension-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* ─── 18. Live Run screen ─────────────────────────────────────────────── */
.live-run-screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding) 60px;
}

.run-status-bar {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  padding: 14px var(--page-padding);
  position: sticky;
  top: 56px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.run-status-bar__state {
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.run-status-bar__elapsed {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-2);
}
.run-status-bar__counter {
  font-size: 13px;
  color: var(--ink-3);
}
.run-status-bar__refusal {
  font-size: 13px;
  color: var(--ink-3);
}
.run-status-bar__progress {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.run-status-bar__progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.btn--stop {
  background: var(--red-deep);
  color: var(--paper);
  font-size: 13px;
  padding: 8px 16px;
  min-height: 40px;
  margin-left: auto;
  flex-shrink: 0;
}
.btn--stop:hover:not(:disabled) {
  background: var(--red);
}

.run-content {
  padding-top: 32px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

/* ─── 19. Agent tiles ─────────────────────────────────────────────────── */
.agent-tile {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.agent-tile--running {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red-soft);
}
.agent-tile--complete {
  border-color: var(--ok);
}
.agent-tile__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.agent-tile__name {
  font-size: 15px;
  font-weight: 600;
}
.agent-tile__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse-ring 1.4s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.5);
  }
}
.agent-tile__status {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
  min-height: 2.9em;
}

/* ─── 20. Transcript ─────────────────────────────────────────────────── */
.transcript-section {
  margin-top: 32px;
}
.transcript-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.transcript-section__title {
  font-size: 16px;
  margin: 0;
}
.transcript-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  background: var(--paper-3);
  color: var(--ink-3);
  border: 1px solid var(--rule);
  transition:
    background var(--transition),
    color var(--transition);
}
.filter-chip--active,
.filter-chip:hover {
  background: var(--ink-2);
  color: var(--paper);
}

.transcript {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
}

.print-only {
  display: none;
}
.transcript__entry {
  display: grid;
  grid-template-columns: 40px 110px 1fr;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.45;
}
.transcript__entry:last-child {
  border-bottom: none;
}
.transcript__ts {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
}
.transcript__agent {
  font-weight: 600;
  color: var(--ink-2);
}
.transcript__text {
  color: var(--ink);
}
.transcript__entry--target .transcript__agent {
  color: var(--ink-3);
  font-style: italic;
}
.transcript__entry--probe .transcript__agent {
  color: var(--red);
}

/* ─── 21. Report screen ──────────────────────────────────────────────── */
.report-screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding) 80px;
}
.report-screen--incomplete .report-header {
  border-top: 4px solid var(--crit);
}

.report-incomplete-banner {
  background: #fde8e6;
  border: 1px solid var(--crit);
  border-radius: var(--radius);
  padding: 12px 20px;
  color: var(--crit);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 24px;
}

.report-header {
  padding: 48px 0 32px;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}
.report-header__main {
}
.report-header__kicker {
  display: block;
  margin-bottom: 10px;
}
.report-header__headline {
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.12;
  font-weight: 600;
  max-width: var(--reading-col);
  color: var(--ink);
  margin-bottom: 16px;
}
.report-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-3);
}
.report-header__meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

/* ─── 22. Grade card ─────────────────────────────────────────────────── */
.grade-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  text-align: center;
  min-width: 220px;
  flex-shrink: 0;
}
.grade-card__grade {
  font-family: var(--font-serif);
  font-size: 72px;
  line-height: 1;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.04em;
}
.grade-card__sub {
  font-size: 44px;
  vertical-align: super;
  color: var(--ink-3);
}
.grade-card__score {
  font-size: 15px;
  color: var(--ink-3);
  margin: 4px 0 16px;
}
.grade-card__table {
  width: 100%;
  font-size: 12px;
  text-align: left;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 12px;
}
.grade-card__table td {
  padding: 2px 4px;
}
.grade-card__table td:first-child {
  color: var(--ink-3);
}
.grade-card__confidence {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 10px;
  font-style: italic;
}

/* ─── 23. Tabs ───────────────────────────────────────────────────────── */
.tabs {
  margin-bottom: 40px;
}
.tablist {
  display: flex;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 32px;
  gap: 0;
  overflow-x: auto;
}
.tab-button {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--transition),
    border-color var(--transition);
}
.tab-button:hover {
  color: var(--ink-2);
}
.tab-button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--red);
}
.tabpanel {
  display: none;
}
.tabpanel--active {
  display: block;
}

/* ─── 24. Radar chart ────────────────────────────────────────────────── */
.radar-wrapper {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.radar-svg {
  flex-shrink: 0;
}
.radar-legend {
  flex: 1;
  min-width: 200px;
}
.radar-legend__title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.radar-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}
.radar-score-row__bar-bg {
  flex: 1;
  height: 6px;
  background: var(--paper-3);
  border-radius: 3px;
  overflow: hidden;
}
.radar-score-row__bar {
  height: 100%;
  border-radius: 3px;
  background: var(--ink-3);
  transition: width 0.3s ease;
}
.radar-score-row--low .radar-score-row__bar {
  background: var(--crit);
}
.radar-score-row--mid .radar-score-row__bar {
  background: var(--warn);
}
.radar-score-row--high .radar-score-row__bar {
  background: var(--ok);
}
.radar-score-row__label {
  min-width: 140px;
}
.radar-score-row__val {
  min-width: 32px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink-2);
  font-weight: 600;
}

/* ─── 25. Overview tab (executive summary) ───────────────────────────── */
.exec-summary {
  max-width: var(--reading-col);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 40px;
}
.exec-summary::first-letter {
  font-size: 60px;
  line-height: 0.85;
  float: left;
  margin: 6px 10px 0 0;
  font-weight: 600;
  color: var(--red);
}

.panel-table {
  width: 100%;
  font-size: 13px;
  border-top: 2px solid var(--rule);
  margin-top: 32px;
}
.panel-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--rule);
}
.panel-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.panel-table tr:last-child td {
  border-bottom: none;
}

/* ─── 26. Findings ──────────────────────────────────────────────────── */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.finding-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.finding-card__header {
  padding: 20px 20px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.finding-card__badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.severity-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 12px;
}
.severity-chip--high {
  background: #fde8e6;
  color: var(--crit);
}
.severity-chip--medium {
  background: #fef3c7;
  color: #92400e;
}
.severity-chip--low {
  background: #d4eddc;
  color: #1a5c2a;
}
.dim-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 12px;
  background: var(--paper-3);
  color: var(--ink-3);
}
.finding-card__content {
  flex: 1;
}
.finding-card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.finding-card__detail {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
  margin: 0;
}

.finding-card details {
  border-top: 1px solid var(--rule);
}
.finding-card details summary {
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-3);
  list-style: none;
}
.finding-card details summary::before {
  content: "+ ";
}
.finding-card details[open] summary::before {
  content: "− ";
}
.evidence-box {
  background: var(--paper-3);
  padding: 16px 20px;
  font-size: 12px;
}
.evidence-turn {
  margin-bottom: 10px;
}
.evidence-turn:last-child {
  margin-bottom: 0;
}
.evidence-turn__speaker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.evidence-turn--target .evidence-turn__speaker {
  color: var(--red);
}
.evidence-turn__text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: var(--paper);
  border-left: 3px solid var(--rule-strong);
  padding: 8px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-2);
}
.evidence-turn__annotation {
  font-size: 11px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 3px;
}

/* ─── 27. Methodology tab ────────────────────────────────────────────── */
.methodology-tab {
  font-size: 14px;
  line-height: 1.6;
  max-width: var(--reading-col);
}
.methodology-tab h3 {
  margin-top: 28px;
  margin-bottom: 8px;
}

/* ─── 28. Limitations tab ────────────────────────────────────────────── */
.limitations-tab {
  max-width: var(--reading-col);
}
.limitations-tab h3 {
  margin-top: 0;
  margin-bottom: 12px;
}
.limitations-list,
.mitigations-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
}
.limitations-list li,
.mitigations-list li {
  padding: 10px 0 10px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}
.limitations-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-3);
}
.mitigations-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--ok);
}

/* ─── 29. DOM print header/footer (Firefox fallback) ─────────────────── */
.print-header,
.print-footer {
  display: none;
  font-size: 11px;
  color: var(--ink-3);
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  margin-top: 8px;
  font-family: var(--font-sans);
}

/* ─── 30. Print styles ───────────────────────────────────────────────── */
@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .app-masthead,
  .stepper-bar,
  .privacy-pill,
  .report-action-bar,
  .run-status-bar,
  .btn--stop,
  .tablist,
  .filter-chip,
  .transcript-filters,
  .overview-page__ctas,
  .connect-sidebar {
    display: none !important;
  }

  .tabpanel {
    display: block !important;
  }
  details {
    display: block;
  }
  details > * {
    display: block !important;
  }
  summary::marker,
  summary::-webkit-details-marker {
    display: none;
  }

  h2,
  h3 {
    break-after: avoid;
  }
  figure,
  table {
    break-inside: avoid;
  }
  .report-section {
    break-before: page;
  }
  .finding-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-header {
    grid-template-columns: 1fr auto;
  }
  .radar-svg text {
    fill: #000;
  }
  .radar-svg .radar-fill {
    fill: rgba(0, 0, 0, 0.08);
  }
  .radar-svg .radar-stroke {
    stroke: #000;
  }
  .severity-chip--high {
    background: #eee;
    color: #000;
  }
  .severity-chip--medium {
    background: #eee;
    color: #000;
  }
  .severity-chip--low {
    background: #eee;
    color: #000;
  }

  .print-header,
  .print-footer {
    display: block;
  }

  .print-only {
    display: block;
  }

  /* Suppress the on-screen Transcript tab in print so the full-transcript
     section below the tabs is the only transcript in the PDF and lands as
     the last section (every other .report-section precedes it in DOM order
     and break-before: page above forces each onto its own page). */
  #panel-transcript {
    display: none !important;
  }

  .report-full-transcript .transcript,
  .report-full-transcript .transcript--print {
    max-height: none;
    overflow: visible;
    background: transparent;
    border: none;
    padding: 0;
  }
  .report-full-transcript .transcript__entry {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-full-transcript .transcript__text {
    white-space: pre-wrap;
    word-break: break-word;
  }

  @page {
    margin: 18mm 16mm;
  }
}

/* ─── 31. Mobile (≤ 720px) ─────────────────────────────────────────── */
@media (max-width: 720px) {
  :root {
    --page-padding: 18px;
  }
  h1 {
    font-size: 32px;
  }
  .overview-page__title {
    font-size: 36px;
  }
  .overview-page__features {
    grid-template-columns: 1fr;
  }
  .connect-screen {
    grid-template-columns: 1fr;
  }
  .connect-sidebar {
    position: static;
  }
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .report-header {
    grid-template-columns: 1fr;
  }
  .grade-card {
    min-width: 0;
  }
  .radar-wrapper {
    flex-direction: column;
  }
  .masthead__nav-link span {
    display: none;
  }
}

/* ─── 32. Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── 33. Masthead aliases + additions ───────────────────────────────── */
.masthead {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 100;
}
.masthead__logo {
  margin-right: 4px;
}
.masthead__name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.masthead__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition:
    color var(--transition),
    background var(--transition);
}
.masthead__link:hover {
  color: var(--ink);
  background: var(--paper-3);
}
.masthead__privacy-btn {
  /* inherits .masthead__link */
}

/* Stepper wrapper */
.stepper {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
}
.stepper__list {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  display: flex;
  list-style: none;
  gap: 0;
}

/* ─── 34. Main content area ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  outline: none;
}

/* ─── 35. Overview screen ────────────────────────────────────────────── */
.overview-screen {
  max-width: var(--max-width);
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 40px 0;
}
.overview-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}
.overview-card__icon {
  font-size: 28px;
  margin-bottom: 10px;
}
.overview-card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  font-family: var(--font-sans);
}
.overview-card__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
  margin: 0;
}

.overview-dimensions {
  margin: 40px 0;
}
.overview-dimensions__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  font-family: var(--font-sans);
}
.overview-mechanism {
  margin: 32px auto 0;
  max-width: 680px;
  text-align: center;
}
.dimension-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.dimension-tag {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: 12px;
  color: var(--ink-2);
}

.btn--lg {
  font-size: 16px;
  padding: 14px 32px;
  min-height: 52px;
}

/* ─── 36. Site footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  padding: 24px var(--page-padding);
  margin-top: auto;
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.site-footer__inner a {
  color: var(--ink-3);
}
.site-footer__inner a:hover {
  color: var(--ink);
}
.footer-link-btn {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-link-btn:hover {
  color: var(--ink);
}

/* ─── 37. Modal (used by PrivacyModal + StopModal) ────────────────────── */
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 36px 40px 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}
.modal__title {
  font-size: 22px;
  margin-bottom: 16px;
}
.modal__body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 24px;
}
.modal__body p {
  margin-bottom: 12px;
}
.modal__body p:last-child {
  margin-bottom: 0;
}
.modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── 38. Live Run screen aliases ────────────────────────────────────── */
.run-screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: 60px;
}

/* progress bar inside status bar */
.run-progress-bar {
  flex: 1;
  min-width: 100px;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.run-progress-bar__fill {
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.run-status-bar__phase {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-left: 4px;
}
.run-status-bar__timer {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.run-status-bar__progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}
.run-status-bar__calls {
  margin: 0;
}

/* ─── 39. Mobile additions ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .overview-cards {
    grid-template-columns: 1fr 1fr;
  }
  .stepper__list {
    overflow-x: auto;
  }
  .run-status-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .modal {
    padding: 24px 20px 20px;
  }
}
@media (max-width: 480px) {
  .overview-cards {
    grid-template-columns: 1fr;
  }
}

/* ── PanelBuilder: 6-slot drag-drop role assignment ─────────────────────── */

.panel-builder {
  margin-bottom: 24px;
}

.panel-slots {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-slot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
  background: var(--paper-2, #efe9d9);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 0;
  position: relative;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.panel-slot--empty {
  background: transparent;
  border-style: dashed;
  opacity: 0.85;
}

.panel-slot--lifted {
  outline: 3px solid var(--ok);
  outline-offset: 2px;
  box-shadow: 0 4px 0 0 var(--rule-strong);
}

.panel-slot--drag-over {
  background: var(--paper-3);
  border-color: var(--ok);
}

.panel-slot__handle {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: grab;
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.panel-slot--filled .panel-slot__handle:active {
  cursor: grabbing;
}

.panel-slot__handle:focus-visible {
  outline: 2px solid var(--ok);
  outline-offset: -2px;
}

.panel-slot__role {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 11px;
  text-transform: uppercase;
}

.panel-slot__model {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.panel-slot__provider {
  font-weight: 500;
  font-size: 14px;
}

.panel-slot__model-id {
  font-size: 11px;
  color: #5a5040;
  /* Ellipsis prevents long model ids (claude-3-5-sonnet-20241022) from
     wrapping onto multiple lines and inflating slot height past the viewport.
     Full id is exposed via title= for hover; the handle button's aria-label
     already announces "{provider} {model}" so screen readers get it too. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}

.panel-slot__empty {
  font-style: italic;
  color: #7a7060;
  font-size: 13px;
}

.panel-slot__badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.panel-slot__toolbar {
  /* 2×2 grid: column 1 = move up/down (always visible), column 2 = settings/
     remove (only when slot is filled). grid-auto-flow: column means the
     DOM order ↑, ↓, ⚙, ✕ fills column 1 first (rows top-bottom) then
     column 2, which keeps tab order linear while presenting the requested
     visual layout. Halves the toolbar's horizontal footprint vs. the prior
     4-button row, freeing space for the model name. */
  display: grid;
  grid-template-columns: repeat(2, 28px);
  grid-template-rows: repeat(2, 28px);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px 6px;
  border-left: 1px solid var(--rule-strong);
  align-content: center;
}

.panel-slot__toolbar .btn {
  min-width: 28px;
  min-height: 28px;
  padding: 0 4px;
}

.slot-override {
  grid-column: 1 / -1;
  background: var(--paper-3);
  border-top: 1px solid var(--rule-strong);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-override fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.slot-override legend {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.input--sm {
  font-size: 13px;
  padding: 4px 6px;
  max-width: 120px;
}

/* Badge variants — text-only with background fill, AAA contrast on paper-3 */
.badge--flagship {
  background: var(--paper-3);
  color: var(--ok);
  border: 1px solid var(--ok);
  font-weight: 600;
}

.badge--reasoning {
  background: var(--paper-3);
  color: #5a3e8a;
  border: 1px solid #5a3e8a;
}

.badge--vision,
.badge--search {
  background: var(--paper-3);
  color: #5a5040;
  border: 1px solid var(--rule-strong);
}

.badge--legacy {
  background: transparent;
  color: #7a7060;
  border: 1px dashed var(--rule-strong);
  font-style: italic;
}

/* ── Status pill: "Tested 3 min ago" ─────────────────────────────────── */
.provider-card__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  font-size: 11px;
  color: #5a5040;
  font-style: italic;
}

/* ── Remediation: typed error block ─────────────────────────────────── */

.remediation {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 4px;
  border-left: 3px solid var(--rule-strong);
  background: var(--paper-3);
}

.remediation--fail {
  border-left-color: #b3261e;
  background: #f7e8e6;
}

.remediation--warn {
  border-left-color: #a8771a;
  background: #f6efd9;
}

.remediation--notice {
  border-left-color: #2c6e3f;
  background: #e8f0e8;
}

.remediation__title {
  margin: 0 0 4px 0;
  font-weight: 600;
  font-size: 13px;
}

.remediation__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.remediation__raw {
  margin-top: 6px;
  font-size: 12px;
}

.remediation__raw summary {
  cursor: pointer;
  color: #5a5040;
}

.remediation__raw .mono {
  display: block;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.05);
  padding: 6px 8px;
  border-radius: 2px;
}

.remediation__link {
  margin: 6px 0 0 0;
  font-size: 12px;
}

/* ── Visually hidden helper for SR-only text ───────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Reduced motion: snap drags rather than animate ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .panel-slot,
  .panel-slot--drag-over,
  .panel-slot--lifted {
    transition: none;
  }
}

/* ── Forced-colors (Windows High Contrast) ────────────────────────── */
@media (forced-colors: active) {
  .panel-slot--lifted {
    outline: 3px solid CanvasText;
  }
  .panel-slot--drag-over {
    border-color: Highlight;
  }
  .badge--flagship,
  .badge--reasoning,
  .badge--vision,
  .badge--search,
  .badge--legacy {
    border-color: CanvasText;
    color: CanvasText;
    background: Canvas;
    forced-color-adjust: none;
  }
}

/* ── Self-healing pipeline UI (PR: feature/self-healing-pipeline) ── */

/* Recovery re-run banner — appears at the top of the LiveRun screen
 * when state.priorReport is set, telling the user this run is targeting
 * only previously-unmeasured dims and will merge into the existing
 * report on completion. Visually distinct from the local-endpoint
 * banner so the two don't blend together when both apply.
 */
.rerun-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--surface-info, #eef4fb);
  border: 1px solid var(--rule-info, #b8cde0);
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--ink-1, #1f1d18);
}

/* Live-run "Currently working" pane — surfaces the in-flight call's
 * wall-clock elapsed time so a slow Analyst / Scorer / Chair call never
 * leaves the user staring at a frozen UI for >5s.
 */
.run-inflight-pane {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--surface-2, #f6f4f0);
  border: 1px solid var(--rule-1, #e7e3da);
  border-radius: 6px;
  font-size: 0.9rem;
}
.run-inflight-pane__line {
  margin: 0;
}
.run-inflight-pane__step {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Recovery surface — replaces the grade card on runs that hit the
 * unmeasured-dim floor. Lists which dims couldn't be measured, the
 * recovery events that were tried, and offers a one-click re-run of
 * just the missing set.
 */
.report-recovery-surface {
  margin: 16px 0 24px;
  padding: 18px 20px;
  background: var(--surface-warn, #fff8e7);
  border: 1px solid var(--rule-warn, #d8c890);
  border-radius: 8px;
}
.report-recovery-surface__head {
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.report-recovery-surface__intro {
  margin: 0 0 12px;
  color: var(--ink-2, #4a463c);
}
.report-recovery-surface__reasons {
  margin: 0 0 12px;
}
.report-recovery-surface__reasons summary {
  cursor: pointer;
  font-weight: 500;
}
.report-recovery-surface__reasons ul {
  margin: 6px 0 0 18px;
  padding: 0;
}
.report-recovery-surface__dims {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.report-recovery-surface__dim {
  padding: 6px 0;
  border-top: 1px dashed var(--rule-1, #e7e3da);
}
.report-recovery-surface__dim:first-child {
  border-top: none;
}
.report-recovery-surface__events {
  margin: 4px 0 0;
}
.report-recovery-surface__events summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink-3, #6b6557);
}
.report-recovery-surface__events ol {
  margin: 6px 0 0 22px;
  padding: 0;
  font-size: 0.85rem;
}
.report-recovery-surface__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* "Resume with more budget" inline dialog. Sits below the actions
 * row, expanded only when the user clicks the Resume button. Uses
 * the same warm-warning surface tone as its container so it reads
 * as part of the recovery affordance rather than a separate card.
 */
.report-recovery-surface__resume {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-1, #fffefb);
  border: 1px solid var(--rule-1, #e7e3da);
  border-radius: 6px;
}
.report-recovery-surface__resume-summary {
  cursor: pointer;
  font-weight: 600;
  margin: 0 0 6px;
}
.report-recovery-surface__resume-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}
.report-recovery-surface__resume-row label {
  font-weight: 500;
  font-size: 0.9rem;
}
.report-recovery-surface__resume-row input[type="number"] {
  width: 110px;
  padding: 4px 8px;
  font: inherit;
  border: 1px solid var(--rule-1, #d8d4ca);
  border-radius: 4px;
  background: var(--surface-0, #fff);
}
.report-recovery-surface__resume-preview {
  margin: 4px 0 8px;
}
.report-recovery-surface__resume-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Visual treatment for the grade card on a recovery-state report. The
 * grade reads "—" rather than a number, but we also de-emphasize it so
 * the recovery surface above is clearly the primary affordance.
 */
.grade-card--incomplete {
  opacity: 0.55;
  filter: grayscale(0.4);
}

/* Print rules: the recovery surface stays visible in the printed PDF
 * (it's the primary content of an incomplete run), and forces all its
 * <details> blocks open so the printout shows the full diagnosis. The
 * "Re-run missing dimensions" button is hidden in print since it's
 * not actionable on paper.
 */
@media print {
  .report-recovery-surface {
    background: white;
    border: 2px solid #999;
  }
  .report-recovery-surface details > * {
    display: block !important;
  }
  .report-recovery-surface__actions {
    display: none;
  }
  .run-inflight-pane {
    display: none;
  }
}
