/* ============================================================
   BreachLens — premium cybersecurity dashboard aesthetic
   ============================================================ */

:root {
  --bg: #0a0e14;
  --bg-2: #0c1119;
  --surface: #11161f;
  --surface-2: #151b26;
  --surface-3: #1a2230;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);

  --text: #e7edf4;
  --text-muted: #8a97a8;
  --text-faint: #5c6878;

  --accent: #00d9ff;
  --accent-dim: #0aa7c2;
  --accent-glow: rgba(0, 217, 255, 0.35);

  --critical: #ff4d5e;
  --high: #ff8c42;
  --medium: #ffc53d;
  --low: #25d0a8;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% -10%, #10202b 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  max-width: 1180px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--accent);
}
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-accent { color: var(--accent); }
.topbar-tag {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: "JetBrains Mono", monospace;
}

/* ---------- View system ---------- */
#app {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - 150px);
}
.view { display: none; animation: viewIn 0.5s var(--ease); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Landing ---------- */
.view-landing { display: none; }
.view-landing.active { display: flex; }
.landing-inner {
  max-width: 760px;
  margin: clamp(40px, 9vh, 110px) auto 0;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  background: rgba(0, 217, 255, 0.05);
  margin-bottom: 26px;
}
.hero-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 22px;
}
.accent-text {
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
}
.hero-sub {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  max-width: 600px;
  margin: 0 auto 38px;
}

/* ---------- Scan form ---------- */
.scan-form { max-width: 560px; margin: 0 auto; }
.scan-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 7px 7px 7px 16px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.scan-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.12), 0 0 40px -8px var(--accent-glow);
}
.scan-input-prefix {
  font-family: "JetBrains Mono", monospace;
  color: var(--text-faint);
  font-size: 0.9rem;
  user-select: none;
}
.scan-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.08rem;
  font-family: "JetBrains Mono", monospace;
  padding: 12px 10px;
  min-width: 0;
}
.scan-input::placeholder { color: var(--text-faint); }
.scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #04161c;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.98rem;
  font-family: "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.25s, background 0.2s;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.scan-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px -6px var(--accent-glow); background: #1ce0ff; }
.scan-btn:active { transform: translateY(0); }
.scan-btn:disabled { opacity: 0.6; cursor: wait; }
.scan-btn-icon { transition: transform 0.2s; }
.scan-btn:hover .scan-btn-icon { transform: translateX(3px); }

.form-error {
  color: var(--critical);
  font-size: 0.9rem;
  margin-top: 12px;
  min-height: 1em;
  text-align: left;
  padding-left: 4px;
}

/* ---------- Samples + trust ---------- */
.samples {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 26px;
}
.samples-label { color: var(--text-faint); font-size: 0.85rem; }
.sample-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 100px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}
.sample-chip:hover { color: var(--accent); border-color: var(--accent); background: rgba(0, 217, 255, 0.07); }

.trust-row {
  list-style: none;
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0;
  margin: 44px 0 0;
  color: var(--text-faint);
  font-size: 0.84rem;
}
.trust-row li { display: flex; align-items: center; gap: 8px; }
.trust-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--low); box-shadow: 0 0 8px var(--low); }

/* ---------- Loading ---------- */
.view-loading.active { display: block; }
.loading-inner {
  max-width: 620px;
  margin: clamp(50px, 12vh, 130px) auto 0;
}
.loading-domain {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  margin-bottom: 32px;
  text-align: center;
}
.loading-domain .mono { color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0; }
.check-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  opacity: 0.5;
  transition: opacity 0.4s, border-color 0.4s, transform 0.4s var(--ease);
}
.check-item.active {
  opacity: 1;
  border-color: var(--border-strong);
}
.check-item.done { opacity: 1; }
.check-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  flex-shrink: 0;
  position: relative;
  transition: all 0.3s;
}
.check-item.active .check-icon {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.check-item.done .check-icon {
  border-color: var(--low);
  background: var(--low);
  animation: none;
}
.check-item.done .check-icon::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #04161c;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
@keyframes spin { to { transform: rotate(360deg); } }
.check-label { flex: 1; font-size: 0.96rem; }
.check-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--accent);
}
.loading-hint {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
  margin-top: 26px;
}

