/* ============================================================
   EWI KFZ-Finanzierung Demo — Design System
   CRIF Brand: Dark Theme
   ============================================================ */

/* --- Custom Properties --- */
:root {
  /* CRIF Brand */
  --primary: #002B5C;
  --accent: #E87722;
  --bg-deep: #001B3D;
  --bg-surface: #002244;
  --bg-card: #003366;
  --bg-card-hover: #004080;
  --text-primary: #FFFFFF;
  --text-secondary: #B0BEC5;
  --text-muted: #607D8B;
  --border: #1a4a7a;
  --border-light: #2a5a8a;

  /* Severity */
  --success: #4CAF50;
  --warning: #FFC107;
  --danger: #F44336;
  --info: #29B6F6;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(232,119,34,0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;

  /* Typography */
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 240px;
  --max-width: 1440px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Typography --- */
h1 { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); font-weight: 600; }
h4 { font-size: var(--text-lg); font-weight: 500; }

.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* --- Layout --- */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(0, 27, 61, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-lg);
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-right: var(--sp-xl);
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--text-sm);
}

.header-nav {
  display: flex;
  gap: var(--sp-xs);
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar { display: none; }

.nav-link {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: rgba(232,119,34,0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-left: var(--sp-md);
}

/* Main content */
.app-main {
  margin-top: var(--header-height);
  padding: var(--sp-lg);
  max-width: var(--max-width);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#app-content {
  animation: fadeIn var(--transition-normal);
}

/* --- Grid --- */
.grid { display: grid; gap: var(--sp-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.gap-xl { gap: var(--sp-xl); }

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-lg);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-accent {
  border-left: 3px solid var(--accent);
}

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

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

/* --- KPI Card --- */
.kpi-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-lg);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(232,119,34,0.1) 0%, transparent 70%);
  border-radius: 0 0 0 100%;
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-xs);
}

