/* =========================================================================
   SEO Audit Tool — design system
   Adapted from the claude.ai/design "SEO Day" bundle.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Brand · Navy (parent equity — used as ink, not header field) */
  --navy-900: #14213d;
  --navy-800: #1a2a4d;
  --navy-700: #243a63;
  --navy-100: #e7ecf3;
  --navy-50:  #f1f4f9;

  /* Warm primary · audit accent */
  --warm-700: oklch(0.46 0.12 45);
  --warm-600: oklch(0.56 0.13 45);  /* primary CTA */
  --warm-500: oklch(0.64 0.14 45);
  --warm-200: oklch(0.92 0.04 45);
  --warm-100: oklch(0.96 0.02 45);

  /* Paper · surface */
  --paper:    #fbf8f3;
  --paper-2:  #f5f1e8;
  --surface:  #ffffff;
  --surface-2:#fafaf7;

  /* Ink */
  --ink-1: #1a1b1e;
  --ink-2: #4a4b50;
  --ink-3: #7a7b80;
  --ink-4: #a8a9af;

  /* Lines */
  --line:        #ece7dc;
  --line-strong: #d8d2c2;
  --line-soft:   #f1ede3;

  /* RAG — only colour signal that means status */
  --pass:        oklch(0.55 0.12 155);
  --pass-ink:    oklch(0.36 0.09 155);
  --pass-bg:     oklch(0.96 0.03 155);
  --pass-border: oklch(0.86 0.07 155);

  --partial:        oklch(0.62 0.13 70);
  --partial-ink:    oklch(0.42 0.10 65);
  --partial-bg:     oklch(0.96 0.04 80);
  --partial-border: oklch(0.85 0.09 75);

  --fail:        oklch(0.55 0.17 28);
  --fail-ink:    oklch(0.42 0.13 28);
  --fail-bg:     oklch(0.96 0.04 28);
  --fail-border: oklch(0.86 0.09 28);

  --na-bg:    #f5f1e8;
  --na-ink:   #7a7b80;
  --na-line:  #d8d2c2;

  /* Type */
  --serif:  "Instrument Serif", "Source Serif Pro", Georgia, serif;
  --sans:   "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radius / shadow / motion */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(20,20,40,.04), 0 1px 1px rgba(20,20,40,.03);
  --shadow-2: 0 2px 6px rgba(20,20,40,.06), 0 1px 2px rgba(20,20,40,.04);
  --shadow-3: 0 8px 24px rgba(20,20,40,.08), 0 2px 6px rgba(20,20,40,.04);

  --ease: cubic-bezier(.2,.7,.3,1);
}

/* =========================================================================
   Base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink-1);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* =========================================================================
   Type utilities
   ========================================================================= */
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.dim   { color: var(--ink-2); }

/* =========================================================================
   Header
   ========================================================================= */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: relative;
}
header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--navy-900); opacity: 0;
}
header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--navy-900);
  display: flex; align-items: center; gap: 14px;
}
header h1 .att-logo {
  height: 32px; width: auto; display: block;
}
header h1 .product-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
}
header .header-links {
  display: flex; gap: 22px; align-items: center;
  font-size: 14px;
}
header a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color .12s var(--ease);
}
header a:hover { color: var(--ink-1); }

/* =========================================================================
   Layout
   ========================================================================= */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 62px);
}

main {
  padding: 36px 56px 80px;
  max-width: 1080px;
  width: 100%;
}

/* =========================================================================
   Sidebar
   ========================================================================= */
.step-nav {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}
.step-nav ol { list-style: none; margin: 0; padding: 0; }
.step-nav li {
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 4px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.step-nav li:hover { background: var(--surface); }
.step-nav li.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
.step-nav .title {
  color: var(--ink-1);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  display: flex; align-items: baseline; gap: 8px;
}
.step-nav .title::first-letter,
.step-nav .title::before {
  /* no-op — number lives in text */
}
.step-nav .title:hover { color: var(--navy-900); }
.step-nav .state-pending .title { color: var(--ink-3); cursor: default; }
.step-nav .state-pending .title:hover { color: var(--ink-3); }

.step-nav .status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding-left: 22px;
}
.step-nav .status::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; flex: 0 0 6px;
}
.state-locked .status     { color: var(--pass-ink); }
.state-in_progress .status{ color: var(--warm-700); }
.state-pending .status    { color: var(--ink-4); }

