:root {
  --bg: #070b16;
  --panel: #10182b;
  --line: #24304a;
  --text: #e8edf7;
  --muted: #8b97b3;
  --gold: #e0b25a;
  --raised: #3ee0a4;
  --lowered: #ff6b7a;
  --initiated: #6aa8ff;
  --reaffirmed: #f0c14b;
  --other: #b79bff;
  --font: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.4 var(--font);
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(224, 178, 90, 0.08), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(106, 168, 255, 0.08), transparent 45%);
}

.app { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  background: linear-gradient(180deg, #1b2744, #0e1628);
  border: 1px solid #3a4b72;
  position: relative;
}
.mark::before, .mark::after {
  content: "";
  position: absolute;
  background: var(--gold);
}
.mark::before {
  width: 3px; height: 14px; left: 13px; top: 6px; border-radius: 2px;
}
.mark::after {
  width: 10px; height: 3px; left: 9px; top: 16px;
  transform: rotate(-28deg);
  border-radius: 2px;
}

h1 { margin: 0; font-size: 1.15rem; letter-spacing: -0.03em; }
.deck { margin: 2px 0 0; color: var(--muted); font-size: 0.86rem; }

.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.health, .count, .api-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.health.is-live { color: var(--raised); }
.health.is-down { color: var(--lowered); }
.api-link { color: var(--gold); text-decoration: none; }
.api-link:hover { text-decoration: underline; }

.stats {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
}
.stats-date { font-family: var(--mono); color: var(--text); }
.stat strong { font-variant-numeric: tabular-nums; }
.stat.dir-raised { color: var(--raised); }
.stat.dir-lowered { color: var(--lowered); }
.stat.dir-initiated { color: var(--initiated); }
.stat.dir-reaffirmed { color: var(--reaffirmed); }
.stat.dir-other { color: var(--other); }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.ticker-ctrl input {
  width: 120px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: 13px var(--mono);
  text-transform: uppercase;
}
.btn {
  background: var(--gold);
  color: #1a1408;
  border: 0;
  border-radius: 8px;
  padding: 7px 11px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn:hover { filter: brightness(1.06); }

.directions { display: flex; flex-wrap: wrap; gap: 6px; }
.dir {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.78rem;
}
.dir.is-on { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.dir[data-direction-filter="raised"].is-on { background: var(--raised); border-color: var(--raised); }
.dir[data-direction-filter="lowered"].is-on { background: var(--lowered); border-color: var(--lowered); }
.dir[data-direction-filter="initiated"].is-on { background: var(--initiated); border-color: var(--initiated); }
.dir[data-direction-filter="reaffirmed"].is-on { background: var(--reaffirmed); border-color: var(--reaffirmed); }
.dir[data-direction-filter="other"].is-on { background: var(--other); border-color: var(--other); }

.tape-status {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.tape-status[data-kind="error"] { color: var(--lowered); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 24, 43, 0.72);
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
tbody tr:hover { background: rgba(224, 178, 90, 0.05); }
.col-num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
th.col-num { text-align: right; }
.col-ticker { font-family: var(--mono); font-weight: 700; }
.ticker-btn {
  background: none; border: 0; padding: 0; color: var(--gold);
  font: inherit; cursor: pointer;
}
.col-company, .col-firm, .col-analyst { color: var(--text); }
.col-rating, .col-date { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: lowercase;
}
.pill.dir-raised { background: rgba(62, 224, 164, 0.15); color: var(--raised); }
.pill.dir-lowered { background: rgba(255, 107, 122, 0.15); color: var(--lowered); }
.pill.dir-initiated { background: rgba(106, 168, 255, 0.15); color: var(--initiated); }
.pill.dir-reaffirmed { background: rgba(240, 193, 75, 0.16); color: var(--reaffirmed); }
.pill.dir-other { background: rgba(183, 155, 255, 0.16); color: var(--other); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .top { flex-direction: column; }
  .ticker-ctrl input { width: 100px; }
}
