/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* No color-coded accent left on links — underline by default so they still
   read as clickable against plain white text, per user's "fully neutral"
   colour-scheme choice. */
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--text); }

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--accent);
}

.topbar-date { color: var(--muted); margin-left: 1.5rem; font-size: .8rem; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .8rem;
  color: var(--muted);
}

.btn-refresh {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: .3rem .8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: .8rem;
  transition: background .15s;
}
.btn-refresh:hover { background: var(--border); }
.btn-refresh.large { padding: .6rem 1.5rem; font-size: 1rem; margin-top: 1rem; }

@media (max-width: 1180px) {
  .topbar #live-clock { display: none; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
}

/* ── Stale data warning ───────────────────────────────────────────────────── */
.stale-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 1.5rem .5rem;
  padding: .6rem 1.5rem;
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: .8rem;
}
.stale-banner .btn-refresh { flex-shrink: 0; }

/* ── Sections ─────────────────────────────────────────────────────────────── */
.section {
  margin: 1.2rem 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.section-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .9rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Metrics grid ─────────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
}

.metric-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .7rem .9rem;
  transition: border-color .15s;
}
.metric-card:hover { border-color: var(--accent); }

.metric-label  { font-size: .68rem; color: var(--muted); margin-bottom: .25rem; letter-spacing: .05em; }

/* Sanity-check flag — a value that fell outside its plausible range (see
   src/sanity.py). Not an error, just "verify this before trusting it". */
.metric-price  { font-size: 1.05rem; font-weight: 600; }
.metric-change { font-size: .8rem; margin-top: .15rem; }
.metric-sym    { font-size: .6rem; color: var(--muted); margin-top: .2rem; }

/* ── Two-column layout ────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Macro panel ──────────────────────────────────────────────────────────── */

.panel-title {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .7rem;
}

/* ── News lists ───────────────────────────────────────────────────────────── */
.news-list { list-style: none; }
.news-list.wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: .5rem; }

.news-title { font-size: .82rem; font-weight: 500; line-height: 1.4; }

/* ── Stocks grid ──────────────────────────────────────────────────────────── */

.stock-news { list-style: none; font-size: .72rem; }
.stock-news li { padding: .35rem 0; border-top: 1px solid var(--border); }
.stock-news-header { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.stock-news-title { color: var(--accent); line-height: 1.35; flex: 1; min-width: 0; }
.stock-news-title:hover { color: var(--text); }
.stock-news-date { color: var(--muted); font-size: .65rem; white-space: nowrap; flex-shrink: 0; }
.stock-news-body { color: var(--muted); font-size: .68rem; line-height: 1.4; margin-top: .2rem; }

/* ── Colour helpers ───────────────────────────────────────────────────────── */
.pos     { color: var(--pos); }
.neg     { color: var(--neg); }
.neutral { color: var(--muted); }
.warn    { color: var(--warn); }

.sig-green    { color: var(--pos); }
.sig-red      { color: var(--neg); }
.sig-yellow   { color: var(--warn); }
.sig-blue     { color: var(--accent); }
.sig-neutral  { color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: .65rem;
  color: var(--muted);
  padding: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem 1.2rem;
  font-size: .8rem;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; }

/* ── Market movers ────────────────────────────────────────────────────────── */

.mover-title { font-size: .85rem; font-weight: 500; flex: 1; min-width: 200px; }

/* Event-first movers: headline leads and must dominate visually — the
   affected-instruments line is supporting detail, not a competing focal
   point, so it stays small/muted with color reserved for just the %. */

.mover-summary { font-size: .72rem; color: var(--muted); width: 100%; padding-left: 7rem; margin-top: -.1rem; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Sector rotation ─────────────────────────────────────────────────────── */

.sector-name   { font-size: .6rem;  color: var(--muted); margin-bottom: .3rem; }

/* ── Collapsible details ─────────────────────────────────────────────────── */
details > summary {
  cursor: pointer;
  font-size: .75rem;
  color: var(--muted);
  list-style: none;
  padding: .3rem 0;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▶  ";
  font-size: .65rem;
  color: var(--accent);
}
details[open] > summary::before { content: "▼  "; }

/* ── Ticker search bar ───────────────────────────────────────────────────── */
.search-wrap { display: flex; align-items: center; gap: .4rem; }

.ticker-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: .8rem;
  padding: .3rem .7rem;
  border-radius: 4px;
  width: 130px;
  outline: none;
  transition: border-color .15s, width .2s;
}
.ticker-input:focus { border-color: var(--accent); width: 165px; }
.ticker-input::placeholder { color: var(--muted); }

.btn-email-ticker {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font);
  font-size: .75rem;
  padding: .35rem .9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-email-ticker:hover:not(:disabled)  { background: var(--border); border-color: var(--accent); }
.btn-email-ticker:disabled { opacity: .6; cursor: default; }

/* ── Ticker modal overlay ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-strong);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding-top: 56px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(880px, 96vw);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  position: relative;
  flex-shrink: 0;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 .2rem;
  z-index: 10;
}
.modal-close:hover { color: var(--text); }

/* ── Ticker detail — header ──────────────────────────────────────────────── */
.td-header { margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: .8rem; }

.td-title-row { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.td-symbol    { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.td-name      { font-size: .85rem; color: var(--muted); }
.td-sector    { font-size: .72rem; color: var(--accent); letter-spacing: .05em; }

.td-price-row  { display: flex; align-items: baseline; gap: .6rem; margin-top: .35rem; flex-wrap: wrap; }
.td-price      { font-size: 1.35rem; font-weight: 600; }
.td-change     { font-size: .9rem; }
.td-range      { font-size: .72rem; color: var(--muted); margin-left: auto; }

/* ── Fundamentals card grid ──────────────────────────────────────────────── */
.td-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: .5rem;
  margin-bottom: 1.1rem;
}
.td-metric-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .5rem .7rem;
}
.td-metric-label { font-size: .6rem; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: .2rem; }
.td-metric-value { font-size: .88rem; font-weight: 600; }

/* ── Analyst price-target bar ────────────────────────────────────────────── */
.td-targets {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75rem 1rem;
  margin-bottom: 1.1rem;
}
.td-targets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .55rem;
}
.td-targets-title { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.rec-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  padding: .18rem .55rem;
  border-radius: 3px;
}
.rec-buy        { background: var(--pos-tint);  color: var(--pos); }
.rec-hold       { background: var(--warn-tint); color: var(--warn); }
.rec-sell       { background: var(--neg-tint);  color: var(--neg); }
.rec-neutral    { background: var(--accent-tint); color: var(--muted); }

.td-bar-wrap { position: relative; height: 26px; margin: .4rem 0; }
.td-bar-track {
  position: absolute; top: 50%; left: 0; right: 0;
  height: 4px; background: var(--border);
  transform: translateY(-50%); border-radius: 2px;
}
.td-bar-fill {
  position: absolute; top: 50%; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--neg) 0%, var(--warn) 50%, var(--pos) 100%);
  transform: translateY(-50%); border-radius: 2px;
}
.td-bar-pin {
  position: absolute; top: 0;
  width: 3px; height: 100%;
  border-radius: 2px;
  transform: translateX(-50%);
}
.td-pin-price { background: var(--text); }
.td-pin-mean  { background: var(--accent); }
.td-pin-label {
  position: absolute; top: -15px;
  font-size: .58rem; color: var(--muted);
  transform: translateX(-50%);
  white-space: nowrap;
}

.td-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: .65rem;
  color: var(--muted);
  margin-top: .15rem;
}
.td-upside-row {
  display: flex;
  gap: 1.2rem;
  font-size: .72rem;
  margin-top: .4rem;
  flex-wrap: wrap;
}

/* ── Analysis two-column thesis ──────────────────────────────────────────── */
.td-thesis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) { .td-thesis { grid-template-columns: 1fr; } }

.td-section { margin-bottom: 1rem; }
.td-section-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .45rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.td-bull-title { color: var(--pos); }
.td-bear-title { color: var(--neg); }
.td-section-title.td-neutral { color: var(--accent); }

.td-bullets { list-style: none; font-size: .75rem; color: var(--muted); line-height: 1.6; padding: 0; }
.td-bullets li { padding: .1rem 0; }
.td-bullets li::before { content: "• "; color: var(--accent); }

/* ── Ticker news list ────────────────────────────────────────────────────── */
.td-news-list  { list-style: none; font-size: .76rem; }
.td-news-list li {
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: .5rem;
}
.td-news-list li:last-child { border-bottom: none; }
.td-news-title { flex: 1; color: var(--accent); line-height: 1.35; }
.td-news-title:hover { color: var(--text); }
.td-news-date  { color: var(--muted); font-size: .64rem; white-space: nowrap; flex-shrink: 0; }

/* ── Loading / error states ──────────────────────────────────────────────── */
.td-loading { text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: .85rem; }
.td-error   { color: var(--neg); padding: 1.5rem 0; font-size: .82rem; }

/* ── Chart controls ──────────────────────────────────────────────────────── */
.chart-wrap { margin-bottom: 1.2rem; }

.chart-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}

.chart-group { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.chart-group-label { font-size: .65rem; color: var(--muted); margin-right: .1rem; white-space: nowrap; }

.chart-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .7rem;
  padding: .22rem .55rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.chart-btn:hover { border-color: var(--accent); color: var(--text); }
.chart-btn.active { background: var(--info-tint); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chart-divider { width: 1px; height: 14px; background: var(--border); margin: 0 .1rem; }

.chart-range-bar { display: flex; align-items: center; gap: .15rem; margin-bottom: .4rem; flex-wrap: wrap; }

.range-btn {
  background: none; border: none; color: var(--muted);
  font-family: var(--font); font-size: .72rem; padding: .2rem .5rem;
  cursor: pointer; border-radius: 3px; transition: all .12s;
}
.range-btn:hover { color: var(--text); background: var(--bg3); }
.range-btn.active { color: var(--accent); font-weight: 700; background: var(--info-tint); }

#td-chart-container {
  height: 280px; background: var(--bg); border-radius: 4px 4px 0 0;
  overflow: hidden; border: 1px solid var(--border);
}
#td-rsi-container {
  height: 80px; background: var(--bg); border-radius: 0 0 4px 4px;
  overflow: hidden; border: 1px solid var(--border); border-top: none; display: none;
}
#td-rsi-container.show { display: block; }

.chart-meta-row { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .4rem; flex-wrap: wrap; }
.chart-mcap { font-size: .78rem; color: var(--muted); }
.chart-perf { font-size: .9rem; font-weight: 600; }

/* ── Market Outlook ──────────────────────────────────────────────────────── */
.outlook-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .65rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 640px) { .outlook-grid { grid-template-columns: 1fr; } }

.outlook-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: .8rem 1rem; }
.outlook-period { font-size: .65rem; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: .5rem; }

.outlook-bar-row { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin-bottom: .45rem; }
.outlook-seg-bull { background: var(--pos); border-radius: 3px; }
.outlook-seg-neut { background: var(--border); border-radius: 3px; }
.outlook-seg-bear { background: var(--neg); border-radius: 3px; }

.outlook-pct-row { display: flex; justify-content: space-between; font-size: .7rem; margin-bottom: .5rem; }
.outlook-pct-bull { color: var(--pos); font-weight: 600; }
.outlook-pct-neut { color: var(--muted); }
.outlook-pct-bear { color: var(--neg); font-weight: 600; }

.outlook-summary { font-size: .71rem; color: var(--muted); line-height: 1.45; margin-bottom: .5rem; min-height: 2.5rem; }

.outlook-conf-row { display: flex; align-items: center; gap: .5rem; font-size: .63rem; color: var(--muted); }
.conf-track { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.conf-fill  { height: 100%; background: var(--accent); border-radius: 2px; }

/* ── SWOT ────────────────────────────────────────────────────────────────── */
.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: 1.1rem; }
@media (max-width: 520px) { .swot-grid { grid-template-columns: 1fr; } }

.swot-card { background: var(--bg3); border: 1px solid; border-radius: 6px; padding: .75rem 1rem; }
.swot-str { border-color: var(--pos-line); }
.swot-wkn { border-color: var(--neg-line); }
.swot-opp { border-color: var(--info-line); }
.swot-thr { border-color: var(--warn-line); }

.swot-title { display: flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; margin-bottom: .5rem; }
.swot-str .swot-title { color: var(--pos); }
.swot-wkn .swot-title { color: var(--neg); }
.swot-opp .swot-title { color: var(--accent); }
.swot-thr .swot-title { color: var(--warn); }
.swot-icon { font-size: .85rem; }

.swot-bullets { list-style: none; font-size: .72rem; color: var(--muted); line-height: 1.5; padding: 0; }
.swot-bullets li { padding: .1rem 0; }
.swot-bullets li::before { content: "• "; }

/* ── Catalysts ───────────────────────────────────────────────────────────── */
.catalysts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .6rem;
  margin-bottom: 1.1rem;
}

.catalyst-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: .7rem .9rem; }
.catalyst-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; }
.catalyst-title { font-size: .8rem; font-weight: 600; color: var(--text); flex: 1; line-height: 1.3; }