.step-nav .finding-count {
  font-size: 11px; color: var(--ink-3);
  text-transform: none; letter-spacing: 0; font-weight: 500;
}
.step-nav .rag-dot { display: none; }   /* breakdown pills carry the colour now */

.step-nav .finding-breakdown {
  display: inline-flex; gap: 4px;
  padding-left: 22px; padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.step-nav .finding-breakdown > span {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
  border: 1px solid transparent;
}
.step-nav .breakdown-pass {
  background: var(--pass-bg); color: var(--pass-ink); border-color: var(--pass-border);
}
.step-nav .breakdown-pass::after { content: none; }
.step-nav .breakdown-partial {
  background: var(--partial-bg); color: var(--partial-ink); border-color: var(--partial-border);
}
.step-nav .breakdown-partial::after { content: none; }
.step-nav .breakdown-fail {
  background: var(--fail-bg); color: var(--fail-ink); border-color: var(--fail-border);
}
.step-nav .breakdown-fail::after { content: none; }

/* Group labels */
.step-nav-group-label {
  padding: 16px 12px 6px !important;
  margin-bottom: 0 !important;
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border-bottom: none !important;
  pointer-events: none;
}
.step-nav-group-label:first-child { padding-top: 8px !important; }
.step-nav-group-label:hover { background: transparent !important; }

/* Progress summary */
.step-nav .progress-summary {
  padding: 4px 12px 18px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.step-nav .progress-summary-text {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  margin-bottom: 10px;
}
.step-nav .progress-summary-text strong {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink-1);
  line-height: 1;
}
.step-nav .progress-bar {
  height: 6px; background: var(--paper-2); border-radius: 999px;
  overflow: hidden;
}
.step-nav .progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--warm-600), var(--warm-500));
  border-radius: 999px;
  transition: width 0.3s var(--ease);
}

.audit-overall-dot {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 999px;
  vertical-align: middle;
}
.audit-overall-dot.rag-red   { background: var(--fail); }
.audit-overall-dot.rag-amber { background: var(--partial); }
.audit-overall-dot.rag-green { background: var(--pass); }

/* =========================================================================
   Step page chrome
   ========================================================================= */
main h2 {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0 0 4px;
  color: var(--ink-1);
}
main h2 .show-prompt-link {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  border-radius: var(--r-pill);
  transition: background .12s var(--ease);
  align-self: center;
}
main h2 .show-prompt-link:hover { background: var(--paper-2); }

.step-eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warm-700);
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 12px;
}
.step-eyebrow::before {
  content: "";
  width: 24px; height: 2px;
  background: var(--warm-600);
  border-radius: 2px;
}

/* =========================================================================
   Step intro card
   ========================================================================= */
.step-intro {
  background:
    radial-gradient(140% 100% at 100% 0%, var(--warm-100) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  margin: 18px 0 28px;
  color: var(--ink-1);
  font-size: 17px;
  line-height: 1.55;
  box-shadow: var(--shadow-1);
  border-left: 1px solid var(--line);  /* override old border-left accent */
}
.step-intro p { margin: 0; }
.step-intro p + p { margin-top: 10px; }

/* =========================================================================
   Hint / alert
   ========================================================================= */
.hint {
  background: var(--partial-bg);
  border: 1px solid var(--partial-border);
  border-left: 3px solid var(--partial);
  color: var(--partial-ink);
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
}

/* =========================================================================
   Buttons
   ========================================================================= */
button, input[type="submit"] {
  font-family: inherit;
}
.lock-button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  background: var(--warm-600);
  color: #fff;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.18);
  transition: background .15s var(--ease), transform .08s var(--ease);
}
.lock-button:hover { background: var(--warm-700); }
.lock-button:active { transform: translateY(1px); }
.lock-button:disabled,
form.with-loading button[disabled] {
  opacity: 0.7; cursor: progress;
}

