/* ──────────────────────────────────────────────────────────────────────────
   Theme — inspired by visibility.so
   Newsreader (serif) for display, Inter for UI/body.
   Cream surface, warm-near-black ink, full-pill buttons.
   ────────────────────────────────────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Newsreader:opsz,wght@6..72,400;6..72,500&display=swap");

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --cream: #f5f4ef;
  --cream-2: #ebe9e2;
  --paper: #ffffff;
  --ink: #1a1918;
  --ink-2: #4a4a48;
  --muted: #82807a;
  --line: #d9d6cd;
  --line-soft: #e6e3da;
  --accent: #0056a7;     /* visibility's deep blue accent */
  --accent-ink: #ffffff;
  --hi: #b8412c;         /* warmer "high" than pure red */
  --med: #b5862b;
  --lo: #2f7a4d;
  --radius: 14px;
  --radius-pill: 9999px;
  --shadow-card: 0 1px 0 rgba(26, 25, 24, 0.04), 0 6px 24px -10px rgba(26, 25, 24, 0.08);
  color-scheme: light;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.serif { font-family: "Newsreader", Georgia, "Times New Roman", serif; font-weight: 400; }

/* SVG icon defaults — inherits text color, sits on the baseline */
.icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex: 0 0 auto;
  stroke: currentColor;
}
.icon--spin { animation: iconSpin 1s linear infinite; }
@keyframes iconSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

h1, h2, h3 { font-family: "Newsreader", Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
h1 { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.05; }
h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.12; }
h3 { font-size: 18px; line-height: 1.3; font-weight: 500; }

p { margin: 0; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color 120ms; }
a:hover { border-color: var(--ink); }
a.bare, .admin-nav a, .results-permalink a { border: 0; color: var(--accent); }
a.bare:hover, .admin-nav a:hover { text-decoration: underline; }

button, .btn {
  font: 500 14px/1 "Inter", sans-serif;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  transition: transform 120ms, filter 120ms, background 120ms;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--cream-2); filter: none; }

input[type="email"], input[type="text"], input[type="password"], input[type="search"] {
  font: 400 16px/1 "Inter", sans-serif;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  width: 100%;
  color: var(--ink);
  transition: border-color 120ms, box-shadow 120ms;
}
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--ink); }

/* ──────────────────────────────────────────────────────────────────────────
   Layout helpers
   ────────────────────────────────────────────────────────────────────────── */
.brand {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.brand-side { min-width: 0; }
.brand-center { display: flex; justify-content: center; }

/* visibility.so logo (mark + wordmark) */
.vs-logo {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  border: 0;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.vs-logo:hover { border: 0; }
.vs-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--logo-size, 36px);
  height: var(--logo-size, 36px);
  color: var(--ink);
}
.vs-logo-text {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-left: -4px;
}
.vs-logo-text-dim { font-weight: 300; }

@keyframes sonar-pulse-burst {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; filter: brightness(1.1); }
}

/* Floating QR */
.qr-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 8px 30px -10px rgba(26, 25, 24, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  z-index: 50;
  transition: transform 200ms ease;
}
.qr-float:hover { transform: scale(1.05); }
.qr-shot { width: 110px; height: 110px; line-height: 0; }
.qr-shot svg { width: 100%; height: 100%; display: block; }
.qr-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 640px) { .qr-float { display: none; } }

/* ──────────────────────────────────────────────────────────────────────────
   Landing page
   ────────────────────────────────────────────────────────────────────────── */
.landing {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 28px 96px;
}
.hero {
  margin: 56px 0 40px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--cream-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
}
.hero h1 {
  margin-bottom: 18px;
}
.hero h1 .accent { color: var(--accent); font-style: italic; }
.hero-sub {
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.5;
  max-width: 520px;
  margin: 0 auto;
}