/* ---------- Results ---------- */
.view-results.active { display: block; }
.results-inner { padding: 18px 0 40px; }

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { animation: revealIn 0.6s var(--ease) forwards; }
@keyframes revealIn { to { opacity: 1; transform: none; } }

.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.results-domain { font-size: 1.5rem; font-weight: 500; color: var(--text); }
.results-provider { color: var(--text-faint); font-size: 0.84rem; margin-top: 4px; }
.results-actions { display: flex; gap: 10px; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Top section: gauge + summary */
.results-top {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  margin-bottom: 36px;
}
@media (max-width: 760px) {
  .results-top { grid-template-columns: 1fr; }
}

.gauge-card, .summary-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.gauge-card { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-wrap { position: relative; width: 200px; height: 200px; }
.gauge { transform: rotate(0deg); }
.gauge-track { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 14; }
.gauge-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
  transition: stroke-dashoffset 1.4s var(--ease), stroke 0.6s;
  filter: drop-shadow(0 0 8px currentColor);
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-score {
  font-family: "Space Grotesk", sans-serif;
  font-size: 3.4rem;
  font-weight: 600;
  line-height: 1;
}
.gauge-scale { color: var(--text-faint); font-size: 0.78rem; margin-top: 4px; }
.risk-level-badge {
  margin-top: 20px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding: 7px 20px;
  border-radius: 100px;
  border: 1px solid currentColor;
}
.gauge-note { color: var(--text-faint); font-size: 0.76rem; margin-top: 12px; }

.summary-card { display: flex; flex-direction: column; }
.summary-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.summary-text { font-size: 1.12rem; line-height: 1.6; margin: 0 0 22px; color: var(--text); }
.top-priority {
  background: rgba(0, 217, 255, 0.06);
  border: 1px solid rgba(0, 217, 255, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: auto;
}
.top-priority-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.top-priority-text { font-size: 1rem; color: var(--text); }
.fallback-note {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--medium);
  background: rgba(255, 197, 61, 0.08);
  border: 1px solid rgba(255, 197, 61, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
}

/* "If left unaddressed" trajectory callout — related to top priority, but distinct */
.unaddressed {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 140, 66, 0.06);
  border: 1px dashed rgba(255, 140, 66, 0.4);
}
.unaddressed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--high);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.unaddressed-text { font-size: 0.95rem; color: var(--text-muted); line-height: 1.55; }

/* Attacker's-eye narrative card — distinct warning-toned treatment */
.attack-card {
  margin-bottom: 36px;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,77,94,0.05), rgba(255,77,94,0.01));
  border: 1px solid rgba(255, 77, 94, 0.22);
  border-left: 3px solid var(--critical);
  box-shadow: var(--shadow);
}
.attack-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: #ff7585;
  margin-bottom: 12px;
}
.attack-text { margin: 0; font-size: 1.05rem; line-height: 1.65; color: var(--text); }
.attack-disclaimer {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
}

/* Certificate history timeline */
.cert-history { margin-bottom: 36px; }
.cert-sub { color: var(--text-faint); font-size: 0.84rem; margin: 4px 0 18px; }
.cert-timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.cert-item {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 0 0 18px 22px;
  border-left: 2px solid var(--border-strong);
}
.cert-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.cert-node {
  position: absolute;
  left: -7px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.cert-node.expired { background: var(--text-faint); box-shadow: none; }
.cert-body { padding-bottom: 2px; }
.cert-range { font-size: 0.92rem; color: var(--text); }
.cert-arrow { color: var(--text-faint); margin: 0 4px; }
.cert-flag {
  font-size: 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 6px;
}
.cert-flag.active { color: var(--low); border-color: rgba(37,208,168,0.45); }
.cert-flag.expired { color: var(--text-faint); }
.cert-issuer { color: var(--text-muted); font-size: 0.84rem; margin-top: 2px; }
.cert-gap {
  position: relative;
  padding: 0 0 18px 22px;
  border-left: 2px dashed rgba(255, 140, 66, 0.5);
}
.cert-gap-dot {
  position: absolute;
  left: -6px; top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--high);
}
.cert-gap-text { color: var(--high); font-size: 0.82rem; }