.reopen-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s var(--ease);
}
.reopen-button:hover { background: var(--paper-2); color: var(--ink-1); }

.link-button {
  background: none;
  border: 0;
  color: var(--warm-700);
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  font-size: 14px;
  text-decoration: none;
}
.link-button:hover { color: var(--warm-600); text-decoration: underline; }

.show-prompt-link {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
}
.show-prompt-link:hover { background: var(--paper-2); color: var(--ink-1); }

.prefill-note { color: var(--ink-3); font-size: 12px; margin-top: 4px; }

/* =========================================================================
   Forms
   ========================================================================= */
.params-form, .wizard-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  margin-top: 18px;
  box-shadow: var(--shadow-1);
}
.params-form h3, .wizard-form h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.wizard-form > .hint, .params-form > .hint {
  background: transparent; border: 0; padding: 0;
  color: var(--ink-2); font-size: 14px;
  margin-bottom: 18px;
}

.param-field {
  display: flex; flex-direction: column; gap: 6px;
  margin: 14px 0;
}
.param-field span {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.param-field input,
.param-field textarea {
  font: inherit;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  outline: none;
  color: var(--ink-1);
  transition: border-color .12s var(--ease), background .12s var(--ease), box-shadow .12s var(--ease);
}
.param-field input:focus,
.param-field textarea:focus {
  border-color: var(--warm-600);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--warm-100);
}
.param-field textarea { resize: vertical; min-height: 80px; }

.params-form button, .wizard-form button[type="submit"] {
  padding: 11px 20px;
  background: var(--warm-600);
  color: #fff;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
}
.params-form button:hover, .wizard-form button[type="submit"]:hover {
  background: var(--warm-700);
}

.params-summary {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  display: flex; gap: 18px; flex-wrap: wrap;
  margin: 14px 0;
}
.params-summary strong { color: var(--ink-1); font-weight: 600; }

.mode-toggle-form { margin-top: 14px; }

/* =========================================================================
   Chat / conversational view  (recast as interview transcript)
   ========================================================================= */
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 8px 28px;
  min-height: 240px;
  max-height: 65vh;
  overflow-y: auto;
  box-shadow: var(--shadow-1);
}
.chat-panel .empty { color: var(--ink-3); font-style: italic; padding: 16px 0; }

.turn {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.turn:last-child { border-bottom: 0; }

.turn::before {
  content: "ATT";
  grid-row: span 2;
  width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--navy-900);
  color: #fff;
}
.turn.role-user::before {
  content: "You";
  background: var(--warm-200);
  color: var(--warm-700);
  font-size: 13px;
}

