/* ═══════════════════════════════════════════════════════
   THE WITNESS — Design System v2
   "Noir Observatory" — Surveillance Intelligence Aesthetic
   ═══════════════════════════════════════════════════════
   Typography: Fraunces (display) + Sora (UI) + JetBrains Mono (data)
   Palette: Deep navy base, warm gold accent
   ═══════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  /* Surface hierarchy (darkest → lightest) */
  --surface-0: #060810;
  --surface-1: #0b0e17;
  --surface-2: #111520;
  --surface-3: #181d2c;
  --surface-4: #1f2538;

  /* Border hierarchy */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(232, 163, 8, 0.25);

  /* Text hierarchy */
  --text-primary: #edeef2;
  --text-secondary: #868a9e;
  --text-tertiary: #505468;
  --text-ghost: #353848;

  /* Accent — warm gold */
  --accent: #e8a308;
  --accent-hover: #fbbf24;
  --accent-muted: rgba(232, 163, 8, 0.12);
  --accent-glow: rgba(232, 163, 8, 0.05);
  --accent-strong: rgba(232, 163, 8, 0.30);

  /* Semantic */
  --positive: #34d399;
  --positive-muted: rgba(52, 211, 153, 0.10);
  --negative: #f87171;
  --negative-muted: rgba(248, 113, 113, 0.10);
  --warning: #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.10);
  --info: #60a5fa;
  --info-muted: rgba(96, 165, 250, 0.10);

  /* Spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Type scale */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  /* Fonts */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Sora', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 60px rgba(232, 163, 8, 0.06);

  /* Glass */
  --glass-bg: rgba(11, 14, 23, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--surface-0);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: var(--text-base);
  overflow-x: hidden;
}

/* ── Film Grain Overlay ──────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ── Custom Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface-0); }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-ghost); }

/* ── Selection ───────────────────────────────────────── */
::selection { background: var(--accent-strong); color: var(--surface-0); }

/* ── Decorative: Grid Overlay ────────────────────────── */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(232, 163, 8, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 163, 8, 0.018) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 20%, transparent 70%);
}

/* ── Decorative: Ambient Glow ────────────────────────── */
.ambient-glow {
  position: fixed;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 550px;
  background: radial-gradient(ellipse, rgba(232,163,8,0.035) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.08); opacity: 0.6; }
}

/* ── Header ──────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(6, 8, 16, 0.8);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--text-primary);
}

.logo-eye {
  color: var(--accent);
  display: flex;
  transition: transform var(--duration-slow) var(--ease-out);
  filter: drop-shadow(0 0 8px rgba(232, 163, 8, 0.15));
}

.logo-pupil {
  animation: logoPupilPulse 4s ease-in-out infinite;
  transform-origin: 12px 12px;
}

.logo-iris {
  animation: logoIrisBlink 6s ease-in-out 3s infinite;
  transform-origin: 12px 12px;
}

@keyframes logoPupilPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes logoIrisBlink {
  0%, 88%, 100% { opacity: 1; }
  92% { opacity: 0; }
  96% { opacity: 1; }
}

.logo:hover .logo-eye {
  transform: scale(1.08);
  filter: drop-shadow(0 0 12px rgba(232, 163, 8, 0.25));
}

.logo-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1;
}

.logo-the {
  font-weight: 400;
  opacity: 0.5;
  margin-right: 0.15em;
}

nav {
  display: flex;
  gap: var(--sp-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast);
  letter-spacing: 0.01em;
}

.nav-link:hover { color: var(--text-secondary); background: var(--surface-2); }
.nav-link.active { color: var(--text-primary); background: var(--surface-3); }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* ── System Status ───────────────────────────────────── */
.system-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: default;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  position: relative;
  flex-shrink: 0;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--positive);
  animation: pulse-ring 2.5s ease-out infinite;
  opacity: 0;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

.pulse-dot.error { background: var(--negative); }
.pulse-dot.error::after { border-color: var(--negative); }

.status-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-ghost);
  text-transform: uppercase;
}

