:root {
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 0px;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

/* ── Theme: Midnight (default) ─────────────────────────────── */
:root,
[data-theme="default"] {
  color-scheme: dark;
  --bg: #0f1219;
  --bg-elevated: #161b26;
  --bg-card: #1a2030;
  --bg-hover: #222a3d;
  --border: #2a3348;
  --border-light: #343f56;
  --text: #e8ecf4;
  --text-muted: #8b95a8;
  --text-dim: #5c667a;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-border: rgba(59, 130, 246, 0.25);
  --accent-glow: rgba(59, 130, 246, 0.5);
  --accent-highlight: rgba(59, 130, 246, 0.18);
  --on-accent: #ffffff;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --purple: #a855f7;
  --p1: #3b82f6;
  --p2: #8b5cf6;
  --p3: #06b6d4;
  --p4: #f59e0b;
  --p1-soft: rgba(59, 130, 246, 0.15);
  --p2-soft: rgba(139, 92, 246, 0.15);
  --p3-soft: rgba(6, 182, 212, 0.15);
  --p4-soft: rgba(245, 158, 11, 0.15);
  --p1-subtle: rgba(59, 130, 246, 0.06);
  --p2-subtle: rgba(139, 92, 246, 0.06);
  --p3-subtle: rgba(6, 182, 212, 0.06);
  --p4-subtle: rgba(245, 158, 11, 0.06);
  --p1-medium: rgba(59, 130, 246, 0.2);
  --p2-medium: rgba(139, 92, 246, 0.2);
  --p3-medium: rgba(6, 182, 212, 0.2);
  --p4-medium: rgba(245, 158, 11, 0.2);
  --card-gradient-start: rgba(59, 130, 246, 0.06);
  --row-divider: rgba(255, 255, 255, 0.03);
  --neutral-soft: rgba(148, 163, 184, 0.15);
  --neutral-text: #94a3b8;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-up: 0 -8px 32px rgba(0, 0, 0, 0.4);
  --sidebar-bg: var(--bg-elevated);
  --sidebar-border: var(--border);
  --sidebar-text: var(--text);
  --sidebar-text-muted: var(--text-muted);
  --sidebar-hover-bg: var(--bg-hover);
  --sidebar-active-bg: var(--accent-soft);
  --sidebar-active-text: var(--accent);
  --sidebar-card-bg: var(--bg-card);
}

/* ── Theme: Corporate (Citi-style) ───────────────────────── */
[data-theme="citi"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #f4f7fb;
  --bg-card: #f8fafc;
  --bg-hover: #e8f2fc;
  --border: #dde5ef;
  --border-light: #c8d4e3;
  --text: #1a2b3c;
  --text-muted: #5a6b7d;
  --text-dim: #8a9bb0;
  --accent: #004b87;
  --accent-soft: rgba(0, 75, 135, 0.1);
  --accent-border: rgba(0, 75, 135, 0.28);
  --accent-glow: rgba(0, 75, 135, 0.35);
  --accent-highlight: rgba(0, 75, 135, 0.12);
  --on-accent: #ffffff;
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.1);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.1);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --purple: #6d28d9;
  --p1: #004b87;
  --p2: #1d4ed8;
  --p3: #0369a1;
  --p4: #b45309;
  --p1-soft: rgba(0, 75, 135, 0.12);
  --p2-soft: rgba(29, 78, 216, 0.12);
  --p3-soft: rgba(3, 105, 161, 0.12);
  --p4-soft: rgba(180, 83, 9, 0.12);
  --p1-subtle: rgba(0, 75, 135, 0.05);
  --p2-subtle: rgba(29, 78, 216, 0.05);
  --p3-subtle: rgba(3, 105, 161, 0.05);
  --p4-subtle: rgba(180, 83, 9, 0.05);
  --p1-medium: rgba(0, 75, 135, 0.18);
  --p2-medium: rgba(29, 78, 216, 0.18);
  --p3-medium: rgba(3, 105, 161, 0.18);
  --p4-medium: rgba(180, 83, 9, 0.18);
  --card-gradient-start: rgba(0, 75, 135, 0.04);
  --row-divider: rgba(0, 0, 0, 0.04);
  --neutral-soft: rgba(100, 116, 139, 0.12);
  --neutral-text: #64748b;
  --shadow: 0 4px 24px rgba(0, 59, 112, 0.08);
  --shadow-up: 0 -8px 32px rgba(0, 59, 112, 0.1);
  --sidebar-bg: #003b70;
  --sidebar-border: rgba(255, 255, 255, 0.12);
  --sidebar-text: #ffffff;
  --sidebar-text-muted: rgba(255, 255, 255, 0.72);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(255, 255, 255, 0.15);
  --sidebar-active-text: #ffffff;
  --sidebar-card-bg: rgba(255, 255, 255, 0.1);
}