.turn .role {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}
.turn.role-assistant .role::first-letter { text-transform: uppercase; }
/* Override .role text content via CSS for cleaner labels */
.turn.role-assistant .role { font-size: 0; }
.turn.role-assistant .role::after {
  content: "SEO Auditor";
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.turn.role-user .role { font-size: 0; }
.turn.role-user .role::after {
  content: "You";
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.turn .content {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-1);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.turn .content.rendered { white-space: normal; }
.turn .content.rendered h1,
.turn .content.rendered h2,
.turn .content.rendered h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0.9em 0 0.3em;
  line-height: 1.2;
}
.turn .content.rendered h1 { font-size: 1.3rem; }
.turn .content.rendered h2 { font-size: 1.15rem; }
.turn .content.rendered h3 { font-size: 1.05rem; }
.turn .content.rendered p { margin: 0.55em 0; }
.turn .content.rendered ul,
.turn .content.rendered ol { margin: 0.4em 0; padding-left: 1.4em; }
.turn .content.rendered li { margin: 0.2em 0; }
.turn .content.rendered code {
  background: var(--paper-2);
  padding: 0.05em 0.4em;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.88em;
}
.turn .content.rendered pre {
  background: var(--paper-2);
  padding: 0.7em 0.9em;
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-size: 0.85em;
  border-left: 2px solid var(--warm-600);
}
.turn .content.rendered table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
  font-size: 0.92rem;
}
.turn .content.rendered th,
.turn .content.rendered td {
  border: 1px solid var(--line);
  padding: 0.4em 0.6em;
  text-align: left;
  vertical-align: top;
}
.turn .content.rendered th {
  background: var(--paper-2);
  color: var(--ink-2);
  font-weight: 600;
}
.turn .content.rendered blockquote {
  border-left: 2px solid var(--warm-600);
  margin: 0.6em 0;
  padding: 0.2em 0.9em;
  color: var(--ink-2);
}
.turn .content.rendered hr { border: 0; border-top: 1px solid var(--line); margin: 0.9em 0; }
.turn .content.rendered a { color: var(--warm-700); text-decoration: underline; }

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px 12px 12px 18px;
  box-shadow: var(--shadow-1);
}
.chat-form textarea {
  border: 0;
  outline: none;
  resize: none;
  font: inherit;
  color: var(--ink-1);
  background: transparent;
  padding: 4px 0;
  min-height: 56px;
}
.chat-form button {
  padding: 0 22px;
  background: var(--warm-600);
  color: #fff;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.chat-form button:hover { background: var(--warm-700); }

.lock-form { margin-top: 16px; }

/* Thinking indicator */
.turn.thinking .content::after {
  content: 'Thinking…';
  color: var(--ink-3);
  font-style: italic;
  animation: thinking-pulse 1.4s ease-in-out infinite;
}
@keyframes thinking-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Stuck-recovery hint — appears under the assistant bubble when the
   stream has been silent for ~45s, escalates with a retry button at ~120s. */
.stuck-hint {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--partial-bg);
  border: 1px solid var(--partial-border);
  border-left: 3px solid var(--partial);
  color: var(--partial-ink);
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.stuck-hint--hard {
  background: var(--fail-bg);
  border-color: var(--fail-border);
  border-left-color: var(--fail);
  color: var(--fail-ink);
}
.stuck-hint__retry {
  background: var(--surface);
  border: 1px solid var(--fail-border);
  color: var(--fail-ink);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s var(--ease);
}
.stuck-hint__retry:hover { background: var(--fail-bg); }

/* Interrupted (partial) assistant turn */
.turn.partial {
  background: rgba(212, 154, 0, 0.04);
}
.turn.partial::after {
  content: ""; position: absolute; left: 56px; top: 0; bottom: 0; width: 2px;
  background: var(--partial);
}
.partial-badge {
  display: inline-block;
  padding: 1px 6px;
  background: var(--partial-bg);
  color: var(--partial-ink);
  border: 1px solid var(--partial-border);
  border-radius: 3px;
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.4em;
  vertical-align: middle;
  cursor: help;
}

/* =========================================================================
   Locked panel
   ========================================================================= */
.locked-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0;
  margin-top: 20px;
  box-shadow: var(--shadow-1);
}
.locked-panel > p:first-child {
  display: flex; align-items: center; gap: 12px;
  background:
    linear-gradient(90deg, var(--pass-bg), transparent 70%),
    var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 14px 20px;
  margin: 0;
  font-size: 14px;
  color: var(--ink-1);
}
.locked-panel > p:first-child::before {
  content: "";
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--pass);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  flex: 0 0 22px;
}
.locked-panel > *:not(:first-child) {
  padding-left: 24px;
  padding-right: 24px;
}
.locked-panel > *:last-child {
  padding-bottom: 22px;
}
.locked-panel h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 18px 0 12px;
}
.locked-panel details summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-2);
  padding: 8px 0;
}
.locked-panel details .summary {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper-2);
  padding: 14px 16px;
  border-radius: var(--r-sm);
  margin-top: 6px;
  color: var(--ink-2);
}
.locked-panel form { margin-top: 14px; }

