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

:root {
  --bg-0: #06090f;
  --bg-1: #0c1220;
  --bg-2: #131c2e;
  --bg-3: #1a2540;
  --bg-hover: #1f2d4a;
  --border: #243050;
  --border-light: #2d3d5c;
  --text-1: #e6ecf5;
  --text-2: #8492ac;
  --text-3: #576580;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59,130,246,0.15);
  --green: #10b981;
  --green-light: #34d399;
  --green-bg: rgba(16,185,129,0.12);
  --green-border: rgba(16,185,129,0.25);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.12);
  --red-border: rgba(239,68,68,0.25);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.12);
  --yellow-border: rgba(245,158,11,0.25);
  --purple: #8b5cf6;
  --purple-bg: rgba(139,92,246,0.12);
  --orange: #f97316;
  --orange-bg: rgba(249,115,22,0.12);
  --r: 14px;
  --r-sm: 10px;
  --r-xs: 6px;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --t: 0.2s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-0); color: var(--text-1); min-height: 100vh; line-height: 1.5; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: rgba(12,18,32,0.9);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(24px);
}
.header-left { display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon-wrap {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 12px rgba(249,115,22,0.3);
}
.logo-group { display: flex; flex-direction: column; }
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.logo-tagline { font-size: 9px; color: var(--text-3); letter-spacing: 0.5px; text-transform: uppercase; }

.mode-toggle {
  display: flex; background: var(--bg-0); border-radius: 10px;
  padding: 3px; border: 1px solid var(--border); position: relative;
}
.mode-slider {
  position: absolute; top: 3px; left: 3px;
  width: calc(50% - 3px); height: calc(100% - 6px);
  background: var(--accent); border-radius: 8px;
  transition: transform var(--t);
  box-shadow: 0 2px 8px rgba(59,130,246,0.3); z-index: 0;
}
.mode-btn {
  padding: 7px 18px; border: none; background: transparent;
  color: var(--text-2); font-family: var(--font); font-size: 12px;
  font-weight: 600; border-radius: 8px; cursor: pointer;
  transition: color var(--t); display: flex; align-items: center;
  gap: 5px; position: relative; z-index: 1;
}
.mode-btn.active { color: white; }

.header-right { display: flex; align-items: center; gap: 8px; }

.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 0 12px;
  transition: border-color var(--t);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-icon { font-size: 13px; margin-right: 6px; }
.search-box input {
  background: none; border: none; color: var(--text-1);
  font-family: var(--font); font-size: 12px; padding: 7px 0;
  width: 200px; outline: none;
}
.search-box input::placeholder { color: var(--text-3); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  max-height: 240px; overflow-y: auto; z-index: 200;
}
.search-dropdown.hidden { display: none; }
.search-item { padding: 10px 12px; cursor: pointer; transition: background var(--t); }
.search-item:hover { background: var(--bg-hover); }

.category-select select {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-1); padding: 7px 12px; border-radius: var(--r-sm);
  font-family: var(--font); font-size: 12px; cursor: pointer;
}

/* ===== Main ===== */
.main-content { padding: 16px 20px; }
.hidden { display: none !important; }

/* ===== Keyword Hero ===== */
.keyword-hero {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
}
.keyword-badge {
  font-size: 10px; font-weight: 700; color: var(--orange);
  letter-spacing: 1.5px; margin-bottom: 4px;
}
.keyword-hero h1 { font-size: 32px; font-weight: 900; letter-spacing: -1px; margin-bottom: 8px; }
.hero-meta { display: flex; gap: 8px; }
.meta-chip {
  font-size: 11px; padding: 4px 10px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-2);
}
.meta-chip.fire { background: var(--orange-bg); border-color: rgba(249,115,22,0.3); color: var(--orange); }

.hero-stats { display: flex; gap: 20px; }
.hero-stat {
  text-align: center; padding: 12px 20px;
  background: var(--bg-3); border-radius: var(--r-sm);
  border: 1px solid var(--border); min-width: 120px;
}
.hero-stat-label { display: block; font-size: 10px; color: var(--text-3); margin-bottom: 4px; }
.hero-stat-value { display: block; font-size: 20px; font-weight: 800; font-family: var(--mono); }
.hero-stat-change {
  display: block; font-size: 11px; font-family: var(--mono); font-weight: 600; margin-top: 2px;
}
.hero-stat-change.positive { color: var(--green); }
.hero-stat-change.negative { color: var(--red); }

