:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #F0EEE8;
  --border: #E4E1D8;
  --text-primary: #1A1916;
  --text-secondary: #6B6860;
  --text-muted: #A8A49A;
  --accent: #C8392B;
  --accent-soft: #F5EAE8;
  --green: #2D6A4F;
  --green-soft: #E8F4EE;
  --amber: #B86D0E;
  --amber-soft: #FDF3E3;
  --risk-low: #2D6A4F;
  --risk-mid: #B86D0E;
  --risk-high: #C8392B;
  --shadow-sm: 0 1px 3px rgba(26,25,22,0.06), 0 1px 2px rgba(26,25,22,0.04);
  --shadow-md: 0 4px 16px rgba(26,25,22,0.08), 0 2px 6px rgba(26,25,22,0.04);
  --shadow-lg: 0 12px 40px rgba(26,25,22,0.10), 0 4px 12px rgba(26,25,22,0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Instrument Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── CHAT HERO ── */
.chat-hero {
  margin-bottom: 28px;
  animation: fadeUp 0.6s ease both;
}
.chat-eyebrow {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 10px;
}
.search-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px; line-height: 1.15; margin-bottom: 20px;
  color: var(--text-primary); letter-spacing: -0.5px;
  text-align: left;
}
.search-title em { font-style: italic; color: var(--accent); }
.chat-window {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  max-height: 340px;
  overflow-y: auto;
  padding: 24px 28px 16px;
  scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-messages { display: flex; flex-direction: column; gap: 16px; }

/* ── MESSAGES ── */
.chat-msg {
  display: flex; gap: 10px; align-items: flex-start;
  animation: fadeUp 0.3s ease both;
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.ai-avatar {
  background: var(--text-primary); color: white;
  box-shadow: 0 0 0 2px rgba(26,25,22,0.08);
}
.user-avatar {
  background: var(--accent); color: white;
}
.chat-bubble {
  max-width: 75%; padding: 12px 14px;
  border-radius: 12px; font-size: 13px; line-height: 1.55;
}
.ai-bubble {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px 12px 12px 12px;
}
.user-bubble {
  background: var(--surface-2); color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px 4px 12px 12px;
}
.chat-bubble p { margin: 0; }
.chat-bubble strong { font-weight: 600; }
.est-score-dot {
  display: inline-block; width: 6px; height: 6px;
  background: #999; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.tools-used-indicator {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); margin-top: 8px;
  padding-top: 6px; border-top: 1px solid var(--border);
  letter-spacing: 0.2px;
}

/* inline suggestion pills inside first AI message */
.chat-suggestions-inline {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.chat-sugg-pill {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--border); padding: 4px 10px;
  border-radius: 20px; cursor: pointer; letter-spacing: 0.2px;
  transition: all 0.15s;
}
.chat-sugg-pill:hover {
  background: var(--text-primary); color: white; border-color: var(--text-primary);
}

/* typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* data pill inside AI responses */
.data-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px; margin: 2px 2px;
}
.data-pill.up { background: var(--green-soft); color: var(--green); }
.data-pill.dn { background: var(--accent-soft); color: var(--accent); }
.data-pill.neu { background: var(--surface-2); color: var(--text-secondary); }

/* ── INPUT ── */
.chat-input-row {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  overflow: hidden;
}
.chat-input-wrap {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 22px 24px 22px 32px;
}
.chat-input {
  flex: 1; border: none; outline: none; resize: none;
  font-family: 'Instrument Sans', sans-serif; font-size: 15px;
  color: var(--text-primary); background: transparent;
  line-height: 1.5; max-height: 120px; overflow-y: auto;
}
.chat-input::placeholder { color: #C4BFB8; font-size: 15px; }
.chat-input-actions { display: flex; align-items: center; gap: 8px; }
.chat-attach-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: none; border: none; cursor: pointer;
  color: #C4BFB8; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.chat-attach-btn:hover { color: var(--text-secondary); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: white; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(200,57,43,0.35);
}
.chat-send-btn:hover { background: #A52D21; transform: scale(1.05); box-shadow: 0 4px 12px rgba(200,57,43,0.45); }
.chat-send-btn:disabled { background: var(--border); cursor: not-allowed; transform: none; box-shadow: none; }
.chat-meta-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px 12px 32px; flex-wrap: wrap;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.chat-meta-hint {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); white-space: nowrap;
}
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,246,242,0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 56px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.nav-logo svg {
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(200,57,43,0.5); }
  50% { box-shadow: 0 0 16px rgba(200,57,43,0.9), 0 0 24px rgba(200,57,43,0.3); }
}
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px; letter-spacing: 0.5px;
}
.nav-time {
  font-family: 'DM Mono', monospace;
  font-size: 12px; color: var(--text-secondary);
}

