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

/* Dark theme (default) */
:root,
[data-theme="dark"] {
  --bg: #0a0d13;
  --surface: #111621;
  --surface-2: #181e2c;
  --surface-3: #212838;
  --border: #252d40;
  --border-hover: #3a4868;
  --text: #e4e7ef;
  --text-muted: #8891ab;
  --text-dim: #555e78;
  --primary: #5b8def;
  --primary-soft: rgba(91, 141, 239, 0.10);
  --primary-glow: rgba(91, 141, 239, 0.20);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.10);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.10);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.10);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.10);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.10);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --glass: rgba(17, 22, 33, 0.75);
  --shadow: 0 4px 24px rgba(0,0,0,0.25);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --logo-filter: brightness(0) invert(1);
  --heading-color: #fff;
  --table-row-hover: rgba(255, 255, 255, 0.02);
  --chip-hover-text: #fff;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --surface-3: #e2e5ec;
  --border: #d1d5dc;
  --border-hover: #b0b8c4;
  --text: #1a1d26;
  --text-muted: #4b5263;
  --text-dim: #6b7280;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --primary-glow: rgba(37, 99, 235, 0.15);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.10);
  --orange: #d97706;
  --orange-soft: rgba(217, 119, 6, 0.10);
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.10);
  --cyan: #0891b2;
  --cyan-soft: rgba(8, 145, 178, 0.10);
  --glass: rgba(255, 255, 255, 0.85);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --logo-filter: brightness(0);
  --heading-color: #111827;
  --table-row-hover: rgba(0, 0, 0, 0.03);
  --chip-hover-text: #fff;
}