/* ── Main Layout ─────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-10) var(--sp-6) var(--sp-16);
}

/* ── Views ────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: viewIn var(--duration-slow) var(--ease-out); }

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-10);
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.header-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ── Typography ──────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.subtitle {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  margin-top: 6px;
  font-weight: 400;
}

.monitor-url {
  color: var(--text-tertiary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  transition: color var(--duration-fast);
}

.monitor-url:hover { color: var(--accent); }

/* ── Section Headers ─────────────────────────────────── */
.detail-section {
  margin-bottom: var(--sp-8);
}

.detail-section h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: var(--sp-5);
}

.detail-section h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Collapsible Sections ────────────────────────────── */
.detail-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: var(--sp-5);
}

.detail-section-toggle h2 {
  margin-bottom: 0;
  pointer-events: none;
}

.detail-section-toggle h2::after {
  display: none;
}

.detail-section-toggle:hover .toggle-hint {
  color: var(--text-secondary);
}

.toggle-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.toggle-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--duration-fast);
}

.toggle-chevron {
  color: var(--text-tertiary);
  transition: transform var(--duration-normal) var(--ease-out);
}

.collapsible-content {
  animation: expandIn var(--duration-normal) var(--ease-out);
}

@keyframes expandIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Changes Empty State ─────────────────────────────── */
.changes-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.changes-empty-state h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}

.changes-empty-state p {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: 1.6;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 550;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-fast);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.01em;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(180deg, #f0b429 0%, var(--accent) 100%);
  color: var(--surface-0);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--accent-hover) 0%, #f0b429 100%);
  box-shadow: 0 2px 8px rgba(232, 163, 8, 0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px var(--sp-2);
}

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

.btn-danger {
  background: transparent;
  color: var(--negative);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--negative);
}

.btn-back {
  margin-bottom: var(--sp-5);
  padding-left: 0;
  font-size: var(--text-sm);
}

.btn-sm { padding: 5px var(--sp-3); font-size: var(--text-xs); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── Monitor Cards ───────────────────────────────────── */
.monitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.monitor-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* Scan line sweep effect */
.monitor-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(232, 163, 8, 0.02) 40%,
    rgba(232, 163, 8, 0.06) 50%,
    rgba(232, 163, 8, 0.02) 60%,
    transparent 100%
  );
  transform: translateY(-110%);
  transition: transform 0.7s var(--ease-out);
  pointer-events: none;
  z-index: 1;
}

.monitor-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(232, 163, 8, 0.03);
}

.monitor-card:hover::after {
  transform: translateY(110%);
}

.monitor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  margin-bottom: var(--sp-3);
}

.monitor-card-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.monitor-card-url {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.monitor-card-meta {
  display: flex;
  gap: var(--sp-5);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  position: relative;
}

.meta-item {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.meta-value {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
}

.status-active {
  background: var(--positive-muted);
  color: var(--positive);
}

.status-active::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--positive);
}

.status-paused {
  background: rgba(80, 84, 104, 0.15);
  color: var(--text-tertiary);
}

/* ── Stats Row ───────────────────────────────────────── */
/* ── Monitor Readout Strip ───────────────────────────── */
.stats-row {
  display: flex;
  align-items: stretch;
  gap: 1px;
  margin-bottom: var(--sp-8);
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.stat-card {
  flex: 1;
  background: var(--surface-1);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: relative;
}

.stat-card::before {
  content: '';
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--text-ghost);
  flex-shrink: 0;
  opacity: 0.5;
}

.stat-card[data-accent="gold"]::before { background: var(--accent); opacity: 1; }
.stat-card[data-accent="green"]::before { background: var(--positive); opacity: 1; }
.stat-card[data-accent="blue"]::before { background: var(--info); opacity: 1; }

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  line-height: 1;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 2px;
}

.stat-card[data-accent="gold"] .stat-value { color: var(--accent); }

.stat-card .stat-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* ── Timeline ────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 7px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-default), transparent);
}

/* ── Change Cards ────────────────────────────────────── */
.change-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.change-card:hover {
  border-color: var(--border-default);
  background: var(--surface-2);
}

/* Timeline dot on change cards */
.timeline .change-card {
  position: relative;
}

.timeline .change-card::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 22px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--text-tertiary);
  z-index: 1;
}

.timeline .change-card:first-child::before {
  background: var(--accent);
  border-color: var(--accent);
}