/* ── TICKER TAPE ── */
.ticker-wrap {
  background: var(--text-primary); overflow: hidden;
  height: 32px; display: flex; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ticker-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  background: var(--accent); color: white;
  padding: 0 14px; height: 100%; display: flex; align-items: center;
  letter-spacing: 1px; white-space: nowrap; flex-shrink: 0;
  font-weight: 500;
}
.ticker-track {
  display: flex; gap: 0; overflow: hidden; flex: 1;
}
.ticker-inner {
  display: flex; gap: 0;
  animation: ticker 40s linear infinite;
  white-space: nowrap;
}
.ticker-item {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: rgba(255,255,255,0.75); padding: 0 24px;
  display: flex; align-items: center; gap: 8px;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.ticker-item .change { font-weight: 500; }
.ticker-item .up { color: #5CB88A; }
.ticker-item .dn { color: #E07B70; }
.ticker-sep { color: rgba(255,255,255,0.2); }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ── MAIN LAYOUT ── */
.main {
  max-width: 1400px; margin: 0 auto;
  padding: 28px 32px 60px;
}

/* ── SEARCH CHIPS (used in chat meta row) ── */
.search-chips {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.chip {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--border); padding: 5px 12px;
  border-radius: 20px; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--surface); color: var(--text-primary); border-color: var(--accent);
}
.chip.active {
  background: var(--accent); color: white; border-color: var(--accent);
}
.chip.active:hover {
  background: var(--accent); color: white; border-color: var(--accent);
}
.chip-region:hover {
  background: var(--surface); color: var(--text-primary); border-color: #7B1D13;
}
.chip-region.active {
  background: #7B1D13; color: white; border-color: #7B1D13;
}
.chip-region.active:hover {
  background: #7B1D13; color: white; border-color: #7B1D13;
}

/* ── ASSET TRACKER ── */
.asset-tracker {
  margin-bottom: 28px;
  animation: fadeUp 0.6s 0.1s ease both;
  position: relative; z-index: 20;
}
.at-tab-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px;
}
.at-tab {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-secondary); background: transparent;
  border: none; padding: 5px 12px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.at-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.5); }
.at-tab.active {
  background: var(--surface); color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(26,25,22,0.08);
  font-weight: 500;
}
@keyframes at-pulse {
  0% { background: rgba(200,57,43,0.15); }
  100% { background: var(--surface); }
}
.at-tab.pulse {
  animation: at-pulse 0.8s ease forwards;
}
.at-plus-wrap { position: relative; }
.at-plus-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1.5px dashed var(--border); background: transparent;
  color: var(--text-muted); font-size: 16px; line-height: 1;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.at-plus-btn:hover { border-color: var(--accent); color: var(--accent); }
