:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --panel: #0f1522;
  --panel-2: #161b22;
  --panel-3: #1c2230;
  --border: #21262d;
  --border-2: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  --radius: 10px;
  --pad: 1rem;
  --row-pad: .75rem;
  --font-size: .92rem;
  --topbar-h: 56px;
  --ribbon-h: 40px;
  --sidebar-w: 240px;
}
body.density-dense {
  --pad: .6rem;
  --row-pad: .45rem;
  --font-size: .82rem;
  --radius: 7px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: var(--font-size);
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; height: var(--topbar-h);
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; flex-shrink: 0; }
.logo { color: var(--accent); font-size: 1.4rem; }
.brand-name { font-size: 1rem; letter-spacing: .01em; }
.topbar-actions { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.topbar-actions button { font-size: .82rem; }

.market-status {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: .78rem;
}
.market-status:hover { background: var(--panel-3); }
.market-status .market-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}
.market-status.open .market-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(63,185,80,.15); }
.market-status.pre  .market-dot { background: var(--amber); }
.market-status.closed .market-dot { background: var(--muted); }
.market-status.open .market-label  { color: var(--green); }
.market-status.pre .market-label   { color: var(--amber); }
.market-status .market-sub { font-size: .72rem; }
@media (max-width: 720px) { .market-status .market-sub { display: none; } }