.impact-badge { font-size: .6rem; font-weight: 700; letter-spacing: .06em; padding: .15rem .45rem; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.impact-high   { background: var(--neg-tint);  color: var(--neg);  border: 1px solid var(--neg-line); }
.impact-medium { background: var(--warn-tint); color: var(--warn); border: 1px solid var(--warn-line); }
.impact-low    { background: var(--accent-tint); color: var(--muted); border: 1px solid var(--border); }

.catalyst-desc { font-size: .71rem; color: var(--muted); line-height: 1.4; margin-bottom: .3rem; }
.catalyst-time { font-size: .63rem; color: var(--muted); }

/* ── App shell layout ────────────────────────────────────────────────────── */
/* Sidebar is fixed — body content pushed right, layout otherwise unchanged */
body { margin-left: 200px; }

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 200px;
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 200;
}

.sidebar-logo {
  padding: 1.1rem 1rem .9rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.sidebar-logo-wrap {
  padding: 1.2rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-logo-img {
  max-width: 100%;
  height: auto;
  display: block;
}

.nav-group { padding: 0 .6rem; }
.nav-group:first-of-type .nav-section-label { padding-top: .3rem; }

.nav-section-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .6rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 1rem .4rem .4rem;
  user-select: none;
}
.nav-section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Sidebar search ──────────────────────────────────────────────────────── */
.sidebar-search {
  padding: .65rem .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .35rem;
}
.sidebar-search-input {
  flex: 1;
  min-width: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: .74rem;
  padding: .35rem .6rem;
  border-radius: 4px;
  outline: none;
  transition: border-color .15s;
}
.sidebar-search-input:focus { border-color: var(--accent); }
.sidebar-search-input::placeholder { color: var(--muted); }
.sidebar-search-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font);
  font-size: .74rem;
  padding: .3rem .55rem;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.sidebar-search-btn:hover { background: var(--border); }

/* ── WIP badge ───────────────────────────────────────────────────────────── */
.nav-wip {
  margin-left: auto;
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--warn);
  background: var(--warn-tint);
  border: 1px solid var(--warn-line);
  padding: .1rem .35rem;
  border-radius: 3px;
}

.nav-item {
  display: block;
  padding: .45rem .65rem;
  margin: .05rem 0;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  transition: color .15s, background .15s;
  cursor: pointer;
}
.nav-item:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-item.active {
  color: var(--text);
  background: var(--bg3);
  font-weight: 600;
}
.nav-icon { font-size: .9rem; flex-shrink: 0; }

/* page-wrap and main-content are plain block elements — no change to layout */
.topbar { position: sticky; top: 0; z-index: 100; }

/* ── Search page hero ────────────────────────────────────────────────────── */
.search-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 2rem 2rem;
}
.search-hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
  letter-spacing: .04em;
}
.search-hero-sub {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 2rem;
  text-align: center;
  max-width: 420px;
  line-height: 1.55;
}
.search-hero-wrap {
  display: flex;
  gap: .5rem;
  width: 100%;
  max-width: 500px;
}
.search-hero-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  padding: .65rem 1rem;
  border-radius: 5px;
  outline: none;
  transition: border-color .15s;
}
.search-hero-input:focus { border-color: var(--accent); }
.search-hero-input::placeholder { color: var(--muted); }
.search-hero-btn {
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 700;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity .15s;
}
.search-hero-btn:hover { opacity: .85; }
.search-hint {
  font-size: .67rem;
  color: var(--muted);
  margin-top: .75rem;
  letter-spacing: .02em;
}

.search-recent {
  width: 100%;
  max-width: 500px;
  margin-top: 2rem;
}
.search-recent-title {
  font-size: .65rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.search-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: .72rem;
  padding: .25rem .7rem;
  border-radius: 20px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.search-chip:hover { color: var(--accent); border-color: var(--accent); }

/* ── CIO placeholder ─────────────────────────────────────────────────────── */
.cio-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  text-align: center;
  min-height: 60vh;
}
.cio-icon { font-size: 3.5rem; margin-bottom: 1.2rem; opacity: .35; }
.cio-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: .6rem; letter-spacing: .04em; }
.cio-sub { font-size: .82rem; color: var(--muted); max-width: 380px; line-height: 1.65; }

/* ── CIO Page ────────────────────────────────────────────────────────────── */
.cio-page { padding-bottom: 3rem; }

.cio-search-bar {
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 50;
}
.cio-search-wrap { display: flex; gap: .5rem; max-width: 640px; }
.cio-search-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  padding: .55rem 1rem;
  border-radius: 5px;
  outline: none;
  transition: border-color .15s;
}
.cio-search-input:focus { border-color: var(--accent); }
.cio-search-input::placeholder { color: var(--muted); }
.cio-search-btn {
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 700;
  padding: .55rem 1.3rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.cio-search-btn:hover { opacity: .85; }
.cio-search-hint { font-size: .65rem; color: var(--muted); margin-top: .4rem; }

/* ── CIO Results ─────────────────────────────────────────────────────────── */
.cio-loading { padding: 3rem 1.5rem; color: var(--muted); font-size: .85rem; text-align: center; }
.cio-error   { padding: 2rem 1.5rem; color: var(--neg); font-size: .82rem; }

.cio-body { padding: 1.2rem 1.5rem; }

/* Company header */
.cio-company-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.cio-ticker    { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.cio-name      { font-size: .88rem; color: var(--muted); margin-top: .2rem; }
.cio-sector    { font-size: .7rem; color: var(--accent); letter-spacing: .05em; margin-top: .15rem; }
.cio-price-row { display: flex; align-items: baseline; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.cio-price     { font-size: 1.4rem; font-weight: 600; }
.cio-chg       { font-size: .9rem; }
.cio-range     { font-size: .7rem; color: var(--muted); }

/* Verdict card */
.cio-verdict {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.2rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.verdict-strong-buy  { background: var(--pos-tint);  border-color: var(--pos-line);  }
.verdict-buy         { background: var(--pos-tint);  border-color: var(--pos-line); }
.verdict-hold        { background: var(--warn-tint); border-color: var(--warn-line); }
.verdict-sell        { background: var(--neg-tint);  border-color: var(--neg-line); }
.verdict-strong-sell { background: var(--neg-tint);  border-color: var(--neg-line);  }
/* A missing/unparsed rating used to fall through to verdict-hold (amber) —
   an unrated memo read as a real bearish-leaning answer. Neutral grey instead. */
.verdict-unknown     { background: var(--bg2); border-color: var(--border); }

.cio-verdict-rating {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
}
.verdict-strong-buy  .cio-verdict-rating,
.verdict-buy         .cio-verdict-rating { color: var(--pos); }
.verdict-hold        .cio-verdict-rating { color: var(--warn); }
.verdict-sell        .cio-verdict-rating,
.verdict-strong-sell .cio-verdict-rating { color: var(--neg); }
.verdict-unknown     .cio-verdict-rating { color: var(--muted); }

.cio-verdict-meta { display: flex; gap: 1.2rem; font-size: .72rem; margin-top: .25rem; flex-wrap: wrap; }
.cio-verdict-meta span { color: var(--muted); }
.cio-verdict-meta strong { color: var(--text); }
.cio-verdict-thesis { font-size: .8rem; color: var(--muted); line-height: 1.55; flex: 1; min-width: 200px; padding-top: .15rem; }

/* Two & three column grids */
.cio-two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.cio-three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
@media (max-width: 800px) { .cio-two-col, .cio-three-col { grid-template-columns: 1fr; } }

/* Individual sections */
.cio-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .85rem 1rem;
}
.cio-section-title {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cio-section-badge {
  font-size: .58rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 3px;
  letter-spacing: .05em;
}
.badge-pos  { background: var(--pos-tint);  color: var(--pos); }
.badge-neg  { background: var(--neg-tint);  color: var(--neg); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-neu  { background: var(--accent-tint); color: var(--muted); }

.cio-para { font-size: .79rem; color: var(--muted); line-height: 1.65; }
.cio-para-full { font-size: .79rem; color: var(--muted); line-height: 1.65; }

.cio-bullets { list-style: none; padding: 0; margin: 0; }
.cio-bullets li { font-size: .76rem; color: var(--muted); line-height: 1.55; padding: .2rem 0; display: flex; gap: .4rem; }
.cio-bullets li::before { content: "•"; color: var(--accent); flex-shrink: 0; }
.cio-bull-bullets li::before { color: var(--pos); }
.cio-bear-bullets li::before { color: var(--neg); }

/* Financial health score */
.cio-health-score {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .5rem;
  line-height: 1;
}
.cio-health-label { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* Metrics grid */
.cio-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem;
  margin-bottom: 1rem;
}
.cio-metric-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; padding: .5rem .7rem; }
.cio-metric-label { font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.cio-metric-value { font-size: .88rem; font-weight: 600; }

/* Catalyst sub-headers */
.cio-catalyst-group { margin-bottom: .5rem; }
.cio-catalyst-period {
  font-size: .62rem; font-weight: 700; color: var(--gold);
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .2rem;
}

/* News in CIO */
.cio-news-list { list-style: none; padding: 0; }
.cio-news-list li { font-size: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .5rem; align-items: baseline; }
.cio-news-list li:last-child { border-bottom: none; }
.cio-news-title { flex: 1; color: var(--accent); line-height: 1.35; }
.cio-news-title:hover { color: var(--text); }
.cio-news-date  { font-size: .63rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* ── CIO: decision-first layout additions ───────────────────────────────── */
.cio-decision-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

/* Company header now carries a Regenerate button alongside the ticker info */
.cio-company-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

/* What Would Change My Mind — an UPGRADE/DOWNGRADE pair, colour-coded like
   the bull/bear bullet lists rather than a plain neutral list. */
.cio-triggers { list-style: none; padding: 0; margin: 0; }
.cio-triggers li { font-size: .76rem; color: var(--muted); line-height: 1.55; padding: .25rem 0; }
.cio-trigger-up   { color: var(--pos); }
.cio-trigger-down { color: var(--neg); }

/* Mechanically-derived sizing/entry/exit — deliberately visually distinct
   (dashed border) from the model's own judgement sections, since these
   numbers are arithmetic on realized volatility, not an LLM opinion. */
.cio-levels { border-style: dashed; }
.cio-levels-method { font-size: .68rem; color: var(--muted); font-style: italic; margin-top: .6rem; line-height: 1.5; }

/* Generation status banner (polled every 2s while a job is running) */
.cio-status { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
              background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
              padding: 1rem 1.25rem; flex-wrap: wrap; }
.cio-status .cio-loading { padding: 0; text-align: left; }
.cio-status-elapsed { font-size: .72rem; color: var(--muted); white-space: nowrap; }

/* Staleness / generated-at footer line shown above the decision block */
.cio-stale { font-size: .74rem; color: var(--warn); background: var(--warn-tint);
             border: 1px solid var(--warn-line); border-radius: 6px; padding: .5rem .8rem; margin-bottom: 1rem; }
.cio-meta  { font-size: .68rem; color: var(--muted); margin-bottom: .8rem; }

/* "Full analysis" collapsible fold — this is what keeps the page
   decision-first: everything below it is opt-in reading, not the default view. */
.cio-collapse { margin-top: .5rem; }
.cio-collapse-toggle {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent); font-family: var(--font); font-size: .78rem; font-weight: 600;
  padding: .5rem .9rem; cursor: pointer; width: 100%; text-align: left;
}
.cio-collapse-toggle:hover { background: var(--bg2); }
.cio-collapse-body { margin-top: .8rem; }

/* ── Portfolio Page ─────────────────────────────────────────────────────────── */

.pf-page { padding-bottom: 4rem; }

/* Init loading state */
.pf-init-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 7rem 2rem; text-align: center;
}
.pf-init-icon  { font-size: 3rem; margin-bottom: 1.2rem; }
.pf-init-title { font-size: 1.2rem; font-weight: 600; margin-bottom: .6rem; }
.pf-init-sub   { font-size: .8rem; color: var(--muted); max-width: 420px; line-height: 1.7; }
.pf-init-dots  { font-size: 2rem; color: var(--accent); margin-top: 1.2rem; letter-spacing: .3rem; }
.pf-init-dots span { animation: pf-blink 1.4s infinite both; }
.pf-init-dots span:nth-child(2) { animation-delay: .2s; }
.pf-init-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pf-blink { 0%,80%,100% { opacity:0 } 40% { opacity:1 } }

/* Summary cards */
.pf-summary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .6rem; padding: 1rem 1.2rem .5rem;
}
.pf-summary-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  padding: .7rem 1rem;
}
.pf-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .3rem; }
.pf-value { font-size: 1.1rem; font-weight: 600; }
.pf-sub   { font-size: .68rem; color: var(--muted); margin-top: .15rem; }
.pf-benchmark-badge {
  display: inline-block; font-size: .6rem; font-weight: 700; padding: .15rem .4rem;
  border-radius: 3px; margin-left: .4rem; vertical-align: middle; text-transform: uppercase;
}
.pf-outperform   { background: var(--pos-tint); color: var(--pos); }
.pf-underperform { background: var(--neg-tint);  color: var(--neg); }

.pf-risk-metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .6rem;
}

