/* ═══════════════════════════════════════════════════
   SOTW — State of the World
   "Global Operations Center" aesthetic
   Fonts: Bricolage Grotesque (display) + Space Mono (data)
   ═══════════════════════════════════════════════════ */

:root {
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-data: 'Space Mono', 'Courier New', monospace;

  --bg-void: #060a10;
  --bg-surface: #0c1018;
  --bg-panel: #111820;
  --bg-card: #161e28;
  --bg-hover: #1c2632;

  --border: rgba(255, 255, 255, 0.06);
  --border-bright: rgba(255, 255, 255, 0.12);

  --text-primary: #e8e6e1;
  --text-secondary: #8a919c;
  --text-muted: #505862;

  /* Signal colors */
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.08);
  --orange: #f59e0b;
  --orange-glow: rgba(245, 158, 11, 0.08);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.08);
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.08);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.08);
  --purple: #a855f7;

  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.06);
}

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

html {
  height: 100%;
  overflow-x: clip;
}

body {
  height: 100%;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 14px;
  overflow: hidden;
  max-width: 100vw;
}

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

/* ── Film grain overlay ────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: 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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ── HEADER ────────────────────────────────────── */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  position: relative;
}

.hdr-left { display: flex; align-items: center; gap: 12px; }

.hdr-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50% { opacity: 0.5; box-shadow: 0 0 16px var(--accent); }
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

.hdr-subtitle {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  font-weight: 400;
}

.hdr-center { display: flex; align-items: center; }

.threat-level {
  display: flex;
  align-items: center;
  gap: 10px;
}

.threat-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.threat-dots {
  display: flex;
  gap: 4px;
}

.threat-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  transition: all 0.3s;
}

.threat-dots .dot.active[data-level="1"] { background: var(--green); border-color: var(--green); }
.threat-dots .dot.active[data-level="2"] { background: var(--green); border-color: var(--green); }
.threat-dots .dot.active[data-level="3"] { background: var(--orange); border-color: var(--orange); }
.threat-dots .dot.active[data-level="4"] { background: var(--orange); border-color: var(--orange); }
.threat-dots .dot.active[data-level="5"] { background: var(--red); border-color: var(--red); }

.threat-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--orange);
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.conn-dot.live {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 3s infinite;
}

.conn-dot.paused { background: var(--orange); box-shadow: 0 0 4px var(--orange); }
.conn-dot.reconnecting { background: var(--orange); }
.conn-dot.disconnected { background: var(--red); }

