:root {
  --bg: #0b0f17;
  --panel: #0f141d;
  --line: #1f2836;
  --text: #d7dde6;
  --muted: #8591a3;
  --accent: #f5b13d;
  --up: #2fbf71;
  --down: #e5484d;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--sans);
}

.boot {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--muted);
  font-family: var(--mono);
}

.terminal {
  display: grid;
  grid-template-rows: 48px 1fr 30px;
  height: 100vh;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #090c12;
}
.wordmark {
  font: 600 14px var(--mono);
  letter-spacing: 0.14em;
  color: var(--muted);
}
.wordmark b { color: var(--text); }
.wordmark .mark {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 5px;
  background: var(--accent);
  color: #111;
  text-align: center;
  line-height: 22px;
  letter-spacing: 0;
}
.status { display: flex; align-items: center; gap: 18px; font-family: var(--mono); color: var(--muted); }
.pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pill.open { background: rgba(47, 191, 113, 0.15); color: var(--up); }
.clock { color: var(--text); }

/* ---- layout ---- */
.grid {
  display: grid;
  grid-template-columns: 480px 1fr 340px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}
.center, .side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  min-height: 0;
}
.panel h2 {
  margin: 0 0 10px;
  font: 600 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---- watchlist ---- */
.watchlist { display: flex; flex-direction: column; }
.watchlist .scroll { overflow: auto; min-height: 0; }
.watchlist table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.watchlist th {
  position: sticky;
  top: 0;
  background: var(--panel);
  padding: 6px 8px;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.watchlist td { padding: 5px 8px; border-bottom: 1px solid #141b26; white-space: nowrap; }
.watchlist td.num { text-align: right; }
.watchlist td.name { color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-family: var(--sans); }
.watchlist tr { cursor: pointer; }
.watchlist tr:hover td { background: #131a25; }
.watchlist tr.selected td { background: rgba(245, 177, 61, 0.1); }
.watchlist .logo { vertical-align: -4px; margin-right: 8px; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* ---- chart panel ---- */
.chart-panel { display: flex; flex-direction: column; flex: 1 1 auto; }
.symbol-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; }
.symbol-id { display: flex; align-items: center; gap: 10px; }
.symbol-id .sym { font: 700 22px var(--mono); }
.symbol-id .name { color: var(--muted); }
.quote .price { font: 600 30px var(--mono); }
.change-badge {
  position: relative;
  top: 6px;
  margin-left: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  font: 600 13px var(--mono);
  vertical-align: middle;
}
.change-badge.up { background: rgba(47, 191, 113, 0.15); }
.change-badge.down { background: rgba(229, 72, 77, 0.15); }
.price-chart { flex: 1 1 auto; min-height: 260px; }

.fundamentals { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.fact { background: #0c1119; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; }
.fact span { display: block; font-size: 11px; color: var(--muted); }
.fact b { font: 600 14px var(--mono); }

/* ---- news ---- */
.news { flex: 0 0 190px; overflow: hidden; }
.news ul { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid #141b26; }
.news .meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.news .empty { margin: 30px 0; text-align: center; color: var(--muted); }

/* ---- side ---- */
.sectors .donut { height: 220px; }
.movers ul { list-style: none; margin: 0; padding: 0; }
.movers li {
  display: grid;
  grid-template-columns: 64px 1fr 72px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #141b26;
  cursor: pointer;
  font-family: var(--mono);
}
.movers h3 {
  position: relative;
  top: -21px;
  margin: 0 0 -10px;
  font: 600 15px var(--sans);
  background: var(--panel);
  display: inline-block;
  padding-right: 8px;
}
.movers .pct { text-align: right; }
.spark { width: 96px; height: 26px; }

/* ---- ticker ---- */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  background: #090c12;
  font: 12px/30px var(--mono);
  color: var(--muted);
}
.ticker .tape { display: inline-block; padding-left: 100%; animation: tape 60s linear infinite; }
.ticker span { margin-right: 48px; }
.ticker span::before { content: "▲ "; color: var(--accent); }
@keyframes tape { to { transform: translateX(-100%); } }