/* ── Theme: Light ──────────────────────────────────────────── */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #eef2f7;
  --border: #dfe4ec;
  --border-light: #cdd5e0;
  --text: #1c2434;
  --text-muted: #5a6578;
  --text-dim: #8b95a8;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-border: rgba(37, 99, 235, 0.25);
  --accent-glow: rgba(37, 99, 235, 0.35);
  --accent-highlight: rgba(37, 99, 235, 0.12);
  --on-accent: #ffffff;
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --purple: #7c3aed;
  --p1: #2563eb;
  --p2: #7c3aed;
  --p3: #0891b2;
  --p4: #d97706;
  --p1-soft: rgba(37, 99, 235, 0.12);
  --p2-soft: rgba(124, 58, 237, 0.12);
  --p3-soft: rgba(8, 145, 178, 0.12);
  --p4-soft: rgba(217, 119, 6, 0.12);
  --p1-subtle: rgba(37, 99, 235, 0.05);
  --p2-subtle: rgba(124, 58, 237, 0.05);
  --p3-subtle: rgba(8, 145, 178, 0.05);
  --p4-subtle: rgba(217, 119, 6, 0.05);
  --p1-medium: rgba(37, 99, 235, 0.18);
  --p2-medium: rgba(124, 58, 237, 0.18);
  --p3-medium: rgba(8, 145, 178, 0.18);
  --p4-medium: rgba(217, 119, 6, 0.18);
  --card-gradient-start: rgba(37, 99, 235, 0.04);
  --row-divider: rgba(0, 0, 0, 0.04);
  --neutral-soft: rgba(100, 116, 139, 0.12);
  --neutral-text: #64748b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-up: 0 -8px 32px rgba(0, 0, 0, 0.1);
  --sidebar-bg: #ffffff;
  --sidebar-border: #dfe4ec;
  --sidebar-text: #1c2434;
  --sidebar-text-muted: #5a6578;
  --sidebar-hover-bg: #eef2f7;
  --sidebar-active-bg: rgba(37, 99, 235, 0.1);
  --sidebar-active-text: #2563eb;
  --sidebar-card-bg: #f4f6f9;
}

