/* ─── Design Tokens ─── */
:root {
  --teal-50: #fdeaea;
  --teal-100: #ffd2d2;
  --teal-400: #ff2727;
  --teal-500: #e01f1f;
  --teal-600: #c81919;
  --teal-900: #5c0d0d;

  --beige-50: #fdf6f0;
  --beige-100: #f9f1e9;
  --beige-200: #f0e4d6;
  --beige-300: #d6b793;
  --beige-500: #a68a63;

  --ink-900: #1a0202;
  --ink-700: #3d1f1a;
  --ink-500: #6b7280;
  --ink-400: #8f95a1;
  --ink-200: #c7cad0;
  --ink-100: #e8e5df;

  --red-500: #c81919;
  --red-100: #fde2e2;
  --amber-500: #f4a227;
  --amber-100: #fef0d9;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --blue-500: #60a5fa;
  --blue-100: #dbeafe;

  --bg: var(--beige-50);
  --surface: #ffffff;
  --surface-2: var(--beige-100);
  --border: var(--beige-200);
  --border-strong: var(--beige-300);
  --text-primary: var(--ink-900);
  --text-secondary: #555b68;
  --text-muted: #686e7c;
  --accent: var(--teal-400);
  --accent-dark: var(--teal-600);
  /* Text-safe variants (WCAG AA 4.5:1). The vivid tokens above stay for
     fills, bars, dots and icons, which only need 3:1. */
  --accent-text: #d90000;
  --accent-btn: #ee0000;
  --red-text: #c81919;
  --amber-text: #9b6008;
  --green-text: #167f3d;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(20,18,16,0.06), 0 1px 2px rgba(20,18,16,0.04);
  --shadow-md: 0 4px 16px rgba(20,18,16,0.08), 0 1px 4px rgba(20,18,16,0.04);
  --shadow-lg: 0 8px 32px rgba(20,18,16,0.10), 0 2px 8px rgba(20,18,16,0.05);
}

[data-theme="dark"] {
  --bg: #150707;
  --surface: #1f0f0f;
  --surface-2: #2a1414;
  --border: #3a1c1c;
  --border-strong: #4d2424;
  --text-primary: #f5ece6;
  --text-secondary: #a8a2a2;
  --text-muted: #8a8080;
  --accent: #ff2727;
  --accent-text: #ff4141;
  --red-text: #ea5858;
  --amber-text: #f4a227;
  --green-text: #22c55e;
  --accent-dark: #ff5f57;
  --red-100: rgba(200,25,25,0.14);
  --amber-100: rgba(244,162,39,0.14);
  --green-100: rgba(34,197,94,0.14);
  --blue-100: rgba(96,165,250,0.14);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
svg { display: block; }

/* ─── Utilities ─── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.container--wide { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ─── Topbar ─── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar__logo {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topbar__logo-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar__logo-mark svg { color: white; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-ghost {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); }

/* ─── Hero / Landing ─── */
#view-landing { display: block; }
#view-loading { display: none; }
#view-results { display: none; }

.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  background: var(--teal-50);
  border: 1px solid rgba(255,39,39,0.2);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 28px;
}
[data-theme="dark"] .hero__eyebrow { background: rgba(255,39,39,0.1); }
.hero__title {
  font-family: 'Fraunces', serif;
  font-size: clamp(40px, 6vw, 68px);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.hero__title em { font-style: italic; color: var(--accent); }
.hero__sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 44px;
  line-height: 1.6;
  font-weight: 300;
}

/* ─── URL Input ─── */
.audit-form {
  max-width: 600px;
  margin: 0 auto 48px;
}
.audit-input-wrap {
  display: flex;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.audit-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,39,39,0.15), var(--shadow-md);
}
.audit-input-prefix {
  padding: 0 4px 0 18px;
  display: flex; align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}