/* =========================================================================
   Verdict / RAG colours — used by findings table + scorecard
   ========================================================================= */
.rag-red, .rag-fail   { color: var(--fail-ink); }
.rag-amber, .rag-partial { color: var(--partial-ink); }
.rag-green, .rag-pass { color: var(--pass-ink); }

.rag-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.rag-red.rag-dot   { background: var(--fail); }
.rag-amber.rag-dot { background: var(--partial); }
.rag-green.rag-dot { background: var(--pass); }

/* Verdict badge (used in findings table) */
.verdict-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.verdict-badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor;
}
.verdict-badge.bucket-pass {
  background: var(--pass-bg); color: var(--pass-ink); border-color: var(--pass-border);
}
.verdict-badge.bucket-partial {
  background: var(--partial-bg); color: var(--partial-ink); border-color: var(--partial-border);
}
.verdict-badge.bucket-fail {
  background: var(--fail-bg); color: var(--fail-ink); border-color: var(--fail-border);
}
.verdict-badge.bucket-na {
  background: var(--na-bg); color: var(--na-ink);
  border: 1px dashed var(--na-line);
}

/* =========================================================================
   Scorecard (rebuilt: hero + radial + tally + pillar strip)
   ========================================================================= */
.scorecard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-3);
  margin: 18px 0 28px;
}
.scorecard-header {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1.2fr;
  border-bottom: 1px solid var(--line);
}
.scorecard-overall {
  padding: 28px 32px;
  background:
    radial-gradient(120% 100% at 0% 100%, var(--warm-100), transparent 60%),
    var(--surface);
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 16px;
  border-right: 1px solid var(--line);
}
.scorecard-rag-label {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}
.scorecard-rag-chip {
  width: 10px; height: 10px; border-radius: 3px;
}
.scorecard-rag-chip.rag-red   { background: var(--fail); }
.scorecard-rag-chip.rag-amber { background: var(--partial); }
.scorecard-rag-chip.rag-green { background: var(--pass); }

.scorecard-bignum {
  font-family: var(--serif);
  font-size: 88px;
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--ink-1);
  display: flex; align-items: baseline; gap: 4px;
}
.scorecard-bignum-suffix {
  color: var(--ink-3);
  font-size: 22px;
}

.scorecard-bench {
  font-size: 13px;
  color: var(--ink-2);
}