.search { position: relative; flex: 1; max-width: 520px; }
.search input {
  width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: .55rem .75rem; border-radius: var(--radius); font-size: .9rem; font-family: inherit;
}
.search input:focus { outline: none; border-color: var(--accent); background: #101826; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0,0,0,.45); overflow: hidden; z-index: 50;
  max-height: 400px; overflow-y: auto;
}
.search-item {
  padding: .55rem .75rem; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.search-item:last-child { border-bottom: none; }
.search-item.highlight, .search-item:hover { background: var(--panel-3); }
.search-sym { font-weight: 700; color: var(--accent); min-width: 70px; }
.search-meta { display: flex; gap: .4rem; align-items: center; flex: 1; min-width: 0; font-size: .8rem; }
.search-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.search-tag { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- RIBBON ---------- */
.ribbon {
  display: flex; align-items: center; gap: .3rem;
  padding: 0 1rem; height: var(--ribbon-h);
  background: var(--panel-2); border-bottom: 1px solid var(--border);
  overflow: hidden; white-space: nowrap;
  position: sticky; top: var(--topbar-h); z-index: 30;
}
.ribbon-track {
  display: inline-flex; align-items: center; gap: .3rem;
  flex: 1; min-width: 0;
}
.ribbon-track.marquee {
  animation: marquee 45s linear infinite;
  will-change: transform;
}
.ribbon-track.marquee:hover { animation-play-state: paused; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.ribbon-item {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .25rem .6rem; border-radius: 6px; font-size: .82rem;
  transition: background .1s; flex-shrink: 0;
}
.ribbon-item:hover { background: var(--panel-3); }
.ribbon-sym { font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.ribbon-price { font-variant-numeric: tabular-nums; }
.ribbon-change { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .78rem; }
.ribbon-change.gain { color: var(--green); }
.ribbon-change.loss { color: var(--red); }
.ribbon-refresh { margin-left: auto; flex-shrink: 0; padding: .25rem .55rem; font-size: .82rem; }

/* ---------- LAYOUT ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; flex: 1; min-height: 0; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 1rem .75rem; display: flex; flex-direction: column;
  position: sticky; top: calc(var(--topbar-h) + var(--ribbon-h)); align-self: start;
  height: calc(100vh - var(--topbar-h) - var(--ribbon-h));
  overflow-y: auto;
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 1rem; }
.nav a {
  padding: .5rem .65rem; border-radius: 7px; font-size: .9rem; color: var(--text);
}
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: rgba(88,166,255,.12); color: var(--accent); }
.nav-badge {
  display: inline-block; float: right; background: var(--red); color: white;
  font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px;
  margin-top: 1px;
}

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  margin: .5rem .3rem .4rem;
}
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: .9rem;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--border-2); }

.lists { list-style: none; padding: 0; margin: 0 0 1rem; }
.lists li { border-radius: 7px; margin-bottom: 2px; }
.lists li.active { background: rgba(88,166,255,.1); }
.lists li.active .list-link { color: var(--accent); }
.list-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem .65rem; font-size: .88rem; color: var(--text);
}
.list-link:hover { background: var(--panel-2); border-radius: 7px; }
.lists .count { color: var(--muted); font-size: .75rem; }

.footer-note { margin-top: auto; color: var(--muted); padding: .4rem .3rem; }

/* ---------- MAIN ---------- */
.content { padding: 1.25rem 1.75rem 3rem; max-width: 1280px; width: 100%; min-width: 0; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.15rem;
}
.page-head h1 { margin: 0; font-size: 1.45rem; }
.muted { color: var(--muted); font-size: .85rem; }
body.density-dense .page-head h1 { font-size: 1.2rem; }

.controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.controls label { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
select, button, input {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: .5rem .7rem; border-radius: 7px; font-size: .86rem; font-family: inherit;
}
body.density-dense select, body.density-dense button, body.density-dense input { padding: .32rem .55rem; font-size: .8rem; }
button { cursor: pointer; }
button:hover { background: var(--panel-3); }
button:disabled { opacity: .55; cursor: wait; }
button.ghost { background: transparent; padding: .3rem .6rem; font-size: .8rem; border-color: var(--border); }
button.ghost:hover { background: var(--panel-2); }
button.ghost.danger { color: var(--red); border-color: rgba(248,81,73,.25); }
button.ghost.danger:hover { background: rgba(248,81,73,.08); }
.btn-link { display: inline-flex; align-items: center; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 7px; font-size: .8rem; }
.btn-link:hover { background: var(--panel-2); }

/* ---------- ADD ROW ---------- */
.add-row form { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.add-row input { flex: 1; min-width: 180px; }
.add-row button[type="submit"] { background: #238636; border-color: #2ea043; font-weight: 600; }
.add-row button[type="submit"]:hover { background: #2ea043; }

/* ---------- SUMMARY STATS ---------- */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1.15rem; }
body.density-dense .summary { gap: .5rem; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; }
body.density-dense .stat { padding: .5rem .65rem; }
.stat-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.55rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
body.density-dense .stat-value { font-size: 1.15rem; }
.stat.buy .stat-value, .gain { color: var(--green); }
.stat.sell .stat-value, .loss { color: var(--red); }
.stat.hold .stat-value { color: var(--amber); }

/* ---------- PANELS ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
body.density-dense .panel { padding: .65rem .85rem; margin-bottom: .75rem; }
.panel-head {
  font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .6rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.panel.danger-panel { border-color: rgba(248,81,73,.25); }

/* ---------- HOME: movers & list grid ---------- */
.mover-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .35rem; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.mover-link {
  flex: 1 1 auto; display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(110px, 1fr) 95px 85px;
  align-items: center; gap: .6rem;
  text-decoration: none; color: inherit;
}
.mover-sector { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .mover-row { grid-template-columns: 1fr auto; gap: .35rem; }
  .mover-row .mover-sector { grid-column: 1 / -1; order: 3; font-size: .75rem; }
}
.sell-grid .mover-row { grid-template-columns: 80px 70px 1fr; }

.buy-filters {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem 0 .7rem;
  border-bottom: 1px solid var(--border); margin-bottom: .5rem;
}
.buy-filters label { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; }
.buy-filters select, .buy-filters input { padding: .35rem .55rem; font-size: .82rem; }
.mover-row:last-child { border-bottom: none; }
.mover-row:hover { background: var(--panel-2); border-radius: 5px; }
.mover-sym { font-weight: 700; }
.mover-price { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.empty-tiny { color: var(--muted); font-size: .85rem; padding: .5rem 0; }

.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .65rem; }
.list-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: .75rem .85rem; transition: border-color .1s;
}
.list-card:hover { border-color: var(--border-2); background: var(--panel-3); }
.list-card-name { font-weight: 600; font-size: .95rem; }
.list-card-meta { display: flex; justify-content: space-between; margin-top: .25rem; font-size: .78rem; color: var(--text); }

/* ---------- TABLE ---------- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--row-pad) .85rem; border-bottom: 1px solid var(--border); font-size: var(--font-size); text-align: left; }
th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: .3rem; justify-content: flex-end; }
.ticker-link:hover { color: var(--accent); }
.gain { color: var(--green); }
.loss { color: var(--red); }

.pill {
  display: inline-block; padding: .14rem .55rem; border-radius: 999px;
  font-weight: 700; font-size: .7rem; letter-spacing: .05em;
}
.pill.BUY { background: rgba(63,185,80,.15); color: var(--green); }
.pill.SELL { background: rgba(248,81,73,.15); color: var(--red); }
.pill.HOLD { background: rgba(210,153,34,.15); color: var(--amber); }
.pill.STRONG_BUY { background: rgba(63,185,80,.25); color: #4ade80; box-shadow: 0 0 0 1px rgba(63,185,80,.35); }
.pill.WATCH { background: rgba(139,148,158,.15); color: var(--muted); }
.pill.TRIM { background: rgba(248,150,73,.15); color: #f8964a; }
.pill.EXIT { background: rgba(248,81,73,.25); color: var(--red); box-shadow: 0 0 0 1px rgba(248,81,73,.35); }
.error { color: var(--red); font-size: .82rem; }

.empty { color: var(--muted); padding: 2.5rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- CHART TOOLBAR ---------- */
.chart-toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center;
  padding: .55rem .75rem; margin-bottom: .65rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.toolbar-label {
  font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  margin-right: .25rem;
}
.chip-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.chip-group-label { color: var(--muted); font-size: .75rem; margin-right: .2rem; }
.chip-row-actions { display: inline-flex; gap: .3rem; margin-left: auto; }
.chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
  padding: .28rem .6rem; border-radius: 999px; font-size: .78rem; font-family: inherit;
  cursor: pointer; transition: background .1s, border-color .1s, color .1s;
}
.chip:hover { background: var(--panel-3); color: var(--text); }
.chip.active { background: rgba(88,166,255,.15); border-color: rgba(88,166,255,.45); color: var(--accent); }
.chip.ghost { border-style: dashed; }

/* ---------- CHARTS (ticker detail) ---------- */
.charts { display: grid; gap: .75rem; margin-bottom: 1rem; }
.chart-slot {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .65rem; height: 300px; position: relative;
}
.chart-slot.price-slot { height: 460px; }
.chart-slot .tf-select {
  position: absolute; top: .35rem; right: .4rem; z-index: 2;
  background: var(--panel); color: var(--muted); border: 1px solid var(--border);
  padding: .2rem .4rem; border-radius: 5px; font-size: .72rem;
  font-family: inherit;
}
.chart-slot .tf-select:hover, .chart-slot .tf-select:focus { color: var(--text); border-color: var(--border-2); }
.chart-slot canvas { width: 100% !important; height: 100% !important; }
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.chart-pair .chart-slot { height: 260px; }
@media (max-width: 900px) {
  .chart-pair { grid-template-columns: 1fr; }
  .chart-slot.price-slot { height: 380px; }
  .chart-slot { height: 260px; }
}

/* ---------- KEY STATS ---------- */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .75rem; }
.kv > div { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .87rem; }
.kv > div:nth-last-child(-n+2) { border-bottom: none; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-variant-numeric: tabular-nums; }

.reasons { margin: 0; padding-left: 1.1rem; color: #c9d1d9; font-size: .88rem; }
.reasons li { margin-bottom: .25rem; }

.why-signal { margin: 0; }
.why-signal > summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .2rem 0 .4rem;
}
.why-signal > summary::-webkit-details-marker { display: none; }
.why-signal[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: .6rem; padding-bottom: .55rem; }
.why-signal > summary strong { color: var(--text); font-size: 1rem; }

.breakdown-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.breakdown-list > li {
  display: grid; grid-template-columns: 44px 1fr; gap: .65rem; align-items: flex-start;
  padding: .5rem .65rem; background: var(--panel-2); border-radius: 7px;
}
.bd-score {
  font-weight: 700; font-size: .95rem; text-align: center;
  font-variant-numeric: tabular-nums; padding-top: 2px;
}
.bd-name { font-weight: 600; font-size: .9rem; }
.bd-reason { color: #c9d1d9; font-size: .85rem; margin-top: .15rem; }
.bd-learn { margin-top: .3rem; }
.bd-learn > summary { cursor: pointer; font-size: .75rem; list-style: none; }
.bd-learn > summary::-webkit-details-marker { display: none; }
.bd-learn[open] > summary::after { content: " ▴"; }
.bd-learn:not([open]) > summary::after { content: " ▾"; }
.bd-learn p { margin: .3rem 0 0; font-size: .8rem; line-height: 1.45; }

.bd-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: .65rem; padding: .5rem .65rem;
  background: var(--panel-2); border-radius: 7px; font-size: .88rem;
}
.bd-total strong { font-variant-numeric: tabular-nums; }
.bd-total .pill { margin-left: .3rem; }

.prose { line-height: 1.55; color: #c9d1d9; margin: 0; font-size: .9rem; }

/* ---------- SENTIMENT STRIP (ticker detail, above charts) ---------- */
.sentiment-strip {
  display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
  padding: .55rem .85rem; margin-bottom: 1rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: .85rem; text-decoration: none;
}
.sentiment-strip:hover { background: var(--panel-2); }
.sentiment-strip .strip-label {
  font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.sentiment-strip .strip-body { display: inline-flex; flex-wrap: wrap; gap: .7rem 1.15rem; align-items: center; }
.sentiment-strip .strip-cell { display: inline-flex; align-items: baseline; gap: .35rem; }
.sentiment-strip .strip-cell .muted { font-size: .72rem; }
.sentiment-strip .strip-expand { margin-left: auto; font-size: .72rem; }

/* ---------- SENTIMENT ---------- */
.sentiment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
@media (max-width: 700px) { .sentiment-grid { grid-template-columns: 1fr; } }
.sent-box {
  background: var(--panel-2); border: 1px solid var(--border);
  padding: .65rem .85rem; border-radius: 8px;
}
.sent-box .stat-value { font-size: 1.1rem; font-weight: 600; margin: .2rem 0 .25rem; }
.sent-box .muted { font-size: .78rem; }

.news { list-style: none; padding: 0; margin: 0; }
.news li { padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.news li:last-child { border-bottom: none; }
.news a { color: var(--accent); }
.news a:hover { text-decoration: underline; }

/* ---------- DENSITY PICKER ---------- */
.kv-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem 1rem; }
.kv-settings label {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem;
  padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.kv-settings label:last-child { border-bottom: none; }
.kv-settings label > span:first-child { color: var(--muted); }
.kv-settings label select, .kv-settings label input { min-width: 120px; }
@media (max-width: 700px) { .kv-settings { grid-template-columns: 1fr; } }

.density-picker { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.density-picker button {
  text-align: left; padding: 1rem; border-radius: 10px; background: var(--panel-2);
  border: 1px solid var(--border);
}
.density-picker button.active { border-color: var(--accent); background: rgba(88,166,255,.07); }
.density-picker .dp-sample {
  display: flex; flex-direction: column; gap: 4px;
  padding: .55rem .65rem; background: var(--bg); border-radius: 6px;
  margin-bottom: .65rem;
}
.density-picker .dp-sample i { display: block; height: 8px; background: var(--border-2); border-radius: 2px; }
.density-picker .dp-sample.dense i { height: 4px; }
.dp-label { font-weight: 600; font-size: .95rem; }
.dp-sub { display: block; margin-top: .15rem; font-size: .8rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 1rem; }
  .topbar { gap: .5rem; }
  .search { max-width: none; }
}

/* ---------- MODAL ---------- */
.mm-modal {
  position: fixed; inset: 0; background: rgba(4,8,14,.78);
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  z-index: 90; backdrop-filter: blur(5px);
}
.mm-modal-card {
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px;
  width: 100%; max-width: 460px; padding: 1.25rem 1.4rem;
  box-shadow: 0 24px 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: .85rem;
}
.mm-modal-card header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.mm-modal-card header h2 { margin: 0; font-size: 1.15rem; }
.mm-modal-card p.muted { margin: 0; }
.mm-modal-card input[type="text"] {
  width: 100%; padding: .65rem .8rem; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-size: .95rem;
}
.mm-modal-card input[type="text"]:focus { outline: none; border-color: var(--accent); }
.mm-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.mm-modal-actions button {
  padding: .55rem 1rem; font-size: .9rem; font-weight: 600;
  background: #238636; border-color: #2ea043;
}
.mm-modal-actions button:hover { background: #2ea043; }
.mm-modal-actions button.ghost { background: transparent; border-color: var(--border); font-weight: 500; }
.mm-modal-actions button.ghost:hover { background: var(--panel-2); }
.mm-modal-actions button.danger { background: #8b2a2a; border-color: #da3633; }
.mm-modal-actions button.danger:hover { background: #da3633; }

.mm-choices { display: flex; flex-direction: column; gap: .35rem; max-height: 60vh; overflow: auto; }
.mm-choice {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: .65rem .8rem; text-align: left; cursor: pointer; color: var(--text);
}
.mm-choice:hover { background: var(--panel-3); border-color: var(--border-2); }
.mm-choice-label { font-weight: 600; font-size: .95rem; }
.mm-choice-sub { font-size: .78rem; margin-top: .15rem; }
.mm-choice.ghost { border-style: dashed; color: var(--accent); }

.welcome-card { max-width: 520px; }
.welcome-steps { display: flex; flex-direction: column; gap: .75rem; margin: .4rem 0 .2rem; }
.welcome-steps > div { display: flex; gap: .75rem; align-items: flex-start; }
.welcome-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(88,166,255,.15); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}

/* ---------- SIGNAL HELP ---------- */
.signal-help { color: #c9d1d9; font-size: .9rem; line-height: 1.5; max-height: 60vh; overflow-y: auto; padding-right: .25rem; }
.signal-help h3 { margin: 1rem 0 .35rem; font-size: .8rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.signal-help h3:first-of-type { margin-top: .5rem; }
.help-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.help-list li { padding: .4rem .55rem; background: var(--panel-2); border-radius: 6px; font-size: .85rem; }
.help-list li strong { display: inline-block; min-width: 140px; color: var(--text); }
.help-list .pill { margin-right: .35rem; vertical-align: middle; }

/* ---------- TOAST ---------- */
.mm-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  padding: .65rem 1.1rem; border-radius: 999px; font-size: .88rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 100;
}

/* ---------- PLAIN-ENGLISH BLOCK ---------- */
.plain-english {
  background: rgba(88,166,255,.06); border: 1px solid rgba(88,166,255,.18);
  border-radius: 10px; padding: 1rem 1.15rem; margin-bottom: 1rem;
}
.plain-english h3 {
  margin: 0 0 .4rem; font-size: .75rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
}
.plain-english p { margin: 0; line-height: 1.55; color: #c9d1d9; }

/* ---------- OWNED BADGE ---------- */
.owned-badge {
  display: inline-block; margin-left: .5rem; padding: .1rem .5rem;
  background: rgba(88,166,255,.15); color: var(--accent);
  border-radius: 4px; font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em;
}
.divergence-panel { border-color: rgba(210,153,34,.35); }
.divergence-row {
  display: grid; grid-template-columns: 24px 1fr auto; gap: .7rem; align-items: center;
  padding: .6rem .7rem; border-radius: 8px; margin-bottom: .35rem;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: .88rem;
}
.divergence-row:hover { background: var(--panel-3); }
.divergence-row.high { border-left: 3px solid var(--red); }
.divergence-row.medium { border-left: 3px solid var(--amber); }
.divergence-row.info { border-left: 3px solid var(--accent); }
.div-icon { font-size: 1.2rem; text-align: center; }
.div-body { min-width: 0; }
.divergence-row .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.divergence-banner {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1rem;
  background: rgba(210,153,34,.08); border: 1px solid rgba(210,153,34,.3);
  color: var(--text); font-size: .9rem;
}
.divergence-banner.high { background: rgba(248,81,73,.08); border-color: rgba(248,81,73,.35); }
.divergence-banner.info { background: rgba(88,166,255,.08); border-color: rgba(88,166,255,.3); }
.divergence-banner .div-icon { font-size: 1.4rem; }
.divergence-banner strong { color: var(--text); }
.divergence-banner p { color: #c9d1d9; line-height: 1.5; }

.source-badge {
  display: inline-block; margin-left: .5rem; padding: .1rem .45rem;
  border-radius: 4px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; cursor: pointer;
  user-select: none;
}
.source-badge.session {
  background: rgba(88,166,255,.18); color: var(--accent);
  border: 1px solid rgba(88,166,255,.35);
}
.source-badge.manual {
  background: rgba(139,148,158,.15); color: var(--muted);
  border: 1px solid rgba(139,148,158,.25);
}
.source-badge.schwab {
  background: rgba(0,150,220,.18); color: #4dc2ff;
  border: 1px solid rgba(0,150,220,.35);
}

.schwab-panel { border-color: rgba(248,150,73,.3); }
.schwab-warning-strip {
  background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.3);
  border-radius: 8px; padding: .7rem .9rem; margin-bottom: .7rem;
  color: #c9d1d9; font-size: .82rem;
}
.schwab-warning-strip strong { color: var(--red); display: block; margin-bottom: .3rem; }
.schwab-warning-strip ul { margin: 0; padding-left: 1.2rem; }
.schwab-warning-strip li { margin-bottom: .3rem; line-height: 1.45; }
.schwab-warning-strip code {
  background: var(--panel-2); padding: 1px 6px; border-radius: 4px;
  font-size: .78rem; font-family: ui-monospace, monospace;
}
.schwab-setup {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px;
  padding: .55rem .75rem; margin-bottom: .7rem;
}
.schwab-setup > summary {
  cursor: pointer; list-style: none; color: var(--accent); font-size: .88rem;
}
.schwab-setup > summary::-webkit-details-marker { display: none; }
.schwab-setup > summary::before {
  content: "▸ "; color: var(--muted);
}
.schwab-setup[open] > summary::before { content: "▾ "; }
.source-badge:hover { filter: brightness(1.15); }

.account-analytics { margin-top: 1rem; }
.account-analytics .panel { margin-bottom: 1rem; }

.totals-row td {
  background: var(--panel-2); font-weight: 600;
  border-top: 2px solid var(--border-2);
}
.totals-row td strong { color: var(--text); }

/* ---------- GLOSSARY ---------- */
.glossary-list {
  max-height: 55vh; overflow-y: auto; padding-right: .25rem;
  display: flex; flex-direction: column; gap: .55rem;
  margin-top: .5rem;
}
.glossary-entry {
  padding: .55rem .75rem; background: var(--panel-2); border-radius: 7px;
  border: 1px solid var(--border);
}
.glossary-term { font-weight: 700; color: var(--accent); font-size: .88rem; margin-bottom: .15rem; }
.glossary-def { color: #c9d1d9; font-size: .85rem; line-height: 1.5; }

/* ---------- GUIDED TOUR ---------- */
.mm-tour-overlay {
  /* Transparent outer — dimming is done via box-shadow on the spotlight element itself.
     pointer-events: none lets the user still scroll the page under the tour card. */
  position: fixed; inset: 0; z-index: 95;
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
/* When no element is spotlit, fall back to a dim overlay */
.mm-tour-overlay.no-spotlight { background: rgba(4,8,14,.55); pointer-events: auto; }
.mm-tour-card {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 2vh;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px;
  width: calc(100% - 2rem); max-width: 540px; padding: 1rem 1.25rem 1.1rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  pointer-events: auto;
  transition: top .25s ease, bottom .25s ease;
}

/* Spotlight: 4 fixed divs framing the target element form the dim mask.
   Keeps rendering cheap (no 9999px shadows) and avoids stacking-context issues. */
.tour-spot-frame {
  position: fixed; background: rgba(4,8,14,.72);
  z-index: 94; pointer-events: auto;
  transition: top .2s, left .2s, width .2s, height .2s;
}
.tour-spotlight {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px;
  border-radius: 6px;
  transition: outline .2s;
}
.mm-tour-progress {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .4rem;
}
.mm-tour-card h2 { margin: 0 0 .45rem; font-size: 1.1rem; }
.mm-tour-card p { margin: 0 0 .75rem; color: #c9d1d9; font-size: .9rem; line-height: 1.5; }
.mm-tour-dots {
  display: flex; gap: .25rem; margin: .6rem 0;
  justify-content: center;
}
.tour-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background .1s;
}
.tour-dot.done { background: rgba(88,166,255,.4); }
.tour-dot.active { background: var(--accent); transform: scale(1.3); }

.footer-link {
  color: var(--muted); text-decoration: none; font-size: .78rem;
}
.footer-link:hover { color: var(--accent); }

.backtest-intro {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .75rem 1rem; margin-bottom: 1rem;
}
.backtest-intro > summary {
  cursor: pointer; display: flex; align-items: center; gap: .6rem;
  list-style: none; color: var(--text);
}
.backtest-intro > summary::-webkit-details-marker { display: none; }
.backtest-intro > summary::before {
  content: "▸"; transition: transform .15s; color: var(--muted);
}
.backtest-intro[open] > summary::before { transform: rotate(90deg); }
.backtest-intro-body { padding-top: .7rem; border-top: 1px solid var(--border); margin-top: .6rem; color: #c9d1d9; font-size: .92rem; }
.backtest-intro-body ol { margin: .4rem 0; padding-left: 1.4rem; }
.backtest-intro-body ol li { margin-bottom: .3rem; }

.home-portfolio { margin-bottom: 1rem; }
.home-port-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem;
}
@media (max-width: 1100px) { .home-port-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .home-port-grid { grid-template-columns: repeat(2, 1fr); } }
.hp-stat {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .75rem;
}
.hp-val { font-size: 1.15rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.hp-val.small { font-size: .95rem; }
.hp-stat.gain .hp-val { color: var(--green); }
.hp-stat.loss .hp-val { color: var(--red); }

.price-freshness {
  display: inline-block; margin-left: .5rem; padding: .05rem .4rem;
  background: rgba(210,153,34,.12); color: var(--amber);
  border-radius: 4px; font-size: .72rem; cursor: help;
}

.buy-action { flex-shrink: 0; font-size: .72rem; padding: .25rem .55rem; }
.mover-row > .buy-action:hover { background: rgba(63,185,80,.15); border-color: rgba(63,185,80,.4); color: var(--green); }

.trending-badge {
  display: inline-block; margin-left: .35rem; padding: .1rem .5rem;
  background: rgba(210,153,34,.2); color: var(--amber);
  border-radius: 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em;
}

.budget-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem .35rem .55rem; border-radius: 999px;
  background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.3);
  color: var(--text); font-size: .82rem; cursor: pointer; font-family: inherit;
  position: relative;
}
.budget-pill:hover { background: rgba(63,185,80,.2); }
.budget-pill .bud-icon { font-size: .95rem; }
.budget-pill .bud-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.budget-pill .bud-amount { font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.budget-pill .bud-sep { color: var(--muted); }
.budget-pill .bud-used { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.budget-pill .bud-bar {
  display: inline-block; width: 46px; height: 4px;
  background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden;
  margin-left: .25rem;
}
.budget-pill .bud-bar-fill {
  display: block; height: 100%;
  background: var(--green); transition: width .2s;
}
.budget-pill.hot { background: rgba(210,153,34,.12); border-color: rgba(210,153,34,.35); }
.budget-pill.hot .bud-amount { color: var(--amber); }
.budget-pill.hot .bud-bar-fill { background: var(--amber); }
.budget-pill.overbudget { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.35); }
.budget-pill.overbudget .bud-amount { color: var(--red); }
.budget-pill.overbudget .bud-bar-fill { background: var(--red); }
@media (max-width: 900px) {
  .budget-pill .bud-label, .budget-pill .bud-sep, .budget-pill .bud-used { display: none; }
}

.refresh-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: .8rem; cursor: pointer; font-family: inherit;
}
.refresh-pill:hover { background: var(--panel-3); }
.refresh-pill.active { background: rgba(88,166,255,.08); border-color: rgba(88,166,255,.3); }
.refresh-pill.active .ref-countdown { color: var(--accent); }
.refresh-pill.running .ref-icon { animation: spin 1s linear infinite; }
.refresh-pill .ref-icon { font-size: .95rem; line-height: 1; }
.refresh-pill .ref-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.refresh-pill .ref-countdown { font-variant-numeric: tabular-nums; color: var(--muted); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (max-width: 900px) { .refresh-pill .ref-label { display: none; } }

.chart-hint {
  display: flex; flex-wrap: wrap; gap: .25rem .5rem;
  font-size: .75rem; margin: .15rem .2rem .75rem;
}
.chart-hint > span:first-child { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; margin-right: .15rem; }

.data-source-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: .78rem; color: var(--text); cursor: pointer;
}
.data-source-pill:hover { background: var(--panel-3); }
.data-source-pill .ds-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}
.data-source-pill.av .ds-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,.15); }
.data-source-pill.av .ds-label { color: var(--accent); }
.data-source-pill.schwab .ds-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(63,185,80,.18); }
.data-source-pill.schwab .ds-label { color: var(--green); }
.data-source-pill.yahoo .ds-dot { background: var(--muted); }
.data-source-pill.fallback .ds-dot { background: var(--amber); }
.data-source-pill.fallback .ds-label { color: var(--amber); }
@media (max-width: 900px) { .data-source-pill .ds-label { display: none; } }

/* AI analysis panel (ticker detail) */
.ai-panel {
  border: 1px solid var(--border-2);
  background: linear-gradient(180deg, rgba(88,166,255,.04) 0%, var(--panel) 60%);
}
.ai-panel .panel-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem; }
.ai-result { display: flex; flex-direction: column; gap: .75rem; }
.ai-verdict-row {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding-bottom: .4rem; border-bottom: 1px dashed var(--border);
}
.ai-verdict-row .pill { font-size: .9rem; padding: .3rem .7rem; }
.ai-headline {
  font-size: 1rem; line-height: 1.45; margin: 0;
  color: var(--text);
}
.ai-columns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 700px) { .ai-columns { grid-template-columns: 1fr; } }
.ai-col h4 { margin: 0 0 .35rem; font-size: .85rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.ai-col ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; line-height: 1.55; }
.ai-col ul li { margin-bottom: .3rem; }
.ai-col-bull { border-left: 3px solid rgba(63,185,80,.4); padding-left: .6rem; }
.ai-col-bear { border-left: 3px solid rgba(248,81,73,.4); padding-left: .6rem; }
.ai-plan {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem .9rem;
}
.ai-plan h4 { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.ai-plan-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .6rem .9rem; font-size: .95rem;
}
.ai-plan-grid > div > .muted {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem;
}
.ai-size { margin: .5rem 0 0; font-size: .85rem; }
.ai-risks h4 { margin: 0 0 .35rem; font-size: .85rem; color: var(--amber); font-weight: 600; }
.ai-risks ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; line-height: 1.55; }
.ai-risks ul li { margin-bottom: .3rem; }
.ai-disclaimer {
  font-size: .75rem; padding: .4rem .6rem;
  background: rgba(210,153,34,.06); border: 1px solid rgba(210,153,34,.18);
  border-radius: var(--radius); line-height: 1.45;
}

/* Scanner (screener page) */
.scanner-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .55rem .75rem;
}
.scanner-filters label {
  display: flex; flex-direction: column; gap: .2rem;
  font-size: .78rem;
}
.scanner-filters label > span:first-child {
  color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
}
.scanner-filters input,
.scanner-filters select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: .35rem .5rem; font-size: .88rem; font-family: inherit;
  width: 100%;
}
.scanner-filters input:focus, .scanner-filters select:focus {
  outline: none; border-color: var(--accent);
}

.scanner-table th.sortable { cursor: pointer; user-select: none; }
.scanner-table th.sortable:hover { color: var(--accent); }
.scanner-table th.sortable.active { color: var(--accent); }
.scanner-table th .sort-arrow {
  font-size: .7rem; margin-left: .2rem; color: var(--muted);
}
.scanner-table th.sortable.active .sort-arrow { color: var(--accent); }

/* Version badge (bottom-left, fixed) */
.version-badge {
  position: fixed; left: .6rem; bottom: .6rem; z-index: 40;
  padding: .25rem .55rem;
  font-size: .7rem; font-family: inherit; color: var(--muted);
  background: rgba(13,17,23,.75); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; user-select: none;
  transition: color 100ms, border-color 100ms, background 100ms;
}
.version-badge:hover {
  color: var(--accent); border-color: var(--accent);
  background: rgba(13,17,23,.95);
}

/* Patch notes modal */
.patch-notes-card {
  max-width: 640px; width: 92vw; max-height: 82vh;
  display: flex; flex-direction: column;
  padding: 0;
}
.patch-notes-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem .5rem;
  border-bottom: 1px solid var(--border);
}
.patch-notes-head h2 { font-size: 1.2rem; }
.patch-notes-body {
  overflow-y: auto;
  padding: .75rem 1.25rem;
  flex: 1; min-height: 0;
}
.patch-release {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}
.patch-release:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.patch-release-head {
  display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
  margin-bottom: .45rem;
}
.patch-version-badge {
  background: rgba(88,166,255,.12); color: var(--accent);
  padding: .1rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.patch-release-title { font-size: 1rem; color: var(--text); }
.patch-release-date { font-size: .75rem; font-variant-numeric: tabular-nums; }
.patch-items {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: .5rem;
}
.patch-items li {
  display: flex; gap: .6rem; align-items: flex-start;
  line-height: 1.45; font-size: .88rem;
}
.patch-icon {
  flex-shrink: 0; width: 1.5rem; text-align: center;
  font-size: 1.05rem; line-height: 1.2;
}
.patch-text { flex: 1; color: var(--text); }
.patch-notes-card .mm-modal-actions {
  border-top: 1px solid var(--border);
  padding: .75rem 1.25rem;
  margin: 0;
}

/* View-mode toggle (header) */
.view-mode-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text);
  font-size: .8rem; cursor: pointer;
  transition: border-color 100ms ease, background 100ms ease;
}
.view-mode-toggle:hover { border-color: var(--accent); }
.view-mode-toggle strong { font-weight: 700; letter-spacing: .01em; }
.view-mode-toggle .vm-hint { color: var(--muted); font-weight: 400; }
.view-mode-toggle .vm-indicator {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.view-mode-toggle.basic .vm-indicator {
  background: #58a6ff; box-shadow: 0 0 0 3px rgba(88,166,255,.18);
}
.view-mode-toggle.advanced .vm-indicator {
  background: #bc8cff; box-shadow: 0 0 0 3px rgba(188,140,255,.18);
}
.view-mode-toggle.basic    strong { color: #58a6ff; }
.view-mode-toggle.advanced strong { color: #bc8cff; }
@media (max-width: 720px) { .view-mode-toggle .vm-hint { display: none; } }

/* Upcoming events (ticker page) */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .7rem;
}
.event-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.event-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.event-date {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.event-meta {
  font-size: .78rem; line-height: 1.4;
}

/* Sector heatmap (Home) */
.sector-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .5rem;
}
.sector-tile {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .65rem .8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  text-decoration: none; color: var(--text);
  transition: transform 80ms ease, border-color 80ms ease;
  min-height: 88px;
}
.sector-tile:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.sec-name {
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  color: rgba(255,255,255,.85);
}
.sec-pct {
  font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.95);
}
.sec-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .72rem; color: rgba(255,255,255,.65);
}
.sec-breadth { display: inline-flex; gap: .35rem; font-variant-numeric: tabular-nums; }
.sec-breadth .gain { color: #b6f3c6; }
.sec-breadth .loss { color: #ffb6b3; }
.sec-leader { font-size: .72rem; color: rgba(255,255,255,.7); }
.sec-leader .gain { color: #b6f3c6; }

/* Sector breadth (Home) */
.breadth-list { display: flex; flex-direction: column; gap: .35rem; }
.breadth-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  gap: .7rem; align-items: center;
  padding: .35rem .5rem;
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: background 80ms ease;
}
.breadth-row:hover { background: var(--panel-2); }
.breadth-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadth-bar {
  display: flex; align-items: stretch;
  height: 20px; border-radius: 3px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--border);
}
.breadth-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 600; color: #0d1117;
  min-width: 0; overflow: hidden;
}
.breadth-seg.buy  { background: #3fb950; }
.breadth-seg.hold { background: #8b949e; }
.breadth-seg.sell { background: #f85149; }
.breadth-net { font-size: .82rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .breadth-row { grid-template-columns: 100px 1fr 50px; gap: .4rem; }
  .breadth-name { font-size: .72rem; }
}

/* Top movers (Home) */
.movers-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 720px) { .movers-grid { grid-template-columns: 1fr; } }
.movers-head {
  margin: 0 0 .4rem; font-size: .85rem; font-weight: 600;
  letter-spacing: .02em;
}
.movers-head.gain { color: var(--green); }
.movers-head.loss { color: var(--red); }
.movers-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.movers-table td { padding: .3rem .35rem; border-bottom: 1px solid var(--border); }
.movers-table tr:last-child td { border-bottom: none; }
.movers-table tr:hover { background: var(--panel-2); }
.mover-tk { font-weight: 700; color: var(--accent); text-decoration: none; }
.mover-tk:hover { text-decoration: underline; }
.mover-sec { font-size: .75rem; }
.mover-px { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.mover-pct { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; min-width: 70px; }

/* AI loading indicator — animated spinner + live elapsed timer + pulsing label */
.ai-loading {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1rem;
  background: rgba(88,166,255,.06);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: var(--radius);
  font-size: .9rem; line-height: 1.45;
}
.ai-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(88,166,255,.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin .9s linear infinite;
  flex: 0 0 auto;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loading-text { flex: 1; min-width: 0; }
.ai-loading-text strong { color: var(--text); }
.ai-loading-elapsed {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  font-size: .82rem;
  padding: .2rem .55rem;
  background: rgba(88,166,255,.1);
  border-radius: 999px;
  flex: 0 0 auto;
}
.ai-loading-pulse::after {
  content: '';
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: ai-dots 1.6s steps(4, end) infinite;
}
@keyframes ai-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