.audit-url-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 16px 4px;
  font-size: 15px;
  background: transparent;
  color: var(--text-primary);
  min-width: 0;
}
.audit-url-input::placeholder { color: var(--text-muted); }
.audit-btn {
  margin: 6px;
  padding: 10px 20px;
  background: var(--accent-btn);
  color: white;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.audit-btn:hover { background: var(--teal-600); }
.audit-btn:active { transform: scale(0.98); }
.audit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.audit-form-hint {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.audit-form-hint span { display: flex; align-items: center; gap: 5px; }

/* ─── Trust bar ─── */
.trust-bar {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  display: flex; align-items: center; justify-content: center; gap: 32px;
  flex-wrap: wrap;
}
.trust-item {
  display: flex; align-items: baseline; gap: 8px;
}
.trust-item__num {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.trust-item__label {
  font-size: 13px;
  color: var(--text-muted);
}
.trust-divider { width: 1px; height: 32px; background: var(--border); }

/* ─── What we check ─── */
.checks-section { padding: 48px 0 64px; }
.section-heading {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 32px;
  text-align: center;
}
.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.check-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.check-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.check-card__score-preview {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.check-card__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.check-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.check-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.check-card__tags {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 14px;
}
.tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── Loading View ─── */
#view-loading {
  min-height: calc(100vh - 56px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 60px 20px;
}
.loading-container { text-align: center; max-width: 420px; }
.loading-url {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 40px;
  word-break: break-all;
}
.loading-ring-wrap {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 36px;
}
.loading-ring-svg { transform: rotate(-90deg); }
.loading-ring-track { fill: none; stroke: var(--border); stroke-width: 6; }
.loading-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: 339.29;
  transition: stroke-dashoffset 0.4s ease;
}
.loading-center-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.loading-percent {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}
.loading-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.loading-steps {
  display: flex; flex-direction: column; gap: 10px;
  text-align: left;
}
.loading-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.3s;
}
.loading-step.active { border-color: var(--accent); color: var(--text-primary); }
.loading-step.done { opacity: 0.5; }
.step-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  transition: all 0.3s;
}
.loading-step.active .step-icon {
  border-color: var(--accent);
  background: rgba(255,39,39,0.08);
  color: var(--accent);
  animation: spin 1s linear infinite;
}
.loading-step.done .step-icon {
  border-color: var(--green-500);
  background: var(--green-100);
  color: var(--green-500);
  animation: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Results View ─── */
#view-results {
  padding: 32px 0 80px;
}

/* Results Header */
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 32px;
}
.results-url {
  display: flex; align-items: center; gap: 8px;
}
.results-url__favicon {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--border);
}
.results-url__text {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}
.results-actions { display: flex; gap: 8px; }
.btn-sm {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  transition: all 0.15s;
  cursor: pointer;
}
.btn-sm:hover { border-color: var(--border-strong); color: var(--text-primary); }
.btn-sm--accent { background: var(--accent-btn); color: white; border-color: var(--accent-btn); }
.btn-sm--accent:hover { background: var(--teal-600); border-color: var(--teal-600); color: white; }

/* Overall Score Banner */
.score-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  display: flex; align-items: center; gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.overall-ring-wrap {
  position: relative;
  width: 100px; height: 100px;
  flex-shrink: 0;
}
.ring-svg { overflow: visible; }
.ring-track { fill: none; stroke: var(--border); stroke-width: 7; }
.ring-fill {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-number {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
}
.ring-denom {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.score-banner__meta { flex: 1; min-width: 200px; }
.score-banner__grade {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amber-100);
  color: var(--amber-text);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 5px;
  margin-bottom: 10px;
}
.score-banner__title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.score-banner__sub { font-size: 14px; color: var(--text-secondary); }
.score-banner__weights {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 12px;
}
.weight-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-2);
}

/* Category Grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.cat-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cat-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,39,39,0.1); }
.cat-card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px;
}
.cat-card__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cat-card__badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
}
.cat-card__score-row {
  display: flex; align-items: baseline; gap: 4px;
  margin-bottom: 12px;
}
.cat-card__score {
  font-family: 'DM Mono', monospace;
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
}
.cat-card__max {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}
.cat-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.cat-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0;
}
.cat-card__issues {
  font-size: 12px;
  color: var(--text-muted);
}

/* Main results layout */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
/* Grid items default to min-width:auto, which lets the filter-tab row's
   intrinsic width push the column past the viewport on phones. */
.results-grid > * { min-width: 0; }

/* Custom interactive elements (issue rows, category cards) */
.cat-card:focus-visible,
.issue-item:focus-visible,
.filter-tab:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .results-grid { grid-template-columns: 1fr; }
}

/* Issues Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.panel__count {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}
.filter-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-tab {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.filter-tab:hover:not(.active) { color: var(--text-secondary); }

.issues-list { padding: 8px; }
.issue-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background 0.12s;
  cursor: pointer;
  border: 1px solid transparent;
}
.issue-item:hover { background: var(--surface-2); }
.issue-item.expanded { background: var(--surface-2); border-color: var(--border); }
.severity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.severity-dot.critical { background: var(--red-500); }
.severity-dot.important { background: var(--amber-500); }
.severity-dot.minor { background: var(--green-500); }
.issue-content { flex: 1; min-width: 0; }
.issue-title { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.issue-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.issue-detail {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  border: 1px solid var(--border);
  display: none;
}
.issue-item.expanded .issue-detail { display: block; }
.issue-fix {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent-text);
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.impact-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.impact-badge.critical { background: var(--red-100); color: var(--red-text); border-color: transparent; }
.impact-badge.important { background: var(--amber-100); color: var(--amber-text); border-color: transparent; }
.impact-badge.minor { background: var(--green-100); color: var(--green-text); border-color: transparent; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

/* Score breakdown */
.breakdown-list { padding: 6px 0; }
.breakdown-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-label { flex: 1; color: var(--text-secondary); }
.breakdown-bar-wrap { width: 80px; }
.breakdown-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.breakdown-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.4s ease;
}
.breakdown-val {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  min-width: 26px;
  text-align: right;
}
.breakdown-val--na { color: var(--text-muted); }

/* Unavailable category */
.impact-badge.na { background: var(--surface-2); color: var(--text-muted); }
/* Dashed border rather than reduced opacity — opacity would drop the text
   below AA contrast. */