/* ===== Insight Layout ===== */
.insight-layout {
  display: grid; grid-template-columns: 1fr 340px;
  gap: 16px; margin-bottom: 16px;
}

.chart-section {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden;
}
.chart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.chart-title h3 { font-size: 13px; font-weight: 700; }
.chart-subtitle { font-size: 10px; color: var(--text-3); }
.chart-controls { display: flex; align-items: center; gap: 8px; }
.divider { width: 1px; height: 20px; background: var(--border); }

.layer-toggles { display: flex; gap: 4px; }
.layer-btn {
  padding: 5px 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2);
  font-family: var(--font); font-size: 11px; font-weight: 500;
  border-radius: var(--r-xs); cursor: pointer; transition: all var(--t);
  display: flex; align-items: center; gap: 4px;
}
.layer-btn.active { border-color: var(--layer-color); color: var(--layer-color); background: color-mix(in srgb, var(--layer-color) 10%, transparent); }
.layer-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--layer-color); }

.timeframe-btns { display: flex; gap: 3px; }
.tf-btn {
  padding: 5px 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2);
  font-family: var(--font); font-size: 11px; font-weight: 500;
  border-radius: var(--r-xs); cursor: pointer; transition: all var(--t);
}
.tf-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.chart-container { height: 360px; }

/* Playback */
.playback-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: white; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(249,115,22,0.3);
  transition: transform var(--t); flex-shrink: 0;
}
.play-btn:hover { transform: scale(1.08); }
.progress-track { flex: 1; height: 5px; background: var(--border); border-radius: 3px; position: relative; overflow: visible; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #f97316, #ef4444); border-radius: 3px; transition: width 0.15s; z-index: 1; position: relative; }
.progress-markers { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none; }
.progress-marker { position: absolute; top: -3px; width: 4px; height: 11px; border-radius: 2px; transform: translateX(-50%); }
.progress-marker.news-m { background: var(--yellow); }
.progress-marker.season-m { background: var(--purple); }
.progress-marker.viral-m { background: var(--green); }
.progress-slider { position: absolute; top: -10px; left: 0; width: 100%; height: 26px; opacity: 0; cursor: pointer; z-index: 3; }
.pb-date { font-family: var(--mono); font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.speed-control { display: flex; gap: 3px; flex-shrink: 0; }
.speed-btn {
  padding: 4px 9px; border: 1px solid var(--border);
  background: transparent; color: var(--text-3);
  font-family: var(--mono); font-size: 10px;
  border-radius: 4px; cursor: pointer; transition: all var(--t);
}
.speed-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== Causal Flow ===== */
.causal-flow {
  display: flex; align-items: center; justify-content: center;
  gap: 0; padding: 20px 24px;
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); margin-top: 16px;
}
.flow-step {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 20px; min-width: 120px;
}
.flow-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 8px;
}
.news-flow { background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.search-flow { background: var(--accent-glow); border: 1px solid rgba(59,130,246,0.25); }
.sales-flow { background: var(--green-bg); border: 1px solid var(--green-border); }
.ad-flow { background: var(--red-bg); border: 1px solid var(--red-border); }
.flow-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.flow-value { font-size: 14px; font-weight: 700; font-family: var(--mono); }

.flow-arrow {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 0 8px;
}
.arrow-text { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.arrow-line { width: 60px; height: 2px; background: var(--border); position: relative; overflow: hidden; border-radius: 1px; }
.arrow-pulse {
  position: absolute; top: 0; left: -30px;
  width: 30px; height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: arrowPulse 2s infinite;
}
@keyframes arrowPulse {
  0% { left: -30px; }
  100% { left: 100%; }
}

/* ===== Event Sidebar ===== */
.event-sidebar {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(360px + 60px + 56px);
}
.sidebar-header {
  padding: 14px 14px 10px; border-bottom: 1px solid var(--border);
}
.sidebar-header h3 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.filter-pills { display: flex; gap: 4px; }
.pill {
  padding: 4px 11px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2);
  font-family: var(--font); font-size: 11px; font-weight: 500;
  border-radius: 20px; cursor: pointer; transition: all var(--t);
}
.pill.active { background: var(--accent); color: white; border-color: var(--accent); }

.event-list { flex: 1; overflow-y: auto; padding: 6px; }
.event-item {
  padding: 10px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: all var(--t);
  border-left: 3px solid transparent; margin-bottom: 3px;
}
.event-item:hover { background: var(--bg-hover); }
.event-item.active { background: var(--bg-hover); border-left-color: var(--accent); }
.event-item.news { border-left-color: var(--yellow); }
.event-item.season { border-left-color: var(--purple); }
.event-item.viral { border-left-color: var(--green); }

.event-date { font-size: 10px; color: var(--text-3); font-family: var(--mono); display: flex; justify-content: space-between; }
.event-title { font-size: 12px; font-weight: 600; margin: 3px 0; line-height: 1.4; }
.event-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.event-tag {
  font-size: 9px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px;
}
.tag-news { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.tag-season { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(139,92,246,0.25); }
.tag-viral { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.event-impact { font-size: 10px; font-family: var(--mono); font-weight: 600; margin-left: auto; }

/* ===== Bottom Grid ===== */
.bottom-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 13px; font-weight: 700; }
.panel-content { padding: 14px; }

/* Related Keywords */
.kw-grid { display: flex; flex-direction: column; gap: 6px; }
.kw-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg-2);
  border-radius: var(--r-xs); border: 1px solid var(--border);
}
.kw-rank { font-family: var(--mono); font-size: 11px; color: var(--text-3); min-width: 20px; }
.kw-name { font-size: 12px; font-weight: 600; flex: 1; }
.kw-vol { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.kw-change { font-family: var(--mono); font-size: 11px; font-weight: 600; min-width: 50px; text-align: right; }
.kw-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; max-width: 60px; }
.kw-bar-fill { height: 100%; border-radius: 2px; }