.audit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
  margin-top: 32px;
}
.audit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.audit-form button {
  margin-top: 8px;
  padding: 14px 22px;
  font-size: 15px;
  justify-content: center;
  width: 100%;
}
.form-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.banner {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin: 8px 0;
  border: 1px solid transparent;
}
.banner--error { background: #fbeae6; color: #8c3320; border-color: #f0d2c8; }
.banner--ok { background: #e2f1e7; color: #1f6b3c; border-color: #c8e0d1; }

.cache-clear-form { display: inline; margin: 0; }
.link-btn--danger {
  color: var(--hi);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  opacity: 0.7;
  transition: opacity 120ms;
}
.link-btn--danger:hover { opacity: 1; text-decoration: underline; background: transparent; }

/* ──────────────────────────────────────────────────────────────────────────
   Audit page
   ────────────────────────────────────────────────────────────────────────── */
.audit {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 36px 96px;
}
.audit-domain { font-size: clamp(28px, 3.4vw, 42px); }

/* ---------- "Fix them now" CTA bar (results page) ---------- */
.ai-prompt-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 22px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #ecf0fa 0%, #f3e8f8 100%);
  border: 1px solid #c9d4e8;
  border-radius: 14px;
  flex-wrap: wrap;
}
.btn--ai-prompt {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  transition: transform 120ms, filter 120ms;
}
.btn--ai-prompt .btn-arrow { font-size: 16px; line-height: 1; }
.btn--ai-prompt:hover { filter: brightness(1.15); transform: translateY(-1px); }
.ai-prompt-hint { color: var(--ink-2); font-size: 13.5px; flex: 1; min-width: 240px; }

/* ---------- Fix dialog ---------- */
.fix-dialog {
  max-width: 720px;
  width: calc(100vw - 32px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--paper);
  box-shadow: 0 32px 80px -16px rgba(26, 25, 24, 0.45);
  color: var(--ink);
}
.fix-dialog::backdrop {
  background: rgba(26, 25, 24, 0.55);
  backdrop-filter: blur(2px);
}
.fix-dialog-inner {
  padding: 28px 32px 32px;
  max-height: 86vh;
  overflow-y: auto;
}
.fix-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.fix-dialog-head h2 {
  font-family: "Newsreader", serif;
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.fix-dialog-sub { color: var(--ink-2); font-size: 14px; margin: 0; line-height: 1.5; }
.fix-dialog-close {
  background: var(--cream-2);
  color: var(--ink-2);
  border: 0;
  border-radius: 99px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.fix-dialog-close:hover { background: var(--line); }

/* Prompt card inside dialog */
.fix-prompt-card {
  background: #0f0e0d;
  color: #f0eee9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2826;
}
.fix-prompt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1a1817;
  border-bottom: 1px solid #2a2826;
}
.fix-prompt-label {
  font: 600 11px/1 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #a8a59c;
}
.fix-prompt-copy {
  background: #2a2826;
  color: #f0eee9;
  border: 0;
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 120ms;
}
.fix-prompt-copy:hover { background: #3a3835; }
.fix-prompt-copy.is-copied { background: var(--lo); color: #fff; }
.fix-prompt-body {
  margin: 0;
  padding: 16px 18px;
  font: 12.5px/1.55 "SF Mono", Menlo, Consolas, monospace;
  color: #d6d2c8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

/* Coding-agent logo row — minimal, just the marks */
.fix-agents {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
}
.fix-agent {
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.55;
  filter: grayscale(0.25);
  transition: opacity 150ms, transform 150ms, filter 150ms;
  cursor: default;
}
.fix-agent:hover { opacity: 1; filter: grayscale(0); transform: translateY(-1px); }

@media (max-width: 640px) {
  .fix-dialog-inner { padding: 22px 20px; }
  .fix-dialog-head h2 { font-size: 22px; }
}

/* ---------- SEO scorecard (sits beside the preview when ready) ---------- */
.preview-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}
.preview-row:has(.scorecard-slot:not(.is-empty)) {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}
.preview-row .preview { margin-bottom: 0; }
.scorecard-slot.is-empty { display: none; }
.scorecard-slot { animation: revealCard 350ms ease-out; }
.score {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--line);
  border-radius: 16px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 18px;
  align-items: center;
  box-shadow: var(--shadow-card);
}
.score--ok { border-left-color: var(--lo); background: #f4f9f6; }
.score--warn { border-left-color: var(--med); background: #fbf7e7; }
.score--bad { border-left-color: var(--hi); background: #faecea; }
.score-head { grid-column: 1 / 2; display: flex; align-items: center; gap: 10px; }
.score-dim {
  font: 600 11px/1 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.score-grade {
  font-family: "Newsreader", serif;
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  grid-row: 1 / 4;
  grid-column: 2 / 3;
  justify-self: end;
  align-self: center;
}
.score-grade--ok { color: #1f6b3c; }
.score-grade--warn { color: #8a6210; }
.score-grade--bad { color: #a02929; }
.score-grade--pending { color: var(--muted); }
.score-row { grid-column: 1 / 2; display: flex; align-items: baseline; gap: 4px; }
.score-num {
  font-family: "Newsreader", serif;
  font-weight: 500;
  font-size: 28px;
  color: var(--ink);
}
.score-tag { color: var(--muted); font-size: 14px; }
.score-meter {
  grid-column: 1 / 3;
  height: 6px;
  background: var(--cream-2);
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0;
}
.score-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4a8fd0);
  border-radius: 99px;
  transition: width 600ms ease;
}
.score--ok .score-meter-fill { background: linear-gradient(90deg, #2f7a4d, #5cb47d); }
.score--warn .score-meter-fill { background: linear-gradient(90deg, #b5862b, #e5b34a); }
.score--bad .score-meter-fill { background: linear-gradient(90deg, #b8412c, #d57458); }
.score-summary {
  grid-column: 1 / 3;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}
.scorecard.is-skeleton .score-summary { color: var(--muted); font-style: italic; }

/* Bigger preview card */
.preview {
  grid-template-columns: minmax(320px, 380px) 1fr;
  padding: 22px;
  border-radius: 18px;
}
.preview-title { font-size: 26px; }

/* Wider 2-column grid */
.audit-grid {
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 28px;
}
.audit-grid .checklist-wrap {
  padding: 28px 30px;
  border-radius: 18px;
}

/* Findings rail becomes a 2-col grid when wide */
.findings-rail .findings {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.findings-rail .findings-head {
  font-size: clamp(22px, 2.4vw, 28px);
  margin: 0 0 18px;
  font-weight: 500;
}
.findings-rail .finding-slot {
  min-height: 130px;
  padding: 18px 20px;
  border-radius: 14px;
}
.findings-rail .finding-title { font-size: 17px; }
.findings-rail .finding p { font-size: 14px; }

/* More dramatic checklist */
.step { padding: 14px 0; gap: 16px; }
.step-icon { width: 26px; height: 26px; flex-basis: 26px; margin-top: 0; }
.step-label { font-size: 16px; font-weight: 500; }
.step-detail { font-size: 13px; }

/* Results page also wider */
.results-head h1 { font-size: clamp(30px, 4vw, 44px); }
.findings--grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Stack on tablet/mobile */
@media (max-width: 980px) {
  .audit { padding: 16px 20px 96px; }
  .audit-grid { grid-template-columns: 1fr; }
  .audit-grid .checklist-wrap { position: static; }
  .preview { grid-template-columns: 1fr; }
}
.audit-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 12px 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

/* ─── preview (screenshot card) ─────────────────────────────────────── */
.preview {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  animation: revealCard 350ms ease-out;
}
.preview-shot {
  aspect-ratio: 16 / 10;
  background: var(--cream-2);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.preview-shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  display: block;
  animation: fadeIn 400ms ease-out;
}
.preview-shot-placeholder { color: var(--muted); }
.preview.is-skeleton .preview-shot {
  background: linear-gradient(110deg, var(--cream-2) 8%, var(--cream) 18%, var(--cream-2) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.preview.is-skeleton .preview-meta .sk-line {
  height: 14px;
  background: var(--cream-2);
  border-radius: 6px;
  margin: 6px 0;
}
.preview.is-skeleton .preview-meta .sk-line--title { width: 70%; height: 22px; }
.preview.is-skeleton .preview-meta .sk-line--body-2 { width: 50%; }
.preview-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.preview-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lo);
}
.preview-title {
  font-family: "Newsreader", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-url {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── audit 2-column layout (checklist + findings side-by-side) ────── */
.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.audit-grid .checklist-wrap { margin-bottom: 0; position: sticky; top: 20px; }
.findings-rail .findings-head {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--ink);
  font-family: "Newsreader", serif;
  font-weight: 500;
}
.findings-rail .findings { gap: 10px; }
.findings-rail .finding-slot {
  padding: 14px 16px;
  min-height: 90px;
}
.findings-rail .finding-title { font-size: 16px; margin: 6px 0 8px; }
.findings-rail .finding p { font-size: 13.5px; margin: 4px 0; }
.findings-rail .finding-hook { font-size: 13px; }
@media (max-width: 900px) {
  .audit-grid { grid-template-columns: 1fr; }
  .audit-grid .checklist-wrap { position: static; }
}

/* ─── stats panel (prefetch results) ────────────────────────────────── */
.stats-panel {
  margin: 4px 0 24px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  animation: revealCard 350ms ease-out;
}
.stats-panel.is-hidden { display: none; }
.stats-head {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 14px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.stat {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--cream);
  border: 1px solid var(--line-soft);
  animation: revealCard 280ms ease-out backwards;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.stat-value {
  font-family: "Newsreader", serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.stat--ok { background: #e7f1ec; border-color: #c8e0d1; }
.stat--ok .stat-value { color: #1f5a35; }
.stat--ok .stat-label { color: #2f7a4d; }
.stat--warn { background: #faf1d4; border-color: #ecdba2; }
.stat--warn .stat-value { color: #6e5212; }
.stat--warn .stat-label { color: #8a6210; }
.stat--bad { background: #fbe4df; border-color: #f0d2c8; }
.stat--bad .stat-value { color: #8c3320; }
.stat--bad .stat-label { color: #a04030; }
@media (max-width: 640px) {
  .preview { grid-template-columns: 1fr; }
  .preview-shot { max-width: 100%; }
}

.audit-domain {
  font-family: "Newsreader", serif;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.015em;
}
.audit-email {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.btn-cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 8px 16px;
  font-size: 13px;
}
.btn-cancel:hover { color: var(--hi); border-color: var(--hi); background: var(--paper); filter: none; }

/* ── checklist ─────────────────────────────────────────────────────── */
.checklist-wrap {
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: opacity 200ms;
}
.step:last-child { border-bottom: 0; }
.step--pending { opacity: 0.55; }
.step--skipped { opacity: 0.4; }
.step-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  position: relative;
  transition: border-color 220ms, background 220ms, transform 220ms;
}
.step--active .step-icon {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 0 rgba(0, 86, 167, 0.32);
  animation: ringPulse 1.6s ease-out infinite;
}
.step--active .step-icon::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBreathe 1.6s ease-in-out infinite;
}
.step--done .step-icon {
  border-color: var(--lo);
  background: var(--lo);
}
.step--done .step-icon::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M3 7.5 L6 10.5 L11 4.5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.step--skipped .step-icon {
  border-style: dashed;
  background: var(--cream-2);
}
.step-body { flex: 1; min-width: 0; }
.step-label {
  display: block;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
}
.step--skipped .step-label { text-decoration: line-through; color: var(--muted); }
.step-detail {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step--active .step-label::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
}

@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 86, 167, 0.32); }
  70%  { box-shadow: 0 0 0 10px rgba(0, 86, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 86, 167, 0); }
}
@keyframes dotBreathe {
  0%, 100% { opacity: 0.55; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1.05); }
}

/* ── caption ticker (the agent's live narration) ───────────────────── */
.caption-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-soft);
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 22px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.caption-dots {
  display: inline-flex;
  gap: 4px;
}
.caption-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: bounceDot 1.2s ease-in-out infinite;
}
.caption-dots span:nth-child(2) { animation-delay: 150ms; }
.caption-dots span:nth-child(3) { animation-delay: 300ms; }
@keyframes bounceDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}
.caption-text {
  flex: 1;
  font-style: italic;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fadeIn 200ms ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── progress bar ──────────────────────────────────────────────────── */
.progress-bar {
  margin: 18px 0 4px;
  height: 4px;
  background: var(--cream-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #4a8fd0);
  border-radius: var(--radius-pill);
  animation: progressCrawl 50s linear forwards;
}
@keyframes progressCrawl {
  0%   { width: 0%; }
  15%  { width: 30%; }
  40%  { width: 55%; }
  80%  { width: 82%; }
  100% { width: 92%; }
}
.progress-text {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: 0.03em;
}

/* ── findings: skeleton + real ─────────────────────────────────────── */
.findings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 8px;
}
.findings-head {
  font-family: "Newsreader", serif;
  font-size: 22px;
  margin: 32px 0 12px;
  color: var(--ink);
}
.finding-slot {
  min-height: 110px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
  transition: opacity 250ms, transform 250ms;
}
.finding-slot.is-skeleton {
  background: linear-gradient(110deg, var(--paper) 8%, var(--cream-2) 18%, var(--paper) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.finding-slot.is-skeleton .sk-line {
  height: 12px;
  background: var(--cream-2);
  border-radius: 6px;
  margin: 6px 0;
}
.finding-slot.is-skeleton .sk-line.sk-line--short { width: 30%; }
.finding-slot.is-skeleton .sk-line.sk-line--title { width: 70%; height: 18px; margin: 12px 0 14px; }
.finding-slot.is-skeleton .sk-line.sk-line--body { width: 90%; }
.finding-slot.is-skeleton .sk-line.sk-line--body-2 { width: 75%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.finding-slot.is-revealed {
  animation: revealCard 350ms ease-out;
}
@keyframes revealCard {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.finding {
  border-left: 3px solid var(--line);
  padding-left: 19px;
}
.finding--high { border-left-color: var(--hi); }
.finding--medium { border-left-color: var(--med); }
.finding--low { border-left-color: var(--lo); }
.finding-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.finding-ord {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.finding-title {
  font-family: "Newsreader", serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.25;
  margin: 8px 0 10px;
  letter-spacing: -0.005em;
}
.finding p { font-size: 14.5px; line-height: 1.55; margin: 6px 0; color: var(--ink-2); }
.finding p strong { color: var(--ink); font-weight: 500; }
.finding-hook { color: var(--accent); font-style: italic; }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font: 600 10.5px/1.4 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}
.chip--high { background: #fbeae6; color: #8c3320; border-color: #f0d2c8; }
.chip--medium { background: #f8eed1; color: #6e5212; border-color: #ecdba2; }
.chip--low { background: #e1efe5; color: #1f5a35; border-color: #c8e0d1; }
.chip--cat { background: var(--cream-2); color: var(--ink-2); border-color: var(--line-soft); }
.chip--status { background: var(--cream-2); color: var(--ink-2); }
.chip--status-running { background: #dbe7f4; color: #1d4a8a; }
.chip--status-done { background: #e1efe5; color: #1f5a35; }
.chip--status-error { background: #fbeae6; color: #8c3320; }
.chip--status-cancelled { background: var(--cream-2); color: var(--muted); }

/* ── results / error panels ────────────────────────────────────────── */
.results { animation: fadeIn 300ms ease-out; }
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}
.results-head h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 8px;
}
.results-head .dom {
  color: var(--accent);
  font-style: italic;
}
.results-summary {
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.5;
  max-width: 540px;
}
.btn-primary {
  background: var(--ink);
  color: var(--accent-ink);
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  white-space: nowrap;
  border: 0;
}
.btn-primary:hover { filter: brightness(1.1); border: 0; }

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin: 16px 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}
.toast--ok { background: #e1efe5; color: #1f5a35; border-color: #c8e0d1; }
.toast--warn { background: #f8eed1; color: #6e5212; border-color: #ecdba2; }

.results-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
}
.results-permalink {
  margin-top: 32px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.error-panel { animation: fadeIn 300ms ease-out; padding-top: 16px; }
.error-panel h1 { color: var(--hi); }
.error-msg { color: var(--ink-2); font-size: 16px; margin: 12px 0 28px; }

/* ── centered (unlock, busy) ───────────────────────────────────────── */
.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.card {
  max-width: 420px;
  width: 100%;
  background: var(--paper);
  padding: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
}
.unlock h1 { font-size: 30px; margin-bottom: 6px; }
.unlock p { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.unlock label { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.unlock button { width: 100%; padding: 14px; font-size: 15px; margin-top: 12px; justify-content: center; }

/* ── admin ─────────────────────────────────────────────────────────── */
.admin {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 32px 96px;
}
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 16px 0 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  gap: 16px;
}
.admin-head h1 {
  font-size: 36px;
  margin: 0;
}
.admin-nav { display: flex; gap: 18px; font-size: 14px; align-items: center; }
.link-btn {
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
}
.link-btn:hover { background: transparent; text-decoration: underline; filter: none; transform: none; }

.admin-search {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 480px;
  position: relative;
}
.admin-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  line-height: 0;
}
.admin-search input { flex: 1; padding: 10px 14px 10px 40px; }
.admin-search button { padding: 10px 18px; background: var(--ink); }
.admin-nav a, .admin-nav .link-btn { display: inline-flex; align-items: center; gap: 6px; }
.unlock-icon { color: var(--accent); margin-bottom: 14px; line-height: 0; }
.toast { line-height: 1.4; }
.finding-hook { display: flex; align-items: flex-start; gap: 8px; }
.finding-hook .icon { margin-top: 3px; }
.chip--cat { display: inline-flex; align-items: center; gap: 4px; }
.admin-pager a { display: inline-flex; align-items: center; gap: 6px; }

.admin-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-size: 14px;
}
.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.admin-table th {
  font: 600 11px/1.2 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--cream);
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: var(--cream); }
.admin-table .empty { text-align: center; color: var(--muted); padding: 36px; }
.admin-pager {
  display: flex;
  gap: 18px;
  margin-top: 20px;
  justify-content: center;
}

.admin-section { margin-top: 36px; }
.admin-section h2 {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ev-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-size: 13px;
}
.ev-table th, .ev-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.ev-table th {
  font: 600 11px/1.2 "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--cream);
}
.ev-table tr:last-child td { border-bottom: 0; }
.ev-time { color: var(--muted); white-space: nowrap; width: 100px; font-variant-numeric: tabular-nums; }
.ev-kind { color: var(--muted); white-space: nowrap; width: 110px; font-weight: 500; }
.ev--tool_use .ev-kind { color: var(--accent); }
.ev--tool_result .ev-kind { color: var(--lo); }
.ev--finding .ev-kind { color: var(--med); }
.ev--error .ev-kind { color: var(--hi); }
.ev-body code {
  font: 12px/1.4 "SF Mono", Menlo, Consolas, monospace;
  background: var(--cream-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.report-iframe {
  width: 100%;
  height: 720px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--paper);
}

/* ── mobile ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .brand, .landing, .audit, .admin { padding-left: 18px; padding-right: 18px; }
  .hero { margin-top: 28px; }
  .results-head { flex-direction: column; gap: 16px; }
  .findings { gap: 12px; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  .admin-table { font-size: 12.5px; }
  .admin-table th, .admin-table td { padding: 10px 8px; }
}