.scorecard-radial {
  padding: 28px 24px;
  display: grid; place-items: center;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--paper));
}
.scorecard-radial-svg {
  width: 220px; height: 220px;
  position: relative;
}
.scorecard-radial-svg svg { display: block; width: 100%; height: 100%; }
.scorecard-radial-center {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
}
.scorecard-radial-num {
  font-family: var(--serif);
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.scorecard-radial-lbl {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

.scorecard-tally {
  padding: 28px 32px;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 18px;
}
.scorecard-tally-h {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.scorecard-tally-rows {
  display: flex; flex-direction: column; gap: 12px;
}
.scorecard-tally-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 16px;
}
.scorecard-tally-num {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.scorecard-tally-row.bucket-pass    .scorecard-tally-num { color: var(--pass-ink); }
.scorecard-tally-row.bucket-partial .scorecard-tally-num { color: var(--partial-ink); }
.scorecard-tally-row.bucket-fail    .scorecard-tally-num { color: var(--fail-ink); }
.scorecard-tally-bar {
  height: 10px; border-radius: 999px;
  background: var(--paper-2);
  position: relative; overflow: hidden;
}
.scorecard-tally-bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.scorecard-tally-row.bucket-pass    .scorecard-tally-bar-fill { background: var(--pass); }
.scorecard-tally-row.bucket-partial .scorecard-tally-bar-fill { background: var(--partial); }
.scorecard-tally-row.bucket-fail    .scorecard-tally-bar-fill { background: var(--fail); }
.scorecard-tally-lbl {
  font-size: 13px; color: var(--ink-2); font-weight: 500;
}

/* Pillar strip */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(var(--scorecard-columns, 5), 1fr);
  background: var(--paper);
}
.scorecard-area {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--line);
  position: relative;
}
.scorecard-area:last-child { border-right: 0; }
.scorecard-area-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  min-height: 28px;
}
.scorecard-area-score {
  display: flex; align-items: baseline; gap: 4px;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.scorecard-area-score-suffix { color: var(--ink-3); font-size: 14px; }
.scorecard-area-bar {
  height: 4px; background: var(--paper-2); border-radius: 999px;
  overflow: hidden;
}
.scorecard-area-bar-fill {
  display: block; height: 100%; border-radius: 999px;
}
.scorecard-area.rag-green .scorecard-area-bar-fill { background: var(--pass); }
.scorecard-area.rag-amber .scorecard-area-bar-fill { background: var(--partial); }
.scorecard-area.rag-red   .scorecard-area-bar-fill { background: var(--fail); }
.scorecard-area-detail {
  font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.scorecard-area-count.pass    { color: var(--pass-ink); font-weight: 600; }
.scorecard-area-count.partial { color: var(--partial-ink); font-weight: 600; }
.scorecard-area-count.fail    { color: var(--fail-ink); font-weight: 600; }

.scorecard-area.missing {
  background: repeating-linear-gradient(135deg, var(--paper) 0 8px, var(--paper-2) 8px 12px);
}
.scorecard-area.missing .scorecard-area-score { color: var(--ink-4); }
.scorecard-area.missing .scorecard-area-detail { color: var(--ink-3); font-style: italic; }

/* =========================================================================
   Findings table (new grid layout, hover-to-expand)
   ========================================================================= */
.audit-findings-panel { margin-top: 22px; }
.audit-findings-panel h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 6px 0 14px;
}

.findings-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}
.findings-table thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}
.findings-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink-2);
  line-height: 1.5;
}
.findings-table tbody tr:last-child td { border-bottom: 0; }
.findings-table tbody tr:hover { background: var(--paper); }
.findings-table tbody td:first-child {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-3);
  width: 44px;
}
.findings-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--ink-1);
  font-size: 13.5px;
}
/* Verdict cell — render as a badge via colour class on the row */
.findings-table tr[class*="verdict-"] td:nth-child(3) {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.findings-table tr.verdict-pass    td:nth-child(3),
.findings-table tr.verdict-strong  td:nth-child(3),
.findings-table tr.verdict-ok      td:nth-child(3) { color: var(--pass-ink); }
.findings-table tr.verdict-partial td:nth-child(3),
.findings-table tr.verdict-adequate td:nth-child(3),
.findings-table tr.verdict-nice_to_have td:nth-child(3) { color: var(--partial-ink); }
.findings-table tr.verdict-fail    td:nth-child(3),
.findings-table tr.verdict-weak    td:nth-child(3),
.findings-table tr.verdict-missing td:nth-child(3),
.findings-table tr.verdict-important td:nth-child(3),
.findings-table tr.verdict-critical td:nth-child(3) { color: var(--fail-ink); }
.findings-table tr.verdict-na      td:nth-child(3) { color: var(--ink-3); font-style: italic; }

/* The "recommended fix" cell sits in ink-1 since it's actionable */
.findings-table tbody td:last-child {
  color: var(--ink-1);
}

/* =========================================================================
   Keyword panel (Step 3)
   ========================================================================= */
.keywords-panel { margin-top: 18px; }
.keywords-panel h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 6px 0 10px;
}
.keyword-category {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin: 12px 0;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.keyword-category > summary {
  padding: 14px 22px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  list-style: none;
}
.keyword-category > summary::-webkit-details-marker { display: none; }
.keyword-category > summary::before {
  content: "›";
  display: inline-block;
  margin-right: 10px;
  color: var(--ink-3);
  transition: transform .12s var(--ease);
}
.keyword-category[open] > summary::before { transform: rotate(90deg); }

.keyword-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.keyword-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 12px 22px 8px;
  border-bottom: 1px solid var(--line);
}
.keyword-table td {
  padding: 10px 22px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-1);
}
.keyword-table tbody tr:last-child td { border-bottom: 0; }
.keyword-table td:last-child {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}