.change-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
}

.change-summary {
  font-size: var(--text-base);
  font-weight: 550;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.change-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.change-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-ghost);
}

/* ── Score Badge (inline) ────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.score-low { background: rgba(80, 84, 104, 0.15); color: var(--text-tertiary); }
.score-medium { background: var(--warning-muted); color: var(--warning); }
.score-high { background: var(--accent-muted); color: var(--accent); }
.score-critical { background: var(--negative-muted); color: var(--negative); }

/* ── Score Ring (detail view) ────────────────────────── */
.score-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(
    var(--ring-color, var(--accent)) calc(var(--score-pct, 0) * 1%),
    var(--surface-3) calc(var(--score-pct, 0) * 1%)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 24px -8px var(--ring-color, var(--accent));
}

.score-ring-inner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-ring-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Change Detail Header ────────────────────────────── */
.change-detail-header {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.change-detail-meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.change-detail-score-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.change-detail-tags {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Category badge */
.category-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-3);
  color: var(--text-secondary);
}

/* ── Analysis Boxes ──────────────────────────────────── */
.analysis-box {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-3);
  position: relative;
}

/* Corner bracket decorations */
.analysis-box::before,
.analysis-box::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  opacity: 0.35;
  transition: opacity var(--duration-normal);
}

.analysis-box::before {
  top: -1px;
  left: -1px;
  border-top: 1.5px solid var(--accent);
  border-left: 1.5px solid var(--accent);
}

.analysis-box::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1.5px solid var(--accent);
  border-right: 1.5px solid var(--accent);
}

.analysis-box:hover::before,
.analysis-box:hover::after {
  opacity: 0.7;
}

.analysis-box h3 {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin-bottom: var(--sp-3);
  font-family: var(--font-sans);
}

.analysis-box p {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
}

.analysis-details {
  list-style: none;
}

.analysis-details li {
  padding: var(--sp-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  line-height: 1.65;
}

.analysis-details li:last-child { border-bottom: none; }

.analysis-details li::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 9px;
  flex-shrink: 0;
}

/* ── Screenshot Comparison ───────────────────────────── */
.screenshot-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.screenshot-panel {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.screenshot-viewfinder {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.screenshot-viewfinder::before,
.screenshot-viewfinder::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.4;
}

.screenshot-viewfinder::before {
  top: 10px;
  left: 10px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}

.screenshot-viewfinder::after {
  bottom: 10px;
  right: 10px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}

.screenshot-viewfinder img {
  width: 100%;
  height: auto;
  display: block;
}

.screenshot-label {
  padding: var(--sp-3) var(--sp-4);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.label-before { color: var(--negative); }
.label-after { color: var(--positive); }

.screenshot-panel img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Diff Overlay ────────────────────────────────────── */
.diff-canvas-wrap {
  position: relative;
}

.diff-source-img {
  width: 100%;
  height: auto;
  display: block;
}

.diff-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Text Diff ───────────────────────────────────────── */
.diff-view {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.8;
  overflow-x: auto;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
}

.diff-view > div {
  padding: 1px var(--sp-4);
  border-left: 3px solid transparent;
}

.diff-add {
  background: rgba(52, 211, 153, 0.08);
  border-left-color: var(--positive) !important;
  color: var(--positive);
}

.diff-del {
  background: rgba(248, 113, 113, 0.08);
  border-left-color: var(--negative) !important;
  color: var(--negative);
  text-decoration: line-through;
  text-decoration-color: rgba(248, 113, 113, 0.3);
}

.diff-ctx {
  color: var(--text-ghost);
}

.diff-prefix {
  display: inline-block;
  width: 16px;
  color: inherit;
  opacity: 0.5;
  user-select: none;
}

.diff-skip {
  padding: var(--sp-2) var(--sp-4);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px dashed var(--border-subtle);
  border-bottom: 1px dashed var(--border-subtle);
  background: var(--surface-0);
}

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6) var(--sp-12);
}

.empty-eye {
  color: var(--text-ghost);
  margin-bottom: var(--sp-6);
  position: relative;
  display: inline-block;
}