.at-plus-dropdown {
  display: none; position: absolute; top: 100%; left: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  min-width: 180px; margin-top: 4px; overflow: hidden;
}
.at-plus-dropdown.open { display: block; }
.at-plus-item {
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 8px 14px; cursor: pointer; color: var(--text-secondary);
  transition: background 0.1s;
}
.at-plus-item:hover { background: var(--bg); color: var(--text-primary); }
.at-notify {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--accent); height: 0; overflow: hidden;
  transition: height 0.3s ease, opacity 0.3s ease;
  opacity: 0; margin-bottom: 0;
}
.at-notify.show { height: 20px; opacity: 1; margin-bottom: 8px; }
.at-ticker-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  transition: opacity 0.3s ease;
}
.at-ticker-box {
  display: flex; align-items: center; gap: 10px;
  background: #FFFFFF; border: 1px solid #E4E1D8;
  border-radius: 8px; padding: 8px 14px;
  cursor: pointer; transition: all 0.15s;
  min-width: 120px;
}
.at-ticker-box:hover { box-shadow: var(--shadow-sm); }
.at-ticker-box.selected {
  background: var(--text-primary); border-color: var(--text-primary);
}
.at-ticker-box.selected .at-sym { color: white; }
.at-ticker-box.selected .at-name { color: rgba(255,255,255,0.6); }
.at-ticker-box.selected .at-chg { color: rgba(255,255,255,0.8); }
.at-sym {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 700;
  color: var(--text-primary);
}
.at-name {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted);
}
.at-chg {
  font-family: 'DM Mono', monospace; font-size: 11px;
  margin-left: auto; white-space: nowrap;
}
.at-chg.up { color: #2D6A4F; }
.at-chg.dn { color: #C8392B; }

/* ── GRID ── */
.grid-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px; margin-bottom: 16px;
  animation: fadeUp 0.6s 0.2s ease both;
}
.grid-mid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
  animation: fadeUp 0.6s 0.3s ease both;
}
.grid-bot {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  animation: fadeUp 0.6s 0.4s ease both;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.card-title {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase;
}
.card-badge {
  font-family: 'DM Mono', monospace; font-size: 10px;
  padding: 3px 8px; border-radius: 20px;
}
.badge-live { background: #FEE2E2; color: var(--accent); }
.badge-ai { background: #EDE9FE; color: #5B21B6; }
.badge-back { background: var(--green-soft); color: var(--green); }
.card-body { padding: 16px 20px 20px; }

/* ── ARTICLE CAROUSEL ── */
.articles-section {
  margin-bottom: 28px;
  animation: fadeUp 0.6s 0.15s ease both;
}
.articles-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.articles-label {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.articles-label::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
.articles-nav { display: flex; gap: 6px; }
.art-nav-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-secondary);
  transition: all 0.15s;
}
.art-nav-btn:hover { background: var(--text-primary); color: white; border-color: var(--text-primary); }
.articles-track-wrap {
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.articles-track-wrap.dragging { cursor: grabbing; }
.articles-track {
  display: flex; gap: 14px;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}
.articles-track.no-transition { transition: none; }
/* Dot indicators */
.articles-dots {
  display: flex; justify-content: center; gap: 6px; margin-top: 12px;
}
.art-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); transition: all 0.2s; cursor: pointer;
}
.art-dot.active { background: var(--text-primary); width: 18px; border-radius: 3px; }
.article-card {
  flex: 0 0 calc(25% - 11px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: box-shadow 0.2s, transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.article-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.article-img {
  width: 100%; height: 130px; object-fit: cover;
  background: var(--surface-2); display: block;
  position: relative; overflow: hidden;
}
.article-img-placeholder {
  width: 100%; height: 130px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; position: relative;
}
.article-img-overlay {
  position: absolute; top: 8px; left: 8px;
  display: flex; gap: 5px;
}
.article-outlet-badge {
  font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 500;
  padding: 3px 7px; border-radius: 3px; letter-spacing: 0.5px;
  background: rgba(26,25,22,0.75); color: white;
  backdrop-filter: blur(4px);
}
.article-risk-badge {
  font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 500;
  padding: 3px 7px; border-radius: 3px;
  backdrop-filter: blur(4px);
}
.article-body { padding: 12px; }
.article-headline {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  color: var(--text-primary); margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.article-summary {
  font-size: 11px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 10px;
}
.article-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.article-time {
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted);
}
.article-tags { display: flex; gap: 4px; }

/* ── EVENT OVERLAY TOGGLE ── */
.ev-toggle {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); padding: 4px 10px;
  border-radius: 6px; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
}
.ev-toggle:hover { border-color: var(--text-secondary); color: var(--text-secondary); }
.ev-toggle.active {
  background: var(--text-primary); color: white; border-color: var(--text-primary);
}
.ev-toggle-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0.5;
  transition: opacity 0.15s;
}
.ev-toggle.active .ev-toggle-dot { opacity: 1; box-shadow: 0 0 4px rgba(200,57,43,0.6); }
.ev-detail {
  display: none; margin-top: 12px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-secondary); line-height: 1.5;
  animation: fadeUp 0.2s ease;
}
.ev-detail.show { display: block; }
.ev-detail-score {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; margin-right: 6px;
}
.ev-detail-headline {
  font-size: 12px; color: var(--text-primary); font-weight: 500;
  margin-bottom: 4px;
}
.ev-detail-meta {
  font-size: 10px; color: var(--text-muted);
  display: flex; gap: 10px; align-items: center;
}

