/* Stock Pulse — refactored per Knaflic principles.
 *
 * Color discipline: ONE accent (cyan) for emphasis. Red/green ONLY for direction.
 * Fire tier red is the "hawk" — it's the only thing that lights up; everything
 * else is "pigeon" grey. Watch tier is a subtle amber sidebar — present but not loud.
 *
 * Hierarchy via size: score is BIG (24px), everything else is small (11-13px).
 * White space generous. No chart borders. No decorative gradients/glows/pulse.
 * Direct labels (bar inline with number). One source of truth per row.
 */

:root {
  /* GREYSCALE — the "sky full of pigeons" */
  --bg-0: #0b0e13;          /* page bg */
  --bg-1: #11151c;          /* slight elevation */
  --bg-2: #1a1f29;          /* card / hover */
  --border: #1f2532;
  --text-1: #e8eaed;        /* primary text */
  --text-2: #9aa1ac;        /* secondary text */
  --text-3: #5b6270;        /* tertiary / dim */

  /* THE HAWK — reserved for fire tier + score emphasis */
  --accent: #38e3ff;        /* cyan: the single accent for active emphasis (score) */
  --fire: #ff5b5b;          /* the alert red — only used for fire tier */
  --watch: #d6a04a;         /* watch tier amber — quieter than fire */

  /* SEMANTIC — direction only */
  --up: #4ade80;
  --down: #ff5b5b;          /* same red as fire — consistent semantic meaning */

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  background: var(--bg-0);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* ─────────────────────────── TOPBAR ─────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
}
.brand {
  font-size: 14px;
  letter-spacing: 1px;
  font-weight: 600;
  margin: 0;
  color: var(--text-2);
  text-transform: lowercase;
}
.brand span { color: var(--text-1); font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  width: 32px; height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text-1); background: var(--bg-2); }

.scan-btn {
  background: var(--text-1);
  color: var(--bg-0);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  transition: opacity 0.15s;
}
.scan-btn:hover { opacity: 0.85; }
.scan-btn:disabled { opacity: 0.5; cursor: wait; }

/* ─────────────────────────── TABS ─────────────────────────── */
.tabs {
  display: flex;
  gap: 28px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  padding: 14px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-1); }
.tab.active {
  color: var(--text-1);
  border-bottom-color: var(--text-1);
}

.tab-panel { display: none; padding: 32px; max-width: 1280px; margin: 0 auto; }
.tab-panel.active { display: block; }

/* ─────────────────────── HERO HEADLINE (story) ─────────────────────── */
.hero-headline {
  margin-bottom: 32px;
}
.hero-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 1px;
  margin: 0 0 6px 0;
  text-transform: uppercase;
}
.hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--text-1);
}
.hero-title em {
  font-style: normal;
  color: var(--fire);
}