/* Radar ring emanation effect */
.empty-eye::before,
.empty-eye::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: radar 4s ease-out infinite;
}

.empty-eye::before {
  width: 80px;
  height: 80px;
  animation-delay: 0s;
}

.empty-eye::after {
  width: 120px;
  height: 120px;
  animation-delay: 2s;
}

@keyframes radar {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.25; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

.empty-state h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}

.empty-state p {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-8);
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.82) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.active {
  display: flex;
  animation: viewIn var(--duration-fast) var(--ease-out);
}

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 460px;
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modalIn var(--duration-normal) var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-6);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close { padding: var(--sp-1); }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); flex: 1; }

.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group .optional {
  font-weight: 400;
  color: var(--text-ghost);
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  transition: all var(--duration-fast);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group input::placeholder { color: var(--text-ghost); }

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-with-icon input { padding-left: 34px; }

.form-row { display: flex; gap: var(--sp-3); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── Preview / Element Selector ───────────────────────── */
.modal-with-preview {
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

.input-with-btn {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
}

.input-with-btn .input-with-icon {
  flex: 1;
}

#btn-preview {
  white-space: nowrap;
  margin-top: 0;
  height: 38px;
}

.selector-preview {
  margin-top: var(--sp-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-1);
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.preview-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.preview-mode-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.preview-mode-btn:hover {
  color: var(--text-secondary);
}

.preview-mode-btn.active {
  background: var(--surface-3);
  color: var(--accent);
}

.preview-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.preview-actions-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  background: var(--surface-1);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.btn-xs {
  padding: 2px var(--sp-2);
  font-size: 10px;
}

.preview-container {
  position: relative;
  background: var(--surface-0);
  min-height: 200px;
}

.preview-container img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 2;
}

.preview-overlay.mode-select {
  cursor: crosshair;
}

.preview-highlight {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(232, 163, 8, 0.10);
  border-radius: 3px;
  pointer-events: none;
  z-index: 3;
  transition: all 0.1s var(--ease-out);
}

.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  background: var(--surface-1);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  z-index: 4;
}

.preview-loading.hidden {
  display: none;
}

.selector-selected {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--accent-muted);
}

.selector-selected-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.selector-selected-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 500;
}

.selector-selected-text {
  font-size: 10px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Lightbox ────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 8, 16, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform var(--duration-normal) var(--ease-out);
}

.lightbox.active img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  z-index: 1;
}

.lightbox-close:hover {
  background: var(--surface-4);
  color: var(--text-primary);
}

/* Make diff images clickable */
.diff-canvas-wrap {
  cursor: zoom-in;
}

.screenshot-viewfinder {
  cursor: zoom-in;
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 550;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  transform: translateY(20px);
  opacity: 0;
  transition: all var(--duration-slow) var(--ease-out);
  z-index: 300;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--positive); }
.toast.error { border-color: var(--negative); }

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton Loader ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Channel Cards ───────────────────────────────────── */
.channels-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.channel-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--duration-fast);
}

.channel-card:hover { border-color: var(--border-default); }

.channel-info {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.channel-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.channel-type-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.channel-preview {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* Channel add form */
.channel-form-container {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-top: var(--sp-3);
  animation: viewIn var(--duration-normal) var(--ease-out);
}

.channel-type-picker {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.channel-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 550;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.channel-type-option:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.channel-type-option.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--text-primary);
}

.channel-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}

.channels-empty {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  padding: var(--sp-2) 0;
}

/* Channel Picker (reuse existing) */
.channel-picker-container {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-top: var(--sp-3);
  animation: viewIn var(--duration-normal) var(--ease-out);
}

.channel-picker-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-3);
}

.channel-picker-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.channel-picker-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  text-align: left;
}

.channel-picker-item:hover:not([disabled]) {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.channel-picker-item--linked {
  opacity: 0.45;
  cursor: not-allowed;
}

.channel-picker-item-label {
  font-weight: 600;
  white-space: nowrap;
}

.channel-picker-item-preview {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.channel-picker-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.channel-picker-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  color: var(--text-ghost);
  font-size: var(--text-xs);
}

.channel-picker-divider::before,
.channel-picker-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.channel-picker-create {
  width: 100%;
}

/* ── Channel Setup Guides ────────────────────────────── */
.channel-guide {
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.channel-guide-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}

.channel-guide-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.channel-guide-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}