/* Controls bar */
.pf-controls {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1.2rem 1rem;
}
.pf-btn {
  font-family: var(--font); font-size: .76rem; font-weight: 600;
  padding: .45rem 1rem; border: none; border-radius: 5px; cursor: pointer;
  transition: opacity .15s;
}
.pf-btn:hover { opacity: .82; }
.pf-btn-rebalance { background: var(--accent); color: var(--accent-ink); }
.pf-btn-rebalance:disabled { opacity: .45; cursor: not-allowed; }
.pf-btn-reflect   { background: var(--bg3); color: var(--text); border: 1px solid var(--accent); }
.pf-btn-reflect:disabled { opacity: .45; cursor: not-allowed; }
.pf-btn-reset     { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.pf-controls-hint { font-size: .65rem; color: var(--muted); }

/* Sections */
.pf-section       { padding: 0 1.2rem 1.2rem; }
.pf-section-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: .6rem 0; border-bottom: 1px solid var(--border);
  margin-bottom: .6rem;
}
.pf-collapsible { cursor: pointer; user-select: none; display: flex; align-items: center; gap: .5rem; }
.pf-collapsible:hover { color: var(--text); }
.pf-toggle-arrow { margin-left: auto; font-size: .65rem; transition: transform .2s; }

/* Table */
.pf-table-wrap { overflow-x: auto; }
.pf-table {
  width: 100%; border-collapse: collapse; font-size: .74rem;
}
.pf-table th {
  font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); text-align: left; padding: .4rem .7rem; white-space: nowrap;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg);
}
.pf-table td {
  padding: .55rem .7rem; border-bottom: 1px solid var(--rule);
  vertical-align: middle; white-space: nowrap;
}
.pf-table tbody tr:hover { background: var(--bg3); }
.pf-table tbody tr:last-child td { border-bottom: none; }
.pf-thesis {
  font-size: .67rem; color: var(--muted); font-style: italic;
  white-space: normal; max-width: 260px; line-height: 1.4;
}
.pf-ticker-link { color: var(--accent); cursor: pointer; font-weight: 600; }
.pf-ticker-link:hover { color: var(--text); }

/* Trade badges */
.pf-badge {
  display: inline-block; font-size: .58rem; font-weight: 700; padding: .12rem .4rem;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .04em;
}
.pf-badge-buy  { background: var(--pos-tint); color: var(--pos); }
.pf-badge-sell { background: var(--neg-tint);  color: var(--neg); }

/* Rebalance log */
.pf-rebalance-log  { padding: .4rem 0; }
.pf-rebalance-entry {
  display: flex; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border);
  font-size: .74rem; align-items: baseline;
}
.pf-rebalance-entry:last-child { border-bottom: none; }
.pf-rebalance-ts { font-size: .63rem; color: var(--muted); flex-shrink: 0; min-width: 120px; }
.pf-rebalance-summary { color: var(--text); }

/* Rebalance overlay */
.pf-rebalance-overlay {
  position: fixed; inset: 0; background: var(--overlay-strong);
  z-index: 600; display: flex; align-items: center; justify-content: center;
}
.pf-rebalance-modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 3rem 3.5rem; text-align: center; max-width: 420px;
}
.pf-rebalance-icon  { font-size: 3rem; margin-bottom: 1rem; }
.pf-rebalance-title { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.pf-rebalance-sub   { font-size: .78rem; color: var(--muted); line-height: 1.65; }

/* Reflect / Update Views panel */
.pf-reflect-panel {
  margin: 0 1.2rem 1.2rem;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 7px;
  overflow: hidden;
}
.pf-reflect-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem; border-bottom: 1px solid var(--border);
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.pf-reflect-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px;
  background: var(--border);
}
.pf-reflect-card {
  background: var(--bg2); padding: .8rem 1rem;
  transition: background .12s;
}
.pf-reflect-card:hover { background: var(--bg3); }
.pf-reflect-card-top {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem;
}
.pf-reflect-sym   { font-size: .85rem; font-weight: 700; }
.pf-stance {
  font-size: .58rem; font-weight: 700; padding: .12rem .4rem;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .04em;
}
.pf-stance-bullish  { background: var(--pos-tint);  color: var(--pos); }
.pf-stance-neutral  { background: var(--info-tint); color: var(--accent); }
.pf-stance-cautious { background: var(--neg-tint);  color: var(--neg); }
.pf-reflect-changed {
  font-size: .58rem; color: var(--warn); font-weight: 600; margin-left: auto;
  letter-spacing: .03em;
}
.pf-reflect-thesis  { font-size: .72rem; color: var(--text); line-height: 1.45; margin-bottom: .3rem; }
.pf-reflect-comment { font-size: .68rem; color: var(--muted); line-height: 1.5; font-style: italic; }

/* Thesis drift timeline (reuses .pf-reflect-grid/.pf-reflect-card) */
.pf-drift-entry { padding: .4rem 0; border-top: 1px solid var(--border); }
.pf-drift-entry:first-child { border-top: none; padding-top: 0; }
.pf-drift-entry-top { display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.pf-drift-date  { font-size: .62rem; color: var(--muted); }
.pf-drift-event { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.pf-drift-stable { font-size: .58rem; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: .03em; }

/* Stress test */
.pf-stress-controls { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.pf-stress-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem;
}
.pf-stress-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  padding: .7rem 1rem;
}
.pf-stress-window { font-size: .6rem; color: var(--muted); margin-top: .1rem; }
.pf-stress-detail  { font-size: .65rem; color: var(--muted); margin-top: .5rem; line-height: 1.55; }
.pf-stress-proxied { font-size: .58rem; color: var(--warn); }

/* ── Earnings Calendar ───────────────────────────────────────────────────── */
.ec-page { padding-bottom: 3rem; }

/* Loading state */
.ec-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 55vh; gap: .6rem; padding: 3rem;
}
.ec-loading-icon  { font-size: 3rem; margin-bottom: .4rem; opacity: .5; }
.ec-loading-title { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: .04em; }
.ec-loading-sub   { font-size: .78rem; color: var(--muted); text-align: center; max-width: 380px; line-height: 1.6; }

/* Empty state */
.ec-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 40vh; gap: .5rem; padding: 3rem; text-align: center;
}
.ec-empty-icon  { font-size: 2.8rem; margin-bottom: .4rem; opacity: .35; }
.ec-empty-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.ec-empty-sub   { font-size: .78rem; color: var(--muted); max-width: 340px; line-height: 1.6; }

/* Refreshing banner */
.ec-refresh-banner {
  font-size: .72rem; color: var(--muted); background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .45rem 1.5rem; letter-spacing: .03em;
  animation: ec-pulse 2s ease-in-out infinite;
}
@keyframes ec-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* Week tabs */
.ec-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--bg2); padding: 0 1.5rem; overflow-x: auto;
  scrollbar-width: none;
}
.ec-tabs::-webkit-scrollbar { display: none; }
.ec-tab {
  font-family: var(--font); font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .75rem 1.1rem; border: none; background: none;
  color: var(--muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.ec-tab:hover { color: var(--text); }
.ec-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Body / day groups */
.ec-body { padding: 0 1.5rem 2rem; }

.ec-day {
  margin-top: 1.6rem;
}
.ec-day-header {
  font-size: .65rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding: .35rem 0; margin-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .6rem;
}
.ec-day-count {
  font-size: .6rem; background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  padding: .08rem .45rem; font-weight: 500;
}

/* Card grid */
.ec-cards {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .6rem 0 .4rem;
}

/* Individual card */
.ec-card {
  width: 100px;
  display: flex; flex-direction: column; align-items: center;
  gap: .3rem; cursor: pointer;
  padding: .6rem .4rem .5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  transition: border-color .13s, background .13s;
  position: relative;
}
.ec-card:hover { border-color: var(--accent); background: var(--bg3); }

/* Logo wrapper — fixed square */
.ec-logo-wrap {
  width: 52px; height: 52px;
  border-radius: 8px; overflow: hidden;
  background: var(--logo-plate);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Real logo image */
.ec-logo-img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 4px;
}

/* Letter-avatar fallback */
.ec-logo-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--logo-plate-ink);
  letter-spacing: .04em; border-radius: 8px;
}

/* Ticker label */
.ec-card-ticker {
  font-size: .72rem; font-weight: 700; color: var(--accent);
  letter-spacing: .02em; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 100%;
}

/* Company name */
.ec-card-name {
  font-size: .62rem; color: var(--muted);
  text-align: center; line-height: 1.3;
  word-break: break-word;
}

/* In-portfolio dot */
.ec-card-pf {
  position: absolute; top: 4px; right: 5px;
  font-size: .62rem; line-height: 1;
}

/* Today badge on day header */
.ec-today-badge {
  font-size: .58rem; font-weight: 700; background: var(--pos-tint);
  color: var(--pos); border-radius: 3px; padding: .08rem .4rem;
  letter-spacing: .04em; text-transform: uppercase;
}

/* ── Competitor Comparison ──────────────────────────────────────────────────── */

.comp-page { padding: 2rem; }

/* Hero */
.comp-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 1rem; text-align: center;
}
.comp-hero-icon  { font-size: 2.5rem; }
.comp-hero-title { font-size: 1.4rem; font-weight: 700; color: var(--fg, var(--text)); letter-spacing: .02em; }
.comp-hero-sub   { font-size: .8rem; color: var(--muted); }
.comp-hero-search { display: flex; gap: .5rem; }

.comp-input {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; font-family: var(--font);
  width: 320px; outline: none;
}
.comp-input:focus { border-color: var(--accent); }
.comp-input-sm   { width: 200px; font-size: .8rem; padding: .4rem .8rem; }

.comp-btn {
  background: var(--accent); color: var(--text); border: none; border-radius: 8px;
  padding: .6rem 1rem; cursor: pointer; font-size: .9rem; font-family: var(--font);
}
.comp-btn:hover  { opacity: .85; }
.comp-btn-sm     { padding: .4rem .7rem; font-size: .8rem; }

/* Re-search bar */
.comp-rebar { display: flex; gap: .5rem; margin-bottom: 1.5rem; }

/* Loading */
.comp-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 40vh; gap: 1rem;
}
.comp-loading-label { color: var(--muted); font-size: .85rem; }

/* Error */
.comp-error { color: var(--neg); padding: 2rem; text-align: center; font-size: .9rem; }