/* ── Theme: Soft & Friendly ────────────────────────────────── */
[data-theme="soft"] {
  color-scheme: light;
  --bg: #faf7f4;
  --bg-elevated: #fff9f5;
  --bg-card: #ffffff;
  --bg-hover: #f5ede6;
  --border: #e8ddd4;
  --border-light: #d9cec4;
  --text: #3d3530;
  --text-muted: #8a7e75;
  --text-dim: #b0a49a;
  --accent: #e07a5f;
  --accent-soft: rgba(224, 122, 95, 0.12);
  --accent-border: rgba(224, 122, 95, 0.28);
  --accent-glow: rgba(224, 122, 95, 0.35);
  --accent-highlight: rgba(224, 122, 95, 0.12);
  --on-accent: #ffffff;
  --green: #81b29a;
  --green-soft: rgba(129, 178, 154, 0.15);
  --amber: #f2cc8f;
  --amber-soft: rgba(242, 204, 143, 0.2);
  --red: #e07a5f;
  --red-soft: rgba(224, 122, 95, 0.12);
  --purple: #b5838d;
  --p1: #e07a5f;
  --p2: #b5838d;
  --p3: #81b29a;
  --p4: #f2cc8f;
  --p1-soft: rgba(224, 122, 95, 0.15);
  --p2-soft: rgba(181, 131, 141, 0.15);
  --p3-soft: rgba(129, 178, 154, 0.15);
  --p4-soft: rgba(242, 204, 143, 0.2);
  --p1-subtle: rgba(224, 122, 95, 0.06);
  --p2-subtle: rgba(181, 131, 141, 0.06);
  --p3-subtle: rgba(129, 178, 154, 0.06);
  --p4-subtle: rgba(242, 204, 143, 0.08);
  --p1-medium: rgba(224, 122, 95, 0.2);
  --p2-medium: rgba(181, 131, 141, 0.2);
  --p3-medium: rgba(129, 178, 154, 0.2);
  --p4-medium: rgba(242, 204, 143, 0.25);
  --card-gradient-start: rgba(224, 122, 95, 0.05);
  --row-divider: rgba(61, 53, 48, 0.04);
  --neutral-soft: rgba(138, 126, 117, 0.12);
  --neutral-text: #8a7e75;
  --shadow: 0 4px 24px rgba(61, 53, 48, 0.06);
  --shadow-up: 0 -8px 32px rgba(61, 53, 48, 0.08);
  --sidebar-bg: #fff9f5;
  --sidebar-border: #e8ddd4;
  --sidebar-text: #3d3530;
  --sidebar-text-muted: #8a7e75;
  --sidebar-hover-bg: #f5ede6;
  --sidebar-active-bg: rgba(224, 122, 95, 0.12);
  --sidebar-active-text: #c96a52;
  --sidebar-card-bg: #ffffff;
}

/* ── Theme: Aurora ─────────────────────────────────────────── */
[data-theme="aurora"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-elevated: #131a24;
  --bg-card: #182030;
  --bg-hover: #1f2a3d;
  --border: #2a3a52;
  --border-light: #354a68;
  --text: #e0e8f4;
  --text-muted: #8899b0;
  --text-dim: #5c6d84;
  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-border: rgba(34, 211, 238, 0.28);
  --accent-glow: rgba(34, 211, 238, 0.45);
  --accent-highlight: rgba(34, 211, 238, 0.18);
  --on-accent: #0d1117;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --purple: #c084fc;
  --p1: #22d3ee;
  --p2: #a78bfa;
  --p3: #34d399;
  --p4: #f472b6;
  --p1-soft: rgba(34, 211, 238, 0.15);
  --p2-soft: rgba(167, 139, 250, 0.15);
  --p3-soft: rgba(52, 211, 153, 0.15);
  --p4-soft: rgba(244, 114, 182, 0.15);
  --p1-subtle: rgba(34, 211, 238, 0.06);
  --p2-subtle: rgba(167, 139, 250, 0.06);
  --p3-subtle: rgba(52, 211, 153, 0.06);
  --p4-subtle: rgba(244, 114, 182, 0.06);
  --p1-medium: rgba(34, 211, 238, 0.2);
  --p2-medium: rgba(167, 139, 250, 0.2);
  --p3-medium: rgba(52, 211, 153, 0.2);
  --p4-medium: rgba(244, 114, 182, 0.2);
  --card-gradient-start: rgba(34, 211, 238, 0.06);
  --row-divider: rgba(255, 255, 255, 0.03);
  --neutral-soft: rgba(136, 153, 176, 0.15);
  --neutral-text: #8899b0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-up: 0 -8px 32px rgba(0, 0, 0, 0.45);
  --sidebar-bg: #0f1520;
  --sidebar-border: #2a3a52;
  --sidebar-text: #e0e8f4;
  --sidebar-text-muted: #8899b0;
  --sidebar-hover-bg: #1a2438;
  --sidebar-active-bg: rgba(34, 211, 238, 0.12);
  --sidebar-active-text: #22d3ee;
  --sidebar-card-bg: #182030;
}