/* =========================================================================
   Persona cards (Step 2)
   ========================================================================= */
.persona-edit-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.persona-edit-form > button { grid-column: 1 / -1; justify-self: start; }

.persona-card {
  grid-column: span 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-1);
  margin: 0;
}
.persona-card legend {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  padding: 0 8px 0 0;
  color: var(--ink-1);
}
.persona-card legend small {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-left: 6px;
}
.persona-card .param-field { margin: 10px 0; }

/* =========================================================================
   Compile / streaming (Step 8)
   ========================================================================= */
.compiling-panel {
  background: var(--surface);
  border: 1px solid var(--pass-border);
  border-left: 3px solid var(--pass);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  margin-top: 18px;
  box-shadow: var(--shadow-1);
}
.compiling-panel h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.compile-stream-output {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin-top: 12px;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
}
.compile-stream-output:not(.rendered) {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}
.compile-stream-output.rendered h1,
.compile-stream-output.rendered h2,
.compile-stream-output.rendered h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.compile-stream-output.rendered h1 { font-size: 1.4rem; margin: 0.9em 0 0.4em; }
.compile-stream-output.rendered h2 { font-size: 1.15rem; margin: 0.8em 0 0.4em; }
.compile-stream-output.rendered h3 { font-size: 1.0rem; margin: 0.7em 0 0.3em; }
.compile-stream-output.rendered p { margin: 0.5em 0; }
.compile-stream-output.rendered ul,
.compile-stream-output.rendered ol { margin: 0.4em 0; padding-left: 1.4em; }
.compile-stream-output.rendered table {
  border-collapse: collapse; width: 100%; margin: 0.6em 0; font-size: 0.92em;
}
.compile-stream-output.rendered th,
.compile-stream-output.rendered td {
  border: 1px solid var(--line); padding: 0.4em 0.6em;
}
.compile-stream-output.rendered th { background: var(--paper-2); }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--pass-border);
  border-top-color: var(--pass);
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 6px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   UI text edit (admin pencil)
   ========================================================================= */
.ui-text-edit {
  background: rgba(20,33,61,.06);
  border: 1px solid rgba(20,33,61,.18);
  color: var(--navy-700);
  cursor: pointer;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 4px;
  font-size: 0.85em;
  line-height: 1.6;
  vertical-align: middle;
  opacity: 0.55;
  transition: opacity .15s var(--ease);
}
.ui-text-edit:hover { opacity: 1; }
.ui-text-edit-dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0;
  max-width: 640px;
  width: 90%;
  box-shadow: var(--shadow-3);
}
.ui-text-edit-dialog::backdrop { background: rgba(20,33,61,.35); }
.ui-text-edit-form { padding: 22px 26px; display: flex; flex-direction: column; gap: 12px; }
.ui-text-edit-form h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}
.ui-text-edit-key {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  margin: 0;
}
.ui-text-edit-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 8em;
  background: var(--paper);
}
.ui-text-edit-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ui-text-edit-cancel {
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--ink-2); padding: 7px 16px; border-radius: var(--r-pill); cursor: pointer;
}
.ui-text-edit-submit {
  background: var(--warm-600); color: #fff; border: 0;
  padding: 7px 18px; border-radius: var(--r-pill); cursor: pointer; font-weight: 600;
}
.ui-text-edit-submit:hover { background: var(--warm-700); }
.ui-text-edit-error {
  background: var(--fail-bg);
  border: 1px solid var(--fail-border);
  color: var(--fail-ink);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  margin: 0;
  font-size: 13px;
}

/* =========================================================================
   Admin dev notes
   ========================================================================= */