.channel-guide-steps li {
  counter-increment: step;
  position: relative;
  padding-left: var(--sp-8);
  margin-bottom: var(--sp-4);
}

.channel-guide-steps li:last-child {
  margin-bottom: 0;
}

.channel-guide-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  background: var(--accent-muted);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.channel-guide-steps li strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.channel-guide-steps li p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 4px;
}

.channel-guide-steps li a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.channel-guide-steps li a:hover {
  text-decoration: underline;
}

.channel-guide-steps li code {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-0);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.channel-guide-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-2);
  color: var(--accent);
  word-break: break-all;
  line-height: 1.5;
}

/* ── Debug View ──────────────────────────────────────── */
.debug-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}

.debug-panel {
  padding: var(--sp-6);
}

.debug-panel h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--sp-4);
  color: var(--text-primary);
}

.debug-panel-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-4);
}

.debug-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-3);
}

.debug-stat {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
}

.debug-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.debug-stat-dot.dot-ok { background: var(--positive); }
.debug-stat-dot.dot-error { background: var(--negative); }

.debug-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.debug-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.debug-recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.debug-recent-item {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
}

.debug-recent-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 4px;
}

.debug-recent-summary {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: 500;
}

.debug-recent-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Gradient Orbs (from landing) ────────────────────── */
.gradient-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(232, 163, 8, 0.08) 0%, transparent 70%);
  top: -150px;
  right: -100px;
  animation: orbFloat1 30s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.06) 0%, transparent 70%);
  bottom: -100px;
  left: -80px;
  animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(232, 163, 8, 0.05) 0%, transparent 70%);
  top: 40%;
  left: 30%;
  animation: orbFloat3 22s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-40px, 60px); }
  66% { transform: translate(30px, -30px); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(50px, -40px); }
  66% { transform: translate(-30px, 20px); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-30px, -50px); }
  66% { transform: translate(40px, 30px); }
}

/* ── Glass Morphism ─────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--glass-border);
}

/* Radial glow on hover for interactive glass cards */
.monitor-card.glass-card,
.change-card.glass-card,
.analysis-box.glass-card {
  position: relative;
}

.monitor-card.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(232, 163, 8, 0.04), transparent 40%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-normal);
  z-index: 0;
}

.monitor-card.glass-card:hover::before {
  opacity: 1;
}

/* ── User Menu ──────────────────────────────────────── */
.user-menu {
  position: relative;
  margin-left: var(--sp-4);
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast);
  color: var(--text-secondary);
}

.user-menu-btn:hover {
  background: var(--surface-3);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-accent);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--duration-fast) var(--ease-out);
  z-index: 150;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-email {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.user-dropdown-item:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* ── Auth Views ─────────────────────────────────────── */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: var(--sp-6);
  position: relative;
  overflow: hidden;
}

/* Ambient orb 1 — large warm drift, top-left */
.auth-container::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -5%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(232, 163, 8, 0.12) 0%, rgba(232, 163, 8, 0.04) 40%, transparent 65%);
  border-radius: 50%;
  animation: authOrb1 18s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

/* Ambient orb 2 — cooler tone, bottom-right */
.auth-container::after {
  content: '';
  position: absolute;
  bottom: -15%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(232, 163, 8, 0.09) 0%, rgba(96, 165, 250, 0.03) 40%, transparent 65%);
  border-radius: 50%;
  animation: authOrb2 24s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  filter: blur(50px);
}

@keyframes authOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20% { transform: translate(80px, 30px) scale(1.1); }
  40% { transform: translate(120px, -50px) scale(0.95); }
  60% { transform: translate(40px, 60px) scale(1.05); }
  80% { transform: translate(-30px, 20px) scale(0.98); }
}

@keyframes authOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-70px, -40px) scale(1.08); }
  50% { transform: translate(-100px, 30px) scale(0.92); }
  75% { transform: translate(40px, -60px) scale(1.04); }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: var(--sp-10) var(--sp-8);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  text-align: center;
  position: relative;
  overflow: visible;
  z-index: 1;
}