/* Copy-paste fix snippet */
.snippet-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.snippet-code {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--accent);
  white-space: pre-wrap;
  word-break: break-all;
}
.snippet-copy {
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 9px;
  padding: 0 16px;
  font-size: 0.82rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.18s;
}
.snippet-copy:hover { color: var(--accent); border-color: var(--accent); }
.snippet-copy.copied { color: var(--low); border-color: var(--low); }

/* Findings */
.findings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.severity-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; }

.findings-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 40px; }

.finding {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sev-color, var(--text-faint));
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease);
}
.finding:hover {
  border-color: var(--border-strong);
  box-shadow: 0 10px 36px -18px rgba(0,0,0,0.9);
}
.finding-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.finding-summary::-webkit-details-marker { display: none; }
.sev-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 7px;
  flex-shrink: 0;
  color: #06090e;
}
.finding-title { flex: 1; font-weight: 500; font-size: 1.02rem; }
.finding-chevron {
  color: var(--text-faint);
  transition: transform 0.3s var(--ease);
  flex-shrink: 0;
}
details[open] .finding-chevron { transform: rotate(180deg); }
.finding-body {
  padding: 0 20px 20px 20px;
  display: grid;
  gap: 16px;
  animation: bodyIn 0.35s var(--ease);
}
@keyframes bodyIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.finding-block-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.finding-explanation { color: var(--text-muted); line-height: 1.6; }
.finding-recommendation {
  color: var(--text);
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

/* Raw signals */
.raw-signals {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 36px;
  padding: 4px 20px;
}
.raw-signals summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 500;
  color: var(--text-muted);
  list-style: none;
}
.raw-signals summary::-webkit-details-marker { display: none; }
.raw-signals summary::before { content: "▸ "; color: var(--accent); }
.raw-signals[open] summary::before { content: "▾ "; }
.raw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 4px 0 20px;
}
.raw-item { font-size: 0.86rem; }
.raw-item-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.raw-item-value { color: var(--text); word-break: break-word; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 100px; font-size: 0.74rem; font-family: "JetBrains Mono", monospace; }
.pill.yes { background: rgba(37,208,168,0.14); color: var(--low); }
.pill.no { background: rgba(255,77,94,0.14); color: var(--critical); }
.pill.unknown { background: rgba(138,151,168,0.16); color: var(--text-muted); }

/* "Check ran, found nothing notable" — reads as a completed check, not empty/error */
.clean-note {
  color: var(--text-muted);
  font-size: 0.84rem;
}
.clean-note::before {
  content: "✓";
  color: var(--low);
  font-weight: 700;
  margin-right: 6px;
}

/* Informational (tech-stack) finding — neutral, not severity-colored */
.finding-info {
  border-left-color: var(--text-faint);
  border-style: dashed;
  background: var(--surface-2);
}
.finding-info .sev-badge {
  background: transparent !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-strong);
}
.finding-info .finding-title { color: var(--text-muted); font-weight: 500; }

/* ---------- Re-check control (per finding card) ---------- */
/* Footer row inside the finding body: button + status, separated from the
   recommendation/snippet above by a subtle divider, matching the card's spacing scale. */
.recheck-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Button styled like .snippet-copy (the app's secondary/ghost action). */
.recheck-btn {
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.18s;
}
.recheck-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Disabled (in-progress) or non-activatable (non-recheckable) control:
   muted, non-interactive. Covers both the :disabled attribute and the
   .is-disabled marker class used on the non-recheckable control. */
.recheck-btn:disabled,
.recheck-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-faint);
  border-color: var(--border);
  background: var(--surface-2);
}
.recheck-btn:disabled:hover,
.recheck-btn.is-disabled:hover {
  color: var(--text-faint);
  border-color: var(--border);
}

/* Status pill — base look. Variants below are each visually distinct
   (color, border, background tone) per Requirements 6.1–6.3. */