.admin-notes {
  margin-top: 28px;
  padding: 14px 18px;
  background: var(--partial-bg);
  border: 1px solid var(--partial-border);
  border-left: 3px solid var(--partial);
  border-radius: var(--r-md);
}
.admin-notes summary { cursor: pointer; font-weight: 600; color: var(--partial-ink); user-select: none; }
.admin-notes-count { color: var(--partial-ink); font-weight: 400; margin-left: 6px; opacity: .7; }
.admin-notes-body { margin-top: 12px; }
.admin-notes-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.admin-notes-list:empty { display: none; }
.admin-note {
  background: var(--surface);
  border: 1px solid var(--partial-border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
}
.admin-note-meta { display: flex; gap: 12px; align-items: baseline; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.admin-note-author { color: var(--ink-2); font-weight: 500; }
.admin-note-date { flex: 1; }
.admin-note-delete { font-size: 12px; }
.admin-note-content { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.admin-notes-form { display: flex; flex-direction: column; gap: 8px; }
.admin-notes-form textarea {
  padding: 8px 12px;
  border: 1px solid var(--partial-border);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  background: var(--surface);
}
.admin-notes-form button {
  align-self: flex-end;
  padding: 6px 16px;
  background: var(--partial); color: #fff; border: 0;
  border-radius: var(--r-pill); cursor: pointer;
  font-weight: 600; font-size: 13px;
}
.admin-notes-error {
  background: var(--fail-bg); border: 1px solid var(--fail-border); color: var(--fail-ink);
  padding: 6px 10px; border-radius: var(--r-sm); margin: 8px 0 0; font-size: 13px;
}

/* =========================================================================
   Show-prompt modal
   ========================================================================= */
.prompt-modal {
  width: min(900px, 92vw);
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
}
.prompt-modal::backdrop { background: rgba(20,33,61,.4); }
.prompt-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.prompt-modal-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.prompt-modal-close { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 0 6px; }
.prompt-modal-close:hover { color: var(--ink-1); }
.prompt-modal-tabs { display: flex; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.prompt-tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 16px; cursor: pointer;
  font-size: 13px; color: var(--ink-3);
}
.prompt-tab.is-active { border-bottom-color: var(--warm-600); color: var(--warm-700); font-weight: 600; }
.prompt-modal-body { overflow: auto; max-height: calc(85vh - 110px); }
.prompt-pane { display: none; padding: 16px 22px; }
.prompt-pane.is-active { display: block; }
.prompt-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 8px; }
.prompt-toolbar small { color: var(--ink-3); font-size: 12px; }
.prompt-text {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
  margin: 0;
  color: var(--ink-2);
}
.copy-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  cursor: pointer;
}
.copy-button:hover { background: var(--paper-2); }

/* Grounding trace */
.grounding-trace { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.grounding-trace summary { cursor: pointer; color: var(--warm-700); }
.grounding-trace ul { margin: 6px 0 0; padding-left: 20px; }
.grounding-trace li { word-break: break-all; }

/* Inline HTML editing toolbar (Bold / Italic / Link / Paragraph / List).
   Sits above a textarea; loaded via /static/markup-toolbar.js for admins. */
.markup-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: fit-content;
}
.markup-toolbar__btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-1);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s var(--ease);
  min-width: 30px;
}
.markup-toolbar__btn:hover { background: var(--paper-2); border-color: var(--line-strong); }
.markup-toolbar__btn:active { background: var(--line); }

/* Free-tier paywall locks on sidebar steps (seoday-app-3li). */
.step-nav li.tier-locked .title {
  color: var(--ink-4);
  cursor: help;
  display: flex; align-items: center; gap: 6px;
}
.step-nav li.tier-locked .title:hover { color: var(--ink-3); }
.step-nav li.tier-locked .tier-lock-icon { font-size: 12px; opacity: 0.7; }
.step-nav li.tier-locked .status {
  color: var(--warm-700);
  font-weight: 600;
}