/* ── Theme: Warm Sunset ────────────────────────────────────── */
[data-theme="sunset"] {
  color-scheme: dark;
  --bg: #1a1210;
  --bg-elevated: #241a16;
  --bg-card: #2c201a;
  --bg-hover: #3a2a22;
  --border: #4a3830;
  --border-light: #5c4840;
  --text: #f5e6dc;
  --text-muted: #c4a898;
  --text-dim: #9a8070;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.12);
  --accent-border: rgba(249, 115, 22, 0.28);
  --accent-glow: rgba(249, 115, 22, 0.45);
  --accent-highlight: rgba(249, 115, 22, 0.18);
  --on-accent: #1a1210;
  --green: #a3e635;
  --green-soft: rgba(163, 230, 53, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --purple: #e879f9;
  --p1: #fb923c;
  --p2: #f472b6;
  --p3: #fbbf24;
  --p4: #f87171;
  --p1-soft: rgba(251, 146, 60, 0.15);
  --p2-soft: rgba(244, 114, 182, 0.15);
  --p3-soft: rgba(251, 191, 36, 0.15);
  --p4-soft: rgba(248, 113, 113, 0.15);
  --p1-subtle: rgba(251, 146, 60, 0.06);
  --p2-subtle: rgba(244, 114, 182, 0.06);
  --p3-subtle: rgba(251, 191, 36, 0.06);
  --p4-subtle: rgba(248, 113, 113, 0.06);
  --p1-medium: rgba(251, 146, 60, 0.2);
  --p2-medium: rgba(244, 114, 182, 0.2);
  --p3-medium: rgba(251, 191, 36, 0.2);
  --p4-medium: rgba(248, 113, 113, 0.2);
  --card-gradient-start: rgba(249, 115, 22, 0.06);
  --row-divider: rgba(255, 255, 255, 0.03);
  --neutral-soft: rgba(196, 168, 152, 0.15);
  --neutral-text: #c4a898;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-up: 0 -8px 32px rgba(0, 0, 0, 0.45);
  --sidebar-bg: #201612;
  --sidebar-border: #4a3830;
  --sidebar-text: #f5e6dc;
  --sidebar-text-muted: #c4a898;
  --sidebar-hover-bg: #3a2a22;
  --sidebar-active-bg: rgba(249, 115, 22, 0.12);
  --sidebar-active-text: #fb923c;
  --sidebar-card-bg: #2c201a;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  transition: transform 0.25s ease, width 0.25s ease;
}

.app.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 1rem;
  position: relative;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-card-bg);
  color: var(--sidebar-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  border-color: var(--sidebar-border);
}

.sidebar-expand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-expand:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-light);
}

.collapsed-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  z-index: 15;
}

.app.sidebar-collapsed .collapsed-topbar {
  display: flex;
}

.collapsed-topbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand strong { display: block; font-size: 0.95rem; color: var(--sidebar-text); }
.brand span { font-size: 0.75rem; color: var(--sidebar-text-muted); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--sidebar-text-muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
}

.client-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.client-chip-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-family: var(--font);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: var(--radius-sm);
  text-align: left;
  width: calc(100% + 0.5rem);
}

.client-chip-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-active-text);
}

.client-chip .dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}

.client-chip-btn .dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}

.client-chip-btn .dot.in-progress {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.client-chip-btn .dot.failed {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.sidebar-footer small {
  color: var(--sidebar-text-muted);
  font-size: 0.7rem;
  font-family: var(--mono);
}

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem 2.5rem;
  max-width: 1200px;
  transition: margin-left 0.25s ease, max-width 0.25s ease;
}

.app.sidebar-collapsed .main {
  margin-left: 0;
  max-width: none;
  padding-top: calc(52px + 2rem);
}

.main:has(#view-results.active) {
  max-width: 1600px;
  padding-right: 1.5rem;
}

.app.sidebar-collapsed .main:has(#view-results.active) {
  max-width: none;
  padding-right: 2.5rem;
}

.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 520px;
}