/* ─────────────────────── HERO CARDS (the hawk) ─────────────────────── */
/* Only shown for fire + top-watch tickers. These are the "hawk" — the ONE thing
 * we want the eye to lock onto first. Everything else is grey. */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.hero-card {
  background: var(--bg-1);
  border-left: 3px solid var(--fire);
  padding: 20px 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.hero-card:hover { background: var(--bg-2); }
.hero-card.tier-watch { border-left-color: var(--watch); }
.hero-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.hero-card-ticker {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.5px;
}
.hero-card-tier {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--fire);
}
.hero-card.tier-watch .hero-card-tier { color: var(--watch); }
.hero-card-price {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.hero-card-change {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  margin-left: 8px;
}
.hero-card-change.up { color: var(--up); }
.hero-card-change.down { color: var(--down); }
.hero-card-meta {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.5px;
}

/* Entry-phase chip — green/yellow/orange/red mirrors the "is it too late?" verdict */
.phase-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
}
.phase-chip.phase-early    { background: rgba(46, 204, 113, 0.16); color: #2ecc71; }
.phase-chip.phase-mid      { background: rgba(241, 196, 15, 0.16); color: #f1c40f; }
.phase-chip.phase-late     { background: rgba(230, 126, 34, 0.16); color: #e67e22; }
.phase-chip.phase-blowoff  { background: rgba(231, 76, 60, 0.18);  color: #e74c3c; }

/* ─────────────────────── FILTER PANEL (collapsed by default) ─────────────────────── */
.filter-panel {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-1);
  border-radius: 4px;
}
.filter-panel[hidden] { display: none; }
.filter-input, .filter-select {
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 3px;
}

/* ─────────────────────── BOARD TABLE ───────────────────────
 * Knaflic principles applied:
 *  - No chart border, no row gridlines beyond a thin baseline divider
 *  - SCORE column gets BIG font (24px) — the eye lands here first (preattentive size)
 *  - Everything else is small + dim
 *  - Direct labels (sentiment bar inline)
 *  - Fire tier = red text + red left bar (consistent semantic color = direction-bad)
 *  - Watch tier = dim amber sidebar only — quieter signal
 *  - Neutral tier = no decoration whatsoever (the "pigeons") */
.board-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
}
.board-table thead th {
  text-align: left;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 16px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.board-table th.num { text-align: right; }
.board-table th:hover { color: var(--text-1); }
.board-table th.sort-asc::after,
.board-table th.sort-desc::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.board-table th.sort-asc::after { border-bottom: 5px solid var(--accent); }
.board-table th.sort-desc::after { border-top: 5px solid var(--accent); }

.board-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.board-table tbody tr:hover { background: var(--bg-1); }
.board-table tbody tr.tier-fire-row { border-left-color: var(--fire); }
.board-table tbody tr.tier-watch-row { border-left-color: var(--watch); }

.board-table td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.board-table td.num { text-align: right; }

.cell-ticker {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--text-1);
}
.board-table tr.tier-fire-row .cell-ticker { color: var(--fire); }

/* THE BIG NUMBER — score column (Knaflic: pre-attentive size = where the eye lands) */
.cell-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  font-family: var(--mono);
}
.board-table tr.tier-fire-row .cell-score { color: var(--accent); }
.board-table tr.tier-watch-row .cell-score { color: var(--text-1); }

.cell-mentions { color: var(--text-2); font-size: 12px; }
.cell-mentions small { color: var(--text-3); font-size: 10px; }

.sentiment-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sentiment-bar-fill {
  display: inline-flex;
  height: 4px;
  width: 80px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.sentiment-bar-fill .bull { background: var(--up); }
.sentiment-bar-fill .bear { background: var(--down); }
.sentiment-bar-fill .neu { background: var(--text-3); }
.sentiment-numbers {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}
.sentiment-numbers .up { color: var(--up); }
.sentiment-numbers .down { color: var(--down); }

.cell-price { color: var(--text-1); font-size: 13px; }
.cell-change { font-weight: 600; font-family: var(--mono); }
.cell-change.up { color: var(--up); }
.cell-change.down { color: var(--down); }

.empty { text-align: center; color: var(--text-3); padding: 48px; font-style: italic; }

/* ─────────────────────── HYPE RADAR ─────────────────────── */
.hype-actions {
  margin-bottom: 24px;
}
.link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text-1); }

.hype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.hype-card {
  background: var(--bg-1);
  padding: 20px 24px;
  border-radius: 4px;
  border-left: 3px solid var(--text-3);
}
.hype-card.high { border-left-color: var(--fire); }
.hype-card.med { border-left-color: var(--watch); }

.hype-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.hype-company {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--text-1);
}
.hype-score {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}
.hype-card.med .hype-score { color: var(--watch); }
.hype-card.low .hype-score { color: var(--text-2); }

.hype-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 14px;
  font-family: var(--mono);
}
.hype-catalyst {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0 0 14px 0;
}

.hype-basket {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.basket-label {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 1px;
  margin-right: 4px;
  align-self: center;
}
.sympathy-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-2);
  color: var(--text-1);
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.sympathy-chip:hover { border-color: var(--accent); color: var(--accent); }

