/* ═════════════════════════════════════════════════════════════════════
   PRESTIJ PEERREVIEW AI — MACBOOK PRO EDITION (LIGHT THEME & MACOS)
   ═════════════════════════════════════════════════════════════════════ */

:root {
  /* Default: Apple macOS Light Theme */
  --bg-desktop: #e9e9ee;
  --bg-mac-window: rgba(255, 255, 255, 0.96);
  --bg-titlebar: linear-gradient(180deg, #f5f5f7 0%, #ebebef 100%);
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-subtle: #f4f4f7;
  --bg-card-hover: rgba(0, 113, 227, 0.04);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: #0071e3;
  --border-card: rgba(0, 0, 0, 0.06);

  --text-main: #1d1d1f;
  --text-muted: #515154;
  --text-dim: #86868b;

  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-blue-active: #005bb5;
  --apple-blue-glow: rgba(0, 113, 227, 0.2);

  --apple-emerald: #10b981;
  --apple-emerald-bg: rgba(16, 185, 129, 0.1);
  --apple-indigo: #4f46e5;
  --apple-indigo-bg: rgba(79, 70, 229, 0.1);
  --apple-crimson: #ef4444;
  --apple-amber: #f59e0b;

  /* Terminal Theme Variables (Light Theme) */
  --term-container-bg: #ffffff;
  --term-header-bg: #f1f5f9;
  --term-header-text: #475569;
  --term-screen-bg: #f8fafc;
  --term-screen-text: #1e293b;
  --term-border: rgba(0, 0, 0, 0.09);
  --term-prompt: #64748b;
  --term-time: #94a3b8;
  --term-phase-bg: linear-gradient(90deg, rgba(0, 113, 227, 0.10) 0%, rgba(79, 70, 229, 0.05) 100%);
  --term-phase-text: #1d4ed8;
  --term-badge-dns-bg: rgba(6, 182, 212, 0.12);
  --term-badge-dns-text: #0e7490;
  --term-badge-tcp-bg: rgba(168, 85, 247, 0.12);
  --term-badge-tcp-text: #7e22ce;
  --term-badge-http-bg: rgba(16, 185, 129, 0.12);
  --term-badge-http-text: #047857;
  --term-badge-gateway-bg: rgba(99, 102, 241, 0.12);
  --term-badge-gateway-text: #4338ca;
  --term-badge-sec-bg: rgba(245, 158, 11, 0.14);
  --term-badge-sec-text: #b45309;
  --term-badge-dom-bg: rgba(59, 130, 246, 0.12);
  --term-badge-dom-text: #1d4ed8;
  --term-badge-scraper-bg: rgba(14, 165, 233, 0.12);
  --term-badge-scraper-text: #0369a1;
  --term-badge-api-bg: rgba(249, 115, 22, 0.12);
  --term-badge-api-text: #c2410c;
  --term-badge-stack-bg: rgba(236, 72, 153, 0.12);
  --term-badge-stack-text: #be185d;
  --term-badge-auth-bg: rgba(20, 184, 166, 0.12);
  --term-badge-auth-text: #0f766e;
  --term-badge-synthesis-bg: rgba(129, 140, 248, 0.12);
  --term-badge-synthesis-text: #4338ca;
  --term-success: #059669;
  --term-warning: #d97706;
  --term-error: #dc2626;

  --mac-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* Optional Dark Theme Fallback */
[data-theme="dark"] {
  --bg-desktop: #0b0f19;
  --bg-mac-window: rgba(17, 24, 39, 0.94);
  --bg-titlebar: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  --bg-panel: rgba(17, 24, 39, 0.88);
  --bg-subtle: #1f2937;
  --bg-card-hover: rgba(56, 189, 248, 0.06);

  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-card: rgba(255, 255, 255, 0.08);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --apple-blue: #38bdf8;
  --apple-blue-hover: #0ea5e9;
  --apple-blue-glow: rgba(56, 189, 248, 0.25);

  /* Terminal Colors (Dark Theme) */
  --term-container-bg: #111827;
  --term-header-bg: #1e293b;
  --term-header-text: #94a3b8;
  --term-screen-bg: #0b0f19;
  --term-screen-text: #e2e8f0;
  --term-border: rgba(255, 255, 255, 0.1);
  --term-prompt: #94a3b8;
  --term-time: #64748b;
  --term-phase-bg: linear-gradient(90deg, rgba(30, 58, 138, 0.45) 0%, rgba(67, 56, 202, 0.25) 100%);
  --term-phase-text: #93c5fd;
  --term-badge-dns-bg: rgba(6, 182, 212, 0.2);
  --term-badge-dns-text: #22d3ee;
  --term-badge-tcp-bg: rgba(168, 85, 247, 0.2);
  --term-badge-tcp-text: #c084fc;
  --term-badge-http-bg: rgba(16, 185, 129, 0.2);
  --term-badge-http-text: #34d399;
  --term-badge-gateway-bg: rgba(99, 102, 241, 0.2);
  --term-badge-gateway-text: #818cf8;
  --term-badge-sec-bg: rgba(245, 158, 11, 0.2);
  --term-badge-sec-text: #fbbf24;
  --term-badge-dom-bg: rgba(59, 130, 246, 0.2);
  --term-badge-dom-text: #60a5fa;
  --term-badge-scraper-bg: rgba(14, 165, 233, 0.2);
  --term-badge-scraper-text: #38bdf8;
  --term-badge-api-bg: rgba(249, 115, 22, 0.2);
  --term-badge-api-text: #fb923c;
  --term-badge-stack-bg: rgba(236, 72, 153, 0.2);
  --term-badge-stack-text: #f472b6;
  --term-badge-auth-bg: rgba(20, 184, 166, 0.2);
  --term-badge-auth-text: #2dd4bf;
  --term-badge-synthesis-bg: rgba(129, 140, 248, 0.2);
  --term-badge-synthesis-text: #a5b4fc;
  --term-success: #34d399;
  --term-warning: #fbbf24;
  --term-error: #f87171;

  --mac-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* System Accent Colors */
[data-accent="purple"] {
  --apple-blue: #8b5cf6;
  --apple-blue-hover: #7c3aed;
  --apple-blue-active: #6d28d9;
  --apple-blue-glow: rgba(139, 92, 246, 0.25);
}
[data-accent="pink"] {
  --apple-blue: #ec4899;
  --apple-blue-hover: #db2777;
  --apple-blue-active: #be185d;
  --apple-blue-glow: rgba(236, 72, 153, 0.25);
}
[data-accent="emerald"] {
  --apple-blue: #10b981;
  --apple-blue-hover: #059669;
  --apple-blue-active: #047857;
  --apple-blue-glow: rgba(16, 185, 129, 0.25);
}
[data-accent="amber"] {
  --apple-blue: #f59e0b;
  --apple-blue-hover: #d97706;
  --apple-blue-active: #b45309;
  --apple-blue-glow: rgba(245, 158, 11, 0.25);
}
[data-accent="blue"] {
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-blue-active: #005bb5;
  --apple-blue-glow: rgba(0, 113, 227, 0.25);
}

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

body.macbook-desktop {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Plus Jakarta Sans", system-ui, sans-serif;
  background-color: var(--bg-desktop);
  background-image: radial-gradient(at 10% 10%, rgba(0, 113, 227, 0.08) 0px, transparent 50%),
                    radial-gradient(at 90% 90%, rgba(79, 70, 229, 0.08) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

/* Ambient glow blobs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}
.glow-cyan { width: 500px; height: 500px; background: var(--apple-blue); top: -150px; left: -150px; }
.glow-indigo { width: 600px; height: 600px; background: var(--apple-indigo); bottom: -200px; right: -200px; }

/* ── MACBOOK PRO WINDOW FRAME ───────────────────────────────────────── */
.macbook-frame {
  max-width: 1480px;
  margin: 0 auto;
  background: var(--bg-mac-window);
  border-radius: var(--radius-xl);
  box-shadow: var(--mac-shadow);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(30px) saturate(180%);
  position: relative;
  z-index: 1;
}

/* macOS Window Titlebar */
.mac-titlebar {
  height: 46px;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  user-select: none;
}

.mac-traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mac-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.mac-dot:hover { filter: brightness(0.9); }
.mac-close { background: #ff5f56; border: 0.5px solid #e0443e; }
.mac-minimize { background: #ffbd2e; border: 0.5px solid #dea123; }
.mac-zoom { background: #27c93f; border: 0.5px solid #1aab29; }

.mac-window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.apple-logo { font-size: 16px; color: var(--text-main); line-height: 1; }
.window-name { color: var(--text-main); font-weight: 700; }
.window-badge {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-dim);
}
[data-theme="dark"] .window-badge { background: rgba(255, 255, 255, 0.08); }

.mac-status-tray {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mac-accent-palette {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}
[data-theme="dark"] .mac-accent-palette { background: rgba(255, 255, 255, 0.06); }
.accent-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
  outline: none;
}
.accent-circle:hover {
  transform: scale(1.25);
}
.accent-circle.active {
  border-color: var(--text-main);
  box-shadow: 0 0 0 1px var(--bg-titlebar);
}
.dot-blue { background: #0071e3; }
.dot-purple { background: #8b5cf6; }
.dot-pink { background: #ec4899; }
.dot-emerald { background: #10b981; }
.dot-amber { background: #f59e0b; }

.mac-system-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.mac-theme-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.mac-theme-btn:hover {
  background: var(--bg-subtle);
  color: var(--apple-blue);
}

/* ── HEADER ────────────────────────────────────────────────────────── */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
}
[data-theme="dark"] .app-header { background: rgba(0, 0, 0, 0.2); }

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--apple-blue), var(--apple-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--apple-blue-glow);
}
.brand-logo svg { width: 24px; height: 24px; }

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.brand-title .highlight {
  color: var(--apple-blue);
}
.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Real-Time System Date & Time Display */
.real-datetime-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.real-datetime-chip:hover {
  border-color: var(--apple-blue);
  box-shadow: 0 2px 10px rgba(0, 113, 227, 0.12);
  transform: translateY(-0.5px);
}
.real-datetime-chip .clock-icon {
  width: 14px;
  height: 14px;
  color: var(--apple-blue);
  flex-shrink: 0;
}
.real-datetime-chip .live-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.real-datetime-chip .live-dot {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
}
.real-datetime-chip .live-time {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--apple-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--apple-emerald);
  background: var(--apple-emerald-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}
.pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-emerald);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.theme-switch .sun { display: none; }
.theme-switch .moon { display: block; }
[data-theme="light"] .theme-switch .sun { display: block; }
[data-theme="light"] .theme-switch .moon { display: none; }
.theme-switch svg { width: 14px; height: 14px; }

.auditor-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-full);
}
.auditor-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--apple-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}
.auditor-meta { display: flex; flex-direction: column; line-height: 1.2; }
.auditor-name { font-size: 12px; font-weight: 700; color: var(--text-main); }
.auditor-org { font-size: 10px; color: var(--text-dim); }

/* ── MAIN WORKSPACE ────────────────────────────────────────────────── */
.main-wrapper {
  padding: 28px;
}

/* KPI Banner (Apple Widget Cards) */
.kpi-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-tile {
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
}
.kpi-icon {
  font-size: 26px;
  background: var(--bg-subtle);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}
.kpi-content { display: flex; flex-direction: column; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-dim); letter-spacing: 0.04em; }
.kpi-num { font-size: 20px; font-weight: 800; color: var(--text-main); line-height: 1.2; margin: 2px 0; }
.kpi-desc { font-size: 11px; color: var(--text-muted); }

/* Multi-Tier Fallback API Stack Strip */
.fallback-stack-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  padding: 12px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}
.stack-badge-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stack-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.stack-step {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s;
}
.stack-step.step-1 { background: rgba(0, 113, 227, 0.08); color: var(--apple-blue); border-color: rgba(0, 113, 227, 0.25); }
.stack-step.step-2 { background: rgba(79, 70, 229, 0.08); color: var(--apple-indigo); border-color: rgba(79, 70, 229, 0.25); }
.stack-step.step-3 { background: rgba(245, 158, 11, 0.08); color: var(--apple-amber); border-color: rgba(245, 158, 11, 0.25); }
.stack-step.step-4 { background: rgba(239, 68, 68, 0.08); color: var(--apple-crimson); border-color: rgba(239, 68, 68, 0.25); }
.stack-step.step-5 { background: var(--apple-emerald-bg); color: var(--apple-emerald); border-color: rgba(16, 185, 129, 0.3); font-weight: 700; }
.stack-arrow {
  font-size: 10px;
  color: var(--text-dim);
}

/* ── 2-COLUMN GRID ─────────────────────────────────────────────────── */
.auditor-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 1080px) {
  .auditor-grid { grid-template-columns: 1fr; }
}

.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Elongate left panel card to fill full height */
.auditor-grid > .panel-card:first-child {
  display: flex;
  flex-direction: column;
}
.auditor-grid > .panel-card:first-child #auditForm {
  flex-shrink: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.panel-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--apple-blue);
  background: rgba(0, 113, 227, 0.08);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Form Styles */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.text-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.text-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--apple-blue-glow);
  background: #fff;
}
[data-theme="dark"] .text-input:focus { background: #1f2937; }

.text-optional {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 4px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 4px;
  margin-bottom: 12px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.form-hint strong {
  color: var(--apple-blue);
}
.form-hint-icon {
  font-size: 14px;
  line-height: 1;
}

.btn-primary-action {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(180deg, var(--apple-blue) 0%, var(--apple-blue-active) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--apple-blue-glow);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.btn-primary-action:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.35);
  transform: translateY(-1px);
}
.btn-primary-action:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Live Terminal (macOS Terminal Style — Elongated to Fill Free Space & Adapts to System Colors) */
.terminal-container {
  margin-top: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--term-border);
  background: var(--term-container-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 520px;
  transition: background-color 0.3s, border-color 0.3s;
}
.terminal-header {
  background: var(--term-header-bg);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--term-border);
  transition: background-color 0.3s;
  user-select: none;
}
.terminal-dots { display: flex; gap: 6px; }
.terminal-dots .dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--term-header-text);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.terminal-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.05);
  color: var(--term-header-text);
  border: 1px solid var(--term-border);
}
[data-theme="dark"] .terminal-status { background: rgba(255, 255, 255, 0.1); color: #cbd5e1; }
.terminal-status.status-running { background: rgba(245, 158, 11, 0.15); color: #d97706; border-color: rgba(245, 158, 11, 0.3); }
.terminal-status.status-success { background: rgba(16, 185, 129, 0.15); color: #059669; border-color: rgba(16, 185, 129, 0.3); }
.terminal-status.status-error { background: rgba(239, 68, 68, 0.15); color: #dc2626; border-color: rgba(239, 68, 68, 0.3); }

.terminal-screen {
  padding: 16px 18px;
  flex: 1;
  min-height: 460px;
  max-height: none;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--term-screen-text);
  background: var(--term-screen-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: background-color 0.3s, color 0.3s;
}

.term-line {
  margin-bottom: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.term-phase-banner {
  background: var(--term-phase-bg);
  border-left: 4px solid var(--apple-blue);
  padding: 7px 12px;
  margin: 12px 0 8px 0;
  font-weight: 700;
  color: var(--term-phase-text);
  border-radius: 0 8px 8px 0;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.term-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  margin-right: 6px;
  letter-spacing: 0.4px;
}

.badge-dns { background: var(--term-badge-dns-bg); color: var(--term-badge-dns-text); border: 1px solid currentColor; }
.badge-tcp { background: var(--term-badge-tcp-bg); color: var(--term-badge-tcp-text); border: 1px solid currentColor; }
.badge-http { background: var(--term-badge-http-bg); color: var(--term-badge-http-text); border: 1px solid currentColor; }
.badge-gateway { background: var(--term-badge-gateway-bg); color: var(--term-badge-gateway-text); border: 1px solid currentColor; }
.badge-sec { background: var(--term-badge-sec-bg); color: var(--term-badge-sec-text); border: 1px solid currentColor; }
.badge-dom { background: var(--term-badge-dom-bg); color: var(--term-badge-dom-text); border: 1px solid currentColor; }
.badge-scraper { background: var(--term-badge-scraper-bg); color: var(--term-badge-scraper-text); border: 1px solid currentColor; }
.badge-api { background: var(--term-badge-api-bg); color: var(--term-badge-api-text); border: 1px solid currentColor; }
.badge-stack { background: var(--term-badge-stack-bg); color: var(--term-badge-stack-text); border: 1px solid currentColor; }
.badge-auth { background: var(--term-badge-auth-bg); color: var(--term-badge-auth-text); border: 1px solid currentColor; }
.badge-synthesis { background: var(--term-badge-synthesis-bg); color: var(--term-badge-synthesis-text); border: 1px solid currentColor; }
.badge-handoff { background: var(--term-badge-synthesis-bg); color: var(--term-badge-synthesis-text); border: 1px solid currentColor; }
.badge-agent { background: rgba(251, 146, 60, 0.15); color: #ea580c; border: 1px solid currentColor; }
.badge-benchmark { background: rgba(16, 185, 129, 0.15); color: #059669; border: 1px solid currentColor; }
.badge-tier { background: rgba(168, 85, 247, 0.15); color: #7e22ce; border: 1px solid currentColor; }

.term-time { color: var(--term-time); font-size: 10px; margin-right: 6px; font-weight: normal; }
.term-success { color: var(--term-success); font-weight: 600; }
.term-warning { color: var(--term-warning); }
.term-error { color: var(--term-error); font-weight: 600; }
.term-highlight { color: var(--apple-blue); font-weight: 600; }
.term-line.prompt { color: var(--term-prompt); font-style: italic; }
.term-line.agent-1 { color: var(--apple-blue); }
.term-line.agent-2 { color: var(--apple-indigo); }

/* Scorecard Right Side */
.provider-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--apple-emerald-bg);
  color: var(--apple-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  min-height: 520px;
  text-align: center;
  color: var(--text-dim);
}
.placeholder-icon { font-size: 48px; margin-bottom: 12px; }
.empty-placeholder h3 { font-size: 16px; color: var(--text-main); margin-bottom: 6px; }
.empty-placeholder p { font-size: 12px; max-width: 360px; margin: 0 auto; color: var(--text-muted); }

/* Master Score Bar (Apple Activity Style) */
.master-score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.score-ring-box { display: flex; align-items: center; }
.score-circle {
  background: var(--apple-blue);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 14px var(--apple-blue-glow);
}
.score-value { font-size: 26px; font-weight: 800; line-height: 1; }
.score-max { font-size: 10px; opacity: 0.85; margin-top: 2px; }

.score-meta { flex: 1; min-width: 180px; }
.score-tier { font-size: 18px; font-weight: 800; color: var(--text-main); }
.score-status { font-size: 12px; font-weight: 600; color: var(--apple-emerald); margin-top: 2px; }
.score-author { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.export-fast-actions { display: flex; gap: 8px; }
.btn-export {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-export.excel {
  background: var(--apple-emerald-bg);
  color: var(--apple-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.btn-export.excel:hover {
  background: var(--apple-emerald);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-export.pdf {
  background: rgba(0, 113, 227, 0.08);
  color: var(--apple-blue);
  border: 1px solid rgba(0, 113, 227, 0.2);
}
.btn-export.pdf:hover {
  background: var(--apple-blue);
  color: #fff;
  box-shadow: 0 4px 12px var(--apple-blue-glow);
}

/* Metrics Split: Radar + Probe Facts */
.metrics-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .metrics-split { grid-template-columns: 1fr; }
}
.radar-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  height: 250px;
}
.probe-summary-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.box-title { font-size: 12px; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.probe-list { list-style: none; font-size: 11.5px; color: var(--text-muted); line-height: 1.8; }

/* Rubric Table */
.rubric-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.rubric-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rubric-table th {
  background: var(--bg-subtle);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
}
.rubric-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.rubric-table tr:last-child td { border-bottom: none; }
.rubric-item-name { font-weight: 700; color: var(--text-main); }
.rubric-item-scale { font-size: 10px; color: var(--text-dim); }
.badge-score {
  display: inline-block;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 113, 227, 0.1);
  color: var(--apple-blue);
}
.rubric-evidence { color: var(--text-muted); line-height: 1.4; }
.rubric-impact { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* Narratives */
.narratives-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 768px) {
  .narratives-container { grid-template-columns: 1fr; }
}
.narrative-box {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
}
.box-strength { background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.2); }
.box-gap { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.2); }
.box-recom { background: rgba(0, 113, 227, 0.05); border-color: rgba(0, 113, 227, 0.2); }
.box-rating { background: rgba(79, 70, 229, 0.05); border-color: rgba(79, 70, 229, 0.2); }

.box-head { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.box-strength .box-head { color: var(--apple-emerald); }
.box-gap .box-head { color: var(--apple-crimson); }
.box-recom .box-head { color: var(--apple-blue); }
.box-rating .box-head { color: var(--apple-indigo); }

.box-body { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.formatted-list { list-style-position: inside; }
.formatted-list li { margin-bottom: 4px; }

.exec-option { font-weight: 800; color: var(--apple-emerald); margin-bottom: 4px; }
.exec-just { font-style: italic; font-size: 11px; color: var(--text-dim); }

/* ── ADMIN PROTECTED ARCHIVE (macOS TouchID / Security Style) ───────── */
.badge-lock.locked {
  background: rgba(239, 68, 68, 0.1);
  color: var(--apple-crimson);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.badge-lock.unlocked {
  background: var(--apple-emerald-bg);
  color: var(--apple-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.mac-security-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}
.mac-security-card {
  max-width: 440px;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.05);
}
.mac-shield-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.1);
  color: var(--apple-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}
.mac-shield-icon svg { width: 28px; height: 28px; }

.mac-auth-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.mac-auth-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.mac-auth-form { width: 100%; }
.mac-input-group {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.mac-password-input {
  width: 100%;
  padding: 12px 42px 12px 16px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.2s;
}
[data-theme="dark"] .mac-password-input { background: #1f2937; }
.mac-password-input:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 4px var(--apple-blue-glow);
}
.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.btn-toggle-eye:hover { opacity: 1; }

.auth-error-banner {
  background: rgba(239, 68, 68, 0.1);
  color: var(--apple-crimson);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  animation: shake 0.3s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-mac-primary {
  width: 100%;
  padding: 11px 18px;
  background: var(--apple-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--apple-blue-glow);
  transition: all 0.15s;
}
.btn-mac-primary:hover {
  background: var(--apple-blue-hover);
  transform: translateY(-1px);
}

/* Unlocked View Toolbar */
.unlocked-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--apple-emerald-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 12px;
}
.admin-active-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--apple-emerald);
}
.active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-emerald);
}
.btn-lock-now {
  background: #fff;
  border: 1px solid var(--border-subtle);
  color: var(--apple-crimson);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-lock-now:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--apple-crimson);
}

/* History Table */
.history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-table th {
  padding: 10px 12px;
  text-align: left;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 700;
}
.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.history-table tr:hover { background: var(--bg-card-hover); }

.badge-tier {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.badge-tier.tier-outstanding { background: var(--apple-emerald-bg); color: var(--apple-emerald); }
.badge-tier.tier-strong { background: rgba(0, 113, 227, 0.1); color: var(--apple-blue); }

.action-btn-group { display: flex; gap: 4px; }
.btn-micro {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}
.btn-micro.excel { background: var(--apple-emerald-bg); color: var(--apple-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.btn-micro.pdf { background: rgba(0, 113, 227, 0.08); color: var(--apple-blue); border: 1px solid rgba(0, 113, 227, 0.3); }

/* Footer */
.app-footer {
  text-align: center;
  padding: 28px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.4);
}
.footer-sub { font-size: 11px; margin-top: 4px; color: var(--text-muted); }

/* Toast Messages */
.toast-tray { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-message {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: toast-slide-in 0.3s ease forwards;
}
.toast-info { background: var(--apple-blue); }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-fadeout { opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }
