/* AgentFit — documentation-first interface system. */

:root {
  --fg: #111318;
  --muted: #59616d;
  --line: #252a31;
  --line-soft: #d7dce2;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f0f3f6;
  --accent: #1558b0;
  --success: #176b3a;
  --warning: #8a5a00;
  --danger: #8f252b;
  --secondary: #6b3fa0;
  --info: #0b6e75;
  --unknown: #737b86;
  --max-width: 1180px;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Compatibility aliases used by the existing report renderers. */
  --bg-2: var(--surface-alt);
  --panel: var(--surface);
  --panel-2: var(--surface-alt);
  --line-strong: var(--line);
  --text: var(--fg);
  --text-dim: var(--muted);
  --text-faint: var(--muted);
  --cyan: var(--accent);
  --emerald: var(--success);
  --amber: var(--warning);
  --rose: var(--danger);
  --violet: var(--secondary);
  --grad: var(--accent);
  --radius: 0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 280px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea, .card, .dashboard-card, .diagnostic-panel { border-radius: 0; }
button { color: inherit; }
a { color: var(--accent); text-underline-offset: 0.16em; }
a:visited { color: #4a3f9e; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
::selection { background: #cfe0f7; color: var(--fg); }

h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 1.7rem; line-height: 1.2; letter-spacing: -0.015em; }
h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
h3 { margin: 0; font-size: 1rem; line-height: 1.35; }
h4 { margin: 0; font-size: 0.95rem; }
.mono { font-family: var(--mono); }
.dim { color: var(--muted); }
.center { text-align: center; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.skip-link:focus { transform: translateY(0); }

/* Header and primary navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(246, 247, 249, 0.96);
}
.nav-inner {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 12px 16px;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
}
.logo:visited { color: var(--fg); }
.logo-mark {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border: 1px solid var(--line);
  color: var(--accent);
  font: 700 11px/1 var(--mono);
}
.logo-word { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  margin: 0;
}
.tab, .btab {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.tab:hover, .btab:hover { color: var(--fg); border-color: var(--line-soft); }
.tab.active, .btab.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--fg);
  font-weight: 650;
}

/* Root dashboard layout */
#dashboard-main {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 0 16px;
}
.dashboard-intro {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 0 28px;
  text-align: center;
}
.dashboard-intro p:last-child { margin: 8px auto 0; color: var(--muted); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font: 700 12px/1.35 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.workspace { min-height: 520px; }
.panel { display: none; }
.panel.active { display: block; }

/* Account entry */
.run-account {
  max-width: 760px;
  margin: 0 auto 24px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.run-account-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.run-account-in p { margin: 0; }
.run-account-in .meta-label { display: inline; margin-right: 8px; }
.auth-copy { text-align: center; }
.auth-copy p { max-width: 560px; margin: 6px auto 16px; color: var(--muted); font-size: 13.5px; }
.auth-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.run-token-notice {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--warning);
  background: #fffaf0;
}
.run-token-notice p { margin: 0; }
.run-token-notice .token-value { margin-top: 6px; font-size: 12px; word-break: break-all; }

/* Dashboard overview */
.dashboard-content { display: grid; gap: 35px; }
.dashboard-site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.meta-label, .card-index {
  display: block;
  margin: 0 0 3px;
  color: var(--muted);
  font: 700 11px/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dashboard-domain { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.dashboard-site-meta { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.site-add-form { width: min(100%, 430px); }
.dashboard-section { min-width: 0; }
.section-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.section-tag, .status-label, .badge, .sev-tag {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
  color: var(--muted);
  font: 700 11px/1.35 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.section-intro-left { max-width: 780px; margin: 0 0 14px; color: var(--muted); }
.feature-heading { margin: 0 0 4px; }

.diagnostic-panel {
  border: 1px solid var(--line);
  background: var(--surface);
}
.diagnostic-title-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.status-marker { font: 700 15px/1.35 var(--mono); color: var(--unknown); }
.diagnostic-title-row p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.diagnostic-success .status-marker { color: var(--success); }
.diagnostic-success .status-label { border-color: var(--success); color: var(--success); }
.diagnostic-warning .status-marker { color: var(--warning); }
.diagnostic-warning .status-label { border-color: var(--warning); color: var(--warning); }
.diagnostic-danger .status-marker { color: var(--danger); }
.diagnostic-danger .status-label { border-color: var(--danger); color: var(--danger); }
.diagnostic-info .status-marker { color: var(--info); }
.diagnostic-info .status-label { border-color: var(--info); color: var(--info); }
.diagnostic-facts {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(100px, 0.7fr) minmax(180px, 1fr);
  margin: 0;
  background: var(--surface-alt);
}
.diagnostic-facts div { min-width: 0; padding: 9px 12px; border-right: 1px solid var(--line-soft); }
.diagnostic-facts div:last-child { border-right: 0; }
.diagnostic-facts dt { color: var(--muted); font: 700 11px/1.3 var(--mono); text-transform: uppercase; }
.diagnostic-facts dd { margin: 3px 0 0; font-variant-numeric: tabular-nums; }
.diagnostic-facts a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.dashboard-metric {
  min-width: 0;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.dashboard-metric h3 { color: var(--muted); font-size: 12px; }
.metric-value, .m-value, .lc-score, .p-stats, .sov-val {
  font-variant-numeric: tabular-nums lining-nums;
}
.metric-value { margin: 4px 0 1px; font-size: 25px; font-weight: 700; line-height: 1.15; }
.dashboard-metric > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.source-note { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.section-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
}
.amf-card { border: 1px solid var(--line); background: var(--surface); }
.amf-card .dashboard-metric-grid { border: 0; }
.amf-card .section-action { margin-top: 0; border: 0; }
.ledger-block { margin-top: 18px; }
.learn-link {
  margin-left: auto;
  color: var(--accent);
  font: 700 12px/1.35 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.learn-link:hover { text-decoration: underline; }
.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.dashboard-card {
  min-height: 132px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}
.dashboard-card-link { cursor: pointer; }
.dashboard-card-link:hover { border-color: var(--accent); background: #f8fbff; }
.dashboard-card strong { display: block; margin: 12px 0 5px; font-size: 15px; }
.dashboard-card > span:last-child { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* Forms and actions */
.row-form { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.row-form .input { flex: 1 1 180px; }
.probe-form { display: grid; gap: 14px; }
.grid-2, .keys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; }
.stack-form { display: grid; align-content: start; gap: 10px; }
.field-inline { min-height: 38px; flex-direction: row; align-items: center; gap: 8px; }
.field-inline input { width: 18px; height: 18px; margin: 0; }
.site-profile-controls { align-items: end; }
.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--fg);
  outline: none;
}
.input:hover { border-color: var(--line); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input::placeholder { color: var(--muted); opacity: 1; }
textarea.input { resize: vertical; }
.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { border-color: #0e478e; background: #0e478e; color: #fff; }
.btn-ghost { background: var(--surface); }
.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.run-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0 12px;
}
.run-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint, .hint-inline { color: var(--muted); font-size: 12px; }
.hint { margin: 9px 0 16px; }
.tool-actions { margin-top: 10px; }
.input-sm { max-width: 150px; }
.input-area { min-height: 90px; font-family: var(--mono); font-size: 12px; }
.notice, .empty-state {
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
}
.notice-warn { border-color: var(--warning); background: #fffaf0; }
.link-btn { padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* Dense tables */
.table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.table-scroll:focus-visible { outline-offset: 2px; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--fg);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums lining-nums;
}
th, td { padding: 6px 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom: 2px solid var(--line);
  background: var(--surface-alt);
  font-weight: 700;
  white-space: nowrap;
}
.stage-table { min-width: 880px; }
.stage-table th:first-child, .stage-table td:first-child {
  position: sticky;
  z-index: 1;
  left: 0;
  min-width: 168px;
  background: var(--surface);
  font-weight: 700;
}
.stage-table thead th:first-child { z-index: 3; background: var(--surface-alt); }
.stage-table td:nth-child(2) { width: 105px; white-space: nowrap; }
.stage-table td:nth-child(3) { min-width: 270px; }
.stage-table td:nth-child(4) { min-width: 250px; }
.stage-table td:nth-child(5) { min-width: 100px; }
.stage-name { display: block; }
.stage-blurb { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.stage-status-badge { display: inline-flex; gap: 6px; align-items: center; font: 700 11px/1.4 var(--mono); text-transform: uppercase; }
.stage-status-badge.status-pass { color: var(--success); }
.stage-status-badge.status-partial { color: var(--warning); }
.stage-status-badge.status-fail { color: var(--danger); }
.stage-status-badge.status-unavailable, .stage-status-badge.status-skipped, .stage-status-badge.status-not-run { color: var(--muted); }
.stage-status-badge.status-pending { color: var(--info); }
.stage-summary, .stage-unavailable, .stage-evidence { margin: 0; }
.stage-unavailable { padding-left: 16px; color: var(--muted); }
.stage-evidence { color: var(--muted); font: 12px/1.45 var(--mono); }
.stage-pass td:first-child { border-left: 3px solid var(--success); }
.stage-partial td:first-child { border-left: 3px solid var(--warning); }
.stage-fail td:first-child { border-left: 3px solid var(--danger); }
.stage-unavailable-row td:first-child, .stage-skipped td:first-child, .stage-not-run td:first-child { border-left: 3px solid var(--unknown); }
.stage-pending td:first-child { border-left: 3px solid var(--info); }
.blog-table { margin-top: 12px; border: 1px solid var(--line); }
.blog-table th { background: var(--surface-alt); }

/* Receipt and verification */
.receipt-ledger { margin-top: 16px; padding: 13px; border: 1px solid var(--line); background: var(--surface); }
.receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.receipt-head h3 { margin: 0; }
.receipt-hash { font-size: 12px; word-break: break-all; }
.receipt-verdict { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.receipt-verdict.ok > p:first-child, .ok, .ok-line { color: var(--success); }
.receipt-verdict.warn > p:first-child, .warn { color: var(--warning); }
.verification-output { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--line-soft); background: var(--surface); }
.verification-output p:first-child { font-weight: 700; }
.output { margin-top: 18px; }
.receipt-ledger .output { margin-top: 8px; }

/* Secondary tool panels */
.tool-panel { padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.tool-panel-header { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tool-panel-header p:last-child { max-width: 780px; margin: 5px 0 0; color: var(--muted); }
.blog-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 16px; }
.bpanel { display: none; }
.bpanel.active { display: block; }

/* Generic rendered report components */
.card, .shift-card, .layer-card, .provider-lane, .provider-card, .crawler-card,
.engine-diagnosis, .blog-card, .prompt-card, .action-card, .artifact, .surface-map {
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.report-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.score-ring {
  position: relative;
  display: grid;
  width: 110px;
  min-height: 82px;
  flex: 0 0 110px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}
.score-ring svg { display: none; }
.score-ring .val-num { position: static; text-align: center; }
.score-ring .val-num b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.score-ring .val-num span { color: var(--muted); font: 700 10px/1.3 var(--mono); letter-spacing: 0.08em; }
.report-meta { min-width: 220px; flex: 1; }
.report-meta h3 { margin: 0; font-size: 18px; }
.report-meta .verdict { margin: 2px 0 5px; color: var(--accent); font: 700 12px/1.4 var(--mono); }
.report-meta .summary { margin: 0; color: var(--muted); }
.layer-strip, .metric-grid, .provider-grid, .crawler-split, .engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.layer-chip, .metric-card, .surface-stat {
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
}
.lc-label, .m-label { color: var(--muted); font: 700 11px/1.3 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
.lc-score { font-size: 22px; font-weight: 700; }
.lc-bar, .sov-bar, .bar { height: 4px; margin-top: 7px; overflow: hidden; background: var(--line-soft); }
.lc-bar i, .sov-bar i, .bar i { display: block; height: 100%; background: var(--accent); }
.metric-card .m-value { margin-top: 3px; font-size: 26px; font-weight: 700; }
.metric-card .m-note { color: var(--muted); font-size: 11px; }
.metric-card dt { color: var(--muted); font: 700 11px/1.3 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
.metric-card dd { margin: 4px 0 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.provider-head, .prompt-head, .action-head, .artifact-head, .blog-card-head, .surface-map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.provider-head .p-name { font-weight: 700; }
.provider-error, .error-box { padding: 10px 12px; border: 1px solid var(--danger); background: #fff7f7; color: var(--danger); }
.sample, .sample-copy, .draft-body, .action-list { color: var(--muted); }
.sample-copy { white-space: pre-wrap; }
.citations, .evidence { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.citation-link { margin-right: 8px; }
.check { margin-bottom: 8px; border: 1px solid var(--line-soft); background: var(--surface); }
.check-head { display: flex; align-items: center; gap: 10px; padding: 9px 11px; cursor: pointer; }
.check-head:hover { background: var(--surface-alt); }
.check-flag { width: 9px; height: 9px; flex: 0 0 9px; border: 1px solid currentColor; }
.check-flag.pass, .check-status.pass { color: var(--success); background: var(--success); }
.check-flag.fail, .check-status.fail { color: var(--danger); background: var(--danger); }
.check-flag.warn, .check-status.warn { color: var(--warning); background: var(--warning); }
.check-flag.neutral { color: var(--unknown); background: var(--unknown); }
.check-status.neutral { color: var(--muted); }
.check-title { font-weight: 650; }
.check-status { margin-left: auto; background: transparent !important; font: 700 11px/1.3 var(--mono); text-transform: uppercase; }
.check-body { display: none; padding: 0 11px 11px 30px; }
.check.open .check-body { display: block; }
.check-detail, .check-why { margin: 0 0 7px; color: var(--muted); font-size: 13px; }
.ev-line { margin: 3px 0; font-size: 12px; }
.surface-map-head { margin-bottom: 12px; }
.surface-kicker { color: var(--accent); font: 700 10px/1.3 var(--mono); text-transform: uppercase; }
.surface-source { color: var(--muted); font: 11px/1.3 var(--mono); }
.surface-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.surface-stat b { display: block; font-size: 19px; }
.surface-stat span { color: var(--muted); font: 10px/1.3 var(--mono); text-transform: uppercase; }
.surface-nodes { display: flex; flex-wrap: wrap; gap: 6px; }
.surface-node { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid var(--line-soft); color: var(--muted); font: 11px/1.3 var(--mono); text-decoration: none; }
.surface-node i { width: 7px; height: 7px; border: 1px solid var(--unknown); }
.surface-node.reachable i { border-color: var(--success); background: var(--success); }
.surface-node .role { color: var(--accent); text-transform: uppercase; }
.surface-note, .surface-unavailable { color: var(--muted); font-size: 12px; }
.crawler-card b { display: block; margin: 5px 0 3px; }
.crawler-card p { margin: 0; color: var(--muted); font-size: 13px; }
.crawler-card.pass b { color: var(--success); }
.crawler-card.warn b, .crawler-card.fail b { color: var(--danger); }
.crawler-card.token b { color: var(--info); }
.extract-triad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.extract-triad div { padding: 7px; border: 1px solid var(--line-soft); text-align: center; font: 700 11px/1.3 var(--mono); text-transform: uppercase; }
.extract-triad .on { border-color: var(--success); color: var(--success); }
.extract-triad .off { color: var(--muted); }
.aio-banner { margin-bottom: 12px; padding: 8px 10px; border: 1px solid var(--line-soft); color: var(--muted); }
.aio-banner.unavailable { border-color: var(--warning); color: var(--warning); }
.aio-banner.found { border-color: var(--success); }
.engine-diagnosis.mentioned-not-cited { border-left: 3px solid var(--warning); }
.engine-diagnosis.invisible { border-left: 3px solid var(--danger); }
.engine-diagnosis.cited { border-left: 3px solid var(--success); }
.sev-tag { margin-left: auto; }
.fix, .a-how, .a-why { color: var(--muted); }
.action-card { border-left-width: 3px; }
.artifact pre, .code-block {
  max-width: 100%;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
  color: var(--fg);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
}
.copy-btn { min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.sov { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr 44px; gap: 8px; align-items: center; margin: 5px 0; }
.sov-bar { margin: 0; }
.empty { padding: 24px 0; color: var(--muted); text-align: center; font: 13px/1.5 var(--mono); }
.loading { padding: 16px 0; color: var(--info); font: 13px/1.5 var(--mono); }
h3.sec-label { margin: 24px 0 10px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font: 700 12px/1.3 var(--mono); text-transform: uppercase; }
.badge-ctr { border-color: var(--info); color: var(--info); }
.badge-recover { border-color: var(--danger); color: var(--danger); }
.badge-rank { border-color: var(--success); color: var(--success); }
.badge-kind { border-color: var(--secondary); color: var(--secondary); }
.flag-list { margin: 6px 0; padding: 0; list-style: none; }
.flag-list li { padding: 2px 0; color: var(--muted); font-size: 12px; }
.card-actions, .edit-box { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.edit-box { flex-direction: column; }
.draft-body h4 { margin: 12px 0 4px; color: var(--fg); }
.draft-body p { color: var(--muted); }
.cov-covered td:nth-child(2) { color: var(--success); }
.cov-weak td:nth-child(2) { color: var(--warning); }
.cov-missing td:nth-child(2) { color: var(--danger); }

/* Blog pages rendered by the Worker */
.hero, .section, .blog-page {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 24px 16px;
}
.blog-page { max-width: 760px; }
.blog-page h1 { margin: 12px 0 4px; font-size: 1.7rem; }
.blog-post h2 { margin: 30px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft); }
.blog-post p { color: var(--muted); line-height: 1.65; }
.blog-index-item { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.blog-index-item h2 { margin: 0 0 3px; }
.code-src { margin-top: 4px; color: var(--muted); font-size: 11px; }

/* Feedback and footer */
.toast {
  position: fixed;
  z-index: 100;
  bottom: 18px;
  left: 50%;
  max-width: min(540px, calc(100% - 24px));
  padding: 9px 13px;
  transform: translate(-50%, 18px);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.footer {
  width: min(100%, var(--max-width));
  margin: 52px auto 0;
  padding: 22px 16px 42px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  text-align: center;
  font-size: 12.5px;
}
.footer p { margin: 3px 0; }


/* Compact guided flow — questionnaire rhythm with native AgentFit controls. */
:root {
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.18);
  --line-soft: rgba(29, 29, 31, 0.1);
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-alt: rgba(245, 245, 247, 0.88);
  --accent: #0071e3;
  --success: #248a3d;
  --warning: #9a6700;
  --danger: #d70015;
  --info: #007aff;
  --max-width: 1120px;
  --radius: 16px;
  --soft-shadow: 0 14px 44px rgba(0, 0, 0, 0.07), 0 2px 10px rgba(0, 0, 0, 0.04);
}

html { scroll-padding-top: 90px; }
body {
  background:
    radial-gradient(circle at 12% 5%, rgba(0, 113, 227, 0.08), transparent 26rem),
    radial-gradient(circle at 88% 18%, rgba(175, 82, 222, 0.055), transparent 24rem),
    var(--bg);
}
button, input, select, textarea, .card, .dashboard-card, .diagnostic-panel { border-radius: 12px; }

.nav {
  border-bottom: 1px solid rgba(29, 29, 31, 0.08);
  background: rgba(245, 245, 247, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
}
.nav-inner {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 18px;
}
.logo { flex: 0 0 auto; }
.logo-mark {
  min-width: 27px;
  height: 27px;
  border: 0;
  border-radius: 9px;
  background: var(--fg);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.logo-word { font-size: 15px; letter-spacing: -0.015em; }
.tabs {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 1px;
  max-width: calc(100% - 116px);
  padding: 3px;
  overflow-x: auto;
  border: 1px solid rgba(29, 29, 31, 0.06);
  border-radius: 13px;
  background: rgba(118, 118, 128, 0.1);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab, .btab {
  min-height: 30px;
  padding: 5px 9px;
  border: 0;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 12.5px;
  transition:
    color 180ms ease,
    background 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 260ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 180ms ease;
}
.tab:hover, .btab:hover { border-color: transparent; background: rgba(255, 255, 255, 0.52); }
.tab:active, .btab:active { transform: scale(0.97); }
.tab.active, .btab.active {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
  color: var(--fg);
  font-weight: 650;
}

#dashboard-main { padding: 0 18px; }
.dashboard-intro { padding: 28px 0 18px; }
.dashboard-intro h1 {
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  font-weight: 720;
  letter-spacing: -0.045em;
}
.dashboard-intro p:last-child { max-width: 620px; margin-top: 6px; font-size: 14px; }
.eyebrow { font-size: 10.5px; letter-spacing: 0.11em; }

.flow-shell {
  max-width: 800px;
  margin: 0 auto 14px;
  padding: 9px 12px 10px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.045);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.flow-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.flow-step { color: var(--accent); font: 650 10.5px/1.2 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.flow-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.flow-shortcut { display: inline-flex; gap: 4px; color: var(--muted); }
kbd {
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
  font: 600 10px/1.5 var(--mono);
  text-align: center;
}
.flow-track { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(118, 118, 128, 0.15); }
.flow-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0071e3, #5ac8fa);
  box-shadow: 0 0 12px rgba(0, 113, 227, 0.35);
  transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.workspace { min-height: 440px; }
#panel-run { max-width: 980px; margin: 0 auto; }
.tool-panel {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.tool-panel-header { margin-bottom: 16px; padding-bottom: 14px; border-bottom-color: var(--line-soft); }
.tool-panel-header h2 { font-size: 1.35rem; letter-spacing: -0.025em; }
.tool-panel-header p:last-child { max-width: 680px; margin-top: 4px; font-size: 13.5px; }
.run-account {
  margin-bottom: 18px;
  padding: 15px;
  border-color: rgba(29, 29, 31, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--soft-shadow);
}
.dashboard-content { gap: 12px; }
.dashboard-site-header {
  align-items: center;
  padding: 13px 15px;
  border-color: rgba(29, 29, 31, 0.09);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.045);
}
#panel-run .dashboard-content > .dashboard-section {
  padding: 14px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.045);
}
.dashboard-domain { font-size: 18px; letter-spacing: -0.02em; }
.section-heading { margin-bottom: 10px; padding-bottom: 8px; border-bottom-color: var(--line-soft); }
.section-heading h2 { letter-spacing: -0.02em; }
.section-tag, .status-label, .badge, .sev-tag {
  padding: 2px 7px;
  border-color: transparent;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.11);
  font-size: 9.5px;
}
.diagnostic-panel { overflow: hidden; border-color: var(--line-soft); border-radius: 14px; }
.diagnostic-title-row { padding: 12px; border-bottom-color: var(--line-soft); }
.diagnostic-facts { background: rgba(245, 245, 247, 0.75); }
.dashboard-metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  border: 0;
}
.dashboard-metric {
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(245, 245, 247, 0.72);
}
.metric-value { font-size: 23px; letter-spacing: -0.035em; }
.amf-card { border: 0; background: transparent; }
.section-action { border-color: var(--line-soft); border-radius: 13px; }
.dashboard-card {
  min-height: 100px;
  border-color: var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 260ms ease,
    border-color 180ms ease;
}
.dashboard-card strong { margin: 8px 0 4px; }
.dashboard-card-link:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 113, 227, 0.32);
  background: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

.input {
  min-height: 40px;
  border-color: rgba(29, 29, 31, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  transition: border-color 180ms ease, box-shadow 220ms ease, background 180ms ease;
}
.input:hover { border-color: rgba(29, 29, 31, 0.28); background: #fff; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.13); }
.field-inline input { accent-color: var(--accent); }
.btn {
  min-height: 38px;
  padding: 8px 15px;
  border-color: rgba(29, 29, 31, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  transition:
    transform 160ms ease,
    color 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 220ms ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 113, 227, 0.28);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.btn:active { transform: translateY(0) scale(0.97); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { border-color: #0077ed; background: #0077ed; color: #fff; box-shadow: 0 8px 20px rgba(0, 113, 227, 0.24); }
.notice, .empty-state, .receipt-ledger, .verification-output { border-color: var(--line-soft); border-radius: 13px; }
.table-scroll { overflow: auto; border-color: var(--line-soft); border-radius: 14px; }
.card, .shift-card, .layer-card, .provider-lane, .provider-card, .crawler-card,
.engine-diagnosis, .blog-card, .prompt-card, .action-card, .artifact, .surface-map {
  border-color: var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}
.toast {
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.88);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.flow-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  max-width: 800px;
  align-items: center;
  gap: 10px;
  margin: 14px auto 0;
  padding: 9px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.07);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.footer { margin-top: 34px; padding-top: 18px; }
.flow-action-status { overflow: hidden; color: var(--muted); font: 600 11px/1.4 var(--mono); text-align: center; text-overflow: ellipsis; white-space: nowrap; }

@keyframes flow-forward {
  from { opacity: 0; transform: translate3d(18px, 6px, 0) scale(0.992); filter: blur(3px); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: blur(0); }
}
@keyframes flow-backward {
  from { opacity: 0; transform: translate3d(-18px, 6px, 0) scale(0.992); filter: blur(3px); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: blur(0); }
}
@keyframes flow-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes loading-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.panel.active.flow-enter[data-direction="forward"] { animation: flow-forward 440ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.panel.active.flow-enter[data-direction="backward"] { animation: flow-backward 440ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.panel.active.flow-enter .tool-panel-header,
.panel.active.flow-enter .probe-form,
.panel.active.flow-enter .row-form,
.panel.active.flow-enter > .hint {
  animation: flow-rise 420ms 70ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.dashboard-metric, .dashboard-card, .provider-card {
  animation: flow-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.dashboard-metric:nth-child(2), .dashboard-card:nth-child(2), .provider-card:nth-child(2) { animation-delay: 35ms; }
.dashboard-metric:nth-child(3), .dashboard-card:nth-child(3), .provider-card:nth-child(3) { animation-delay: 70ms; }
.dashboard-metric:nth-child(4), .dashboard-card:nth-child(4), .provider-card:nth-child(4) { animation-delay: 105ms; }
.dashboard-metric:nth-child(5), .dashboard-card:nth-child(5), .provider-card:nth-child(5) { animation-delay: 140ms; }
.loading { animation: loading-breathe 1.25s ease-in-out infinite; }
@media (max-width: 1100px) {
  .dashboard-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .dashboard-metric-grid, .provider-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-grid, .crawler-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagnostic-facts { grid-template-columns: 1.5fr 0.6fr 1fr; }
}

@media (max-width: 720px) {
  .nav-inner { justify-items: start; }
  .tabs { justify-content: flex-start; }
  .dashboard-site-header, .section-action { align-items: stretch; flex-direction: column; }
  .site-add-form { width: 100%; }
  .site-profile-controls { width: 100%; }
  .diagnostic-facts { grid-template-columns: 1fr; }
  .diagnostic-facts div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .diagnostic-facts div:last-child { border-bottom: 0; }
  .auth-forms, .grid-2, .keys-grid, .engine-grid, .crawler-split { grid-template-columns: 1fr; }
  .run-account-in { align-items: flex-start; }
}

@media (max-width: 520px) {
  .dashboard-card-grid, .dashboard-metric-grid { grid-template-columns: 1fr; }
  .diagnostic-title-row { grid-template-columns: 18px 1fr; }
  .diagnostic-title-row .status-label { grid-column: 2; justify-self: start; }
  .row-form { flex-direction: column; }
  .row-form .input { flex-basis: auto; }
  .input-sm { max-width: none; }
  .surface-stats, .extract-triad { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .nav-inner, #dashboard-main, .hero, .section, .blog-page, .footer { padding-left: 12px; padding-right: 12px; }
  .dashboard-intro { padding-top: 20px; }
  .run-controls { grid-template-columns: 1fr; }
  table { font-size: 13px; }
}

@media (max-width: 900px) {
  .nav-inner { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 14px 9px; }
  .logo { align-self: center; }
  .tabs { width: 100%; max-width: 100%; }
  .dashboard-intro { padding-top: 22px; }
}

@media (max-width: 720px) {
  #dashboard-main { padding-right: 12px; padding-left: 12px; }
  .flow-shell { margin-bottom: 12px; }
  .tool-panel { padding: 18px; border-radius: 19px; }
  #panel-run .dashboard-content > .dashboard-section { padding: 14px; border-radius: 16px; }
  .flow-actions { margin-top: 14px; border-radius: 15px; }
}

@media (max-width: 520px) {
  .dashboard-intro h1 { font-size: 1.8rem; }
  .dashboard-intro p:last-child { font-size: 13px; }
  .flow-shortcut { display: none; }
  .flow-meta { grid-template-columns: auto 1fr; }
  .tool-panel { padding: 15px; }
  .flow-actions { grid-template-columns: 1fr 1fr; }
  .flow-actions .btn { width: 100%; }
  .flow-action-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
  .status-marker, .stage-status-badge, .check-status { forced-color-adjust: auto; }
  .btn-primary { border: 2px solid ButtonText; }
}