/* Warm glow halo behind card */
.auth-card::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(232, 163, 8, 0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
  animation: authCardGlow 6s ease-in-out infinite;
}

@keyframes authCardGlow {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}


.auth-logo {
  margin-bottom: var(--sp-5);
  position: relative;
  z-index: 1;
}

/* ── Interactive Auth Eye ──────────────────────────── */
.auth-eye-blinker {
  display: inline-block;
  animation: authEyeBlink 5s ease-in-out 2.5s infinite;
  transform-origin: center;
}

.auth-eye-blinker.paused {
  animation: none;
}

@keyframes authEyeBlink {
  0%, 88%, 100% { transform: scaleY(1); }
  91% { transform: scaleY(0.15); }
  94% { transform: scaleY(1); }
}

.auth-eye {
  display: block;
  filter: drop-shadow(0 0 20px rgba(232, 163, 8, 0.15));
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.auth-eye.closed {
  transform: scaleY(0.18);
}

.auth-eye-iris {
  transition: transform 0.15s ease-out, opacity 0.25s ease;
  transform-origin: 60px 30px;
}

.auth-eye.closed .auth-eye-iris {
  opacity: 0;
}

.auth-eye-outer {
  transform-origin: 60px 30px;
}

/* ── Password Toggle ─────────────────────────────── */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-ghost);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle:hover {
  color: var(--text-secondary);
  background: var(--surface-2);
}

.password-toggle.showing {
  color: var(--accent);
}

.password-toggle svg {
  display: block;
}

/* Keep verify-pending mail icon animation, not the eye */
.auth-logo .verify-pending-icon {
  animation: floatMail 3s ease-in-out infinite;
}

.auth-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-1);
  position: relative;
  z-index: 1;
}

.auth-subtitle {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-8);
  position: relative;
  z-index: 1;
}

.auth-form {
  text-align: left;
  position: relative;
  z-index: 1;
}

.auth-form .form-group {
  margin-bottom: var(--sp-4);
}

.auth-form input {
  width: 100%;
  padding: 11px var(--sp-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: rgba(6, 8, 16, 0.6);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  transition: all var(--duration-fast);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.auth-form input::placeholder {
  color: var(--text-ghost);
}

.btn-full {
  width: 100%;
  padding: 12px;
  margin-top: var(--sp-2);
}

.auth-error {
  color: var(--negative);
  font-size: var(--text-xs);
  min-height: 20px;
  margin-top: var(--sp-3);
  text-align: center;
}

.auth-success {
  color: var(--positive);
  font-size: var(--text-sm);
  margin-top: var(--sp-4);
  text-align: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--positive-muted);
  border-radius: var(--radius-sm);
}

.auth-links {
  margin-top: var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  position: relative;
  z-index: 1;
}

.auth-links a {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.auth-links a:hover {
  color: var(--accent);
}

.auth-links-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-ghost);
}

/* ── Verify Pending ──────────────────────────────────── */
.verify-pending-icon {
  animation: floatMail 3s ease-in-out infinite;
}

@keyframes floatMail {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.verify-loading-spinner {
  margin-bottom: var(--sp-4);
}

.verify-loading-spinner .spinner {
  width: 24px;
  height: 24px;
}

.verify-pending-hint {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-top: var(--sp-4);
  position: relative;
  z-index: 1;
}

.verify-pending-change {
  margin-top: var(--sp-5);
  position: relative;
  z-index: 1;
}

.verify-change-link {
  font-size: var(--text-sm);
  color: var(--text-ghost);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.verify-change-link:hover {
  color: var(--accent);
}

.change-email-row {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.change-email-row input {
  flex: 1;
  font-size: var(--text-sm);
}

.change-email-row .btn {
  white-space: nowrap;
}

/* ── Settings ─────────────────────────────────────────── */
.settings-grid {
  display: grid;
  gap: var(--sp-6);
  max-width: 560px;
}

.settings-section {
  padding: var(--sp-6);
}

.settings-section h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--sp-5);
}

.settings-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-field:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

.settings-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.settings-lang-select {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-3);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.settings-lang-select:hover {
  border-color: var(--accent);
}

.settings-lang-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232, 163, 8, 0.15);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--sp-2);
}