/* Conversion Funnel */
.funnel { display: flex; flex-direction: column; gap: 0; align-items: center; }
.funnel-step {
  padding: 12px; text-align: center; position: relative;
  border-radius: var(--r-xs);
}
.funnel-bar {
  height: 32px; border-radius: 6px; display: flex;
  align-items: center; justify-content: space-between;
  padding: 0 12px; margin-bottom: 4px; transition: width 0.5s;
}
.funnel-label { font-size: 11px; font-weight: 600; color: white; }
.funnel-value { font-size: 11px; font-family: var(--mono); font-weight: 600; color: white; }
.funnel-rate { font-size: 10px; color: var(--text-3); }
.funnel-arrow { color: var(--text-3); font-size: 10px; margin: 2px 0; }

/* AI */
.ai-title { display: flex; align-items: center; gap: 8px; }
.ai-icon-wrap {
  width: 24px; height: 24px; background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.ai-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white; border-radius: 10px; text-transform: uppercase;
}
.ai-cards { display: flex; flex-direction: column; gap: 8px; }
.ai-card {
  padding: 12px; background: var(--bg-2); border-radius: var(--r-sm);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
}
.ai-card.urgent { border-left-color: var(--red); }
.ai-card.opportunity { border-left-color: var(--green); }
.ai-card.info { border-left-color: var(--accent); }
.ai-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ai-card-type { font-size: 10px; font-weight: 600; }
.ai-card-type.urgent { color: var(--red); }
.ai-card-type.opportunity { color: var(--green); }
.ai-card-type.info { color: var(--accent); }
.ai-card-time { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.ai-card p { font-size: 12px; line-height: 1.6; color: var(--text-2); }
.ai-card strong { color: var(--text-1); }

/* ===== Realtime Mode ===== */
.realtime-layout {
  display: grid; grid-template-columns: 380px 1fr;
  gap: 16px; margin-bottom: 16px;
}

.live-section {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden;
}
.live-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.live-header h3 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.live-dot { width: 6px; height: 6px; background: var(--red); border-radius: 50%; animation: pulse 1.5s infinite; display: inline-block; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,0.6)} 70%{box-shadow:0 0 0 6px rgba(239,68,68,0)} }
.live-controls select {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-1); padding: 5px 10px; border-radius: var(--r-xs);
  font-family: var(--font); font-size: 11px;
}