.recheck-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-family: "JetBrains Mono", monospace;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid transparent;
  line-height: 1.3;
}
/* Empty slot (not yet re-checked) takes no visual space. */
.recheck-status:empty {
  display: none;
}
/* A small leading dot reinforces the colour difference between states. */
.recheck-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Pending — neutral "in progress" look with a subtle pulsing dot. */
.recheck-status.is-pending {
  color: var(--text-muted);
  border-color: var(--border-strong);
  background: rgba(138, 151, 168, 0.1);
}
.recheck-status.is-pending::before {
  animation: recheckPulse 1.1s ease-in-out infinite;
}
@keyframes recheckPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

/* Resolved — green/teal, reusing the app's "low / good" tone. */
.recheck-status.is-resolved {
  color: var(--low);
  border-color: rgba(37, 208, 168, 0.45);
  background: rgba(37, 208, 168, 0.14);
}

/* Unresolved — warning/red, the "still present" tone. */
.recheck-status.is-unresolved {
  color: var(--critical);
  border-color: rgba(255, 77, 94, 0.45);
  background: rgba(255, 77, 94, 0.14);
}

/* Indeterminate — neutral/amber, "could not confirm". */
.recheck-status.is-indeterminate {
  color: var(--medium);
  border-color: rgba(255, 197, 61, 0.4);
  background: rgba(255, 197, 61, 0.1);
}

/* Failed — muted error tone (orange/high), distinct from the others. */
.recheck-status.is-failed {
  color: var(--high);
  border-color: rgba(255, 140, 66, 0.4);
  background: rgba(255, 140, 66, 0.1);
}

/* Timestamp appended after the status text — quiet, secondary. */
.recheck-status .recheck-time {
  color: var(--text-faint);
  font-size: 0.72rem;
}

/* Respect reduced-motion: don't pulse the pending indicator. */
@media (prefers-reduced-motion: reduce) {
  .recheck-status.is-pending::before { animation: none; }
}

/* Chat */
.chat-section {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
}
.chat-orb {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.chat-sub { color: var(--text-faint); font-size: 0.82rem; margin-top: 4px; }
.chat-log {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 440px;
  overflow-y: auto;
  min-height: 60px;
}
.chat-empty { color: var(--text-faint); font-size: 0.9rem; text-align: center; padding: 16px 0; }
.msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.55;
  animation: msgIn 0.3s var(--ease);
  white-space: pre-wrap;
  word-wrap: break-word;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #04161c;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.msg.bot {
  align-self: flex-start;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.thinking { color: var(--text-faint); }
.dots span {
  display: inline-block;
  animation: blink 1.2s infinite;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }
.chat-form {
  display: flex;
  gap: 10px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.96rem;
  font-family: "Inter", sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,217,255,0.12); }
.chat-send {
  background: var(--accent);
  color: #04161c;
  border: none;
  border-radius: 11px;
  width: 48px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s, background 0.2s;
}
.chat-send:hover { transform: translateY(-1px); background: #1ce0ff; }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Error view */
.view-error.active { display: flex; }
.error-inner {
  max-width: 480px;
  margin: clamp(50px, 14vh, 150px) auto 0;
  text-align: center;
}
.error-glyph {
  color: var(--high);
  display: inline-grid;
  place-items: center;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,140,66,0.08);
  border: 1px solid rgba(255,140,66,0.25);
  margin-bottom: 22px;
}
.error-title { font-family: "Space Grotesk", sans-serif; font-size: 1.6rem; margin: 0 0 12px; }
.error-message { color: var(--text-muted); margin-bottom: 28px; }
.error-retry { margin: 0 auto; }

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 30px 20px;
  color: var(--text-faint);
  font-size: 0.8rem;
  font-family: "JetBrains Mono", monospace;
}

/* ---------- Print / PDF ---------- */
@media print {
  #bg-canvas, .topbar, .chat-section, .results-actions, .site-footer, .samples, .loading-hint { display: none !important; }
  body { background: #fff; color: #111; }
  .view { display: none !important; }
  .view-results { display: block !important; }
  .gauge-card, .summary-card, .finding, .raw-signals {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .summary-text, .finding-title, .finding-explanation, .results-domain, .gauge-score { color: #111 !important; }
  details[id="raw-signals"], details.finding { }
}

@media (max-width: 560px) {
  .topbar { padding: 16px; }
  .topbar-tag { display: none; }
  .results-actions { width: 100%; }
  .scan-input-prefix { display: none; }
  .msg { max-width: 90%; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