/* Comparison table */
.comp-table      { display: flex; flex-direction: column; gap: 0; overflow-x: auto; }
.comp-header-row {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem; margin-bottom: .25rem;
}
.comp-row {
  display: flex; gap: 0;
  padding: .4rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.comp-row:last-child { border-bottom: none; }

/* Label column */
.comp-label-col {
  width: 90px; min-width: 90px;
  font-size: .7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding-right: .5rem; flex-shrink: 0;
}

/* Data columns */
.comp-col-head,
.comp-cell {
  flex: 1; min-width: 110px; text-align: center; padding: 0 .5rem;
}
.comp-col-head {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  cursor: pointer; padding: .5rem; border-radius: 8px;
}
.comp-col-head:hover { background: var(--bg2); }
.comp-target  { background: var(--info-tint); border-radius: 6px; }
.comp-col-sym  { font-size: .82rem; font-weight: 700; color: var(--accent); }
.comp-col-name { font-size: .65rem; color: var(--muted); text-align: center; line-height: 1.3; }
.comp-star     { color: var(--warn); font-size: .75rem; }
.comp-cell     { font-size: .82rem; color: var(--text); }

/* Logo */
.comp-logo-wrap {
  width: 44px; height: 44px; border-radius: 8px; background: var(--bg2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  flex-shrink: 0;
}
.comp-logo-img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.comp-logo-fb  {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: var(--text); border-radius: 8px;
}

/* Metric bars */
.comp-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; margin-top: 4px; }
.comp-bar      { height: 100%; border-radius: 2px; transition: width .4s ease; }
.comp-52w      { height: 5px; margin-top: 5px; }
.comp-52w-label { font-size: .65rem; color: var(--muted); display: block; margin-top: 2px; }

/* ── Watchlist ──────────────────────────────────────────────────────────────── */

.wl-page    { padding: 1.5rem 2rem; }
.wl-add-bar { display: flex; gap: .5rem; margin-bottom: 1.5rem; }

.wl-input {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: .5rem .9rem; border-radius: 6px; font-size: .85rem;
  font-family: var(--font); width: 220px; outline: none;
}
.wl-input:focus  { border-color: var(--accent); }

.wl-add-btn {
  background: var(--accent); color: var(--text); border: none; border-radius: 6px;
  padding: .5rem .9rem; cursor: pointer; font-size: .82rem; font-family: var(--font);
}
.wl-add-btn:hover { opacity: .85; }

.wl-table    { width: 100%; border-collapse: collapse; font-size: .82rem; }
.wl-table th {
  font-size: .65rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; padding: .4rem .6rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.wl-row     { border-bottom: 1px solid var(--rule); cursor: pointer; transition: background .1s; }
.wl-row:hover     { background: var(--bg2); }
.wl-row td        { padding: .55rem .6rem; vertical-align: middle; }
.wl-row-err       { cursor: default; }
.wl-row-err:hover { background: transparent; }

.wl-logo-cell { width: 42px; }
.wl-logo-wrap {
  width: 32px; height: 32px; border-radius: 6px; background: var(--bg2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.wl-logo-img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.wl-logo-fb  {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700; color: var(--text); border-radius: 6px;
}

.wl-sym   { font-weight: 700; color: var(--accent); min-width: 60px; }
.wl-name  {
  color: var(--muted); font-size: .75rem; max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wl-price { font-weight: 600; white-space: nowrap; }
.wl-mcap  { color: var(--muted); font-size: .78rem; }
.wl-pe    { color: var(--muted); font-size: .78rem; }
.wl-chg   { font-weight: 600; white-space: nowrap; }

.wl-range      { width: 80px; }
.wl-range-wrap { height: 4px; background: var(--border); border-radius: 2px; }
.wl-range-bar  { height: 100%; background: var(--accent); border-radius: 2px; }

.wl-rm { background: none; border: none; color: var(--muted); cursor: pointer;
         font-size: 1rem; padding: .1rem .3rem; border-radius: 3px; }
.wl-rm:hover { color: var(--neg); background: var(--neg-tint); }

.wl-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 50vh; gap: .8rem; text-align: center;
}
.wl-empty-icon  { font-size: 2.5rem; }
.wl-empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.wl-empty-sub   { font-size: .8rem; color: var(--muted); }
.wl-loading, .wl-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Market Heatmap ─────────────────────────────────────────────────────────── */

.hm-page   { padding: 1.5rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.hm-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

.hm-tabs { display: flex; gap: .4rem; }
.hm-tab  {
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  padding: .35rem .8rem; border-radius: 6px; cursor: pointer;
  font-size: .78rem; font-family: var(--font);
}
.hm-tab.active, .hm-tab:hover { border-color: var(--accent); color: var(--accent); }

.hm-summary { font-size: .78rem; color: var(--muted); }

.hm-grid    { display: flex; flex-wrap: wrap; gap: 4px; min-height: 260px; }
.hm-tile    {
  min-width: 80px; min-height: 90px; border-radius: 6px; padding: .7rem;
  cursor: pointer; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  transition: filter .15s; color: var(--text);
}
.hm-tile:hover      { filter: brightness(1.2); }
.hm-tile-name   { font-size: .6rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.hm-tile-ticker { font-size: .8rem; font-weight: 700; margin: .25rem 0; }
.hm-tile-pct    { font-size: 1.05rem; font-weight: 700; }

.hm-indices    { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: .7rem; }
.hm-index-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: .9rem 1rem; cursor: pointer; transition: border-color .15s;
}
.hm-index-card:hover { border-color: var(--accent); }
.hm-idx-ticker { font-size: .85rem; font-weight: 700; color: var(--accent); }
.hm-idx-name   { font-size: .65rem; color: var(--muted); margin-bottom: .4rem; }
.hm-idx-price  { font-size: 1rem; font-weight: 600; }
.hm-idx-chg    { font-size: .82rem; font-weight: 600; margin-top: .15rem; }

.hm-loading, .hm-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Economic Calendar ──────────────────────────────────────────────────────── */

.eco-page { padding: 1.5rem 2rem; display: flex; flex-direction: column; gap: 1.5rem; }

.eco-indicators-section,
.eco-events-section {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem 1.25rem;
}

.eco-section-title {
  font-size: .7rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .75rem;
}

.eco-indicators { display: flex; flex-wrap: wrap; gap: .6rem; }
.eco-ind-card   {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  padding: .5rem .85rem; min-width: 80px;
}
.eco-ind-label { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.eco-ind-val   { font-size: .9rem; font-weight: 600; color: var(--text); margin-top: .15rem; }

.eco-date-group        { margin-bottom: 1.2rem; }
.eco-date-group:last-child { margin-bottom: 0; }

.eco-date-header {
  font-size: .75rem; font-weight: 700; color: var(--accent);
  letter-spacing: .06em; text-transform: uppercase;
  padding-bottom: .4rem; border-bottom: 1px solid var(--border);
  margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem;
}

.eco-today-badge {
  font-size: .58rem; background: var(--info-tint); color: var(--accent);
  border-radius: 3px; padding: .1rem .35rem; letter-spacing: .04em;
}

.eco-event-card {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: .6rem .5rem; border-bottom: 1px solid var(--rule);
}
.eco-event-card:last-child { border-bottom: none; }

.eco-event-left  { display: flex; align-items: flex-start; gap: .65rem; flex: 1; }
.eco-impact-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: .3rem; }
.eco-event-name  { font-size: .84rem; font-weight: 600; color: var(--text); }
.eco-event-desc  { font-size: .72rem; color: var(--muted); margin-top: .1rem; line-height: 1.4; }

.eco-event-badges {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: .3rem; flex-shrink: 0; margin-left: .5rem; margin-top: .05rem;
}

.eco-country-badge {
  font-size: .6rem; border-radius: 3px; padding: .1rem .35rem;
  letter-spacing: .04em; white-space: nowrap; font-weight: 600;
  background: var(--rule); color: var(--muted); border: 1px solid var(--border);
}
.eco-country-badge.eco-country-us { color: var(--info); border-color: var(--info-line); background: var(--info-tint); }
.eco-country-badge.eco-country-gb { color: var(--neg); border-color: var(--neg-line);  background: var(--neg-tint);  }

.eco-cat-badge {
  font-size: .62rem; border: 1px solid; border-radius: 3px;
  padding: .1rem .4rem; letter-spacing: .05em;
  white-space: nowrap; flex-shrink: 0;
}

.eco-empty { color: var(--muted); font-size: .85rem; padding: 1rem 0; }

/* ── Options Desk ───────────────────────────────────────────────────────────── */
.opt-page          { padding: 1.5rem 2rem; }
.opt-section-title { font-size: .68rem; font-weight: 700; color: var(--muted);
                     text-transform: uppercase; letter-spacing: .1em; margin-bottom: .75rem; }
.opt-grid          { display: flex; flex-wrap: wrap; gap: .7rem; }
.opt-card          { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                     padding: .9rem 1rem; cursor: pointer; flex: 1;
                     min-width: 120px; max-width: 180px; }
.opt-card:hover    { border-color: var(--accent); }
.opt-card-err      { opacity: .5; cursor: default; }
.opt-card-na       { color: var(--muted); font-size: .75rem; margin-top: .4rem; }
.opt-card-sym      { font-size: .88rem; font-weight: 700; color: var(--accent); margin-bottom: .2rem; }
.opt-card-price    { font-size: .72rem; color: var(--muted); margin-bottom: .55rem; }
.opt-card-row      { display: flex; justify-content: space-between; align-items: center;
                     font-size: .78rem; margin-bottom: .25rem; }
.opt-label         { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.opt-iv-bar-wrap   { height: 3px; background: var(--border); border-radius: 2px; margin: .2rem 0 .35rem; }
.opt-iv-bar        { height: 100%; border-radius: 2px; }
.opt-card-footer   { display: flex; gap: .35rem; margin-top: .4rem; flex-wrap: wrap; }
.opt-vol-tag       { font-size: .6rem; color: var(--muted); background: var(--bg3);
                     border-radius: 3px; padding: .1rem .3rem; }

.opt-table         { width: 100%; border-collapse: collapse; font-size: .81rem; }
.opt-table th      { font-size: .62rem; color: var(--muted); text-transform: uppercase;
                     letter-spacing: .06em; padding: .4rem .6rem; text-align: left;
                     border-bottom: 1px solid var(--border); }
.opt-urow          { border-bottom: 1px solid var(--rule); cursor: pointer; }
.opt-urow:hover    { background: var(--bg2); }
.opt-urow td       { padding: .5rem .6rem; vertical-align: middle; }
.opt-u-sym         { font-weight: 700; color: var(--accent); }
.opt-type-badge    { font-size: .65rem; font-weight: 700; border-radius: 3px; padding: .1rem .35rem; }
.opt-type-badge.pos { background: var(--pos-tint); color: var(--pos); }
.opt-type-badge.neg { background: var(--neg-tint);  color: var(--neg); }
.opt-loading, .opt-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Market Screener ────────────────────────────────────────────────────────── */
.scr-page   { padding: 1.5rem 2rem; }
.scr-tabs   { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scr-tab    { background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
              padding: .35rem .8rem; border-radius: 6px; cursor: pointer;
              font-size: .78rem; font-family: var(--font); }
.scr-tab.active, .scr-tab:hover { border-color: var(--accent); color: var(--accent); }

.scr-section-title { font-size: .7rem; font-weight: 700; color: var(--muted);
                     text-transform: uppercase; letter-spacing: .1em; margin-bottom: .75rem; }
.scr-sub    { font-size: .62rem; font-weight: 400; color: var(--muted);
              text-transform: none; letter-spacing: 0; }

.scr-table  { width: 100%; border-collapse: collapse; font-size: .81rem; }
.scr-table th { font-size: .62rem; color: var(--muted); text-transform: uppercase;
                letter-spacing: .06em; padding: .4rem .6rem; text-align: left;
                border-bottom: 1px solid var(--border); }
.scr-row    { border-bottom: 1px solid var(--rule); cursor: pointer; }
.scr-row:hover { background: var(--bg2); }
.scr-row td { padding: .5rem .6rem; vertical-align: middle; }
.scr-sym    { font-weight: 700; color: var(--accent); }
.scr-name   { color: var(--muted); font-size: .75rem; max-width: 180px;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr-price  { font-weight: 500; white-space: nowrap; }
.scr-mcap   { color: var(--muted); font-size: .78rem; }
.scr-sector { color: var(--muted); font-size: .75rem; }
.scr-near   { color: var(--warn); font-weight: 600; }
.scr-group-header td { font-size: .65rem; font-weight: 700; color: var(--muted);
                        text-transform: uppercase; letter-spacing: .06em;
                        padding: .55rem .6rem .3rem; background: var(--bg3); }
.scr-empty  { color: var(--muted); text-align: center; padding: 1.5rem; font-size: .82rem; }
.scr-loading, .scr-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Yield Curve & Rates ────────────────────────────────────────────────────── */
.yc-page        { padding: 1.5rem 2rem; }
.yc-header      { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.yc-inv-badge   { font-size: .72rem; font-weight: 700; background: var(--neg-tint);
                  color: var(--neg); border: 1px solid var(--neg-line); border-radius: 4px;
                  padding: .2rem .6rem; letter-spacing: .04em; }
.yc-norm-badge  { font-size: .72rem; font-weight: 700; background: var(--pos-tint);
                  color: var(--pos); border: 1px solid var(--pos-line); border-radius: 4px;
                  padding: .2rem .6rem; letter-spacing: .04em; }
.yc-chart-wrap  { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                  padding: 1rem 1.25rem; margin-bottom: 1rem; }
.yc-svg         { width: 100%; max-width: 700px; display: block; }
.yc-no-data     { color: var(--muted); font-size: .82rem; padding: 2rem; text-align: center; }

.yc-bottom      { display: flex; gap: 1rem; flex-wrap: wrap; }
.yc-panel       { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                  padding: 1rem 1.25rem; flex: 1; min-width: 200px; }
.yc-panel-title { font-size: .68rem; font-weight: 700; color: var(--muted);
                  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .75rem; }

.yc-spread-row  { display: flex; justify-content: space-between; padding: .35rem 0;
                  border-bottom: 1px solid var(--rule); font-size: .85rem; }
.yc-spread-row:last-child { border-bottom: none; }
.yc-spread-key  { color: var(--muted); font-size: .78rem; }
.yc-spread-val  { font-weight: 600; }

.yc-cb-grid     { display: flex; flex-wrap: wrap; gap: .6rem; }
.yc-cb-card     { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
                  padding: .6rem .9rem; min-width: 110px; }
.yc-cb-flag     { font-size: .72rem; color: var(--muted); margin-bottom: .15rem; }
.yc-cb-label    { font-size: .65rem; color: var(--muted); }
.yc-cb-rate     { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-top: .2rem; }

.yc-loading, .yc-error, .yc-na { color: var(--muted); padding: 1.5rem; text-align: center; font-size: .85rem; }

/* ── News Feed ──────────────────────────────────────────────────────────────── */
.nf-page      { padding: 1.5rem 2rem; max-width: 900px; }
.nf-tabs      { display: flex; gap: .4rem; margin-bottom: .5rem; flex-wrap: wrap; }
.nf-tab       { background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
                padding: .35rem .8rem; border-radius: 6px; cursor: pointer;
                font-size: .78rem; font-family: var(--font); }
.nf-tab.active, .nf-tab:hover { border-color: var(--accent); color: var(--accent); }

.nf-geo-tabs  { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .75rem; }
.nf-geo-tab   { font-size: .68rem; color: var(--muted); border: 1px solid var(--border);
                background: var(--bg3); padding: .2rem .55rem; border-radius: 4px; cursor: pointer; }
.nf-geo-tab.active, .nf-geo-tab:hover { border-color: var(--gold); color: var(--gold); }

.nf-article   { display: flex; gap: .9rem; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.nf-article:last-child { border-bottom: none; }
.nf-article-content { flex: 1; min-width: 0; }
.nf-image     { display: block; flex: 0 0 132px; width: 132px; height: 88px; border-radius: 5px; overflow: hidden;
                background: var(--bg3); }
.nf-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nf-image:hover { outline: 1px solid var(--accent); }
.nf-image-placeholder { background: transparent; }
.nf-article-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; flex-wrap: wrap; }
.nf-cat-badge { font-size: .6rem; font-weight: 700; border-radius: 3px; padding: .1rem .35rem;
                text-transform: uppercase; letter-spacing: .04em; }
.nf-geo-badge { font-size: .6rem; color: var(--gold); border: 1px solid var(--warn-line);
                background: var(--warn-tint); border-radius: 3px; padding: .1rem .3rem; }
.nf-source    { font-size: .68rem; color: var(--muted); font-weight: 500; }
.nf-time      { font-size: .66rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.nf-headline  { display: block; font-size: .88rem; font-weight: 600; color: var(--text);
                text-decoration: none; line-height: 1.35; margin-bottom: .25rem; }
.nf-headline:hover { color: var(--accent); text-decoration: underline; }
.nf-summary   { font-size: .75rem; color: var(--muted); line-height: 1.5;
                display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nf-empty, .nf-loading, .nf-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }
@media (max-width: 560px) {
  .nf-page { padding: 1rem; }
  .nf-article { gap: .65rem; }
  .nf-image { flex-basis: 96px; width: 96px; height: 72px; }
}

/* ── Macro Dashboard ────────────────────────────────────────────────────────── */
.mc-page          { padding: 1.5rem 2rem; }
.mc-loading, .mc-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }
.mc-section-title { font-size: .85rem; font-weight: 700; color: var(--accent); text-transform: uppercase;
                    letter-spacing: .1em; margin: 1.6rem 0 .7rem; padding-bottom: .4rem;
                    border-bottom: 1px solid var(--border); }

/* Rates + inflation, side by side */
.mc-dual          { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 1100px) { .mc-dual { grid-template-columns: 1fr; } }

.mc-panel         { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                    padding: 1rem 1.1rem; }
.mc-panel-title   { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
                    letter-spacing: .08em; margin-bottom: .5rem; }
.mc-canvas-wrap   { position: relative; height: 300px; }
.mc-notes         { font-size: .68rem; color: var(--muted); margin-top: .6rem; line-height: 1.5; }

/* Bond tenor sections — collapsible, matches the CIO "Full analysis" fold */
.mc-tenor         { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                    margin-bottom: .6rem; overflow: hidden; }
.mc-tenor-head    { display: flex; align-items: center; justify-content: space-between;
                    padding: .75rem 1rem; cursor: pointer; user-select: none; }
.mc-tenor-head:hover { background: var(--bg3); }
.mc-tenor-title   { font-size: .8rem; font-weight: 700; color: var(--text); display: flex;
                    align-items: center; gap: .5rem; }
.mc-tenor-caret   { font-size: .7rem; color: var(--muted); transition: transform .12s; }
.mc-tenor-latest  { display: flex; flex-wrap: wrap; gap: .5rem; }
.mc-tenor-chip    { font-size: .68rem; background: var(--bg3); border: 1px solid var(--border);
                    border-radius: 4px; padding: .2rem .5rem; color: var(--text); white-space: nowrap; }
.mc-tenor-chip .flag { margin-right: .25rem; }
.mc-tenor-body    { padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.mc-tenor-body[hidden] { display: none; }

.mc-unavail       { color: var(--muted); }
.mc-unavail-list  { font-size: .68rem; color: var(--muted); margin-top: .6rem; line-height: 1.6; }
.mc-src-error     { color: var(--warn); }

/* Chart builder */
.mc-builder-row   { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .8rem; }
.mc-builder-field label { display: block; font-size: .63rem; color: var(--muted); text-transform: uppercase;
                    letter-spacing: .05em; margin-bottom: .3rem; }
.mc-builder-field select,
.mc-builder-field input { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
                    color: var(--text); font-family: var(--font); font-size: .78rem; padding: .35rem .5rem; }
.mc-builder-field select[size] { min-width: 260px; }
.mc-b-add         { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
                    color: var(--accent); font-family: var(--font); font-size: .78rem; font-weight: 600;
                    padding: .4rem .8rem; cursor: pointer; height: fit-content; }
.mc-b-add:hover   { border-color: var(--accent); }
.mc-b-chips       { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.mc-b-chip        { display: flex; align-items: center; gap: .5rem; background: var(--bg3);
                    border: 1px solid var(--border); border-radius: 999px; padding: .3rem .5rem .3rem .8rem;
                    font-size: .7rem; color: var(--text); }
.mc-b-chip-label  { white-space: nowrap; }
.mc-b-chip-types  { display: flex; align-items: center; gap: .15rem; background: var(--bg2);
                    border-radius: 999px; padding: .15rem; }
.mc-b-chip-type   { background: none; border: none; color: var(--muted); cursor: pointer;
                    display: flex; align-items: center; justify-content: center;
                    width: 20px; height: 20px; border-radius: 999px; padding: 0; }
.mc-b-chip-type:hover  { color: var(--text); }
.mc-b-chip-type.active { background: var(--bg3); color: var(--accent); }
.mc-b-chip-remove { background: none; border: none; color: var(--muted); cursor: pointer;
                    font-size: .85rem; line-height: 1; padding: 0; }
.mc-b-chip-remove:hover { color: var(--neg); }
.mc-b-warn        { font-size: .68rem; color: var(--warn); margin-bottom: .5rem; }
.mc-b-empty       { color: var(--muted); font-size: .78rem; padding: 1.5rem; text-align: center; }
.mc-b-add-series-btn { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
                    color: var(--accent); font-family: var(--font); font-size: .78rem; font-weight: 600;
                    padding: .45rem .9rem; cursor: pointer; margin-bottom: .8rem; }
.mc-b-add-series-btn:hover { border-color: var(--accent); }
.mc-b-picker-panel:empty { margin-bottom: 0; }
.mc-b-picker-panel  { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
                    padding: .8rem; margin-bottom: .8rem; }
.mc-b-source-choice { display: flex; flex-wrap: wrap; gap: .6rem; }
.mc-b-source-btn  { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
                    color: var(--text); font-family: var(--font); font-size: .82rem; font-weight: 600;
                    padding: 1rem 1.4rem; cursor: pointer; flex: 1 1 180px; text-align: left; }
.mc-b-source-btn:hover { border-color: var(--accent); color: var(--accent); }
.mc-b-picker-back { background: none; border: none; color: var(--muted); font-family: var(--font);
                    font-size: .68rem; cursor: pointer; padding: 0; margin-bottom: .6rem;
                    text-decoration: underline; text-underline-offset: 2px; }
.mc-b-picker-back:hover { color: var(--text); }

/* Data table under the builder chart — same visual language as .fin-table */
.mc-b-table-note { font-size: .68rem; color: var(--muted); margin: .6rem 0 .3rem; }
.mc-b-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; margin-top: .8rem; }
.mc-b-table      { border-collapse: collapse; font-size: .74rem; white-space: nowrap; width: 100%; }
.mc-b-table th, .mc-b-table td { padding: .32rem .6rem; text-align: right; border-bottom: 1px solid var(--border); }
.mc-b-table th:first-child, .mc-b-table td:first-child { text-align: left; position: sticky; left: 0;
  background: var(--bg2); min-width: 160px; color: var(--text); }
.mc-b-table thead th { color: var(--muted); font-weight: 600; font-size: .68rem; background: var(--bg2); }
.mc-b-table td { color: var(--text); }

/* ── FX & Commodities ───────────────────────────────────────────────────────── */
.fx-page        { padding: 1.5rem 2rem; }
.fx-grid        { display: flex; flex-wrap: wrap; gap: 1rem; }
.fx-group       { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                  padding: .9rem 1.1rem; flex: 1; min-width: 220px; max-width: 340px; }
.fx-group-title { font-size: .65rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
                  letter-spacing: .1em; margin-bottom: .6rem; }
.fx-table       { width: 100%; border-collapse: collapse; }
.fx-row         { border-bottom: 1px solid var(--rule); }
.fx-row:last-child { border-bottom: none; }
.fx-row td      { padding: .4rem .2rem; font-size: .82rem; vertical-align: middle; }
.fx-label       { color: var(--text); }
.fx-price       { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; padding-left: .5rem !important; }
.fx-chg         { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: .5rem !important; }
.fx-abs         { text-align: right; color: var(--muted); font-size: .72rem; padding-left: .4rem !important; }
.fx-loading, .fx-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Market Breadth ─────────────────────────────────────────────────────────── */
.mb-page        { padding: 1.5rem 2rem; }
.mb-kpi-row     { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1rem; }
.mb-kpi-card    { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                  padding: .9rem 1.1rem; flex: 1; min-width: 140px; }
.mb-kpi-label   { font-size: .63rem; color: var(--muted); text-transform: uppercase;
                  letter-spacing: .06em; margin-bottom: .35rem; }
.mb-kpi-val     { font-size: 1.2rem; font-weight: 700; margin-bottom: .2rem; }
.mb-kpi-sub     { font-size: .68rem; color: var(--muted); }

.mb-gauges      { display: flex; flex-direction: column; gap: .6rem;
                  background: var(--bg2); border: 1px solid var(--border);
                  border-radius: 8px; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.mb-gauge-wrap  { display: grid; grid-template-columns: 180px 1fr 48px; align-items: center; gap: .6rem; }
.mb-gauge-label { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.mb-gauge-bar-bg{ height: 6px; background: var(--border); border-radius: 3px; }
.mb-gauge-bar   { height: 100%; border-radius: 3px; transition: width .4s ease; }
.mb-gauge-pct   { font-size: .75rem; font-weight: 700; text-align: right; }

.mb-section-title { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
                    letter-spacing: .1em; margin-bottom: .65rem; }
.mb-table       { width: 100%; border-collapse: collapse; font-size: .82rem; max-width: 700px; }
.mb-table th    { font-size: .62rem; color: var(--muted); text-transform: uppercase;
                  letter-spacing: .06em; padding: .4rem .5rem; text-align: left;
                  border-bottom: 1px solid var(--border); }
.mb-sec-row     { border-bottom: 1px solid var(--rule); }
.mb-sec-row td  { padding: .45rem .5rem; vertical-align: middle; }
.mb-sec-name    { color: var(--text); font-size: .8rem; }
.mb-sec-bar-wrap{ height: 5px; background: var(--border); border-radius: 3px; }
.mb-sec-bar     { height: 100%; border-radius: 3px; }
.mb-empty       { color: var(--muted); text-align: center; padding: 1.5rem; }
.mb-loading, .mb-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Sector Rotation ────────────────────────────────────────────────────────── */
.rot-page   { padding: 1.5rem 2rem; }
.rot-table  { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rot-table th { font-size: .62rem; color: var(--muted); text-transform: uppercase;
                letter-spacing: .06em; padding: .45rem .6rem; text-align: left;
                border-bottom: 1px solid var(--border); }
.rot-table th:nth-child(n+4) { text-align: right; }
.rot-row    { border-bottom: 1px solid var(--rule); }
.rot-name   { font-weight: 500; white-space: nowrap; }
.rot-tkr    { color: var(--muted); font-size: .72rem; padding-left: .4rem !important; }
.rot-price  { color: var(--muted); text-align: right; font-size: .78rem; }
.rot-cell   { text-align: right; font-weight: 600; padding: .4rem .6rem !important;
              border-radius: 3px; font-variant-numeric: tabular-nums; }
.rot-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .9rem;
              font-size: .65rem; color: var(--muted); }
.rot-loading, .rot-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Dividends ──────────────────────────────────────────────────────────────── */
.div-page   { padding: 1.5rem 2rem; }
.div-section-title { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
                     letter-spacing: .1em; margin-bottom: .6rem; }
.div-table  { width: 100%; border-collapse: collapse; font-size: .82rem; margin-bottom: .5rem; }
.div-table th { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
                padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.div-row    { border-bottom: 1px solid var(--rule); cursor: pointer; }
.div-row:hover { background: var(--bg2); }
.div-row td { padding: .45rem .6rem; vertical-align: middle; }
.div-sym    { font-weight: 700; color: var(--accent); }
.div-name   { color: var(--muted); font-size: .75rem; max-width: 160px;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.div-empty  { color: var(--muted); text-align: center; padding: 1.5rem; }
.div-loading, .div-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Technical Signals ──────────────────────────────────────────────────────── */
.tech-page  { padding: 1.5rem 2rem; }
.tech-tabs  { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tech-tab   { background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
              padding: .35rem .8rem; border-radius: 6px; cursor: pointer; font-size: .78rem; font-family: var(--font); }
.tech-tab.active, .tech-tab:hover { border-color: var(--accent); color: var(--accent); }
.tech-section-title { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
                      letter-spacing: .1em; margin-bottom: .65rem; }
.tech-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tech-table th { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
                 padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.tech-row   { border-bottom: 1px solid var(--rule); cursor: pointer; }
.tech-row:hover { background: var(--bg2); }
.tech-row td { padding: .45rem .6rem; vertical-align: middle; }
.tech-sym   { font-weight: 700; color: var(--accent); }
.tech-name  { color: var(--muted); font-size: .75rem; max-width: 170px;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tech-loading, .tech-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Analyst Consensus ──────────────────────────────────────────────────────── */
.an-page  { padding: 1.5rem 2rem; }
.an-tabs  { display: flex; gap: .4rem; margin-bottom: 1rem; }
.an-tab   { background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
            padding: .35rem .8rem; border-radius: 6px; cursor: pointer; font-size: .78rem; font-family: var(--font); }
.an-tab.active, .an-tab:hover { border-color: var(--accent); color: var(--accent); }
.an-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.an-table th { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
               padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.an-row   { border-bottom: 1px solid var(--rule); cursor: pointer; }
.an-row:hover { background: var(--bg2); }
.an-row td { padding: .45rem .6rem; vertical-align: middle; }
.an-sym   { font-weight: 700; color: var(--accent); }
.an-name  { color: var(--muted); font-size: .75rem; max-width: 160px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-badge { font-size: .63rem; font-weight: 700; border-radius: 3px; padding: .1rem .35rem;
            text-transform: uppercase; letter-spacing: .03em; }
.an-loading, .an-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Correlation Matrix ──────────────────────────────────────────────────────── */
.corr-page  { padding: 1.5rem 2rem; }
.corr-wrap  { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
              padding: 1rem; display: inline-block; overflow-x: auto; max-width: 100%; }
.corr-svg   { display: block; width: 100%; max-width: 900px; }
.corr-legend{ display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.corr-leg-item { font-size: .65rem; color: var(--text); padding: .2rem .5rem; border-radius: 3px; }
.corr-note  { font-size: .65rem; color: var(--muted); margin-top: .5rem; }
.corr-empty, .corr-loading, .corr-error { color: var(--muted); padding: 2rem; text-align: center; font-size: .85rem; }

/* ── Portfolio value-history chart ──────────────────────────────────────────── */
.pf-value-chart { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
                  padding: .75rem 1rem; }
.pf-chart-svg   { display: block; width: 100%; height: auto; cursor: crosshair; }
.pf-chart-empty { color: var(--muted); font-size: .78rem; padding: 1.4rem; text-align: center; }
.pf-chart-wrap  { position: relative; }
.pf-chart-toggle { display: flex; justify-content: flex-end; gap: .35rem; margin-bottom: .4rem; }
.pf-chart-range-btn { background: transparent; border: 1px solid var(--border); color: var(--muted);
                       border-radius: 5px; font-size: .68rem; padding: .15rem .5rem; cursor: pointer; }
.pf-chart-range-btn:hover  { border-color: var(--muted); color: var(--text); }
.pf-chart-range-btn.active { background: var(--pos); border-color: var(--pos); color: var(--bg); font-weight: 700; }
.pf-chart-tooltip { position: absolute; pointer-events: none; background: var(--bg3); border: 1px solid var(--border);
                     border-radius: 6px; padding: .35rem .55rem; font-size: .68rem; line-height: 1.35;
                     box-shadow: 0 4px 12px var(--overlay); white-space: nowrap; z-index: 5; }
.pf-tt-date { color: var(--muted); margin-bottom: .1rem; }

/* ── Holdings news ─────────────────────────────────────────────────────────── */
.pf-news-group  { margin-bottom: 1rem; }
.pf-news-group:last-child { margin-bottom: 0; }
.pf-news-ticker { font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .04em;
                  margin-bottom: .15rem; }

/* ── Financial statements table ────────────────────────────────────────────── */
.fin-controls { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
                flex-wrap: wrap; margin-bottom: .5rem; }
.fin-tabs { display: flex; gap: .25rem; }
.fin-loading, .fin-error { color: var(--muted); font-size: .78rem; padding: .8rem 0; }
.fin-error { color: var(--neg); }
.fin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.fin-table { border-collapse: collapse; font-size: .74rem; white-space: nowrap; width: 100%; }
.fin-table th, .fin-table td { padding: .32rem .6rem; text-align: right; border-bottom: 1px solid var(--border); }
.fin-table th:first-child, .fin-table td:first-child { text-align: left; position: sticky; left: 0;
  background: var(--bg2); min-width: 190px; }
.fin-table thead th { color: var(--muted); font-weight: 600; font-size: .68rem; background: var(--bg2); }
.fin-row-main td { color: var(--text); }
.fin-row-main:hover td { background: var(--info-tint); }
.fin-row-label { display: flex; align-items: center; gap: .3rem; cursor: pointer; user-select: none; }
.fin-chevron { display: inline-block; transition: transform .12s; color: var(--muted); font-size: .6rem; width: .7rem; }
.fin-row-main.expanded .fin-chevron { transform: rotate(90deg); }
.fin-row-sub td { color: var(--muted); font-style: italic; font-size: .7rem; display: none; }
.fin-row-sub.show td { display: table-cell; }
.fin-row-sub td:first-child { padding-left: 1.7rem; }
.fin-pos { color: var(--pos) !important; }
.fin-neg { color: var(--neg) !important; }

/* ── Proactive portfolio intelligence ───────────────────────────────────── */
.today-page { max-width: 1320px; margin: 0 auto; }
.today-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:2rem; margin-bottom:1.2rem;
              padding:1.5rem; border:1px solid var(--border); border-radius:10px;
              background:linear-gradient(135deg,var(--bg2),var(--bg3)); }
.today-hero h1 { margin:.2rem 0 .35rem; font-size:1.65rem; letter-spacing:-.035em; }
.today-hero p { margin:0; color:var(--muted); font-size:.8rem; max-width:650px; line-height:1.5; }
.today-eyebrow,.today-kicker { color:var(--accent); font-size:.62rem; font-weight:700; text-transform:uppercase; letter-spacing:.14em; }
.today-counts { display:flex; gap:.6rem; }
.today-counts div { min-width:72px; padding:.65rem .85rem; border:1px solid var(--border); background:var(--bg2); border-radius:7px; text-align:center; }
.today-counts strong { display:block; font-size:1.25rem; color:var(--text); }
.today-counts span { color:var(--muted); font-size:.62rem; text-transform:uppercase; letter-spacing:.08em; }
.today-status { color:var(--muted); font-size:.68rem; margin:-.5rem 0 1rem; }
.today-section { background:var(--bg2); border:1px solid var(--border); border-radius:9px; padding:1rem; margin-bottom:1rem; min-width:0; }
.today-section-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:.8rem; }
.today-section h2,.ec-priority h2 { margin:.15rem 0 0; font-size:.95rem; }
.today-tabs { display:flex; gap:.25rem; background:var(--bg3); padding:.2rem; border-radius:6px; }
.today-tabs button { border:0; background:transparent; color:var(--muted); padding:.35rem .65rem; border-radius:4px; cursor:pointer; font:600 .68rem var(--font); }
.today-tabs button.active { background:var(--accent); color:var(--accent-ink); }
.today-queue { display:grid; gap:.55rem; }
.today-item { border:1px solid var(--border); border-left:3px solid var(--muted); border-radius:7px; padding:.8rem; background:var(--bg3); }
.today-item.priority-critical,.today-item.priority-high { border-left-color:var(--neg); }
.today-item.priority-medium { border-left-color:var(--warn); }
.today-item-top { display:flex; flex-wrap:wrap; gap:.5rem; color:var(--muted); font-size:.61rem; text-transform:uppercase; letter-spacing:.07em; }
.today-priority { color:var(--text); font-weight:700; }
.today-item-body { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-top:.45rem; }
.today-item h3 { font-size:.82rem; margin:0 0 .25rem; }
.today-item p { color:var(--muted); font-size:.71rem; line-height:1.45; margin:0; }
.today-open,.today-link { color:var(--accent); font-size:.68rem; white-space:nowrap; text-decoration:none; }
.today-actions { display:flex; justify-content:flex-end; align-items:center; gap:.4rem; border-top:1px solid var(--border); margin-top:.65rem; padding-top:.6rem; color:var(--muted); font-size:.64rem; }
.today-actions button { border:1px solid var(--border); background:var(--bg2); color:var(--text); border-radius:4px; padding:.3rem .55rem; cursor:pointer; font:600 .65rem var(--font); }
.today-actions button:hover { border-color:var(--accent); }
.today-actions input { border:1px solid var(--border); background:var(--bg); color:var(--text); border-radius:4px; padding:.27rem .4rem; font:.64rem var(--font); }
/* Controls only the owner can use (POSTs that src/auth.py refuses for anyone
   else) are hidden rather than left to fail with a 403 toast. */
body:not([data-role="admin"]) .today-actions,
body:not([data-role="admin"]) .wl-add-bar,
body:not([data-role="admin"]) .wl-rm { display:none; }
.today-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1rem; }
.today-empty { color:var(--muted); font-size:.74rem; padding:1.2rem; border:1px dashed var(--border); border-radius:6px; text-align:center; }
.earnings-intel { border:1px solid var(--border); border-radius:7px; padding:.75rem; margin-bottom:.5rem; background:var(--bg3); }
.earnings-intel.reported { border-left:3px solid var(--accent); }
.earnings-intel.upcoming { border-left:3px solid var(--warn); }
.earnings-intel-top { display:flex; justify-content:space-between; gap:1rem; font-size:.72rem; }
.earnings-intel-top span,.earnings-intel-context { color:var(--muted); font-size:.63rem; }
.earnings-intel-context { margin-top:.2rem; }
.earnings-intel p { color:var(--muted); font-size:.7rem; line-height:1.45; }
.earnings-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.35rem; margin-top:.55rem; }
.earnings-metrics div { background:var(--bg2); border:1px solid var(--border); border-radius:4px; padding:.4rem; min-width:0; }
.earnings-metrics span,.earnings-metrics strong { display:block; overflow:hidden; text-overflow:ellipsis; }
.earnings-metrics span { color:var(--muted); font-size:.56rem; text-transform:uppercase; letter-spacing:.05em; }
.earnings-metrics strong { font-size:.7rem; margin-top:.15rem; }
.earnings-unavailable { color:var(--muted); font-size:.6rem; margin-top:.45rem; }
.catalyst-row { display:grid; grid-template-columns:76px minmax(0,1fr) auto; gap:.65rem; align-items:start; padding:.65rem 0; border-bottom:1px solid var(--border); text-decoration:none; }
.catalyst-row:last-child { border-bottom:0; }
.catalyst-row time { color:var(--text-dim); font:.66rem var(--font); }
.catalyst-row strong,.catalyst-row span { display:block; }
.catalyst-row strong { color:var(--text); font-size:.72rem; }
.catalyst-row span { color:var(--muted); font-size:.63rem; margin-top:.18rem; line-height:1.35; }
.catalyst-row em { color:var(--muted); font-size:.57rem; font-style:normal; text-transform:uppercase; }
.ec-priority { border:1px solid var(--border); border-radius:9px; padding:1rem; margin-bottom:1.2rem; background:var(--bg2); scroll-margin-top:1rem; }
.ec-priority-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:.8rem; }
.ec-priority-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
.ec-priority-grid .earnings-intel { margin:0; }

/* Editable scenarios remain visually distinct from historical stress tests. */
.scenario-builder { margin-top:1rem; padding-top:1rem; border-top:1px solid var(--border); }
.scenario-builder-head strong,.scenario-builder-head span { display:block; }
.scenario-builder-head strong { font-size:.8rem; }
.scenario-builder-head span { color:var(--muted); font-size:.65rem; margin-top:.15rem; }
.scenario-inputs { display:grid; grid-template-columns:repeat(4,minmax(90px,1fr)) auto; gap:.55rem; align-items:end; margin:.8rem 0; }
.scenario-inputs label { color:var(--muted); font-size:.62rem; text-transform:uppercase; letter-spacing:.06em; }
.scenario-inputs input { display:block; width:100%; box-sizing:border-box; margin-top:.25rem; background:var(--bg3); border:1px solid var(--border); color:var(--text); border-radius:5px; padding:.45rem; font:.75rem var(--font); }
.scenario-loading,.scenario-warning { color:var(--muted); font-size:.68rem; padding:.6rem 0; }
.scenario-warning { color:var(--warn); }
.scenario-summary { display:flex; gap:.55rem; margin:.65rem 0; }
.scenario-summary div { background:var(--bg3); border:1px solid var(--border); border-radius:6px; padding:.55rem .75rem; }
.scenario-summary span,.scenario-summary strong { display:block; }
.scenario-summary span { color:var(--muted); font-size:.58rem; text-transform:uppercase; }
.scenario-summary strong { font-size:1rem; margin-top:.15rem; }
.scenario-table { margin-top:.5rem; }
.scenario-method { color:var(--muted); font-size:.6rem; margin-top:.5rem; }

/* Macro intelligence is deliberately more editorial than a generic data grid. */
.intel-page { max-width:1360px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.intel-hero { display:flex; justify-content:space-between; gap:1rem; align-items:flex-end; padding:1.4rem 1.55rem; border:1px solid var(--border); border-radius:12px; background:linear-gradient(115deg,var(--bg2),var(--bg3)); }
.intel-hero h1 { margin:.2rem 0; font-size:1.7rem; letter-spacing:-.04em; }
.intel-hero p { margin:0; color:var(--muted); font-size:.78rem; }
.intel-status { margin:.8rem .1rem; color:var(--muted); font:.66rem var(--font); }
.intel-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.85rem; }
.intel-card { min-height:134px; box-sizing:border-box; padding:1rem 1.05rem; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg2); box-shadow:var(--shadow-1); }
.intel-card:hover { border-color:color-mix(in srgb,var(--accent) 55%,var(--border)); }
.intel-label { display:block; color:var(--muted); font-size:.62rem; font-weight:700; letter-spacing:.09em; text-transform:uppercase; }
.intel-value { display:block; margin:.5rem 0 .35rem; font-size:1.08rem; letter-spacing:-.02em; color:var(--text); }
.intel-card p { margin:0; color:var(--muted); font-size:.69rem; line-height:1.5; }
.intel-positive { border-left:3px solid var(--accent); }
.intel-risk { border-left:3px solid var(--neg); }
.intel-muted { border-left:3px solid var(--warn); }
.intel-wide { grid-column:span 2; min-height:176px; }
.intel-count { color:var(--accent); }
.intel-timeline { columns:2; padding-left:1.05rem; margin:.1rem 0 0; }
.intel-timeline li { break-inside:avoid; margin:.35rem 0; color:var(--text); font-size:.71rem; line-height:1.35; }

/* Research workbench and brief-builder controls. */
.research-toolbar { display:flex; gap:.65rem; align-items:center; margin-bottom:.7rem; }
.research-toolbar input,.event-form input { flex:1; background:var(--bg3); border:1px solid var(--border); color:var(--text); border-radius:5px; padding:.55rem .65rem; font:.78rem var(--font); }
.research-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; margin-top:1rem; }
.research-grid h2 { font-size:.78rem; margin:0 0:.7rem; }
.research-output { color:var(--text); font-size:.73rem; line-height:1.55; min-height:3rem; }
.research-output .muted,.muted { color:var(--muted); font-size:.65rem; }
.research-output table { width:100%; border-collapse:collapse; font-size:.65rem; }
.research-output th,.research-output td { text-align:left; padding:.25rem; border-bottom:1px solid var(--border); }
.research-output ul { padding-left:1rem; margin:.15rem 0; }
.research-wide { grid-column:1 / -1; }
.event-form { display:flex; gap:.55rem; margin-bottom:.6rem; }
.toggle-line,.section-choices label { display:block; color:var(--text); font-size:.7rem; margin:.45rem 0; }
.section-choices { padding:.45rem 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); margin:.75rem 0; }
@media (max-width: 1100px) { .research-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Research is a ticker-led desk workflow rather than another dashboard grid. */
.research-page { max-width:1360px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.research-hero { display:flex; justify-content:space-between; align-items:end; gap:2rem; padding:1.5rem 1.65rem; border:1px solid var(--border); border-top:3px solid var(--accent); background:linear-gradient(120deg,var(--bg2),var(--bg3)); }
.research-hero h1,.builder-hero h1 { margin:.18rem 0 .3rem; font-size:1.8rem; letter-spacing:-.045em; }
.research-hero p,.builder-hero p { max-width:600px; margin:0; color:var(--muted); font-size:.78rem; line-height:1.55; }
.research-command { min-width:280px; }
.research-command label { display:block; margin-bottom:.38rem; color:var(--muted); font:700 .62rem var(--font); letter-spacing:.1em; text-transform:uppercase; }
.research-command > div { display:flex; gap:.45rem; }
.research-command input { width:86px; padding:.62rem .72rem; border:1px solid var(--border); border-radius:4px; background:var(--bg); color:var(--text); font:700 .85rem var(--font); text-transform:uppercase; }
.research-status { margin:.75rem .1rem 1.15rem; color:var(--muted); font:.66rem var(--font); }
.research-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(285px,1fr); gap:.9rem; }
.research-lane { border:1px solid var(--border); background:var(--bg2); }
.research-valuation-lane { grid-row:span 2; }
.research-activity-lane { grid-column:span 2; }
.research-lane-heading { display:flex; justify-content:space-between; gap:1rem; padding:.82rem 1rem; border-bottom:1px solid var(--border); background:var(--bg3); }
.research-lane-heading span { color:var(--text-dim); font:700 .62rem var(--font); letter-spacing:.09em; text-transform:uppercase; }
.research-lane-heading p { max-width:360px; margin:0; color:var(--muted); font-size:.66rem; line-height:1.35; text-align:right; }
.research-modules { display:grid; gap:1px; background:var(--border); }
.research-modules-valuation { grid-template-columns:1.35fr 1fr; }
.research-module { min-height:154px; padding:1rem; background:var(--bg2); }
.research-module-featured { min-height:220px; grid-row:span 2; background:linear-gradient(145deg,var(--bg2),color-mix(in srgb,var(--accent) 7%,var(--bg2))); }
.research-module h2 { margin:0 0 .85rem; color:var(--muted); font:700 .65rem var(--font); letter-spacing:.07em; text-transform:uppercase; }
.research-modules-stacked { grid-template-columns:1fr; }
.research-modules-stacked .research-module { min-height:188px; }
.research-modules-activity { grid-template-columns:minmax(260px,.8fr) minmax(0,1.6fr); }
.research-event-module { min-height:180px; }

/* SEC filing intelligence: dense chronological feed with analysis on demand. */
.filings-page { max-width:1360px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.filings-hero { display:flex; justify-content:space-between; align-items:end; gap:2rem; padding:1.5rem 1.65rem; border:1px solid var(--border); border-top:3px solid var(--accent); background:linear-gradient(120deg,var(--bg2),var(--bg3)); }
.filings-hero h1 { margin:.18rem 0 .3rem; font-size:1.8rem; letter-spacing:-.045em; }
.filings-hero p { max-width:650px; margin:0; color:var(--muted); font-size:.78rem; line-height:1.55; }
.filings-command { min-width:430px; }
.filings-command label { display:block; margin-bottom:.38rem; color:var(--muted); font:700 .62rem var(--font); letter-spacing:.1em; text-transform:uppercase; }
.filings-command > div { display:flex; gap:.45rem; }
.filings-command input { width:90px; padding:.62rem .72rem; border:1px solid var(--border); border-radius:4px; background:var(--bg); color:var(--text); font:700 .85rem var(--font); text-transform:uppercase; }
.filings-toolbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin:.8rem 0; }
.filings-toolbar p { margin:0; color:var(--muted); font-size:.68rem; }
.filings-filters { display:flex; gap:.25rem; padding:.22rem; border:1px solid var(--border); border-radius:5px; background:var(--bg2); }
.filings-filters button { border:0; border-radius:3px; padding:.38rem .6rem; background:transparent; color:var(--muted); cursor:pointer; font:600 .65rem var(--font); }
.filings-filters button.active { background:var(--accent); color:var(--accent-ink); }
.filings-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); border:1px solid var(--border); background:var(--bg2); margin-bottom:.8rem; }
.filings-summary > div { display:grid; gap:.2rem; padding:.75rem 1rem; border-left:1px solid var(--border); }
.filings-summary > div:first-child { border-left:0; }
.filings-summary strong { font-size:1rem; }
.filings-summary span { color:var(--muted); font-size:.61rem; text-transform:uppercase; letter-spacing:.06em; }
.filings-list { display:grid; gap:1px; border:1px solid var(--border); background:var(--border); }
.filing-row { display:grid; grid-template-columns:92px 145px 76px minmax(240px,1fr) auto; align-items:center; gap:.85rem; padding:.85rem 1rem; background:var(--bg2); }
.filing-row:hover { background:var(--bg3); }
.filing-date { color:var(--text-dim); font:600 .65rem var(--font); }
.filing-identity { display:grid; gap:.15rem; min-width:0; }
.filing-identity strong { font-size:.78rem; }
.filing-identity span { overflow:hidden; color:var(--muted); font-size:.61rem; text-overflow:ellipsis; white-space:nowrap; }
.filing-form { justify-self:start; padding:.25rem .38rem; border:1px solid var(--border); border-radius:3px; color:var(--text); background:var(--bg); font:700 .61rem var(--font); }
.filing-form-8k,.filing-form-sc13d { border-color:color-mix(in srgb,var(--warn) 55%,var(--border)); color:var(--warn); }
.filing-form-10k,.filing-form-10q { border-color:color-mix(in srgb,var(--accent) 55%,var(--border)); color:var(--accent); }
.filing-copy h2 { margin:0 0 .18rem; font-size:.75rem; line-height:1.35; }
.filing-copy p { margin:0; color:var(--muted); font-size:.62rem; }
.filing-actions { display:flex; align-items:center; gap:.35rem; }
.filing-actions a,.filing-actions button { border:1px solid var(--border); border-radius:4px; padding:.35rem .5rem; color:var(--text); background:var(--bg); font:600 .62rem var(--font); text-decoration:none; cursor:pointer; }
.filing-actions a:hover,.filing-actions button:hover { border-color:var(--accent); }
.filing-detail { grid-column:1 / -1; margin:.25rem -1rem -.85rem; padding:1rem; border-top:1px solid var(--border); background:var(--bg); }
.filing-detail-grid { display:grid; grid-template-columns:minmax(200px,.65fr) minmax(340px,1fr); gap:1rem; }
.filing-detail-grid section { padding:.8rem; border:1px solid var(--border); background:var(--bg2); }
.filing-detail-grid h3 { margin:0 0 .6rem; color:var(--muted); font:700 .63rem var(--font); text-transform:uppercase; letter-spacing:.07em; }
.filing-detail-grid strong,.filing-detail-grid li { font-size:.7rem; line-height:1.45; }
.filing-detail-grid ul,.filing-detail-grid ol { margin:.55rem 0 0; padding-left:1.15rem; }
.filing-detail-grid li { margin:.35rem 0; }
.filing-change-section { grid-column:1 / -1; }
.filing-table-wrap { overflow-x:auto; }
.filing-table-wrap table { width:100%; border-collapse:collapse; font-size:.65rem; }
.filing-table-wrap th,.filing-table-wrap td { padding:.35rem; border-bottom:1px solid var(--border); text-align:right; white-space:nowrap; }
.filing-table-wrap th:first-child,.filing-table-wrap td:first-child { text-align:left; }
.filings-empty { padding:1.5rem; color:var(--muted); background:var(--bg2); font-size:.72rem; text-align:center; }

/* No-code alert builder and saved rule monitors. */
.alerts-page { max-width:1260px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.alerts-hero { display:flex; justify-content:space-between; align-items:center; gap:2rem; padding:1.5rem 1.65rem; border:1px solid var(--border); border-top:3px solid var(--accent); background:linear-gradient(120deg,var(--bg2),var(--bg3)); }
.alerts-hero h1 { margin:.18rem 0 .3rem; font-size:1.8rem; letter-spacing:-.045em; }
.alerts-hero p { max-width:670px; margin:0; color:var(--muted); font-size:.78rem; line-height:1.55; }
.alerts-stats { display:grid; min-width:132px; padding:.8rem 1rem; border:1px solid var(--border); background:var(--bg); text-align:right; }
.alerts-stats strong { font-size:1.4rem; }
.alerts-stats span { color:var(--muted); font-size:.62rem; }
.alert-builder,.saved-alerts { margin-top:1rem; border:1px solid var(--border); background:var(--bg2); }
.alert-builder > header,.saved-alerts > header { display:flex; justify-content:space-between; align-items:center; padding:.85rem 1rem; border-bottom:1px solid var(--border); background:var(--bg3); }
.alert-builder h2,.saved-alerts h2 { margin:.1rem 0 0; font-size:.92rem; }
.alerts-kicker { margin:0; color:var(--accent); font:700 .59rem var(--font); letter-spacing:.1em; text-transform:uppercase; }
.alert-builder form { padding:1rem; }
.alert-fields { display:grid; grid-template-columns:minmax(210px,1.5fr) repeat(5,minmax(120px,1fr)); gap:.7rem; }
.alert-fields label { display:grid; gap:.35rem; }
.alert-fields label > span,.alert-condition-heading span { color:var(--muted); font:700 .61rem var(--font); letter-spacing:.06em; text-transform:uppercase; }
.alert-fields input,.alert-fields select,.alert-condition select,.alert-condition input { min-width:0; padding:.55rem .6rem; border:1px solid var(--border); border-radius:4px; background:var(--bg); color:var(--text); font:.69rem var(--font); }
.alert-condition-heading { display:flex; justify-content:space-between; align-items:end; margin:1rem 0 .55rem; padding-top:.8rem; border-top:1px solid var(--border); }
.alert-condition-heading > div { display:grid; gap:.2rem; }
.alert-condition-heading small { color:var(--text-dim); font-size:.61rem; }
.alert-conditions { display:grid; gap:.45rem; }
.alert-condition { display:grid; grid-template-columns:38px minmax(180px,1.5fr) minmax(130px,1fr) minmax(100px,.6fr) 30px; align-items:center; gap:.45rem; }
.alert-condition-grip { color:var(--accent); font:800 .6rem var(--font); letter-spacing:.08em; }
.alert-condition > button { width:30px; height:30px; border:1px solid var(--border); border-radius:4px; background:transparent; color:var(--muted); cursor:pointer; font-size:1rem; }
.alert-condition > button:hover { border-color:var(--neg); color:var(--neg); }
.alert-form-footer { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-top:.85rem; }
.alert-form-footer p { margin:0; color:var(--muted); font-size:.63rem; }
.alert-rule-list { display:grid; gap:1px; background:var(--border); }
.alert-rule-card { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.9rem 1rem; background:var(--bg2); }
.alert-rule-card.disabled { opacity:.55; }
.alert-rule-main { min-width:0; }
.alert-rule-meta { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; color:var(--text-dim); font:700 .57rem var(--font); letter-spacing:.06em; }
.alert-priority { padding:.18rem .32rem; border:1px solid var(--border); border-radius:3px; }
.alert-priority-high { color:var(--neg); border-color:color-mix(in srgb,var(--neg) 50%,var(--border)); }
.alert-priority-medium { color:var(--warn); border-color:color-mix(in srgb,var(--warn) 50%,var(--border)); }
.alert-priority-low { color:var(--accent); border-color:color-mix(in srgb,var(--accent) 50%,var(--border)); }
.alert-rule-main h3 { margin:.35rem 0 .22rem; font-size:.8rem; }
.alert-rule-main p { margin:0 0 .3rem; color:var(--muted); font-size:.68rem; line-height:1.4; }
.alert-rule-main small { color:var(--text-dim); font-size:.59rem; }
.alert-rule-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.3rem; }
.alert-rule-actions button { padding:.35rem .48rem; border:1px solid var(--border); border-radius:4px; background:var(--bg); color:var(--text); cursor:pointer; font:600 .61rem var(--font); }
.alert-rule-actions button:hover { border-color:var(--accent); }
.alert-rule-actions button.danger:hover { border-color:var(--neg); color:var(--neg); }
.alerts-empty { padding:1.5rem; color:var(--muted); background:var(--bg2); font-size:.72rem; text-align:center; }

/* Brief Builder reads as a delivery plan, with every profile as an editor. */
.builder-page { max-width:1160px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.builder-hero { display:flex; justify-content:space-between; align-items:center; gap:2rem; padding:1.5rem 1.65rem; border:1px solid var(--border); background:var(--bg2); }
.builder-flow { display:flex; border:1px solid var(--border); background:var(--bg); }
.builder-flow span { display:grid; gap:.25rem; min-width:84px; padding:.7rem .8rem; border-left:1px solid var(--border); }
.builder-flow span:first-child { border-left:0; }
.builder-flow b { color:var(--text); font-size:.68rem; }
.builder-flow small { color:var(--text-dim); font:.63rem var(--font); }
.edition-editors { display:grid; gap:.8rem; margin-top:1rem; }
.edition-editor { display:grid; grid-template-columns:205px 1fr; border:1px solid var(--border); border-left:4px solid var(--accent); background:var(--bg2); }
.edition-preopen { border-left-color:var(--warn); }
.edition-closing { border-left-color:var(--neg); }
.edition-loading { display:block; padding:1rem; color:var(--muted); }
.edition-identity { display:flex; gap:.75rem; align-items:start; padding:1.1rem 1rem; border-right:1px solid var(--border); background:var(--bg3); }
.edition-identity > span { color:var(--text-dim); font:700 .7rem var(--font); }
.edition-identity h2 { margin:0 0 .28rem; font-size:1rem; letter-spacing:-.02em; }
.edition-identity p { margin:0; color:var(--muted); font:.65rem var(--font); }
.edition-editor-body { display:grid; grid-template-columns:155px 1fr auto; align-items:center; gap:1rem; padding:.85rem 1rem; }
.edition-editor .toggle-line { margin:0; color:var(--text); font-size:.72rem; }
.edition-editor .section-choices { display:flex; flex-wrap:wrap; gap:.35rem .75rem; margin:0; padding:.3rem 0; border:0; }
.edition-editor .section-choices label { margin:0; color:var(--muted); font-size:.68rem; white-space:nowrap; }

@media (max-width: 820px) {
  .today-hero,.today-item-body { align-items:flex-start; flex-direction:column; }
  .today-grid,.ec-priority-grid { grid-template-columns:1fr; }
  .research-grid { grid-template-columns:1fr; }
  .research-page,.builder-page,.filings-page,.alerts-page { padding:1rem; }
  .research-hero,.builder-hero { align-items:flex-start; flex-direction:column; }
  .research-command { min-width:0; width:100%; }
  .research-layout { grid-template-columns:1fr; }
  .research-valuation-lane,.research-activity-lane { grid-row:auto; grid-column:auto; }
  .research-modules-valuation,.research-modules-activity { grid-template-columns:1fr; }
  .research-module-featured { grid-row:auto; }
  .research-lane-heading { align-items:flex-start; flex-direction:column; }
  .research-lane-heading p { text-align:left; }
  .filings-hero,.filings-toolbar { align-items:flex-start; flex-direction:column; }
  .filings-command { min-width:0; width:100%; }
  .filings-command > div { flex-wrap:wrap; }
  .filings-filters { max-width:100%; overflow-x:auto; }
  .filings-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .filings-summary > div:nth-child(3) { border-top:1px solid var(--border); border-left:0; }
  .filings-summary > div:nth-child(4) { border-top:1px solid var(--border); }
  .filing-row { grid-template-columns:78px 1fr auto; }
  .filing-form { grid-column:3; grid-row:1; }
  .filing-copy { grid-column:1 / -1; }
  .filing-actions { grid-column:1 / -1; }
  .filing-detail-grid { grid-template-columns:1fr; }
  .filing-change-section { grid-column:auto; }
  .alerts-hero,.alert-rule-card,.alert-form-footer { align-items:flex-start; flex-direction:column; }
  .alerts-stats { min-width:110px; text-align:left; }
  .alert-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .alert-condition { grid-template-columns:32px 1fr 1fr; }
  .alert-condition input { grid-column:2 / 3; }
  .alert-condition > button { grid-column:3; grid-row:2; }
  .alert-rule-actions { justify-content:flex-start; }
  .builder-flow { width:100%; }
  .builder-flow span { flex:1; min-width:0; }
  .edition-editor { grid-template-columns:1fr; }
  .edition-identity { border-right:0; border-bottom:1px solid var(--border); }
  .edition-editor-body { grid-template-columns:1fr; align-items:start; }
  .intel-page { padding:1rem; }
  .intel-hero { align-items:flex-start; flex-direction:column; }
  .intel-grid { grid-template-columns:1fr; }
  .intel-wide { grid-column:auto; }
  .intel-timeline { columns:1; }
  .scenario-inputs { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .scenario-inputs button { grid-column:1 / -1; }
  .earnings-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .today-section-head { align-items:flex-start; flex-direction:column; }
}

/* ── History (brief archive) ───────────────────────────────────────────────── */

.hist-range {
  font-size: .78rem; color: var(--muted); letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.hist-flip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--bg3); border: 1px solid var(--accent-line);
  border-radius: var(--radius-md); font-size: .95rem;
}
.hist-flip-steady { border-color: var(--border); }
.hist-flip-tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--accent-tint); color: var(--accent);
}
.hist-flip-steady .hist-flip-tag { background: var(--bg2); color: var(--muted); }

.hist-risks { display: grid; gap: 8px; }
.hist-risk {
  display: grid; grid-template-columns: minmax(140px, 1fr) auto auto auto;
  gap: 10px; align-items: center;
  padding: 10px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem; font-variant-numeric: tabular-nums;
}
.hist-risk-label { font-weight: 600; color: var(--text-dim); }
.hist-risk-from { color: var(--muted); }
.hist-risk-arrow { color: var(--faint); }
.hist-risk-to { color: var(--text); font-weight: 600; }

.hist-empty {
  padding: 16px; color: var(--muted); font-size: .85rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); line-height: 1.55;
}

.hist-analogues {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.hist-analogue {
  padding: 14px 16px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.hist-analogue-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.hist-analogue-head strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.hist-analogue-dist { font-size: .72rem; color: var(--muted); }
.hist-analogue-conds {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.hist-analogue-conds span {
  font-size: .72rem; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .03em;
}
.hist-analogue-outcome {
  font-size: .82rem; color: var(--text-dim); padding-top: 10px;
  border-top: 1px solid var(--rule);
}

/* ── Decision journal ──────────────────────────────────────────────────────── */

.jr-scorecard {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.jr-stat {
  padding: 12px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.jr-stat span {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin-bottom: 6px;
}
.jr-stat strong {
  font-size: 1.15rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text);
}

.jr-decision {
  margin-bottom: 16px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden;
}
.jr-decision-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.jr-decision-head strong { font-size: .9rem; font-variant-numeric: tabular-nums; }
.jr-decision-meta {
  display: block; font-size: .72rem; color: var(--muted); margin-top: 3px;
}
.jr-decision-score {
  display: flex; align-items: baseline; gap: 10px;
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.jr-hit { font-size: .72rem; font-weight: 600; color: var(--muted); }
.jr-reason {
  color: var(--muted); font-size: .78rem; max-width: 380px; line-height: 1.5;
}
.jr-unscored { color: var(--faint); font-size: .76rem; font-style: italic; }

.jr-drift {
  margin-bottom: 10px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
/* Flagged rows get the warn tone, not the loss tone: a drifted thesis is a
   prompt to re-read the position, not a statement that it has lost money. */
.jr-drift-flagged { border-color: var(--warn-line); background: var(--warn-tint); }
.jr-drift-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; font-variant-numeric: tabular-nums;
}
.jr-drift-head strong { font-size: .95rem; }
.jr-drift-tag {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--warn); color: var(--accent-ink);
}
.jr-drift-sim { font-size: .74rem; color: var(--muted); }
.jr-drift-body {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.jr-drift-body span {
  display: block; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin-bottom: 5px;
}
.jr-drift-body p {
  margin: 0; font-size: .84rem; line-height: 1.55; color: var(--text-dim);
}

@media (max-width: 720px) {
  .hist-risk { grid-template-columns: 1fr; gap: 4px; }
  .hist-risk-arrow { display: none; }
  .jr-decision-head { align-items: flex-start; }
  .jr-reason { max-width: none; }
}

/* ── Section rail (in-page nav for the dashboard) ──────────────────────────── */

.section-rail {
  position: sticky;
  /* Sits directly under the topbar, which is itself sticky at 0. */
  top: var(--topbar-h, 56px);
  z-index: 40;
  display: flex; gap: 4px; align-items: center;
  padding: 8px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.section-rail::-webkit-scrollbar { display: none; }
.section-rail[hidden] { display: none; }

.section-rail-link {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  color: var(--muted); text-decoration: none;
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.section-rail-link:hover { color: var(--text); background: var(--bg3); }
.section-rail-link.active {
  color: var(--accent);
  background: var(--accent-tint);
}
.section-rail-link:focus-visible {
  outline: 2px solid var(--accent-line); outline-offset: 1px;
}

@media (max-width: 720px) {
  .section-rail { padding: 6px 16px; }
  .section-rail-link { font-size: .7rem; padding: 4px 9px; }
}

/* Anchor targets for the section rail. scroll-margin-top keeps a jumped-to
   heading below the sticky topbar + rail instead of underneath them.

   Deliberately NO `scroll-behavior: smooth` here. It was tried and, in the
   Chromium build behind the desktop app's browser pane, it does not merely
   skip the animation — it swallows the anchor navigation outright, leaving
   every rail chip dead. An instant jump works in every engine, and the rail
   is navigation, not decoration. */
.brief-section[id], .section[id] {
  scroll-margin-top: calc(var(--topbar-h, 56px) + 56px);
}

/* ── Accounts: sidebar box, notices, account and admin pages ───────────────── */

.nav-account {
  margin: 18px 12px 8px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg2); font-size: .78rem;
}
.nav-account-name { font-weight: 700; color: var(--text); word-break: break-all; }
.nav-account-name span {
  margin-left: 6px; font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--accent); background: var(--accent-tint);
  padding: 2px 6px; border-radius: var(--radius-pill);
}
.nav-account-usage { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.nav-account-links { margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.nav-account-links a, .nav-account-privacy { color: var(--text-dim); text-decoration: none; }
.nav-account-links a:hover, .nav-account-privacy:hover { color: var(--accent); }
.nav-account-links form { margin: 0; }
.nav-account-links button {
  background: none; border: 0; padding: 0; color: var(--text-dim);
  font: inherit; cursor: pointer;
}
.nav-account-links button:hover { color: var(--neg); }
.nav-account-signin {
  display: block; text-align: center; padding: 8px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
}
.nav-account-signin:hover { background: var(--accent-hi); }
.nav-account-privacy { display: inline-block; margin-top: 8px; font-size: .72rem; }

.auth-notice {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px;
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: .85rem; z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.auth-notice.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.auth-notice a { color: var(--accent); font-weight: 700; margin-left: 6px; }

.ai-locked {
  margin: 0 0 1rem; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg2); border: 1px dashed var(--border); color: var(--text-dim);
  font-size: .85rem;
}
.ai-locked a { color: var(--accent); font-weight: 700; margin-left: 4px; }

.acct-note {
  margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-tint); border: 1px solid var(--accent-line); font-size: .86rem;
}
.acct-note-warn { background: var(--warn-tint); border-color: var(--warn-line); }
.acct-note-error { background: var(--neg-tint); border-color: var(--neg-line); color: var(--neg); }
.acct-secret {
  display: inline-block; margin: 4px 4px 4px 0; padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); font-size: .95rem; user-select: all;
}
.acct-form { display: grid; gap: 10px; max-width: 420px; }
.acct-form label { display: grid; gap: 5px; font-size: .74rem; font-weight: 600; color: var(--text-dim); }
.acct-form input, .acct-form select, .acct-row-form input, .acct-row-form select {
  height: 38px; padding: 0 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: .88rem;
}
.acct-form input:focus, .acct-row-form input:focus {
  outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-ring);
}
.acct-inline { max-width: none; grid-auto-flow: column; justify-content: start; align-items: end; }
.acct-hint { margin: 4px 0 0; font-size: .76rem; color: var(--muted); line-height: 1.5; }
.acct-hint a { color: var(--text-dim); }
.acct-btn {
  display: inline-block; height: 38px; padding: 0 16px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700;
  font-size: .85rem; cursor: pointer; text-decoration: none; line-height: 38px;
}
.acct-btn:hover { background: var(--accent-hi); }
.acct-btn-ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
.acct-btn-ghost:hover { background: var(--bg3); }
.acct-btn-danger { background: var(--neg-tint); color: var(--neg); border: 1px solid var(--neg-line); }
.acct-btn-danger:hover { background: var(--neg-line); }
.acct-btn-small { height: 30px; line-height: 30px; padding: 0 10px; font-size: .76rem; }
.acct-list { margin: 0 0 14px; padding-left: 18px; line-height: 1.7; font-size: .86rem; color: var(--text-dim); }
.acct-danger { border-color: var(--neg-line); }
.acct-table td { vertical-align: middle; }
.acct-row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acct-row-form input[type=number] { width: 76px; }
.acct-used { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.acct-actions form { margin: 0; }
.acct-you {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent);
  margin-left: 4px;
}
.acct-disabled td { opacity: .55; }
.acct-prose p { font-size: .9rem; line-height: 1.65; color: var(--text-dim); max-width: 72ch; }
.acct-prose h2 { margin-top: 0; }

@media (max-width: 720px) {
  .acct-inline { grid-auto-flow: row; }
}