.conn-label {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.last-update {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── TICKER ────────────────────────────────────── */
.ticker {
  height: 28px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 16px;
  white-space: nowrap;
  animation: scroll-ticker 60s linear infinite;
}

@keyframes scroll-ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticker-item .tk-symbol {
  font-weight: 700;
  color: var(--text-primary);
}

.ticker-item .tk-price {
  color: var(--text-secondary);
}

.ticker-item .tk-change {
  font-weight: 700;
}

.ticker-item .tk-change.up { color: var(--green); }
.ticker-item .tk-change.down { color: var(--red); }
.ticker-item.loading { color: var(--text-muted); }

.ticker-sep {
  color: var(--text-muted);
  opacity: 0.3;
}

/* ── DASHBOARD LAYOUT ──────────────────────────── */
.dashboard {
  display: flex;
  height: calc(100vh - 48px - 28px - 28px); /* header + ticker + footer */
  overflow: hidden;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.panel-map {
  flex: 1;
  border-right: none;
}

.panel-feed {
  width: 420px;
  flex-shrink: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

/* ── MAP ───────────────────────────────────────── */
.map-controls {
  display: flex;
  gap: 4px;
}

.map-btn {
  font-family: var(--font-data);
  font-size: 0.65rem;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.map-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.map-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.map-container {
  flex: 1;
  min-height: 0;
}

/* MapLibre overrides */
.maplibregl-popup-content {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-data) !important;
  font-size: 0.8rem !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: 6px !important;
  padding: 12px !important;
  max-width: 280px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6) !important;
}

.maplibregl-popup-tip { border-top-color: var(--bg-card) !important; }

/* ── FEED TABS ─────────────────────────────────── */
.feed-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.feed-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.feed-tab:hover { color: var(--text-secondary); background: var(--bg-panel); }
.feed-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.feed-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.feed-content.active { display: block; }

/* ── BRIEFS TOOLBAR (Latest / History) ─────────── */
.briefs-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.briefs-toolbar-btn {
  font-family: var(--font-data);
  font-size: 0.6rem;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  letter-spacing: 0.1em;
}

.briefs-toolbar-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.briefs-toolbar-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.btb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.btb-dot.live {
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
  animation: pulse-dot 3s infinite;
}
.briefs-toolbar-btn.active .btb-dot.live {
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

/* Brief history list */
.brief-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
}
.brief-history-item:hover {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.04);
}
.brief-history-item .bhi-date {
  font-family: var(--font-data);
  font-size: 0.6rem;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.brief-history-item .bhi-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.brief-history-item .bhi-sources {
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.brief-history-back {
  font-family: var(--font-data);
  font-size: 0.6rem;
  color: var(--accent);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.brief-history-back:hover { border-color: var(--accent); background: var(--accent-glow); }

.brief-history-load-more {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: 0.6rem;
  cursor: pointer;
  text-align: center;
  margin-top: 4px;
  transition: all 0.15s;
}
.brief-history-load-more:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 768px) {
  .briefs-toolbar { padding: 6px 0; }
  .briefs-toolbar-btn { min-height: 44px; font-size: 0.65rem; }
  .brief-history-item { padding: 14px; }
  .brief-history-item .bhi-title { font-size: 0.82rem; }
  .brief-history-item .bhi-date { font-size: 0.65rem; }
}

/* ── BRIEFS ────────────────────────────────────── */
.brief-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
  animation: briefFadeIn 0.4s ease;
}

.brief-card.latest {
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.04);
}

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

.brief-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.brief-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brief-badge {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.brief-badge.pulse {
  background: var(--cyan-glow);
  color: var(--accent);
  border: 1px solid rgba(6, 182, 212, 0.25);
  animation: badgePulse 3s infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.brief-time { font-size: 0.6rem; color: var(--text-muted); }
.brief-sources { font-size: 0.55rem; color: var(--text-muted); }

/* BLUF */
.brief-bluf {
  padding: 14px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.04), transparent);
  border-bottom: 1px solid var(--border);
}

.bluf-label {
  font-family: var(--font-display);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 8px;
}

.bluf-text {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Brief sections */
.brief-section {
  border-bottom: 1px solid var(--border);
}

.brief-section:last-child { border-bottom: none; }

.section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.15s;
}

.section-toggle:hover { background: var(--bg-hover); }

.section-label {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text-muted);
}

.section-count {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 6px;
  border-radius: 8px;
}

.section-arrow {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.brief-section.open .section-arrow { transform: rotate(180deg); }

.section-body {
  display: none;
  padding: 0 14px 14px;
  font-family: var(--font-display);
}

.brief-section.open .section-body { display: block; }

/* Crisis cards */
.crisis-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 6px 14px 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.crisis-card:hover { border-color: var(--border-bright); }

.crisis-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

.crisis-status {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.crisis-status.escalating { background: rgba(239, 68, 68, 0.12); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.crisis-status.active { background: var(--orange-glow); color: var(--orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.crisis-status.de-escalating, .crisis-status.stable { background: var(--green-glow); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }
.crisis-status.unknown { background: rgba(255,255,255,0.03); color: var(--text-muted); }

.crisis-name {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.crisis-toggle {
  color: var(--text-muted);
  font-size: 0.65rem;
  transition: transform 0.2s;
}

.crisis-card.open .crisis-toggle { transform: rotate(180deg); }

.crisis-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 12px;
  border-top: 1px solid transparent;
  transition: max-height 0.3s ease, padding 0.3s ease, border-color 0.2s;
}

.crisis-card.open .crisis-body {
  max-height: 600px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}

.crisis-bullet {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border-bright);
  margin-bottom: 6px;
}

/* Development items */
.dev-item {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  position: relative;
  padding-left: 12px;
}

.dev-item::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

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

/* Markets text */
.markets-text {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Threat assessment */
.brief-threat {
  padding: 12px 14px;
  background: rgba(255,255,255,0.01);
}

.threat-bar {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 8px;
}

.threat-bar.low { background: var(--green-glow); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.2); }
.threat-bar.elevated { background: var(--orange-glow); color: var(--orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.threat-bar.high { background: rgba(249, 115, 22, 0.1); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.2); }
.threat-bar.critical { background: rgba(239, 68, 68, 0.1); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); animation: threatPulse 2s infinite; }

@keyframes threatPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.2); }
}

.threat-rating {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.threat-detail {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── EVENTS ────────────────────────────────────── */
.event-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.evt-filter {
  font-family: var(--font-data);
  font-size: 0.6rem;
  padding: 3px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.evt-filter:hover { color: var(--text-secondary); }
.evt-filter.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.event-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.event-sev {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.event-sev.critical { background: var(--red); box-shadow: 0 0 6px var(--red); }
.event-sev.high { background: var(--orange); }
.event-sev.medium { background: var(--blue); }
.event-sev.moderate { background: var(--cyan); }
.event-sev.low { background: var(--text-muted); }

.event-body { flex: 1; min-width: 0; }

.event-title {
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.event-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.event-cat {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
}

.event-cat.conflict { color: var(--red); background: var(--red-glow); }
.event-cat.politics { color: var(--purple); background: rgba(168, 85, 247, 0.08); }
.event-cat.disaster, .event-cat.earthquake { color: var(--orange); background: var(--orange-glow); }
.event-cat.economy { color: var(--green); background: var(--green-glow); }
.event-cat.health { color: var(--cyan); background: var(--cyan-glow); }
.event-cat.cyber { color: var(--blue); background: var(--blue-glow); }
.event-cat.energy { color: var(--orange); background: var(--orange-glow); }
.event-cat.nuclear { color: #facc15; background: rgba(250, 204, 21, 0.08); }
.event-cat.humanitarian { color: #f472b6; background: rgba(244, 114, 182, 0.08); }
.event-cat.general { color: var(--text-muted); background: rgba(255,255,255,0.03); }

.event-time {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.event-region {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* ── DATA TAB ──────────────────────────────────── */
.data-section {
  margin-bottom: 20px;
}

.data-title {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Fear & Greed Gauge */
.fear-greed {
  text-align: center;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.fg-gauge {
  position: relative;
  width: 160px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 80px 80px 0 0;
  background: conic-gradient(from 180deg at 50% 100%, var(--red) 0deg, var(--orange) 60deg, var(--green) 120deg, var(--green) 180deg);
  overflow: hidden;
}

.fg-gauge::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 60px;
  background: var(--bg-card);
  border-radius: 60px 60px 0 0;
}

.fg-value {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  z-index: 2;
}

.fg-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 2px;
  height: 65px;
  background: var(--text-primary);
  transform-origin: bottom center;
  transform: rotate(-90deg);
  z-index: 1;
  transition: transform 1s ease;
}

.fg-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.fg-explainer {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: left;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Event sections */
.events-section-header {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.event-summary {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 2px 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-sources {
  font-size: 0.55rem;
  color: var(--accent);
  font-weight: 700;
}

.event-item.analysis { opacity: 0.85; }
.event-item.opinion { opacity: 0.7; }

.market-name {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.55rem;
}

/* Markets Grid */
.markets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}

.market-symbol {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.market-price {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.market-change {
  font-size: 0.75rem;
  font-weight: 700;
}

.market-change.up { color: var(--green); }
.market-change.down { color: var(--red); }

/* System Status */
.system-status {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.status-row {
  display: flex;
  justify-content: space-between;
}

.status-val { color: var(--text-primary); font-weight: 700; }

/* ── LOADING ───────────────────────────────────── */
.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

/* ── FOOTER ────────────────────────────────────── */
.ftr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 28px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* ── SSE Reconnect Banner ──────────────────────── */
.sse-reconnect-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.08);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--red);
  cursor: pointer;
  z-index: 50;
}
.sse-reconnect-banner.visible { display: flex; }
.sse-reconnect-banner:hover { background: rgba(239, 68, 68, 0.12); }

/* ── Global Pause Banner ───────────────────────── */
.paused-banner {
  display: none;
  border-bottom: 1px solid rgba(245, 158, 11, 0.28);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.06));
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 45;
}

.paused-banner.visible {
  display: block;
}

.paused-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
}

.paused-banner-copy {
  min-width: 0;
}

.paused-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-data);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: var(--orange);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 6px;
}

.paused-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.paused-subtitle {
  margin-top: 4px;
  font-size: 0.67rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.paused-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.paused-input-label {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.paused-input {
  width: 132px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border-bright);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font-data);
  font-size: 0.74rem;
  outline: none;
}

.paused-input:focus {
  border-color: var(--orange);
}

.paused-turnstile {
  min-width: 300px;
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paused-unpause-btn {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #ffd694;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.paused-unpause-btn:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.8);
}

.paused-unpause-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.paused-status-text {
  width: 100%;
  text-align: right;
  font-size: 0.6rem;
  color: var(--orange);
  min-height: 1em;
}


.restore-banner {
  display: none;
  position: relative;
  z-index: 44;
  border-bottom: 1px solid rgba(6, 182, 212, 0.22);
  background: linear-gradient(90deg, rgba(4, 14, 24, 0.98), rgba(8, 20, 34, 0.94));
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.restore-banner::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #06b6d4, #38bdf8);
}

.restore-banner.visible {
  display: block;
}

.restore-banner.is-complete {
  border-bottom-color: rgba(34, 197, 94, 0.24);
}

.restore-banner.is-complete::before {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

.restore-banner.is-delayed {
  border-bottom-color: rgba(245, 158, 11, 0.3);
}

.restore-banner.is-delayed::before {
  background: linear-gradient(180deg, #f59e0b, #ef4444);
}

.restore-banner-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: center;
  gap: 18px;
  padding: 14px 18px 14px 22px;
}

.restore-copy {
  min-width: 0;
}

.restore-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-data);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: #8fe7f3;
  border: 1px solid rgba(56, 189, 248, 0.42);
  background: rgba(6, 182, 212, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.restore-banner.is-complete .restore-pill {
  color: #aff2bb;
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.12);
}

.restore-banner.is-delayed .restore-pill {
  color: #ffd68a;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.restore-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.restore-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.restore-subtitle {
  margin-top: 4px;
  font-size: 0.66rem;
  line-height: 1.5;
  color: #9db0c3;
}

.restore-dismiss {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.restore-dismiss:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

.restore-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(255, 255, 255, 0.025);
}

.restore-banner.is-complete .restore-metrics {
  border-color: rgba(34, 197, 94, 0.2);
}

.restore-banner.is-delayed .restore-metrics {
  border-color: rgba(245, 158, 11, 0.24);
}

.restore-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.restore-step {
  font-family: var(--font-data);
  font-size: 0.54rem;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.restore-step.done {
  border-color: rgba(34, 197, 94, 0.42);
  color: #a5f3b5;
}

.restore-step.active {
  border-color: rgba(56, 189, 248, 0.55);
  color: #b6f2fa;
  background: rgba(6, 182, 212, 0.14);
}

.restore-banner.is-delayed .restore-step.active {
  border-color: rgba(245, 158, 11, 0.48);
  color: #ffd68a;
  background: rgba(245, 158, 11, 0.12);
}

.restore-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.restore-progress-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #06b6d4, #38bdf8);
  transition: width 0.35s ease;
}

.restore-banner.is-complete .restore-progress-track > span {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.restore-banner.is-delayed .restore-progress-track > span {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.restore-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.restore-status-text {
  font-size: 0.62rem;
  line-height: 1.45;
  color: var(--text-primary);
}

.restore-eta {
  flex-shrink: 0;
  font-size: 0.58rem;
  color: var(--text-muted);
  text-align: right;
}

.ask-paused-note {
  margin: 0 12px 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.08);
  color: #fcd899;
  font-size: 0.65rem;
  line-height: 1.45;
}

/* Paused interaction affordance */
body.paused-mode .ask-input-wrap,
body.paused-mode .ask-suggestions {
  opacity: 0.55;
}

body.paused-mode .ask-input:disabled,
body.paused-mode .ask-send:disabled,
body.paused-mode .suggestion-chip {
  cursor: not-allowed;
}

/* ── SCROLLBAR ─────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Mobile Map Filter Row ─────────────────────── */
.mobile-map-filters {
  display: none;
  gap: 4px;
  padding: 6px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.mobile-map-filters::-webkit-scrollbar { display: none; }
.mobile-map-filters .map-btn {
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ── MOBILE ────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }

  body { overflow: auto; overflow-x: hidden; max-width: 100vw; }

  .panel-map {
    height: 50vh;
    min-height: 300px;
    max-width: 100vw;
  }

  .panel-feed {
    width: 100%;
    max-width: 100vw;
    min-height: 50vh;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .hdr { overflow: hidden; }
  .ftr { overflow: hidden; }

  .hdr-subtitle { display: none; }
  .threat-label { display: none; }

  .map-controls { display: none; }
  .mobile-map-filters { display: flex; }

  .ticker-track { animation-duration: 30s; }

  .paused-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .paused-controls {
    justify-content: flex-start;
  }

  .paused-status-text {
    text-align: left;
  }

  .restore-banner-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 12px 12px 16px;
  }

  .restore-status-row {
    flex-direction: column;
  }

  .restore-eta {
    text-align: left;
  }

  /* Film grain: reduce on tablet */
  body::after { opacity: 0.015; }
}

@media (max-width: 480px) {
  /* [H1/H2] Fix horizontal overflow and header cramping */
  html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
  .hdr { padding: 0 8px; gap: 4px; min-width: 0; overflow: hidden; }
  .hdr-center { display: none; }
  .hdr-left { gap: 4px; min-width: 0; overflow: hidden; flex-shrink: 1; }
  .hdr-right { gap: 4px; flex-shrink: 0; }
  .hdr-subtitle { display: none; }
  .logo-text { font-size: 0.85rem; white-space: nowrap; }
  .conn-label { display: none; }
  /* [#5] Mobile header text: minimum 0.65rem for readability */
  .last-update { font-size: 0.65rem; white-space: nowrap; }
  .ftr { padding: 0 8px; font-size: 0.65rem; }
  .ftr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .paused-input { width: 100%; }
  .paused-turnstile { min-width: 0; width: 100%; justify-content: flex-start; }
  .paused-unpause-btn { width: 100%; }

  .restore-title-row {
    align-items: flex-start;
  }

  .restore-title {
    font-size: 0.84rem;
  }

  .restore-dismiss {
    width: 24px;
    height: 24px;
  }

  .panel-map { height: 40vh; min-height: 250px; }

  .feed-content { padding: 8px; }
  /* [M1] Stack market cards single column on mobile */
  .markets-grid { grid-template-columns: 1fr; }

  /* [#1] Prevent horizontal overflow — aggressive containment */
  .dashboard { max-width: 100vw; width: 100%; overflow-x: hidden; }
  .ticker { max-width: 100vw; overflow-x: clip; overflow-y: hidden; }
  .ticker-track { width: max-content; }
  .panel-feed { max-width: 100vw; width: 100%; overflow-x: hidden; box-sizing: border-box; }
  .feed-content { max-width: 100%; overflow-x: hidden; word-break: break-word; }
  .event-item { max-width: 100%; overflow: hidden; }

  /* [#3] Touch targets: minimum 44px for WCAG compliance */
  .feed-tab { font-size: 0.65rem; padding: 8px 6px; letter-spacing: 0.05em; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .feed-tabs { gap: 0; }
  .evt-filter { min-height: 44px; display: flex; align-items: center; padding: 6px 10px; }
  .suggestion-chip { min-height: 44px; display: flex; align-items: center; padding: 8px 12px; }

  /* [#8] Film grain: disable entirely on small mobile */
  body::after { display: none; }
}

/* ── ASK / Q&A AGENT ─────────────────────────────── */
.ask-tab {
  color: var(--accent) !important;
  font-weight: 700 !important;
}

.ask-tab.active {
  border-color: var(--accent) !important;
  background: var(--accent-glow) !important;
}

.ask-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 400px;
  max-height: 700px;
}

@media (max-width: 900px) {
  .ask-container {
    height: calc(100vh - 300px);
    min-height: 350px;
  }
}

.ask-intro {
  text-align: center;
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

.ask-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
  animation: askIconPulse 3s infinite;
}

@keyframes askIconPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.ask-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.ask-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 340px;
  margin: 0 auto;
}

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 12px;
  justify-content: center;
  flex-shrink: 0;
}

.suggestion-chip {
  font-family: var(--font-data);
  font-size: 0.6rem;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-bright);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* Messages area */
.ask-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

.ask-msg {
  max-width: 95%;
  animation: msgSlideIn 0.25s ease;
}

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

.ask-msg.user {
  align-self: flex-end;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: 12px 12px 2px 12px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.ask-msg.agent {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px 12px 12px 12px;
  padding: 14px 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.ask-msg.agent strong {
  color: var(--text-primary);
}

.ask-msg.agent h2, .ask-msg.agent h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 12px 0 6px;
  text-transform: uppercase;
}

.ask-msg.agent h2:first-child, .ask-msg.agent h3:first-child {
  margin-top: 0;
}

.ask-msg.agent ul {
  padding-left: 16px;
  margin: 6px 0;
}

.ask-msg.agent li {
  margin-bottom: 4px;
}

/* Thinking indicator */
.ask-thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px 12px 12px 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.thinking-dots {
  display: flex;
  gap: 3px;
}

.thinking-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinkBounce 1.2s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-data);
  font-size: 0.55rem;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.12);
  color: var(--accent);
  margin: 4px 4px 4px 0;
}

.tool-badge::before {
  content: '⚡';
  font-size: 0.5rem;
}

/* Input area */
.ask-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.ask-input {
  flex: 1;
  font-family: var(--font-data);
  font-size: 0.8rem;
  padding: 10px 14px;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}

.ask-input:focus {
  border-color: var(--accent);
}

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

.ask-send {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--accent-glow);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.ask-send:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent);
}

.ask-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ask-send svg {
  width: 16px;
  height: 16px;
}

/* Turnstile gate */
.ask-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.gate-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.gate-meta {
  font-size: 0.55rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.ask-session-info {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 0;
}

.ask-session-info .remaining { color: var(--accent); }

/* Character counter */
.ask-char-count {
  text-align: right;
  font-size: 0.6rem;
  color: var(--muted);
  padding: 2px 8px;
  font-family: 'Space Mono', monospace;
}
.ask-char-count.warn { color: #f97316; }
.ask-char-count.danger { color: #ef4444; }

/* ── Event Expand/Detail ──────────────────── */
.event-item { cursor: pointer; transition: background 0.2s ease, border-left 0.2s ease; border-left: 3px solid transparent; }
.event-item:hover { background: rgba(6, 182, 212, 0.04); }
.event-item.expanded { background: rgba(6, 182, 212, 0.06); border-left: 3px solid var(--accent); }
.event-item.expanded .event-expand-hint { display: none; }
.event-item.expanded .event-summary { display: none; } /* hide truncated summary when detail shown */

.event-expand-hint {
  font-size: 0.55rem;
  color: var(--muted);
  opacity: 0.5;
  margin-left: auto;
  font-family: 'Space Mono', monospace;
}
.event-item:hover .event-expand-hint { opacity: 1; color: var(--accent); }

.event-detail {
  margin: 10px 0 8px;
  padding: 12px;
  background: rgba(6, 182, 212, 0.03);
  border: 1px solid rgba(6, 182, 212, 0.1);
  border-radius: 6px;
  animation: detailSlideIn 0.25s ease;
}

@keyframes detailSlideIn {
  from { opacity: 0; max-height: 0; transform: translateY(-8px); }
  to { opacity: 1; max-height: 2000px; transform: translateY(0); }
}

.detail-summary {
  color: #c0c8d4;
  font-size: 0.75rem;
  line-height: 1.6;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.detail-article {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.detail-article-label {
  font-size: 0.55rem;
  font-family: 'Space Mono', monospace;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.7;
}

.detail-article p {
  color: #a8b2c0;
  font-size: 0.72rem;
  line-height: 1.65;
  margin: 0 0 8px 0;
}

.detail-article p:last-child { margin-bottom: 0; }

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-meta-label {
  font-size: 0.5rem;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detail-meta-value {
  font-size: 0.7rem;
  color: #c0c8d4;
}

.detail-meta-value.sev-critical { color: #ef4444; font-weight: 700; }
.detail-meta-value.sev-high { color: #f97316; font-weight: 600; }
.detail-meta-value.sev-medium { color: #eab308; }
.detail-meta-value.sev-low { color: #8a919c; }

.detail-source-link {
  display: inline-block;
  font-size: 0.65rem;
  font-family: 'Space Mono', monospace;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 4px;
  transition: all 0.2s ease;
}
.detail-source-link:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent);
}

.detail-empty, .detail-error {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
}

.event-detail-loading {
  font-size: 0.7rem;
  color: var(--accent);
  font-family: 'Space Mono', monospace;
}

.loading-dots::after {
  content: '';
  animation: loadDots 1.5s infinite;
}
@keyframes loadDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Mobile detail adjustments */
@media (max-width: 480px) {
  .event-detail { padding: 10px; margin: 8px 0 6px; }
  .detail-meta-grid { grid-template-columns: 1fr 1fr; }
  .detail-article p { font-size: 0.7rem; }
  .event-expand-hint { display: none; } /* Always hidden on mobile — tap is obvious */
}

/* ══════════════════════════════════════════════════
   MAIN BRIEF — Flagship Intelligence Brief
   ══════════════════════════════════════════════════ */
.main-brief {
  background: linear-gradient(135deg, rgba(6,182,212,0.04) 0%, rgba(6,10,16,0.95) 50%, rgba(239,68,68,0.03) 100%);
  border: 1px solid rgba(6,182,212,0.15);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.main-brief::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--red), var(--orange), var(--accent));
  background-size: 200% 100%;
  animation: briefAccentShift 8s ease infinite;
}
@keyframes briefAccentShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.main-brief-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.main-brief-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.mb-dot.pulse { animation: pulse 2s ease-in-out infinite; }
.mb-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
}

.main-brief-catchup {
  border-color: rgba(34, 197, 94, 0.3);
}

.mb-catchup-tag {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
  color: #9ce7a8;
}

.main-brief-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mb-time, .mb-sources {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--muted);
}

/* BLUF */
.main-brief-bluf {
  background: rgba(6,182,212,0.06);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 0 6px 6px 0;
}
.mb-bluf-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
}
.mb-bluf-text {
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #e0e6ef;
}

/* Crisis Grid */
.mb-section-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
}
.mb-crises-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mb-crisis-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
}
.mb-crisis-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.mb-crisis-header:hover { background: rgba(255,255,255,0.03); }
.mb-crisis-status {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.mb-crisis-status.active, .mb-crisis-status.escalating { background: rgba(239,68,68,0.15); color: var(--red); }
.mb-crisis-status.deescalating, .mb-crisis-status.stable { background: rgba(34,197,94,0.15); color: var(--green); }
.mb-crisis-status.developing { background: rgba(245,158,11,0.15); color: var(--orange); }
.mb-crisis-name {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: #e0e6ef;
  flex: 1;
}
.mb-crisis-toggle {
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.mb-crisis-card.open .mb-crisis-toggle { transform: rotate(180deg); }
.mb-crisis-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 12px;
}
.mb-crisis-card.open .mb-crisis-body {
  max-height: 500px;
  padding: 0 12px 12px;
}
.mb-crisis-bullet {
  font-family: var(--font-display);
  font-size: 0.68rem;
  line-height: 1.6;
  color: #8a919c;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.mb-crisis-bullet:last-child { border-bottom: none; }

/* Collapsible sections */
.main-brief-section { margin-bottom: 12px; }
.mb-section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 8px 0;
  cursor: pointer;
  color: inherit;
}
.mb-section-toggle .mb-section-label { margin-bottom: 0; }
.mb-section-count {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  background: rgba(6,182,212,0.1);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
}
.mb-section-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.main-brief-section.open .mb-section-arrow { transform: rotate(180deg); }
.mb-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.main-brief-section.open .mb-section-body { max-height: 1000px; }
.mb-dev-item {
  font-family: var(--font-display);
  font-size: 0.68rem;
  line-height: 1.6;
  color: #8a919c;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.mb-dev-item:last-child { border-bottom: none; }
.mb-markets-text {
  font-family: var(--font-display);
  font-size: 0.68rem;
  line-height: 1.6;
  color: #8a919c;
}

/* Threat Assessment */
.main-brief-threat {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mb-threat-bar {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.mb-threat-bar.critical { background: rgba(239,68,68,0.15); }
.mb-threat-bar.high { background: rgba(245,158,11,0.15); }
.mb-threat-bar.elevated { background: rgba(168,85,247,0.15); }
.mb-threat-rating {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
}
.mb-threat-bar.critical .mb-threat-rating { color: var(--red); }
.mb-threat-bar.high .mb-threat-rating { color: var(--orange); }
.mb-threat-bar.elevated .mb-threat-rating { color: #a855f7; }
.mb-threat-detail {
  font-family: var(--font-display);
  font-size: 0.65rem;
  line-height: 1.6;
  color: #8a919c;
}

/* ══════════════════════════════════════════════════
   UPDATES FEED — Timeline-style update stream
   ══════════════════════════════════════════════════ */
.updates-feed {
  margin-top: 12px;
}
.updates-feed-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.uf-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.uf-count {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--accent);
  background: rgba(6,182,212,0.1);
  padding: 1px 6px;
  border-radius: 3px;
}

.updates-timeline {
  position: relative;
  padding-left: 20px;
}
.updates-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(6,182,212,0.15);
}

.update-item {
  position: relative;
  padding-bottom: 16px;
  margin-bottom: 4px;
}
.update-item:last-child { padding-bottom: 0; }

.update-timeline-dot {
  position: absolute;
  left: -18px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.update-content {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 10px 12px;
}
.update-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.update-time {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--accent);
}
.update-ago {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--muted);
}
.update-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: #e0e6ef;
  margin-bottom: 6px;
  line-height: 1.4;
}
.update-body {
  font-family: var(--font-display);
  font-size: 0.65rem;
  line-height: 1.6;
  color: #8a919c;
}

/* ══════════════════════════════════════════════════
   CATEGORIZED BRIEF — Topic-based intelligence cards
   ══════════════════════════════════════════════════ */
.mb-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.mb-category-card {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.mb-category-card:hover { border-color: rgba(255,255,255,0.12); }

/* Severity accent — left border */
.mb-category-card.critical { border-left: 3px solid var(--red); }
.mb-category-card.high { border-left: 3px solid var(--orange); }
.mb-category-card.medium { border-left: 3px solid var(--accent); }
.mb-category-card.low { border-left: 3px solid rgba(255,255,255,0.15); }

.mb-cat-header {
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.mb-cat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.mb-cat-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}
.mb-cat-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: #e0e6ef;
  flex: 1;
}
.mb-cat-severity-badge {
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.mb-cat-severity-badge.critical { background: rgba(239,68,68,0.15); color: var(--red); }
.mb-cat-severity-badge.high { background: rgba(245,158,11,0.15); color: var(--orange); }
.mb-cat-severity-badge.medium { background: rgba(6,182,212,0.1); color: var(--accent); }
.mb-cat-severity-badge.low { background: rgba(255,255,255,0.05); color: var(--muted); }

.mb-cat-toggle {
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.mb-category-card.open .mb-cat-toggle { transform: rotate(180deg); }

.mb-cat-summary {
  font-family: var(--font-display);
  font-size: 0.62rem;
  line-height: 1.5;
  color: #8a919c;
}

/* Category body — collapsible */
.mb-cat-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 12px;
  border-top: 0px solid transparent;
}
.mb-category-card.open .mb-cat-body {
  max-height: 800px;
  padding: 8px 12px 12px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.mb-cat-dev {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  font-family: var(--font-display);
  font-size: 0.65rem;
  line-height: 1.55;
  color: #9ca3af;
}
.mb-cat-dev:last-child { border-bottom: none; }
.mb-cat-dev-marker {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.mb-cat-dev-detail {
  margin-top: 4px;
  margin-left: 16px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
  opacity: 0.8;
  font-family: var(--font-display);
}
.mb-cat-dev-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(6,182,212,0.12);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-left: 6px;
  flex-shrink: 0;
}

.mb-cat-market-impact {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(245,158,11,0.05);
  border: 1px solid rgba(245,158,11,0.1);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  line-height: 1.5;
  color: #9ca3af;
}
.mb-cat-mi-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--orange);
}

/* Mobile adjustments — briefs + categories */
@media (max-width: 900px) {
  .mb-categories { max-width: 100%; overflow: hidden; }
  .mb-category-card { max-width: 100%; overflow: hidden; word-break: break-word; }
  .mb-cat-body { max-width: 100%; overflow-x: hidden; }
  .mb-cat-dev { word-break: break-word; }
  .mb-cat-summary { word-break: break-word; }
  .main-brief { max-width: 100%; overflow: hidden; word-break: break-word; }
  .main-brief-bluf { max-width: 100%; overflow: hidden; }
  .mb-bluf-text { word-break: break-word; }
  .main-brief-threat { max-width: 100%; overflow: hidden; }
  .mb-threat-detail { word-break: break-word; }
  .mb-markets-text { word-break: break-word; }
}
@media (max-width: 768px) {
  /* ════════════════════════════════════════════════
     MOBILE BRIEF LAYOUT OVERHAUL
     Switch from compact flex to stacked single-column
     ════════════════════════════════════════════════ */

  /* Base font bump for readability */
  body { font-size: 16px; }

  /* Main brief card */
  .main-brief {
    padding: 14px;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 10px;
  }
  .main-brief-header { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* BLUF section — bigger text for the key takeaway */
  .main-brief-bluf {
    padding: 12px 14px;
    margin-bottom: 14px;
  }
  .mb-bluf-label { font-size: 0.6rem; margin-bottom: 6px; }
  .mb-bluf-text {
    font-size: 0.88rem;
    line-height: 1.65;
  }

  /* Threat assessment */
  .main-brief-threat { padding-top: 12px; }
  .mb-threat-detail {
    font-size: 0.78rem;
    line-height: 1.6;
  }

  /* Category cards — more breathing room */
  .mb-categories { gap: 10px; max-width: 100%; }
  .mb-category-card {
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
  }
  .mb-cat-header { padding: 12px 14px; }
  .mb-cat-title-row { flex-wrap: wrap; gap: 6px; }
  .mb-cat-title { font-size: 0.82rem; }
  .mb-cat-summary {
    font-size: 0.72rem;
    line-height: 1.55;
    margin-top: 4px;
  }
  .mb-cat-severity-badge {
    font-size: 0.48rem;
    padding: 3px 8px;
  }

  /* ── CRITICAL: Development items — stacked layout ── */
  .mb-cat-body { padding: 0 14px; }
  .mb-category-card.open .mb-cat-body { padding: 8px 14px 14px; }

  .mb-cat-dev {
    /* Switch from side-by-side flex to stacked block */
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.78rem;
    line-height: 1.6;
  }
  .mb-cat-dev:last-child { border-bottom: none; }

  /* The › marker becomes a label-style prefix */
  .mb-cat-dev-marker {
    display: inline;
    color: var(--accent);
    font-weight: 700;
    margin-right: 6px;
  }

  /* Detail text — clearly separated below the main point */
  .mb-cat-dev-detail {
    display: block;
    margin: 8px 0 0 0;
    padding: 10px 12px;
    background: rgba(255,255,255,0.025);
    border-left: 2px solid rgba(6,182,212,0.25);
    border-radius: 0 6px 6px 0;
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text-muted);
    opacity: 1;
  }

  /* Market impact card */
  .mb-cat-market-impact {
    font-size: 0.72rem;
    padding: 10px 12px;
    margin-top: 10px;
  }

  /* Crisis cards (legacy format) */
  .mb-crisis-card { border-radius: 8px; }
  .mb-crisis-header { padding: 12px 14px; }
  .mb-crisis-name { font-size: 0.82rem; }
  .mb-crisis-bullet {
    font-size: 0.78rem;
    line-height: 1.6;
    padding: 6px 0 6px 14px;
  }

  /* Development items (legacy) */
  .mb-dev-item {
    font-size: 0.78rem;
    line-height: 1.6;
    padding: 8px 0;
  }

  /* Markets text */
  .mb-markets-text {
    font-size: 0.78rem;
    line-height: 1.6;
  }

  /* Section toggles — bigger touch targets */
  .mb-section-toggle {
    padding: 12px 0;
    min-height: 44px;
  }
  .mb-section-label { font-size: 0.6rem; }

  /* Updates timeline */
  .updates-timeline { padding-left: 18px; }
  .update-title { font-size: 0.82rem; }
  .update-body {
    font-size: 0.75rem;
    line-height: 1.6;
  }
  .update-content { padding: 12px 14px; }

  /* Events list — bigger text */
  .event-title { font-size: 0.88rem; line-height: 1.4; }
  .event-summary { font-size: 0.78rem; }
  .event-cat { font-size: 0.6rem; }
  .event-time { font-size: 0.65rem; }
  .event-region { font-size: 0.65rem; }

  /* Event detail */
  .event-detail { padding: 12px; }
  .detail-summary { font-size: 0.82rem; }
  .detail-article p { font-size: 0.78rem; }

  /* Data tab */
  .markets-grid { grid-template-columns: 1fr; }
  .market-price { font-size: 1.2rem; }

  /* Fear & Greed */
  .fg-explainer { font-size: 0.72rem; line-height: 1.6; }
}
@media (max-width: 480px) {
  .main-brief { padding: 10px; }
  .feed-content { padding: 8px; }
  .mb-categories { gap: 8px; }
  .mb-cat-header { padding: 10px 12px; }
  .mb-cat-dev { font-size: 0.75rem; padding: 10px 0; }
  .mb-cat-dev-detail { font-size: 0.7rem; padding: 8px 10px; }
  .mb-bluf-text { font-size: 0.82rem; }
  .main-brief-bluf { padding: 10px 12px; }
  .event-expand-hint { display: none; }
}