/* ── EVENT MODAL ── */
.ev-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(26,25,22,0.45); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.ev-modal-overlay.show { display: flex; }
.ev-modal {
  position: relative; width: 90%; max-width: 520px;
  background: #FFFFFF; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 28px 24px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.14);
  animation: fadeUp 0.25s ease;
  max-height: 85vh; overflow-y: auto;
}
.ev-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 22px;
  color: var(--text-muted); cursor: pointer; line-height: 1;
  padding: 4px 8px; border-radius: 4px;
}
.ev-modal-close:hover { background: var(--surface); color: var(--text-primary); }
.ev-modal-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600;
  margin-bottom: 14px;
}
.ev-modal-date {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.3px;
}
.ev-modal-headline {
  font-family: 'DM Sans', sans-serif; font-size: 17px;
  font-weight: 600; color: var(--text-primary); line-height: 1.4;
  margin-bottom: 14px;
}
.ev-modal-detail {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  margin-bottom: 18px;
}
.ev-modal-section {
  margin-bottom: 14px;
}
.ev-modal-label {
  font-family: 'DM Mono', monospace; font-size: 9px;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.2px; margin-bottom: 6px;
}
.ev-modal-stakeholders {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ev-modal-stakeholder {
  display: inline-block; padding: 3px 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; font-size: 11px; color: var(--text-primary);
  font-weight: 500;
}
.ev-modal-tickers {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ev-modal-ticker {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; background: var(--surface-2);
  border-radius: 4px; font-family: 'DM Mono', monospace;
  font-size: 10px; font-weight: 600; color: var(--text-primary);
}
.ev-modal-signals {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px;
}
.ev-modal-categories {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.ev-modal-cat {
  display: inline-block; padding: 2px 8px;
  background: var(--surface); border-radius: 4px;
  font-family: 'DM Mono', monospace; font-size: 9px;
  color: var(--text-muted); text-transform: uppercase;
}
.ev-modal-divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
.ev-modal-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--text-primary);
  color: #FFFFFF; border-radius: 6px; font-size: 12px;
  font-weight: 500; text-decoration: none;
  transition: opacity 0.15s;
}
.ev-modal-link:hover { opacity: 0.85; }
.ev-modal-link svg { width: 14px; height: 14px; fill: currentColor; }

/* ── MAIN CHART ── */
.chart-area {
  position: relative; height: 220px; margin-top: 8px;
}
canvas { width: 100% !important; }

/* ── HEATMAP ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px; margin-top: 12px;
}
.heatmap-label-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; margin-top: 4px;
}
.hm-day-label {
  font-family: 'DM Mono', monospace; font-size: 9px;
  color: var(--text-muted); text-align: center;
}
.hm-cell {
  aspect-ratio: 1; border-radius: 3px;
  cursor: pointer; transition: transform 0.15s, opacity 0.15s;
  position: relative;
}
.hm-cell:hover { transform: scale(1.15); z-index: 2; }
.hm-cell::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: white;
  font-family: 'DM Mono', monospace; font-size: 10px;
  padding: 4px 8px; border-radius: 4px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  z-index: 10;
}
.hm-cell:hover::after { opacity: 1; }

/* ── BACKTEST TABLE ── */
.bt-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.bt-table th {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.bt-table td {
  padding: 10px 12px; font-size: 13px;
  border-bottom: 1px solid var(--surface-2);
}
.bt-table tr:last-child td { border-bottom: none; }
.bt-table tr:hover td { background: var(--bg); }
.bt-ticker {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500;
}
.bt-move {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500;
}
.bt-move.pos { color: var(--green); }
.bt-move.neg { color: var(--accent); }
.bt-hit {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'DM Mono', monospace; font-size: 11px;
}
.hit-bar {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.hit-fill { height: 100%; background: var(--green); border-radius: 2px; }

/* ── HEADLINE FEED ── */
.feed-scroll {
  max-height: 320px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  margin-top: 12px;
}
.feed-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.4s ease both;
  cursor: pointer; transition: background 0.15s;
  border-radius: 6px; padding: 12px 8px;
  margin: 0 -8px;
}
.feed-item:hover { background: var(--bg); }
.feed-item:last-child { border-bottom: none; }
.feed-score-badge {
  flex-shrink: 0; width: 36px; height: 36px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500;
}
.score-high { background: #FDECEA; color: var(--accent); }
.score-mid { background: var(--amber-soft); color: var(--amber); }
.score-low { background: var(--green-soft); color: var(--green); }
.feed-content { flex: 1; min-width: 0; }
.feed-headline {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  color: var(--text-primary); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-meta {
  display: flex; gap: 10px; align-items: center;
}
.feed-outlet {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); letter-spacing: 0.5px;
}
.feed-time { font-size: 11px; color: var(--text-muted); }
.feed-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.feed-tag {
  font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 3px; text-transform: uppercase;
}
.tag-escalation { background: #FDECEA; color: var(--accent); }
.tag-sanctions { background: var(--amber-soft); color: var(--amber); }
.tag-military { background: #EDE9FE; color: #5B21B6; }
.tag-diplomatic { background: var(--green-soft); color: var(--green); }
.tag-supply { background: #E0F2FE; color: #0369A1; }

/* ── WINDOW SELECTOR ── */
.window-sel {
  display: flex; gap: 4px;
}
.win-btn {
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); transition: all 0.15s;
}
.win-btn.active {
  background: var(--text-primary); color: white; border-color: var(--text-primary);
}

/* ── DISCLAIMER ── */
.disclaimer {
  text-align: center; padding: 24px;
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.3px;
  border-top: 1px solid var(--border); margin-top: 32px;
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.chart-area, #btCardsRow, #articlesTrack, #heatmapGrid, #outletSentimentRows {
  transition: opacity 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── LOADING SHIMMER ── */
.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── MAP BUTTON ── */
.map-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--text-primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Instrument Sans', sans-serif; font-size: 13px; font-weight: 600;
  padding: 8px 16px; cursor: pointer;
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.map-btn:hover { background: #2A2926; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.map-btn-globe { font-size: 15px; }

/* ── MAP MODAL ── */
.map-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,25,22,0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.map-modal.open { opacity: 1; pointer-events: all; }
.map-shell {
  width: 92vw; max-width: 1200px; height: 88vh;
  background: var(--text-primary);
  border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 32px 80px rgba(0,0,0,0.4);
}
.map-modal.open .map-shell { transform: translateY(0) scale(1); }
.map-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.map-title {
  font-family: 'DM Serif Display', serif; font-size: 20px;
  color: white; display: flex; align-items: center; gap: 10px;
}
.map-subtitle {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: rgba(255,255,255,0.4); margin-top: 2px; letter-spacing: 0.5px;
}
.map-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: none;
  color: rgba(255,255,255,0.6); font-size: 16px; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.map-close:hover { background: rgba(255,255,255,0.15); color: white; }
.map-body { flex: 1; display: flex; overflow: hidden; }
.map-svg-wrap { flex: 1; padding: 16px; overflow: hidden; position: relative; }
.map-sidebar {
  width: 260px; flex-shrink: 0;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.map-legend-title {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: rgba(255,255,255,0.4); letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 8px;
}
.map-legend-scale {
  width: 100%; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #1a3a2a, #8B6914, #C8392B);
  margin-bottom: 6px;
}
.map-legend-labels {
  display: flex; justify-content: space-between;
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: rgba(255,255,255,0.4);
}
.map-hotspot {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 12px; cursor: pointer;
  transition: background 0.15s;
}
.map-hotspot:hover { background: rgba(255,255,255,0.09); }
.map-hotspot.active { border-color: rgba(200,57,43,0.5); background: rgba(200,57,43,0.08); }
.map-hotspot-name {
  font-family: 'Instrument Sans', sans-serif; font-size: 13px;
  font-weight: 600; color: white; margin-bottom: 4px;
}
.map-hotspot-score {
  font-family: 'DM Mono', monospace; font-size: 11px;
  display: flex; align-items: center; gap: 6px;
}
.map-hotspot-bar {
  flex: 1; height: 3px; background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden;
}
.map-hotspot-fill { height: 100%; border-radius: 2px; }
svg.world-map { width: 100%; height: 100%; }
svg.world-map path {
  stroke: rgba(255,255,255,0.08); stroke-width: 0.5;
  transition: opacity 0.2s, filter 0.2s;
  cursor: pointer;
}
svg.world-map path:hover { opacity: 0.8; filter: brightness(1.3); }
.map-tooltip {
  position: absolute; background: rgba(26,25,22,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 10px 14px;
  pointer-events: none; opacity: 0; transition: opacity 0.15s;
  font-family: 'DM Mono', monospace; font-size: 11px; color: white;
  min-width: 140px; z-index: 10;
}
.map-tooltip.visible { opacity: 1; }

/* ── SIGNAL SUMMARY ── */
.signal-summary {
  background: var(--text-primary); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 24px;
  animation: fadeUp 0.6s 0.05s ease both;
  box-shadow: var(--shadow-md);
}
.signal-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: rgba(255,255,255,0.4); letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 4px;
}
.signal-headline {
  font-family: 'DM Serif Display', serif; font-size: 18px;
  color: white; line-height: 1.2;
}
.signal-divider {
  width: 1px; height: 48px; background: rgba(255,255,255,0.1); flex-shrink: 0;
}
.signal-watch {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.signal-asset-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 7px 12px;
  transition: background 0.15s;
}
.signal-asset-pill:hover { background: rgba(255,255,255,0.13); }
.signal-asset-ticker {
  font-family: 'DM Mono', monospace; font-size: 12px;
  font-weight: 500; color: white;
}
.signal-asset-move {
  font-family: 'DM Mono', monospace; font-size: 11px;
}
.signal-asset-move.up { color: #5CB88A; }
.signal-asset-move.dn { color: #E07B70; }
.signal-trend {
  flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; gap: 4px; margin-left: auto;
}
.trend-arrow {
  font-size: 28px; line-height: 1;
  filter: drop-shadow(0 0 8px currentColor);
}
.trend-arrow.up { color: #E07B70; }
.trend-arrow.stable { color: #F5C842; }
.trend-arrow.dn { color: #5CB88A; }
.trend-text {
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: 1px; text-transform: uppercase;
}
.trend-text.up { color: #E07B70; }
.trend-text.stable { color: #F5C842; }
.trend-text.dn { color: #5CB88A; }

/* ── OUTLET SENTIMENT ── */
.outlet-row {
  display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
}
.outlet-bar-row {
  display: flex; align-items: center; gap: 10px;
}
.outlet-name {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-secondary); width: 72px; flex-shrink: 0;
}
.outlet-bar-wrap {
  flex: 1; height: 8px; border-radius: 4px;
  background: var(--border); overflow: hidden;
  position: relative;
}
.outlet-seg {
  position: absolute; top: 0; height: 100%;
  transition: width 0.8s ease;
}
.outlet-seg-neg { left: 0; background: #FBBDB7; }
.outlet-seg-neu { background: #E4E1D8; }
.outlet-seg-pos { background: #A8D5BB; }
.outlet-counts {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); width: 60px; text-align: right; flex-shrink: 0;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 12px; text-align: center;
}
.empty-state.visible { display: flex; }
.empty-icon { font-size: 48px; opacity: 0.3; }
.empty-title {
  font-family: 'DM Serif Display', serif; font-size: 22px;
  color: var(--text-primary); opacity: 0.5;
}
.empty-sub {
  font-size: 13px; color: var(--text-muted); max-width: 280px; line-height: 1.5;
}

/* ── ARTICLE PREVIEW PANEL ── */
.article-preview-overlay {
  position: fixed; inset: 0; z-index: 180;
  background: rgba(26,25,22,0.4);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.article-preview-overlay.open { opacity: 1; pointer-events: all; }

.article-preview-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 190;
  width: 440px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 48px rgba(26,25,22,0.12);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.article-preview-panel.open { transform: translateX(0); }

.article-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.article-preview-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.article-preview-close:hover { background: var(--text-primary); color: white; border-color: var(--text-primary); }

.article-preview-body {
  flex: 1; overflow-y: auto; padding: 20px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.article-preview-image {
  width: 100%; height: 180px; object-fit: cover;
  border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--surface-2);
}
.article-preview-image-placeholder {
  width: 100%; height: 180px;
  border-radius: var(--radius-sm); margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.article-preview-outlet {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 6px;
}
.article-preview-title {
  font-family: 'DM Serif Display', serif; font-size: 20px;
  line-height: 1.3; color: var(--text-primary); margin-bottom: 12px;
}
.article-preview-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.article-preview-risk {
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 4px 10px; border-radius: 20px; font-weight: 500;
}
.article-preview-divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
.article-preview-section-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 10px;
}
.article-preview-summary {
  font-size: 14px; line-height: 1.65; color: var(--text-primary);
  margin-bottom: 16px;
}
.article-preview-takeaways {
  list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px;
}
.article-preview-takeaways li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; line-height: 1.5; color: var(--text-secondary);
}
.article-preview-takeaways li::before {
  content: '→'; color: var(--accent); font-weight: 600; flex-shrink: 0;
  margin-top: 1px;
}
.article-preview-signals {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px;
}
.article-preview-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.article-preview-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  background: var(--text-primary); color: white;
  border: none; cursor: pointer;
  font-family: 'Instrument Sans', sans-serif; font-size: 13px; font-weight: 600;
  transition: all 0.15s; text-decoration: none;
}
.article-preview-cta:hover { background: #2A2926; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.article-preview-cta-arrow { font-size: 15px; }