.kpi-value {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-unit {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: var(--sp-xs);
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: var(--text-sm);
  margin-top: var(--sp-sm);
  padding: 2px var(--sp-sm);
  border-radius: var(--radius-full);
}

.kpi-trend.up { background: rgba(76,175,80,0.15); color: var(--success); }
.kpi-trend.down { background: rgba(244,67,54,0.15); color: var(--danger); }

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 2px var(--sp-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-risk { background: rgba(244,67,54,0.15); color: var(--danger); }
.badge-fraud { background: rgba(232,119,34,0.15); color: var(--accent); }
.badge-network { background: rgba(41,182,246,0.15); color: var(--info); }
.badge-success { background: rgba(76,175,80,0.15); color: var(--success); }
.badge-warning { background: rgba(255,193,7,0.15); color: var(--warning); }
.badge-severity-critical { background: rgba(244,67,54,0.2); color: #ff6659; border: 1px solid rgba(244,67,54,0.3); }
.badge-severity-high { background: rgba(232,119,34,0.2); color: var(--accent); border: 1px solid rgba(232,119,34,0.3); }
.badge-severity-medium { background: rgba(255,193,7,0.2); color: var(--warning); border: 1px solid rgba(255,193,7,0.3); }
.badge-severity-low { background: rgba(76,175,80,0.2); color: var(--success); border: 1px solid rgba(76,175,80,0.3); }

/* --- Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #d06a1f;
  box-shadow: 0 0 12px rgba(232,119,34,0.3);
}

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

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--sp-xs) var(--sp-sm);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn-sm { padding: var(--sp-xs) var(--sp-sm); font-size: var(--text-xs); }
.btn-lg { padding: var(--sp-md) var(--sp-xl); font-size: var(--text-base); }

.btn-group {
  display: flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
}

.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-right-width: 1px; }

/* --- Filter Pills --- */
.filter-pills {
  display: flex;
  gap: var(--sp-xs);
  flex-wrap: wrap;
}

.pill {
  padding: var(--sp-xs) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.pill.active {
  background: rgba(232,119,34,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Toggle --- */
.lang-toggle {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.lang-btn {
  padding: var(--sp-xs) var(--sp-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* --- Search --- */
.search-bar {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}

.search-input {
  flex: 1;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,119,34,0.1);
}

.search-input::placeholder { color: var(--text-muted); }

.search-type-select {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

/* --- Gauge / Risk Score --- */
.gauge-container {
  width: 160px;
  height: 100px;
  position: relative;
}

.gauge-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-3xl);
  font-weight: 700;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: var(--sp-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--sp-lg);
}

.timeline-dot {
  position: absolute;
  left: -21px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-deep);
  z-index: 1;
}

.timeline-dot.risk { background: var(--danger); }
.timeline-dot.fraud { background: var(--accent); }
.timeline-dot.network { background: var(--info); }
.timeline-dot.ok { background: var(--success); }

.timeline-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-xs);
}

.timeline-content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --- Alert Feed Item --- */
.alert-item {
  display: flex;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: all var(--transition-fast);
  animation: slideDown var(--transition-normal);
}

.alert-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.alert-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.alert-icon.risk { background: rgba(244,67,54,0.15); }
.alert-icon.fraud { background: rgba(232,119,34,0.15); }
.alert-icon.network { background: rgba(41,182,246,0.15); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--sp-xs); }
.alert-desc { font-size: var(--text-sm); color: var(--text-secondary); }
.alert-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--sp-xs); }
.alert-actions { display: flex; gap: var(--sp-xs); margin-top: var(--sp-sm); }

/* --- Pipeline --- */
.pipeline-container {
  display: flex;
  gap: var(--sp-lg);
  align-items: stretch;
  min-height: 400px;
  position: relative;
}

.pipeline-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.pipeline-stage.active {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.pipeline-stage-header {
  padding: var(--sp-md) var(--sp-lg);
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.pipeline-stage-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
}

.pipeline-stage-title {
  font-weight: 600;
  font-size: var(--text-base);
}

.pipeline-stage-body {
  padding: var(--sp-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.pipeline-arrow {
  display: flex;
  align-items: center;
  color: var(--accent);
  font-size: 24px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Pipeline particles */
.pipeline-flow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFlow 3s linear infinite;
}

/* --- Code / JSON Display --- */
.code-block {
  background: #0a1628;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-secondary);
}

.code-block .key { color: #82AAFF; }
.code-block .string { color: #C3E88D; }
.code-block .number { color: #F78C6C; }
.code-block .boolean { color: #FFCB6B; }
.code-block .null { color: #546E7A; }
.code-block .bracket { color: #89DDFF; }

/* --- Network Graph --- */
.graph-container {
  width: 100%;
  height: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.graph-controls {
  position: absolute;
  top: var(--sp-md);
  right: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  z-index: 10;
}

.graph-legend {
  position: absolute;
  bottom: var(--sp-md);
  left: var(--sp-md);
  display: flex;
  gap: var(--sp-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Scenario Card --- */
.scenario-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.scenario-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.scenario-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.scenario-card.fraud::before { background: var(--accent); }
.scenario-card.network::before { background: var(--info); }
.scenario-card.risk::before { background: var(--warning); }

.scenario-letter {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: rgba(255,255,255,0.08);
  position: absolute;
  top: var(--sp-md);
  right: var(--sp-lg);
}

.scenario-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  margin-bottom: var(--sp-md);
}

/* --- Step Progress --- */
.step-progress {
  display: flex;
  gap: var(--sp-xs);
  margin: var(--sp-md) 0;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition-fast);
}

.step-dot.active { background: var(--accent); transform: scale(1.3); }
.step-dot.done { background: var(--success); }

/* --- Narration Box --- */
.narration-box {
  background: rgba(232,119,34,0.05);
  border: 1px solid rgba(232,119,34,0.2);
  border-radius: var(--radius-md);
  padding: var(--sp-md) var(--sp-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: var(--sp-md) 0;
}

/* --- Curtain / Behind the Scenes --- */
.curtain-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  gap: var(--sp-md);
  height: calc(100vh - var(--header-height) - 120px);
}

.curtain-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.curtain-panel-header {
  padding: var(--sp-sm) var(--sp-md);
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.curtain-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-md);
}

.curtain-event-log {
  grid-column: 1 / -1;
  max-height: 200px;
}

/* Engine trace entries */
.trace-entry {
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  margin-bottom: var(--sp-xs);
  animation: slideRight var(--transition-fast);
  display: flex;
  gap: var(--sp-sm);
  align-items: flex-start;
}

.trace-entry.rule-fire {
  background: rgba(232,119,34,0.1);
  border-left: 2px solid var(--accent);
}

.trace-entry.score-update {
  background: rgba(244,67,54,0.1);
  border-left: 2px solid var(--danger);
}

.trace-entry.network-edge {
  background: rgba(41,182,246,0.1);
  border-left: 2px solid var(--info);
}

.trace-entry.cluster-detect {
  background: rgba(76,175,80,0.1);
  border-left: 2px solid var(--success);
}

.trace-timestamp {
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 65px;
}

.trace-message {
  color: var(--text-secondary);
  word-break: break-word;
}

/* --- Channel Comparison --- */
.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-lg);
  text-align: center;
  transition: all var(--transition-normal);
}

.channel-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.channel-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-md);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(232,119,34,0.1);
}

.channel-name {
  font-weight: 600;
  font-size: var(--text-lg);
  margin-bottom: var(--sp-sm);
}

.channel-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.channel-detail {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-xs) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.channel-detail:last-child { border: none; }
.channel-detail-label { color: var(--text-muted); }
.channel-detail-value { color: var(--text-primary); font-weight: 500; }

/* --- Section --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 600;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-xs);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes particleFlow {
  0% { opacity: 0; transform: translateX(-20px); }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { opacity: 0; transform: translateX(calc(100vw + 20px)); }
}

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(232,119,34,0.2); }
  50% { box-shadow: 0 0 20px rgba(232,119,34,0.4); }
}

.animate-fade-in { animation: fadeIn var(--transition-normal) both; }
.animate-slide-up { animation: slideUp var(--transition-normal) both; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-glow { animation: glow 2s ease infinite; }

.stagger-1 { animation-delay: 100ms; }
.stagger-2 { animation-delay: 200ms; }
.stagger-3 { animation-delay: 300ms; }
.stagger-4 { animation-delay: 400ms; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--sp-xs) var(--sp-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 50;
}

.tooltip:hover::after { opacity: 1; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .pipeline-container { flex-direction: column; }
  .pipeline-arrow { transform: rotate(90deg); justify-content: center; }
  .curtain-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --sp-lg: 16px;
    --sp-xl: 24px;
    --header-height: 56px;
  }

  .app-main { padding: var(--sp-md); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .kpi-value { font-size: var(--text-2xl); }

  .header-logo span { display: none; }
  .section-title { font-size: var(--text-xl); }
}

/* --- Mobile Menu --- */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 20px;
  margin-right: var(--sp-sm);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,27,61,0.98);
  backdrop-filter: blur(12px);
  z-index: 99;
  padding: var(--sp-lg);
  flex-direction: column;
  gap: var(--sp-xs);
}

.mobile-nav.open { display: flex; }

.mobile-nav .nav-link {
  padding: var(--sp-md);
  font-size: var(--text-lg);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
}

/* --- Utilities --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.p-md { padding: var(--sp-md); }
.p-lg { padding: var(--sp-lg); }

/* --- Demo Disclaimer --- */
.demo-disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--sp-xs) var(--sp-md);
  background: rgba(0,27,61,0.95);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  z-index: 100;
}

/* --- Loading Spinner --- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Tab Navigation --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-lg);
}

.tab {
  padding: var(--sp-sm) var(--sp-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Indicator Mini Card --- */
.indicator-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.2);
  font-size: var(--text-sm);
}

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

/* --- Subject List Item --- */
.subject-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.subject-item:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.subject-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.subject-avatar.person { background: rgba(41,182,246,0.2); color: var(--info); }
.subject-avatar.company { background: rgba(232,119,34,0.2); color: var(--accent); }
.subject-avatar.vehicle { background: rgba(76,175,80,0.2); color: var(--success); }