.findings-run-meta {
  margin: 0.35rem 0 0.75rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.findings-filter-count {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.elapsed {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-icon:hover { background: var(--bg-hover); color: var(--red); }

/* Inputs */
.input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-sm { padding: 0.4rem 0.6rem; font-size: 0.8rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-highlight {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--card-gradient-start) 0%, var(--bg-card) 60%);
  margin-bottom: 2rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

/* Phase configuration (setup) */
.config-summary {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.config-summary-item {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.config-summary-item strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.config-summary-item.ready strong { color: var(--green); }

.phase-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.phase-config-card {
  padding: 0;
  overflow: hidden;
}

.phase-config-card .phase-card-header {
  align-items: flex-start;
}

.phase-config-card .phase-card-header .badge {
  margin-left: auto;
  flex-shrink: 0;
}

.config-files {
  padding: 0.75rem 1.25rem 1.25rem;
}

.config-file-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.config-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.config-file-row:last-child { border-bottom: none; }

.config-file-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.config-file-info strong {
  display: block;
  font-size: 0.82rem;
}

.config-file-info strong.muted { color: var(--text-dim); font-weight: 500; }

.config-file-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.config-file-row.empty {
  background: var(--amber-soft);
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  border-radius: var(--radius-sm);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Upload zones */
.upload-zone {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 0.65rem;
}

.upload-zone.dashed {
  border-style: dashed;
  border-color: var(--border-light);
  cursor: pointer;
  justify-content: center;
  text-align: center;
}

.upload-zone.dashed:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone.large { padding: 1.5rem; }

.upload-zone.compact {
  padding: 0.65rem;
  justify-content: center;
  margin-bottom: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.upload-zone.uploaded { border-style: solid; }

.upload-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-icon.done {
  background: var(--green-soft);
  color: var(--green);
}

.upload-text {
  flex: 1;
  min-width: 0;
}

.upload-text strong {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mt { margin-top: 0.75rem; }

/* Prompt list */
.prompt-list { margin-bottom: 0.5rem; }

.prompt-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.prompt-item strong { display: block; font-size: 0.82rem; }
.prompt-item span { font-size: 0.72rem; color: var(--text-muted); }
.prompt-item .check { color: var(--green); font-weight: 700; }

.phase-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.phase-tag.sm {
  width: auto;
  height: auto;
  padding: 0.15rem 0.4rem;
  font-size: 0.65rem;
}

.phase-tag.p1 { background: var(--p1-soft); color: var(--p1); }
.phase-tag.p2 { background: var(--p2-soft); color: var(--p2); }
.phase-tag.p3 { background: var(--p3-soft); color: var(--p3); }
.phase-tag.p4 { background: var(--p4-soft); color: var(--p4); }

/* Section */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* Phase upload grid */
.phase-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.phase-card { padding: 0; overflow: hidden; }

.phase-card-header {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.phase-card-header.p1 { background: var(--p1-subtle); }
.phase-card-header.p2 { background: var(--p2-subtle); }
.phase-card-header.p3 { background: var(--p3-subtle); }
.phase-card-header.p4 { background: var(--p4-subtle); }

.phase-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.p1 .phase-num { background: var(--p1-medium); color: var(--p1); }
.p2 .phase-num { background: var(--p2-medium); color: var(--p2); }
.p3 .phase-num { background: var(--p3-medium); color: var(--p3); }
.p4 .phase-num { background: var(--p4-medium); color: var(--p4); }

.phase-card-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.phase-card-header p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.phase-card .file-list,
.phase-card .upload-zone,
.phase-card .phase-meta {
  margin-left: 1.25rem;
  margin-right: 1.25rem;
}

.phase-card-header .phase-ready-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-dim);
}

.phase-ready-badge.ready {
  background: var(--green-soft);
  color: var(--green);
}

.phase-card-highlight {
  border-color: var(--p2);
  box-shadow: 0 0 0 1px var(--p2-medium);
}

.phase-card-empty {
  opacity: 0.85;
}

.file-list-empty {
  margin: 1rem 1.25rem 0;
  padding: 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.file-list-empty p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
}

.phase-run-footer {
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

.phase-run-footer .btn {
  width: 100%;
  justify-content: center;
}

.phase-run-footer .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.independent-phase-note {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.independent-phase-note strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.independent-phase-note p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

.independent-phase-note em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

.phase-card .file-list { margin-top: 1rem; }

.file-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.file-item:last-child { border-bottom: none; }

.file-icon {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.25rem 0.35rem;
  border-radius: 3px;
  font-family: var(--mono);
}

.file-icon.zip {
  background: var(--amber-soft);
  color: var(--amber);
}

.file-item strong { display: block; font-size: 0.8rem; }
.file-item span { font-size: 0.7rem; color: var(--text-muted); }

.phase-card .upload-zone { margin-top: 0.75rem; margin-bottom: 1rem; }

.phase-meta {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0 1rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.phase-card-footer-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}

.phase-card-footer-actions .btn {
  flex: 1;
}

.asset-browser {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem 1.25rem;
}

.asset-browser-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.asset-browser-header h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.asset-browser-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.asset-browser-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: var(--mono);
}

.asset-tree {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  max-height: 420px;
  overflow: auto;
  padding: 0.5rem 0;
}

.asset-tree-empty {
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.asset-node {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--row-divider);
}

.asset-node:last-child { border-bottom: none; }

.asset-node[data-depth="1"] { padding-left: 1.5rem; }
.asset-node[data-depth="2"] { padding-left: 2.25rem; }
.asset-node[data-depth="3"] { padding-left: 3rem; }
.asset-node[data-depth="4"] { padding-left: 3.75rem; }
.asset-node[data-depth="5"] { padding-left: 4.5rem; }

.asset-node-main strong {
  display: block;
  font-size: 0.82rem;
}

.asset-node-main span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.asset-kind {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.2rem 0.35rem;
  border-radius: 3px;
  font-family: var(--mono);
  text-transform: uppercase;
}

.asset-kind.container {
  background: var(--neutral-soft);
  color: var(--neutral-text);
}

.asset-kind.asset {
  background: var(--green-soft);
  color: var(--green);
}

.asset-kind.failed {
  background: var(--red-soft);
  color: var(--red);
}

.asset-node-actions {
  display: flex;
  gap: 0.25rem;
}

.asset-node-actions .btn-sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
}

.upload-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 1rem 0.75rem;
  min-height: 1rem;
}

.upload-status.error { color: var(--red); }
.upload-status.ok { color: var(--green); }

/* Summary bar */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.summary-stat strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.summary-stat span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-stat.ready strong { color: var(--green); }

/* Orchestrator banner */
.orchestrator-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.orchestrator-banner strong { display: block; font-size: 0.9rem; }
.orchestrator-banner span { font-size: 0.78rem; color: var(--text-muted); }

.pulse {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

/* Progress */
.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progress-card h3 {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.progress-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.status-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.status-badge.running {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.idle {
  background: var(--bg-hover);
  color: var(--text-dim);
}

.status-badge.complete {
  background: var(--green-soft);
  color: var(--green);
}

.step-tracker {
  margin-bottom: 1rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0.3rem 0;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
}

.step.done { color: var(--text-muted); }
.step.done .step-dot { background: var(--green); }

.step.active { color: var(--text); font-weight: 500; }
.step.active .step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.progress-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-fill.p1 { background: var(--p1); }
.progress-fill.p2 { background: var(--p2); }
.progress-fill.p3 { background: var(--p3); }
.progress-fill.p4 { background: var(--p4); }

.status-badge.failed {
  background: var(--red-soft);
  color: var(--red);
}

.orchestrator-banner.idle-banner {
  background: var(--surface-2);
  border: 1px dashed var(--border);
}

.orchestrator-banner.idle-banner.failed-banner {
  border-color: var(--red);
  background: var(--red-soft);
}
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* Activity log */
.activity-log h3 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.log-entries {
  max-height: 200px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.log-entry time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  min-width: 64px;
}

.log-entry .tag {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-family: var(--mono);
}

.log-entry .tag.p1 { background: var(--p1-soft); color: var(--p1); }
.log-entry .tag.p2 { background: var(--p2-soft); color: var(--p2); }
.log-entry .tag.p3 { background: var(--p3-soft); color: var(--p3); }
.log-entry .tag.p4 { background: var(--p4-soft); color: var(--p4); }
.log-entry .tag.all { background: var(--bg-hover); color: var(--text-muted); }

/* Results */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.stat-card strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-card.mismatch strong { color: var(--red); }
.stat-card.review strong { color: var(--amber); }
.stat-card.notfound strong { color: var(--text-muted); }
.stat-card.correct strong { color: var(--green); }

.filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.findings-table-wrap {
  overflow-x: auto;
}

.findings-empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.findings-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.findings-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.findings-table tbody tr:hover {
  background: var(--bg-hover);
}

.status-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.status-pill.mismatch { background: var(--red-soft); color: var(--red); }
.status-pill.review { background: var(--amber-soft); color: var(--amber); }
.status-pill.notfound { background: var(--bg-hover); color: var(--text-muted); }
.status-pill.correct { background: var(--green-soft); color: var(--green); }

.found-warn { color: var(--red); }

.citation {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
}

.citation.muted { color: var(--text-dim); }

.findings-table small {
  color: var(--text-dim);
  font-size: 0.72rem;
}

/* Findings layout + Q&A panel */
.findings-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  align-items: start;
}

.findings-layout.panel-closed {
  grid-template-columns: 1fr;
}

.findings-main {
  min-width: 0;
}

.multi-select-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.multi-select-bar.hidden { display: none; }

.col-check { width: 36px; }
.col-num { width: 44px; color: var(--text-dim); font-family: var(--mono); font-size: 0.8rem; }
.col-actions { width: 100px; }

.findings-table input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.findings-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.findings-table tbody tr.selected {
  background: var(--accent-soft);
}

.findings-table tbody tr:hover:not(.selected) {
  background: var(--bg-hover);
}

.field-name-cell strong { display: block; font-size: 0.82rem; }
.field-name-cell small { color: var(--text-dim); font-size: 0.7rem; }

.cadd-value { font-family: var(--mono); font-size: 0.78rem; }
.cadd-value.warn { color: var(--red); }

.expected-cell {
  font-size: 0.78rem;
  max-width: 220px;
}

.expected-cell .expected-val {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.expected-cell .expected-explanation {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.comments-cell {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 120px;
}

.comments-cell.empty {
  color: var(--text-dim);
  font-style: italic;
}

.row-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-ask {
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
}

.btn-ask:hover { filter: brightness(1.15); }

.status-pill.match { background: var(--green-soft); color: var(--green); }
.status-pill.na { background: var(--bg-hover); color: var(--text-dim); }

/* Q&A Panel */
.qa-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 4rem);
  position: sticky;
  top: 1rem;
  overflow: hidden;
}

.qa-panel.hidden-panel {
  display: none;
}

.qa-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.qa-eyebrow {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.qa-panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.qa-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.qa-close {
  font-size: 1.25rem;
  line-height: 1;
}

.qa-empty {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex: 1;
}

.qa-empty svg { margin-bottom: 1rem; }

.qa-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.qa-content.hidden { display: none; }

.qa-context {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  max-height: 200px;
  overflow-y: auto;
  flex-shrink: 0;
}

.qa-context-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.qa-context-card:last-child { margin-bottom: 0; }

.qa-context-card .ctx-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.qa-context-card .ctx-field-id {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text-dim);
}

.qa-ctx-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.qa-ctx-row label {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qa-ctx-row span { word-break: break-word; }

.qa-context-empty {
  margin: 0;
  padding: 1rem 1.25rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.qa-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.qa-quick-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qa-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  min-height: 180px;
}

.qa-message {
  margin-bottom: 1rem;
}

.qa-message.user .qa-bubble {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  margin-left: 1.5rem;
}

.qa-message.assistant .qa-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-right: 0.5rem;
}

.qa-bubble {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.55;
}

.qa-bubble .qa-role {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.qa-bubble .qa-cite {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
}

.qa-input-area {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.qa-disclaimer {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.qa-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.qa-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  padding: 0.5rem 0.65rem;
  resize: none;
}

.qa-input:focus {
  outline: none;
  border-color: var(--accent);
}

.qa-reviewer-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-card {
  width: min(100%, 480px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.25));
  padding: 1.25rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-subtitle {
  margin: 0 0 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
}

.modal-label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}

.modal-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.modal-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.status-pill.overridden {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.override-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Review history */
.history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.history-stat {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-stat strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.history-stat span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.logic-review-table tbody tr { cursor: default; }

.logic-review-when {
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.logic-review-status-change {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.logic-review-arrow {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.logic-review-comment {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.logic-review-empty {
  padding: 1.25rem 0.75rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.logic-review-count {
  padding: 0.75rem 0.75rem 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.history-table-wrap { overflow-x: auto; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.history-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.history-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.history-table tbody tr:hover { background: var(--bg-hover); }

.history-table tbody tr.active-review {
  background: var(--accent-soft);
}

.history-table tbody tr.active-review:hover {
  background: var(--accent-highlight);
}

.history-entity strong {
  display: block;
  font-size: 0.88rem;
}

.history-entity small {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.history-review-id {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-findings {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.history-mismatch {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--red);
  font-weight: 600;
}

.history-mismatch.zero { color: var(--text-dim); font-weight: 400; }

.history-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-status.complete {
  background: var(--green-soft);
  color: var(--green);
}

.history-status.in_progress {
  background: var(--accent-soft);
  color: var(--accent);
}

.history-status.failed {
  background: var(--red-soft);
  color: var(--red);
}

.history-actions {
  display: flex;
  gap: 0.35rem;
}

.findings-history-link {
  margin-top: 0.5rem;
  padding-left: 0;
}

/* Responsive */
@media (max-width: 1100px) {
  .findings-layout {
    grid-template-columns: 1fr;
  }

  .qa-panel {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    max-height: 55vh;
    z-index: 20;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow-up);
  }

  .main:has(#view-results.active) {
    max-width: 1200px;
  }

  .grid-2,
  .phase-upload-grid,
  .phase-config-grid,
  .progress-grid {
    grid-template-columns: 1fr;
  }

  .summary-bar,
  .stats-row,
  .history-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.25rem; }
  .page-header { flex-direction: column; }
  .theme-picker {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    top: auto;
    right: auto;
    z-index: 20;
  }
  .theme-picker-label { display: none; }
}

/* ── Theme picker (lives in sidebar) ───────────────────────── */
.theme-picker {
  position: relative;
  margin-top: auto;
  margin-bottom: 0.75rem;
  z-index: 2;
}

.theme-picker-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--sidebar-card-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.theme-picker-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  border-color: var(--sidebar-border);
}

.theme-picker-menu {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.theme-picker-menu[hidden] {
  display: none;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: all 0.12s;
  width: 100%;
}

.theme-option:hover {
  background: var(--bg-hover);
}

.theme-option.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--sw1) 50%, var(--sw2) 50%);
  border: 1px solid var(--border);
}

.theme-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.theme-option-text strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.theme-option-text small {
  font-size: 0.7rem;
  color: var(--text-muted);
}