html {
  transition: background-color 0.25s ease, color 0.25s ease;
}
html, body {
  height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app { display: flex; flex-direction: column; height: 100vh; width: 100%; }

/* ── Header ────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 5%; border-bottom: 1px solid var(--border);
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.logo-img {
  height: 26px; width: auto;
  filter: var(--logo-filter);
  opacity: 0.9;
}
.header-divider { width: 1px; height: 24px; background: var(--border); }
.header h1 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.subtitle { font-size: 10px; color: var(--text-dim); margin-top: 1px; letter-spacing: 0.04em; text-transform: uppercase; }
.header-center { display: flex; align-items: center; gap: 16px; }
.scan-counter {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 11px; color: var(--text-muted);
}
.scan-counter .count-num { color: var(--primary); font-weight: 700; }
.probe-counter {
  display: flex; align-items: center; gap: 6px;
  background: var(--red-soft); border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 20px; padding: 4px 12px; font-size: 11px; color: var(--text-muted);
}
.probe-counter .count-num { color: var(--red); font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* ── Last run summary bar (session-level metrics) ───── */
.last-run-panel {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 5%;
}
.last-run-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
.last-run-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 180px;
}
.last-run-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}
.last-run-title strong { font-size: 13px; color: var(--heading-color); }
.last-run-intent.mono {
  font-size: 10px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.last-run-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.lr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.lr-chip strong { color: var(--text); font-weight: 700; }
.lr-chip.lr-total { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.lr-chip.lr-pass { border-color: rgba(34, 197, 94, 0.35); background: var(--green-soft); color: var(--green); }
.lr-chip.lr-fail { border-color: rgba(239, 68, 68, 0.35); background: var(--red-soft); color: var(--red); }
.lr-chip.lr-un { border-color: rgba(245, 158, 11, 0.35); background: var(--orange-soft); color: var(--orange); }
.lr-chip.lr-sast { border-color: var(--border-hover); }
.lr-chip.lr-grade { border-color: var(--purple); background: var(--purple-soft); color: var(--purple); }
.last-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.lr-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
}
.lr-link:hover { background: var(--primary-soft); border-color: var(--primary); }

/* ── In-message scan summary card ─────────────────── */
.scan-summary-card {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  box-shadow: var(--shadow-sm);
}
.scan-summary-card .ssc-head { margin-bottom: 10px; }
.scan-summary-card .ssc-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(91, 141, 239, 0.25);
}
.scan-summary-card .ssc-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.scan-summary-card .ssc-cell {
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border);
}
.scan-summary-card .ssc-cell.pass { border-color: rgba(34, 197, 94, 0.3); }
.scan-summary-card .ssc-cell.fail { border-color: rgba(239, 68, 68, 0.3); }
.scan-summary-card .ssc-cell.uncertain { border-color: rgba(245, 158, 11, 0.35); }
.scan-summary-card .ssc-num {
  display: block;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--heading-color);
}
.scan-summary-card .ssc-lbl {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 4px;
}
.scan-summary-card .ssc-sast {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.scan-summary-card .ssc-endpoint {
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  margin-top: 4px;
}
.scan-summary-card .ssc-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.scan-summary-card .ssc-meta.ssc-ok { color: var(--green); }
.scan-summary-card code {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .scan-summary-card .ssc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .last-run-panel { padding: 8px 16px; }
  .last-run-inner { flex-direction: column; align-items: flex-start; }
  .scan-summary-card .ssc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.session-timer { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.header-btn {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.header-btn:hover { background: var(--surface-3); border-color: var(--border-hover); color: var(--text); }

/* Header links (About, Help) */
.header-link {
  background: none; border: none; padding: 0;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; text-decoration: none; font-family: inherit;
  margin-right: 4px;
}
.header-link:hover { color: var(--primary); }
.header-link:focus { outline: none; }
.header-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Theme toggle */
.theme-toggle {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  margin-right: 4px;
}
.theme-toggle:hover { background: var(--surface-3); border-color: var(--border-hover); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.status-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: 11px; color: var(--text-muted);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); transition: all 0.3s; }
.status-dot.connected { background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.status-dot.processing { background: var(--orange); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.disconnected { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Chat ──────────────────────────────────────────── */
.chat-container {
  flex: 1; overflow-y: auto; padding: 28px 5%;
  display: flex; flex-direction: column; gap: 24px;
  scroll-behavior: smooth;
}

/* ── Welcome Hero ──────────────────────────────────── */
.welcome-hero {
  text-align: center; padding: 48px 20px 20px;
}
.welcome-icon {
  width: 80px; height: 80px; border-radius: 22px;
  background: linear-gradient(135deg, var(--primary-soft), var(--purple-soft));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px; color: var(--primary);
  animation: floatIcon 3s ease-in-out infinite;
  box-shadow: 0 8px 32px rgba(91, 141, 239, 0.1);
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.welcome-hero h2 {
  font-size: 26px; font-weight: 700; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.welcome-sub {
  font-size: 14px; color: var(--text-muted); margin-top: 10px;
  max-width: 560px; margin-left: auto; margin-right: auto; line-height: 1.6;
}
.version-badge {
  display: inline-block; margin-top: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 12px; font-size: 10px;
  color: var(--text-dim); letter-spacing: 0.04em;
}

/* ── Capability Cards ──────────────────────────────── */
.capability-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  max-width: 1000px; margin: 20px auto 0;
}
.cap-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: all 0.25s ease;
  cursor: default;
}
.cap-card:hover {
  border-color: var(--border-hover); background: var(--surface-2);
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.cap-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sast-icon       { background: var(--primary-soft); color: var(--primary); }
.dast-icon       { background: var(--orange-soft); color: var(--orange); }
.grade-icon      { background: var(--purple-soft); color: var(--purple); }
.attack-icon     { background: var(--red-soft); color: var(--red); }
.full-icon       { background: var(--green-soft); color: var(--green); }
.redteam-icon    { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.adaptive-icon   { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.graphviz-icon   { background: var(--cyan-soft); color: var(--cyan); }
.harden-icon     { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.regression-icon { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.cap-card strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.cap-card span { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Suggestions ───────────────────────────────────── */
.suggestion-section { text-align: center; padding-top: 16px; }
.suggestion-label {
  font-size: 11px; color: var(--text-dim); margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 800px; margin: 0 auto; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 8px 18px; font-size: 12px; color: var(--text-muted); cursor: pointer;
  transition: all 0.2s ease; font-family: inherit; line-height: 1.4;
}
.chip:hover {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--chip-hover-text); transform: translateY(-1px); box-shadow: var(--shadow-sm);
}
.chip.chip-new {
  border-color: rgba(239, 68, 68, 0.2); background: var(--red-soft);
}
.chip.chip-new:hover {
  border-color: var(--red); background: rgba(239, 68, 68, 0.15);
}

/* ── Agent commands reference (collapsible) ────────── */
.agent-commands-panel {
  margin-top: 20px; padding: 0 24px 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); max-width: 720px; margin-left: auto; margin-right: auto;
}
.agent-commands-summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  user-select: none;
}
.agent-commands-summary::-webkit-details-marker { display: none; }
.agent-commands-summary:hover { color: var(--primary); }
.agent-commands-chevron {
  font-size: 10px; color: var(--text-dim); transition: transform 0.2s;
}
.agent-commands-panel[open] .agent-commands-chevron { transform: rotate(180deg); }
.agent-commands-content {
  padding: 0 16px 16px; border-top: 1px solid var(--border);
}
.agent-commands-intro {
  font-size: 12px; color: var(--text-muted); margin: 12px 0 10px;
}
.agent-commands-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.agent-commands-table th,
.agent-commands-table td {
  padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.agent-commands-table th {
  color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase;
}
.agent-commands-table td:first-child { color: var(--primary); white-space: nowrap; }
.agent-commands-table tr:hover td { background: var(--table-row-hover); }
.agent-commands-examples {
  margin: 0 0 12px 0; padding-left: 20px; font-size: 12px; color: var(--text-muted);
}
.agent-commands-examples li { margin-bottom: 8px; line-height: 1.5; }
.agent-commands-examples code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 4px 8px; font-size: 11px; word-break: break-all;
}

/* ── Messages ──────────────────────────────────────── */
.message { display: flex; gap: 14px; max-width: 100%; animation: msgIn 0.3s ease-out; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user { flex-direction: row-reverse; }
.message.user .message-content {
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.08), rgba(91, 141, 239, 0.04));
  border-color: rgba(91, 141, 239, 0.15);
}
.message-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
  border: 1px solid var(--border);
}
.message.user .message-avatar { background: var(--surface-3); color: var(--text); }
.message.assistant .message-avatar {
  background: linear-gradient(135deg, var(--primary), #3b64d0);
  color: #fff; border-color: transparent;
}
.message-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; max-width: 95%; line-height: 1.7; position: relative;
}
.message-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.message-time { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.message-actions { display: flex; gap: 4px; }
.msg-action-btn {
  background: none; border: 1px solid transparent; border-radius: var(--radius-xs);
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer; transition: all 0.2s; font-size: 12px;
}
.msg-action-btn:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.msg-action-btn.copied { color: var(--green); }

.message-text h2, .message-text h3, .message-text h4 { margin: 16px 0 8px; font-weight: 600; }
.message-text h2 { font-size: 17px; color: var(--heading-color); }
.message-text h3 { font-size: 15px; color: var(--heading-color); }
.message-text h4 { font-size: 13px; color: var(--text); }
.message-text ul, .message-text ol { padding-left: 20px; margin: 8px 0; }
.message-text li { margin: 5px 0; }
.message-text code {
  background: var(--surface-3); padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 12px; font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', Monaco, monospace;
  border: 1px solid var(--border); color: var(--cyan);
}
.message-text pre {
  background: var(--surface-2); padding: 16px; border-radius: var(--radius-sm);
  overflow-x: auto; margin: 12px 0; border: 1px solid var(--border);
}
.message-text pre code { background: none; padding: 0; border: none; color: var(--text); }
.message-text .table-wrap { overflow-x: auto; margin: 12px 0; border-radius: var(--radius-sm); }
.message-text table { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 12px; table-layout: auto; }
.message-text th, .message-text td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.message-text th { background: var(--surface-2); font-weight: 600; color: var(--heading-color); white-space: nowrap; }
.message-text td { white-space: normal; word-break: break-word; }
.message-text hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.message-text strong { color: var(--heading-color); }
.message-text p { margin: 6px 0; }
.message-text a { color: var(--primary); text-decoration: none; }
.message-text a:hover { text-decoration: underline; }

/* ── Progress Bar ─────────────────────────────────── */
.progress-container {
  display: flex; gap: 14px; max-width: 100%;
  animation: msgIn 0.3s ease-out;
}
.progress-wrapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 22px; max-width: 95%;
  min-width: 320px;
}
.progress-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.progress-spinner {
  width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar {
  height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: 2px; transition: width 0.5s ease;
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.progress-steps {
  margin-top: 10px; display: flex; flex-direction: column; gap: 4px;
}
.progress-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-dim);
  transition: color 0.3s;
}
.progress-step.active { color: var(--text-muted); }
.progress-step.done { color: var(--green); }
.step-icon { width: 14px; text-align: center; }

/* ── Typing Indicator ──────────────────────────────── */
.typing-dots { display: flex; gap: 5px; padding: 8px 0; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-5px); } }

/* ── File-origin hint (file:// vs served UI) ───────── */
.file-origin-banner {
  margin: 8px 5% 0;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--orange-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
}
.file-origin-banner code {
  font-size: 11px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

/* ── Scan defaults panel ───────────────────────────── */
.scan-defaults-panel {
  margin: 0 5% 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}
.scan-defaults-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}
.scan-defaults-summary::-webkit-details-marker { display: none; }
.scan-defaults-summary:hover { color: var(--primary); }
.scan-defaults-chevron {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.scan-defaults-panel[open] .scan-defaults-chevron { transform: rotate(180deg); }
.scan-defaults-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}
.scan-defaults-intro {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 12px 0 14px;
}
.scan-defaults-intro code {
  font-size: 10px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.scan-defaults-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
@media (max-width: 720px) {
  .scan-defaults-grid { grid-template-columns: 1fr; }
  .cfg-span-2 { grid-column: auto; }
}
.cfg-span-2 { grid-column: 1 / -1; }
.cfg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.cfg-field span { text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; color: var(--text-dim); }
.cfg-input, .cfg-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.cfg-input.mono, .server-runtime-pre { font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', Monaco, monospace; font-size: 11px; }
.cfg-input:focus, .cfg-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.server-runtime-nested {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0;
}
.server-runtime-nested > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  list-style: none;
}
.server-runtime-nested > summary::-webkit-details-marker { display: none; }
.server-runtime-nested[open] > summary { border-bottom: 1px solid var(--border); }
.server-runtime-pre {
  margin: 0;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  line-height: 1.45;
}
.ui-config-err {
  font-size: 11px;
  color: var(--orange);
  padding: 0 12px 10px;
  margin: 0;
}

/* ── Input ─────────────────────────────────────────── */
.input-area {
  padding: 14px 5% 10px; border-top: 1px solid var(--border);
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.input-wrapper {
  display: flex; align-items: flex-end; gap: 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
  transition: all 0.25s ease;
}
.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm);
}
textarea {
  flex: 1; background: none; border: none; color: var(--text); font-size: 14px;
  font-family: inherit; resize: none; outline: none; line-height: 1.5;
  max-height: 150px;
}
textarea::placeholder { color: var(--text-dim); }
#sendBtn {
  background: linear-gradient(135deg, var(--primary), #3b64d0);
  border: none; border-radius: var(--radius-sm);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; transition: all 0.2s; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(91, 141, 239, 0.2);
}
#sendBtn:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(91, 141, 239, 0.3); }
#sendBtn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }
#stopBtn {
  background: var(--red-soft); border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px; display: none; align-items: center; justify-content: center;
  color: var(--red); cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
#stopBtn:hover { background: rgba(239, 68, 68, 0.15); }
#stopBtn.visible { display: flex; }
.input-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding: 0 4px;
}
.input-hint { font-size: 10px; color: var(--text-dim); }
.char-count { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--orange); }

/* ── Report Formatting ─────────────────────────────── */
.report { line-height: 1.7; }
.report .spacer { height: 6px; }
.report p { margin: 5px 0; }
.report h2 {
  font-size: 17px; font-weight: 700; color: var(--heading-color);
  margin: 22px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.report h2:first-child { margin-top: 0; }
.report h3 {
  font-size: 14px; font-weight: 600; color: var(--heading-color);
  margin: 18px 0 8px; padding: 10px 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}
.report h3.section-findings { border-left-color: var(--red); }
.report h3.section-recs { border-left-color: var(--green); }
.report h3.section-uncertain { border-left-color: var(--orange); }
.report h3.section-overview { border-left-color: var(--primary); }
.report h4 {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 14px 0 6px;
}
.report h4.section-findings { color: var(--red); }
.report h4.section-recs { color: var(--green); }
.report h4.section-uncertain { color: var(--orange); }
.report ul, .report ol { padding-left: 22px; margin: 6px 0; }
.report ul ul, .report ol ol, .report ul ol, .report ol ul { margin: 2px 0; }
.report li { margin: 4px 0; line-height: 1.6; }
.report li::marker { color: var(--text-dim); }
.report hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── Severity / Status Badges ─────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; vertical-align: middle;
  line-height: 16px;
}
.badge-pass { background: var(--green-soft); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-fail { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-uncertain { background: var(--orange-soft); color: var(--orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-skip { background: rgba(100, 116, 139, 0.08); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.2); }
.badge-critical { background: rgba(220, 38, 38, 0.12); color: #f87171; border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-high { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-medium { background: var(--orange-soft); color: var(--orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-low { background: rgba(59, 130, 246, 0.08); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-info { background: rgba(100, 116, 139, 0.08); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.2); }

/* ── Report Tables ────────────────────────────────── */
.report-table { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.report-table table { border-collapse: collapse; width: 100%; font-size: 12px; }
.report-table th {
  padding: 10px 14px; text-align: left; font-weight: 600; color: var(--heading-color);
  background: var(--surface-2); border-bottom: 2px solid var(--border);
  position: sticky; top: 0;
}
.report-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: normal; word-break: break-word; }
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: var(--table-row-hover); }

/* ── Modals (About, Help) ──────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  visibility: hidden; opacity: 0;
  transition: visibility 0.2s, opacity 0.2s ease;
}
.modal-overlay.modal-open {
  visibility: visible; opacity: 1;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.modal-panel {
  position: relative; z-index: 1;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 520px; width: 100%; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  transition: transform 0.2s ease;
}
.modal-overlay:not(.modal-open) .modal-panel { transform: scale(0.98); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 18px; font-weight: 600; color: var(--heading-color);
  margin: 0;
}
.modal-close {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; color: var(--text-muted);
  cursor: pointer; transition: all 0.2s; padding: 0;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.modal-body {
  padding: 20px; overflow-y: auto; flex: 1;
  font-size: 14px; line-height: 1.6; color: var(--text);
}
.modal-body p { margin: 0 0 12px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body ul { margin: 0 0 12px; padding-left: 20px; }
.modal-body li { margin: 4px 0; }
.modal-body h3 { font-size: 14px; font-weight: 600; color: var(--heading-color); margin: 16px 0 8px; }
.modal-body h3:first-child { margin-top: 0; }
.about-lead { font-size: 15px; color: var(--text-muted); }
.about-features { margin: 12px 0 !important; }
.about-features li { margin: 6px 0; }
.about-meta { font-size: 12px; color: var(--text-dim); margin-top: 16px !important; }
.help-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.modal-body kbd {
  display: inline-block; padding: 2px 6px; font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); font-family: inherit;
}

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

/* ── Focus (accessibility) ───────────────────────────── */
.header-btn:focus-visible,
.theme-toggle:focus-visible,
.chip:focus-visible,
#sendBtn:focus-visible,
#stopBtn:focus-visible,
.msg-action-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* Remove default focus outline when focus-visible is supported */
.header-btn:focus,
.theme-toggle:focus,
.chip:focus,
#sendBtn:focus,
#stopBtn:focus,
.msg-action-btn:focus {
  outline: none;
}

/* ── Reduced motion (accessibility) ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  html,
  .welcome-icon,
  .cap-card,
  .message,
  .progress-container,
  .progress-fill,
  .typing-dots span,
  .status-dot.processing,
  .header-btn,
  .theme-toggle,
  .chip,
  .modal-overlay,
  .modal-panel {
    animation: none !important;
    transition: none !important;
  }
  .progress-fill { transition: width 0.2s ease; /* keep for progress feedback */ }
}

/* ── Responsive ────────────────────────────────────── */
@media (min-width: 1400px) {
  .chat-container { padding: 32px 8%; }
  .header { padding: 12px 8%; }
  .input-area { padding: 14px 8% 10px; }
  .capability-cards { max-width: 1100px; grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1800px) {
  .chat-container { padding: 36px 14%; }
  .header { padding: 12px 14%; }
  .input-area { padding: 14px 14% 10px; }
}
@media (max-width: 768px) {
  .header-center { display: none; }
  .session-timer { display: none; }
}
@media (max-width: 640px) {
  .capability-cards { grid-template-columns: 1fr; gap: 10px; }
  .message-content { max-width: 98%; padding: 14px 16px; }
  .header { padding: 10px 16px; }
  .chat-container { padding: 16px; gap: 16px; }
  .input-area { padding: 10px 16px 8px; }
  .welcome-hero { padding: 24px 12px 12px; }
  .welcome-hero h2 { font-size: 20px; }
  .welcome-icon { width: 64px; height: 64px; }
  .message-meta { display: none; }
  .msg-action-btn { display: none; }
}