.hype-details-toggle {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
}
.hype-details-toggle:hover { color: var(--text-1); }
.hype-dimensions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 16px;
}
.hype-dimensions[hidden] { display: none; }
.dim {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
}
.dim-label { color: var(--text-3); }
.dim-val { color: var(--text-1); font-weight: 600; }

/* ─────────────────────── FILINGS ─────────────────────── */
.filings-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.filing-row {
  display: grid;
  grid-template-columns: 70px 80px 1fr 80px;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-0);
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  color: var(--text-1);
  transition: background 0.1s;
}
.filing-row:hover { background: var(--bg-1); }
.filing-form { font-weight: 700; color: var(--accent); font-size: 11px; }
.filing-ticker { color: var(--text-1); font-weight: 600; }
.filing-title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filing-date { color: var(--text-3); font-size: 11px; text-align: right; }

/* ─────────────────────── ALERTS TAB ─────────────────────── */
.alerts-list {
  display: grid;
  gap: 1px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.alert-row {
  display: grid;
  grid-template-columns: 110px 80px 60px 1fr 80px 80px;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-0);
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.alert-row:hover { background: var(--bg-1); }
.alert-tier {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.alert-tier.fire { color: var(--fire); }
.alert-tier.volume_spike { color: var(--watch); }
.alert-tier.insider_cluster { color: var(--accent); }
.alert-tier.activist { color: #c084fc; }
.alert-tier.squeeze { color: #f472b6; }
.alert-tier.halt { color: var(--fire); }
.alert-tier.reg_fd { color: var(--text-2); }
.alert-tier.velocity { color: var(--watch); }
.alert-tier.hype { color: var(--accent); }
.alert-ticker { font-weight: 700; color: var(--text-1); }
.alert-score { color: var(--accent); font-weight: 600; }
.alert-reason { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-date { color: var(--text-3); font-size: 11px; text-align: right; }
.alert-return { font-weight: 600; text-align: right; font-size: 11px; }
.alert-return.up { color: var(--up); }
.alert-return.down { color: var(--down); }
.alert-return.pending { color: var(--text-3); }

/* ─────────────────────── MODAL ─────────────────────── */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-1);
  border-radius: 6px;
  width: min(880px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
}
.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text-1); }

.drill-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.drill-ticker {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--mono);
  margin: 0;
}
.drill-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.drill-price {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  text-align: right;
}
.drill-change { font-size: 14px; font-weight: 600; }
.drill-change.up { color: var(--up); }
.drill-change.down { color: var(--down); }

.drill-section { margin-bottom: 32px; }
.drill-section h3 {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-3);
  margin: 0 0 12px 0;
  font-weight: 600;
  text-transform: uppercase;
}

.opt-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}
.opt-table th, .opt-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.opt-table th {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 500;
}
.opt-table tr td:first-child, .opt-table tr th:first-child { text-align: left; }
.opt-table tr.call-row td:first-child { color: var(--up); font-weight: 700; }
.opt-table tr.put-row td:first-child { color: var(--down); font-weight: 700; }

.mention-list { max-height: 280px; overflow-y: auto; }
.mention-row {
  padding: 10px 14px;
  border-left: 2px solid var(--border);
  margin-bottom: 6px;
  font-size: 12px;
}
.mention-row.bullish { border-left-color: var(--up); }
.mention-row.bearish { border-left-color: var(--down); }
.mention-meta {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-family: var(--mono);
}
.mention-snippet { color: var(--text-2); line-height: 1.45; }
.mention-snippet a { color: var(--accent); text-decoration: none; margin-left: 4px; }

/* ─────────────────────── RESPONSIVE ─────────────────────── */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .tabs { padding: 0 16px; gap: 20px; }
  .tab-panel { padding: 20px 16px; }
  .hero-title { font-size: 22px; }
  .hero-cards { grid-template-columns: 1fr; }
  .board-table thead th { padding: 8px 10px; }
  .board-table td { padding: 12px 10px; font-size: 12px; }
  .cell-score { font-size: 18px; }
  .cell-ticker { font-size: 14px; }
  .sentiment-bar-fill { width: 50px; }
  .modal-content { padding: 20px 16px; }
}