.settings-danger {
  border-color: rgba(239, 68, 68, 0.15);
}

.settings-danger h3 {
  color: var(--negative);
}

.settings-danger-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-4);
  line-height: 1.5;
}

.btn-danger-solid {
  background: var(--negative);
  color: var(--surface-0);
  border: 1px solid var(--negative);
}

.btn-danger-solid:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.delete-confirm {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}

.delete-confirm-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}

.delete-confirm-row {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.delete-confirm-row input,
.delete-confirm-row .password-wrapper {
  flex: 1;
}

/* ── Stagger Animation ───────────────────────────────── */
.stagger {
  opacity: 0;
  animation: staggerIn 0.45s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

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

/* ── Responsive ──────────────────────────────────────── */
/* ── Upgrade View ───────────────────────────────────── */
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-8);
  align-items: start;
}

.upgrade-card {
  padding: var(--sp-8) var(--sp-6);
  text-align: left;
  position: relative;
  transition: all var(--duration-slow) var(--ease-out);
}

.upgrade-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.upgrade-card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 60px rgba(232, 163, 8, 0.06);
}

.upgrade-card-featured:hover {
  border-color: var(--accent);
  box-shadow: 0 0 60px rgba(232, 163, 8, 0.12);
}

.upgrade-card-current {
  opacity: 0.7;
}

.upgrade-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 14px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: var(--surface-0);
  white-space: nowrap;
}

.upgrade-plan-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--sp-3);
}

.upgrade-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: var(--sp-2);
}

.upgrade-amount {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.upgrade-card-featured .upgrade-amount {
  background: linear-gradient(135deg, var(--accent) 0%, #fde68a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.upgrade-period {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.upgrade-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
  line-height: 1.5;
}

.upgrade-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}

.upgrade-feature {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
}

.upgrade-feature.included {
  color: var(--text-secondary);
}

.upgrade-feature.included svg {
  color: var(--positive);
  flex-shrink: 0;
}

.upgrade-feature.excluded {
  color: var(--text-ghost);
}

.upgrade-feature.excluded svg {
  color: var(--text-ghost);
  flex-shrink: 0;
  opacity: 0.5;
}

/* ── Tier Badges ────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tier-free {
  background: var(--surface-3);
  color: var(--text-tertiary);
}

.tier-pro {
  background: var(--accent-muted);
  color: var(--accent);
}

.tier-agency {
  background: var(--info-muted);
  color: var(--info);
}

/* ── Usage Meters ───────────────────────────────────── */
.usage-meter {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
}

.usage-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 80px;
}

.usage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.usage-fill-warning {
  background: var(--negative);
}

.usage-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── Settings Plan Actions ──────────────────────────── */
.settings-plan-actions {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Locked frequency option styling ────────────────── */
select option:disabled {
  color: var(--text-ghost);
}

@media (max-width: 768px) {
  .monitors-grid { grid-template-columns: 1fr; }
  .upgrade-grid { grid-template-columns: 1fr; max-width: 400px; margin-left: auto; margin-right: auto; }
  .screenshot-compare { grid-template-columns: 1fr; }
  .stats-row { flex-wrap: wrap; }
  .stats-row .stat-card { flex: 1 1 40%; }
  .form-row { flex-direction: column; }
  .view-header { flex-direction: column; }
  .header-actions { width: 100%; }
  main { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
  .header-inner { padding: 0 var(--sp-4); }
  h1 { font-size: var(--text-2xl); }
  .status-label { display: none; }
  .timeline { padding-left: 20px; }
  .timeline .change-card::before { left: -17px; }
  .score-ring { width: 48px; height: 48px; }
  .score-ring-inner { width: 36px; height: 36px; }
}

@media (max-width: 480px) {
  .stats-row { flex-direction: column; }
  .stats-row .stat-card { flex: 1 1 100%; }
  .header-inner { gap: var(--sp-4); }
  .monitor-card-url { max-width: 180px; }
  .change-detail-header { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: var(--sp-8) var(--sp-5); }
  .auth-container { min-height: calc(100vh - 80px); }
  .delete-confirm-row { flex-direction: column; }
}