.live-grid { padding: 8px; max-height: 600px; overflow-y: auto; }
.live-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  cursor: pointer; transition: all var(--t); margin-bottom: 3px;
}
.live-item:hover { background: var(--bg-hover); }
.live-item.active { background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--accent-glow); }
.live-rank {
  font-family: var(--mono); font-size: 14px; font-weight: 800;
  min-width: 28px; text-align: center;
}
.live-rank.top3 { color: var(--orange); }
.live-info { flex: 1; }
.live-kw { font-size: 13px; font-weight: 600; }
.live-kw-meta { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.live-sparkline { width: 60px; height: 24px; }
.live-change { font-family: var(--mono); font-size: 12px; font-weight: 600; min-width: 55px; text-align: right; }
.live-change.up { color: var(--green); }
.live-change.down { color: var(--red); }

.live-detail { display: flex; flex-direction: column; gap: 16px; }
.live-chart-section {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden; flex: 1;
}
.live-badge {
  font-size: 11px; color: var(--red); font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.live-metrics { display: flex; gap: 16px; }
.live-metric { display: flex; flex-direction: column; align-items: center; }
.lm-label { font-size: 9px; color: var(--text-3); }
.lm-value { font-size: 16px; font-weight: 700; font-family: var(--mono); }
.lm-value.green { color: var(--green); }
.lm-value.red { color: var(--red); }

.live-news {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden; max-height: 250px;
}
.live-news-header { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.live-news-header h3 { font-size: 13px; font-weight: 700; }
.live-news-list { padding: 6px; overflow-y: auto; max-height: 200px; }
.live-news-item {
  padding: 8px 10px; border-radius: var(--r-xs);
  margin-bottom: 3px; animation: slideIn 0.3s ease;
  border-left: 3px solid var(--yellow);
}
.live-news-item:hover { background: var(--bg-hover); }
@keyframes slideIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
.ln-time { font-size: 10px; color: var(--accent); font-family: var(--mono); }
.ln-title { font-size: 12px; font-weight: 600; margin: 2px 0; line-height: 1.4; }
.ln-source { font-size: 10px; color: var(--text-3); }

/* ===== Alert Section ===== */
.alert-section {
  background: var(--bg-1); border-radius: var(--r);
  border: 1px solid var(--border); overflow: hidden;
}
.alert-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.alert-header h3 { font-size: 13px; font-weight: 700; }
.alert-count {
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  background: var(--red); color: white; border-radius: 10px;
}
.alert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; }
.alert-card {
  padding: 16px; background: var(--bg-2); border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.alert-card.red { border-left: 3px solid var(--red); }
.alert-card.green { border-left: 3px solid var(--green); }
.alert-card.yellow { border-left: 3px solid var(--yellow); }
.alert-type { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; }
.alert-type.danger { color: var(--red); }
.alert-type.success { color: var(--green); }
.alert-type.warning { color: var(--yellow); }
.alert-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.alert-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.alert-action {
  margin-top: 10px; padding: 6px 14px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); border-radius: var(--r-xs);
  font-family: var(--font); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all var(--t);
}
.alert-action:hover { background: var(--accent); color: white; }

/* Toast */
.toast-container { position: fixed; top: 60px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; background: var(--bg-3); border: 1px solid var(--border-light);
  border-radius: var(--r-sm); box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 4s forwards;
  max-width: 320px; display: flex; gap: 10px; align-items: flex-start;
}
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-text { font-size: 12px; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-body { color: var(--text-2); }
@keyframes toastIn { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateX(40px)} }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .bottom-grid { grid-template-columns: 1fr 1fr; }
  .alert-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .insight-layout, .realtime-layout, .bottom-grid { grid-template-columns: 1fr; }
  .keyword-hero { flex-direction: column; gap: 16px; align-items: flex-start; }
  .hero-stats { flex-wrap: wrap; }
  .causal-flow { flex-wrap: wrap; gap: 8px; }
  .alert-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .header { flex-wrap: wrap; gap: 8px; }
  .header-center { order: 3; width: 100%; display: flex; justify-content: center; }
  .chart-container { height: 260px; }
  .causal-flow { padding: 12px; }
}