.cat-card--unavailable { cursor: default; border-style: dashed; border-color: var(--border-strong); background: transparent; }
.cat-card--unavailable:hover { border-color: var(--border-strong); box-shadow: none; }
.cat-card__score--na { color: var(--text-muted); }

/* Core Web Vitals */
.vitals { padding: 14px 20px 16px; }
.vitals__devices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.vitals__device {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.vitals__device-label { font-size: 12px; color: var(--text-secondary); }
.vital-score {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 500;
}
.vital-score--na { color: var(--text-muted); }
.vitals__section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.vitals__tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px; font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.vital-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.vital-row:last-child { border-bottom: none; }
.vital-row__label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}
.vital-row__val {
  font-family: 'DM Mono', monospace;
  font-size: 12px; font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
}
.vital--good { background: var(--green-100); color: var(--green-text); }
.vital--ni   { background: var(--amber-100); color: var(--amber-text); }
.vital--poor { background: var(--red-100);   color: var(--red-text); }
.vital--na   { color: var(--text-muted); }
.vitals__note, .vitals__empty {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* AI Grade Card */
.ai-grade-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.ai-grade-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.ai-grade-label { font-size: 13px; color: var(--text-secondary); }
.ai-grade-val {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--amber-text);
  line-height: 1;
}
.ai-grade-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ai-checks { display: flex; flex-direction: column; gap: 7px; }
.ai-check {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}
.ai-check__status {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
}
.status-pass { background: var(--green-100); color: var(--green-text); }
.status-fail { background: var(--red-100); color: var(--red-text); }
.status-warn { background: var(--amber-100); color: var(--amber-text); }
.status-na { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* Gated blur overlay */
.gated-section {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.gated-section::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* Responsive */
@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .hero { padding: 52px 0 40px; }
  .score-banner { padding: 20px; gap: 20px; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .trust-divider { display: none; }
  .trust-bar { gap: 20px; }
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.4s ease forwards; }
.delay-1 { animation-delay: 0.08s; opacity: 0; }
.delay-2 { animation-delay: 0.16s; opacity: 0; }
.delay-3 { animation-delay: 0.24s; opacity: 0; }
.delay-4 { animation-delay: 0.32s; opacity: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ─── Print / PDF export ─── */
@media print {
  /* Always print on the light palette, even if the viewer has dark mode on —
     dark backgrounds waste ink and print poorly. */
  :root, [data-theme="dark"] {
    color-scheme: light;
    --bg: #fdf6f0;
    --surface: #ffffff;
    --surface-2: #f9f1e9;
    --border: #f0e4d6;
    --border-strong: #d6b793;
    --text-primary: #1a0202;
    --text-secondary: #555b68;
    --text-muted: #686e7c;
    --accent-text: #d90000;
    --red-text: #c81919;
    --amber-text: #9b6008;
    --green-text: #167f3d;
    --accent: #ff2727;
    --accent-dark: #c81919;
    --red-100: #fde2e2;
    --amber-100: #fef0d9;
    --green-100: #dcfce7;
    --blue-100: #dbeafe;
  }

  .topbar, .results-actions, .filter-tabs { display: none !important; }
  body { background: #fff; }
  #view-results { padding: 0; }
  .panel, .cat-card, .score-banner { break-inside: avoid; box-shadow: none !important; }

  /* The report is meant to be the FULL report — expand every issue's detail
     and fix text, regardless of which ones the viewer had clicked open. */
  .issue-detail { display: block !important; }
  .issue-item { cursor: default; break-inside: avoid; }
  .issue-item:hover { background: none; }
}

/* Same rules as above, applied via a class instead of @media print — used
   by the JS-driven PDF export (downloadPdfReport) so it renders correctly
   on mobile browsers that don't support window.print(). */
html.pdf-exporting {
  color-scheme: light;
  --bg: #fdf6f0;
  --surface: #ffffff;
  --surface-2: #f9f1e9;
  --border: #f0e4d6;
  --border-strong: #d6b793;
  --text-primary: #1a0202;
  --text-secondary: #555b68;
  --text-muted: #686e7c;
  --accent-text: #d90000;
  --red-text: #c81919;
  --amber-text: #9b6008;
  --green-text: #167f3d;
  --accent: #ff2727;
  --accent-dark: #c81919;
  --red-100: #fde2e2;
  --amber-100: #fef0d9;
  --green-100: #dcfce7;
  --blue-100: #dbeafe;
}
.pdf-exporting .topbar,
.pdf-exporting .results-actions,
.pdf-exporting .filter-tabs { display: none !important; }
.pdf-exporting body { background: #fff; }
.pdf-exporting #view-results { padding: 0; }
.pdf-exporting .panel, .pdf-exporting .cat-card, .pdf-exporting .score-banner { break-inside: avoid; box-shadow: none !important; }
.pdf-exporting .issue-detail { display: block !important; }
.pdf-exporting .issue-item { cursor: default; break-inside: avoid; }
.pdf-exporting .issue-item:hover { background: none; }

