/* AlgoEdge Research — Design System */
/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --bg:       #ffffff;
  --bg2:      #f9fafb;
  --bg3:      #f3f4f6;
  --border:   rgba(0,0,0,.08);
  --border2:  rgba(0,0,0,.14);

  --text:     #111827;
  --text2:    #6b7280;
  --text3:    #9ca3af;

  --green:    #15803d;
  --green-bg: #f0fdf4;
  --amber:    #92400e;
  --amber-bg: #fffbeb;
  --red:      #991b1b;
  --red-bg:   #fef2f2;
  --blue:     #1d4ed8;
  --blue-bg:  #eff6ff;

  --radius-sm: 5px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0f1117;
    --bg2:      #161b22;
    --bg3:      #1c2128;
    --border:   rgba(255,255,255,.08);
    --border2:  rgba(255,255,255,.14);
    --text:     #e6edf3;
    --text2:    #8b949e;
    --text3:    #6e7681;
    --green:    #3fb950;
    --green-bg: #0d2116;
    --amber:    #e3b341;
    --amber-bg: #271e0e;
    --red:      #f85149;
    --red-bg:   #2d0f0e;
    --blue:     #58a6ff;
    --blue-bg:  #0d1f38;
  }
}

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

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-sans); }
input, select { font-family: var(--font-sans); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 9px; }

/* ── Layout ── */
.app-shell { display: grid; grid-template-columns: 200px 1fr; height: 100vh; overflow: hidden; }

@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .three-col { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .nb-grid { grid-template-columns: 1fr; }
}

/* ── Sidebar ── */
.sidebar {
  background: var(--bg2);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sb-brand {
  padding: 16px 16px 12px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.sb-wordmark { font-size: 14px; font-weight: 500; color: var(--text); }
.sb-tag { font-size: 10px; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }
.sb-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.sb-section { font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); padding: 8px 8px 3px; }
.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  border: none; background: transparent; width: 100%; text-align: left;
  font-size: 13px; color: var(--text2); margin-bottom: 1px;
  transition: background .12s, color .12s;
}
.sb-item:hover { background: var(--bg3); color: var(--text); }
.sb-item.active { background: var(--bg3); color: var(--text); font-weight: 500; }
.sb-item svg { width: 13px; height: 13px; flex-shrink: 0; opacity: .6; }
.sb-item.active svg { opacity: 1; }
.live-pip { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex-shrink: 0; animation: livepulse 2s infinite; }
@keyframes livepulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.sb-foot {
  padding: 10px 14px;
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}
.sb-user { display: flex; align-items: center; gap: 8px; }
.sb-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg3); border: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500; color: var(--text2); flex-shrink: 0;
}
.sb-uname { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-uplan { font-size: 10px; color: var(--text3); }
.sb-signout {
  background: none; border: none; color: var(--text3);
  font-size: 13px; padding: 3px 5px; border-radius: 4px;
  cursor: pointer; flex-shrink: 0; line-height: 1;
}
.sb-signout:hover { background: var(--bg3); color: var(--text2); }

/* ── Main area ── */
.main { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.tb-title { font-size: 14px; font-weight: 500; }
.tb-subtitle { font-size: 11px; color: var(--text3); margin-top: 1px; font-family: var(--font-mono); }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.live-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--green); font-family: var(--font-mono);
}
.live-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; border: 0.5px solid var(--border2); background: transparent; color: var(--text2); transition: all .12s; }
.btn:hover { background: var(--bg3); color: var(--text); }
.btn-primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn-primary:hover { opacity: .85; background: var(--text); }

/* ── Content ── */
.content { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
/* Notebooks screen needs full-height, no padding so iframe fills all space */
.content.no-pad { padding: 0; overflow: hidden; gap: 0; min-height: 0; }

/* ── Screens ── */
.screen { display: none; flex-direction: column; gap: 14px; }
/* flex-shrink:0 prevents flex from collapsing the screen to fit the viewport.
   .content{overflow-y:auto} then handles scrolling naturally. */
.screen.active { display: flex; flex-shrink: 0; }

/* ── Metric cards ── */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex-shrink: 0; }
.metric { background: var(--bg2); border-radius: var(--radius); padding: 11px 13px; }
.metric-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.metric-value { font-size: 20px; font-weight: 500; letter-spacing: -.025em; line-height: 1; }
.metric-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }
.val-green { color: var(--green); }
.val-amber { color: var(--amber); }
.val-red { color: var(--red); }

/* ── Grids ── */
.two-col { display: grid; grid-template-columns: minmax(0,1fr) 204px; gap: 10px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ── Cards ── */
.card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 0.5px solid var(--border);
}
.card-title { font-size: 12px; font-weight: 500; }
.card-action { font-size: 11px; color: var(--text3); cursor: pointer; font-family: var(--font-mono); background: none; border: none; color: var(--text3); }
.card-action:hover { color: var(--text2); }

/* ── Signal table ── */
.signal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.signal-table th {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text3); padding: 7px 14px;
  text-align: left; border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
}
.signal-table td { padding: 9px 14px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.signal-table tr:last-child td { border-bottom: none; }
.signal-table tr.clickable { cursor: pointer; }
.signal-table tr.clickable:hover td { background: var(--bg2); }
.signal-table tr.selected td { background: var(--blue-bg); }

.strat-name { font-size: 12px; font-weight: 500; }
.strat-sub { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }

/* ── Signal badges ── */
.badge { display: inline-block; font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 3px; }
.badge-long { background: var(--green-bg); color: var(--green); }
.badge-cash { background: var(--bg3); color: var(--text3); border: 0.5px solid var(--border); }
.badge-watch { background: var(--amber-bg); color: var(--amber); }
.badge-tool { font-size: 10px; color: var(--text3); }

/* ── Confidence bar ── */
.conf-wrap { display: flex; align-items: center; gap: 5px; }
.conf-track { width: 44px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.conf-fill { height: 100%; border-radius: 2px; background: var(--blue); }
.conf-num { font-size: 10px; font-family: var(--font-mono); color: var(--text3); }

/* ── Sharpe color ── */
.shp-good { color: var(--green); }
.ticker-mono { font-size: 11px; font-family: var(--font-mono); color: var(--text2); }
.shp-mono { font-size: 11px; font-family: var(--font-mono); }

/* ── Detail panel ── */
.detail-panel {
  background: var(--bg);
  border: 0.5px solid var(--blue);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: none;
  animation: fadeSlideDown .15s ease;
}
.detail-panel.open { display: block; }
@keyframes fadeSlideDown { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.detail-title { font-size: 14px; font-weight: 500; }
.detail-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }
.detail-close { background: none; border: none; color: var(--text3); font-size: 13px; padding: 2px 4px; border-radius: 3px; }
.detail-close:hover { background: var(--bg3); }
.detail-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 10px; }
.detail-stat { background: var(--bg2); border-radius: var(--radius-sm); padding: 8px 10px; }
.detail-stat-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.detail-stat-value { font-size: 16px; font-weight: 500; }
.detail-holdings { background: var(--bg2); border-radius: var(--radius-sm); padding: 10px 12px; }
.detail-holdings-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 7px; }
.holding-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 0.5px solid var(--border); }
.holding-row:last-child { border-bottom: none; }
.holding-ticker { font-size: 12px; font-weight: 500; font-family: var(--font-mono); }
.holding-weight { font-size: 11px; color: var(--green); font-family: var(--font-mono); }
.holding-note { font-size: 11px; color: var(--text3); }

/* ── Side panel: Regime ── */
.regime-block { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.regime-section { padding: 10px 12px; border-bottom: 0.5px solid var(--border); }
.regime-section:last-child { border-bottom: none; }
.regime-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-bottom: 4px; }
.regime-value { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.regime-sub { font-size: 11px; color: var(--text2); line-height: 1.4; }
.state-bull { color: var(--green); }
.state-transition { color: var(--amber); }
.state-bear { color: var(--red); }
.hurst-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.hurst-track { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.hurst-fill { height: 100%; background: var(--text); border-radius: 2px; transition: width .5s ease; }
.hurst-val { font-size: 10px; font-family: var(--font-mono); color: var(--text2); }
.hurst-labels { display: flex; justify-content: space-between; font-size: 9px; font-family: var(--font-mono); color: var(--text3); margin-top: 2px; }
.vix-row { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.vix-value { font-size: 18px; font-weight: 500; font-family: var(--font-mono); }
.vix-sub { font-size: 10px; color: var(--text3); }

/* ── Activity feed ── */
.activity-list { padding: 0; }
.activity-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-bottom: 0.5px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.ad-green { background: var(--green); }
.ad-amber { background: var(--amber); }
.ad-blue { background: var(--blue); }
.activity-text { font-size: 11px; color: var(--text2); line-height: 1.45; flex: 1; }
.activity-text strong { color: var(--text); font-weight: 500; }
.activity-time { font-size: 10px; color: var(--text3); font-family: var(--font-mono); flex-shrink: 0; }

/* ── Vault ── */
.vault-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.vf-btn { padding: 5px 11px; border-radius: 20px; font-size: 11px; font-weight: 500; border: 0.5px solid var(--border); background: transparent; color: var(--text2); transition: all .12s; }
.vf-btn:hover { color: var(--text); border-color: var(--border2); }
.vf-btn.active { background: var(--text); color: var(--bg); border-color: transparent; }
.vault-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vault-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  cursor: pointer;
  transition: border-color .12s;
  position: relative;
  overflow: hidden;
}
.vault-card:hover { border-color: var(--border2); }
.vault-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.vc-trend::before { background: #7c3aed; }
.vc-mean_rev::before { background: #0f766e; }
.vc-ml::before { background: #b45309; }
.vc-volatility::before { background: #b91c1c; }
.vc-quant::before { background: #1d4ed8; }
.vc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.vc-type { font-size: 9px; text-transform: uppercase; letter-spacing: .09em; color: var(--text3); }
.vc-name { font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.vc-metrics { display: flex; gap: 10px; margin-bottom: 8px; }
.vc-m { font-size: 10px; font-family: var(--font-mono); color: var(--text3); }
.vc-m span { color: var(--text2); }
.vc-footer { display: flex; align-items: center; justify-content: space-between; }
.vc-lock  { font-size: 10px; color: var(--text3); }
.vc-colab { font-size: 10px; color: var(--blue); font-weight: 500; }

/* ── Notebooks ── */
.notebook-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .12s;
}
.notebook-card:hover { border-color: var(--border2); }
.nb-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.nb-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.nb-m { display: flex; gap: 4px; font-size: 11px; }
.nb-ml { color: var(--text3); }
.nb-mv { font-family: var(--font-mono); }
.nb-tag { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.nbt-trend { background: #ede9fe; color: #5b21b6; }
.nbt-mean_rev { background: #ccfbf1; color: #0f766e; }
.nbt-ml { background: #fef3c7; color: #92400e; }
.nbt-volatility { background: #fee2e2; color: #991b1b; }
.nbt-quant { background: #dbeafe; color: #1e40af; }
.nb-open { font-size: 11px; color: var(--blue); font-weight: 500; white-space: nowrap; }

/* ── Regime full screen ── */
.regime-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rcard { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.rcard-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-bottom: 8px; }
.rcard-value { font-size: 22px; font-weight: 500; letter-spacing: -.025em; margin-bottom: 4px; }
.rcard-sub { font-size: 12px; color: var(--text2); line-height: 1.5; }
.state-bar { display: flex; border-radius: 4px; overflow: hidden; height: 6px; margin: 8px 0 3px; gap: 1px; }
.sb-bull { background: var(--green); }
.sb-trans { background: var(--amber); }
.sb-bear { background: var(--red); }
.state-bar-labels { display: flex; justify-content: space-between; font-size: 10px; font-family: var(--font-mono); color: var(--text3); }
.hurst-full { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin: 8px 0 3px; overflow: hidden; }
.hurst-fill-full { height: 100%; background: var(--text); border-radius: 2px; }
.hurst-full-labels { display: flex; justify-content: space-between; font-size: 10px; font-family: var(--font-mono); color: var(--text3); }
.regime-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rg-cell { border-radius: var(--radius); padding: 12px; }
.rg-cell-title { font-size: 11px; font-weight: 500; margin-bottom: 5px; }
.rg-cell-body { font-size: 12px; line-height: 1.5; }
.rg-bull { background: var(--green-bg); }
.rg-bull .rg-cell-title { color: var(--green); }
.rg-bull .rg-cell-body { color: #166534; }
.rg-trans { background: var(--amber-bg); }
.rg-trans .rg-cell-title { color: var(--amber); }
.rg-trans .rg-cell-body { color: #78350f; }
.rg-bear { background: var(--bg2); }
.rg-bear .rg-cell-title { color: var(--red); }
.rg-bear .rg-cell-body { color: var(--text2); }

/* ── Risk screen ── */
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.risk-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.risk-score { font-size: 30px; font-weight: 500; letter-spacing: -.04em; margin: 4px 0; }
.risk-meter { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.risk-meter-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--amber), var(--red)); }
.risk-item { display: flex; align-items: center; justify-content: space-between; font-size: 11px; padding: 3px 0; }
.ri-label { color: var(--text2); }
.ri-value { font-family: var(--font-mono); font-weight: 500; }
.corr-grid { display: grid; gap: 2px; }
.corr-cell { border-radius: 3px; padding: 3px 2px; text-align: center; font-size: 10px; font-family: var(--font-mono); color: var(--text2); }
.corr-header { font-size: 9px; font-family: var(--font-mono); color: var(--text3); text-align: center; overflow: hidden; white-space: nowrap; padding: 2px; }

/* ── Ticker bar ── */
.ticker-bar {
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  padding: 7px 0;
  width: 100%;
  flex-shrink: 0;
  -webkit-mask-image: linear-gradient(
    to right, transparent 0%, black 60px,
    black calc(100% - 60px), transparent 100%);
  mask-image: linear-gradient(
    to right, transparent 0%, black 60px,
    black calc(100% - 60px), transparent 100%);
}
.ticker-inner {
  display: inline-flex;
  align-items: center;
  animation: ticker 90s linear infinite;
  will-change: transform;
}
.ticker-inner:hover { animation-play-state: paused; }
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
  border-right: 0.5px solid var(--border);
  white-space: nowrap;
}
.ticker-name { font-weight: 500; color: var(--text); }
.tick-long { color: var(--green); }
.tick-cash { color: var(--text3); }
.tick-watch { color: var(--amber); }

/* ── History chart ── */
.history-wrap { padding: 14px; }
.history-chart { height: 100px; position: relative; }
.history-labels { display: grid; font-size: 10px; color: var(--text3); font-family: var(--font-mono); text-align: center; margin-top: 4px; }

/* ── Upgrade UI ── */
.upgrade-row-cell { padding: 0 !important; border-bottom: none !important; }
.upgrade-banner {
  padding: 10px 14px;
  background: var(--blue-bg);
  font-size: 12px;
  color: var(--text2);
  border-top: 0.5px solid var(--border);
}
.upgrade-banner a { color: var(--blue); font-weight: 500; text-decoration: none; }
.upgrade-banner a:hover { text-decoration: underline; }
.vault-upgrade-banner { padding: 4px 0; }

.upgrade-gate {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 10px;
  padding: 60px 24px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.ug-icon  { font-size: 28px; }
.ug-title { font-size: 16px; font-weight: 500; }
.ug-sub   { font-size: 13px; color: var(--text2); line-height: 1.6; max-width: 380px; }
.ug-btn   { margin-top: 6px; padding: 9px 20px; font-size: 13px; }

/* ── Regime screen redesign ── */

.rcard-regime-main { display: flex; flex-direction: column; }

.regime-state-lg {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -.05em;
  line-height: 1;
  margin: 6px 0 4px;
}

.regime-days-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.regime-explainer {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 10px;
}

.regime-dist-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 2px;
}

.regime-rec-box {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  margin-top: 4px;
}

/* Sizing guide */
.sizing-guide-wrap { padding: 10px 14px 14px; overflow-x: auto; }

.sizing-table { width: 100%; border-collapse: collapse; }
.sizing-table th {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text3);
  padding: 6px 12px; text-align: left;
  border-bottom: 0.5px solid var(--border);
}
.sizing-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.sizing-table tbody tr:last-child td { border-bottom: none; }

.sg-regime-name { font-size: 12px; font-weight: 500; }
.sg-size { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--text); }
.sg-size-green { color: var(--green); }
.sg-size-red   { color: var(--red); }
.sg-note { font-size: 11px; color: var(--text2); }

.sg-row.sg-current { background: var(--bg2); }
.sg-cur-bull  { border-left: 3px solid var(--green); }
.sg-cur-trans { border-left: 3px solid var(--amber); }
.sg-cur-bear  { border-left: 3px solid var(--red); }

/* Chart area */
.regime-chart-pad { padding: 14px; }

.regime-chart-legend { display: flex; gap: 14px; margin-top: 10px; }
.regime-chart-legend span {
  font-size: 11px; color: var(--text3);
  display: flex; align-items: center; gap: 5px;
}
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; font-style: normal; }
.ld-bull  { background: var(--green); }
.ld-trans { background: var(--amber); }
.ld-bear  { background: var(--red); }

/* History gate for free users */
.rhg-gate { position: relative; overflow: hidden; min-height: 160px; }

.rhg-blur {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  padding: 14px;
  opacity: 0.45;
}

.rhg-color-band {
  display: flex;
  height: 60px;
  gap: 3px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  opacity: 0.8;
}

.rhg-fake-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
}
.rhg-fake-bars div { flex: 1; }

.rhg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.rhg-lock-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg3);
  color: var(--text3);
  border: 0.5px solid var(--border2);
}

.rhg-copy {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  max-width: 360px;
}

/* ── Weekly Action Card ── */
.action-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.action-card.action-amber { border-left-color: var(--amber); }
.action-card.action-red   { border-left-color: var(--red); }

.action-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.action-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 12px;
}

.action-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  white-space: nowrap;
}

/* ── NEW signal badge ── */
.badge-new {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--blue-bg);
  color: var(--blue);
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: .02em;
}

/* ── One-line strategy note ── */
.strat-note {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Show all toggle ── */
.show-all-btn {
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.show-all-btn:hover { color: var(--text2); }

/* ── Blurred preview rows ── */
.blurred-row {
  filter: blur(3.5px);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
}

/* ── Upgrade wall ── */
.upgrade-wall {
  padding: 18px 18px 16px;
  border-top: 0.5px solid var(--border);
  text-align: center;
  background: var(--bg2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.upgrade-wall-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.upgrade-wall-sub {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 14px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}
.upgrade-wall-btn { font-size: 12px; }

/* ── Changes this week ── */
.changes-section {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.changes-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 8px;
}
.change-item {
  font-size: 12px;
  color: var(--text2);
  padding: 5px 0;
  line-height: 1.5;
}
.change-item + .change-item {
  border-top: 0.5px solid var(--border);
}
.change-from   { color: var(--text3); }
.change-arrow  { color: var(--text3); margin: 0 4px; }
.change-to-long  { color: var(--green); font-weight: 500; }
.change-to-watch { color: var(--amber); font-weight: 500; }
.change-to-cash  { color: var(--text3); }
.change-date   { color: var(--text3); font-size: 11px; font-family: var(--font-mono); margin-left: 6px; }

/* ── Animations ── */
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.fade-in { animation: fadeIn .2s ease; }

/* ── Utility ── */
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text2); }
.text-faint { color: var(--text3); }
.gap-4 { gap: 4px; }
.mt-2 { margin-top: 8px; }
.full-span { grid-column: 1 / -1; }

/* ═══════════════════════════════════════════════════════════
   NOTEBOOK VIEWER
   ═══════════════════════════════════════════════════════════ */

/* Screen layout: left list + right viewer */
#screen-notebooks {
  overflow-y: auto;
  padding: 0;
  gap: 0;
}

.nb-list-panel {
  width: 280px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  overflow-y: auto;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
}

.nb-list-header {
  padding: 14px 16px 10px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.nb-list-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 8px;
}
.nb-search {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-sans);
  outline: none;
}
.nb-search:focus { border-color: var(--blue); }
.nb-search::placeholder { color: var(--text3); }

.nb-list-items { flex: 1; padding: 8px; }

.nb-list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .1s;
  margin-bottom: 2px;
  border: 0.5px solid transparent;
}
.nb-list-item:hover { background: var(--bg3); }
.nb-list-item.active {
  background: var(--bg);
  border-color: var(--border);
}
.nb-item-dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 4px; flex-shrink: 0;
}
.nb-item-info { min-width: 0; }
.nb-item-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-item-meta {
  font-size: 10px; color: var(--text3); margin-top: 2px;
  font-family: var(--font-mono);
}
.nb-item-badge {
  flex-shrink: 0;
  font-size: 9px; font-weight: 500;
  padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .05em;
}
.nbb-trend      { background: #2d1f5c; color: #a78bfa; }
.nbb-mean_rev   { background: #0d2d29; color: #34d399; }
.nbb-volatility { background: #2d0f0e; color: #f87171; }
.nbb-ml         { background: #2d1f0d; color: #fbbf24; }
.nbb-quant      { background: #0d1f38; color: #60a5fa; }

/* Light mode badge overrides */
@media (prefers-color-scheme: light) {
  .nbb-trend      { background: #ede9fe; color: #5b21b6; }
  .nbb-mean_rev   { background: #ccfbf1; color: #0f766e; }
  .nbb-volatility { background: #fee2e2; color: #991b1b; }
  .nbb-ml         { background: #fef3c7; color: #92400e; }
  .nbb-quant      { background: #dbeafe; color: #1e40af; }
}

.nb-lock-overlay-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 7px;
  opacity: .5;
  cursor: default;
  margin-bottom: 2px;
}
.nb-lock-overlay-item .nb-item-name { color: var(--text2); }

/* Right viewer pane */
.nb-viewer-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.nb-viewer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.nb-viewer-name {
  font-size: 13px; font-weight: 500; color: var(--text);
}
.nb-viewer-meta {
  font-size: 10px; color: var(--text3); margin-top: 1px;
  font-family: var(--font-mono);
}
.nb-viewer-actions { display: flex; gap: 8px; align-items: center; }
.nb-action-btn {
  font-size: 11px; font-weight: 500;
  padding: 5px 12px; border-radius: 6px;
  border: 0.5px solid var(--border2);
  background: transparent; color: var(--text2);
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .12s;
}
.nb-action-btn:hover { background: var(--bg2); color: var(--text); }
.nb-action-btn.primary {
  background: #1d4ed8; color: #fff; border-color: #1d4ed8;
}
.nb-action-btn.primary:hover { opacity: .88; }

.nb-viewer-body { padding: 20px 28px 40px; flex: 1; }

/* Empty state */
.nb-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
  padding: 40px;
  text-align: center;
}
.nb-empty-icon { font-size: 28px; margin-bottom: 4px; }

/* ── Notebook document styles ──────────────────────────────── */
.nb-document { font-family: var(--font-sans); font-size: 13px; color: var(--text); }

.nb-cell { margin-bottom: 10px; }

/* Markdown cell */
.nb-md-cell {
  padding: 6px 0;
  line-height: 1.7;
  color: var(--text);
}
.nb-md-cell h1 { font-size: 18px; font-weight: 500; letter-spacing: -.02em; margin: 0 0 6px; }
.nb-md-cell h2 { font-size: 15px; font-weight: 500; margin: 14px 0 6px; }
.nb-md-cell h3 { font-size: 13px; font-weight: 500; margin: 10px 0 4px; }
.nb-md-cell p  { margin: 4px 0; line-height: 1.65; color: var(--text2); }
.nb-md-cell blockquote {
  border-left: 3px solid var(--border2);
  padding: 4px 12px;
  color: var(--text2);
  background: var(--bg2);
  border-radius: 0 6px 6px 0;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
}
.nb-md-cell ul, .nb-md-cell ol {
  padding-left: 18px; margin: 4px 0; color: var(--text2);
}
.nb-md-cell li  { margin: 2px 0; font-size: 12px; }
.nb-md-cell hr  { border: none; border-top: 0.5px solid var(--border); margin: 10px 0; }
.nb-md-cell a   { color: var(--blue); text-decoration: none; }
.nb-md-cell a:hover { text-decoration: underline; }
.nb-md-cell table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.nb-md-cell td, .nb-md-cell th {
  padding: 5px 10px; border: 0.5px solid var(--border); font-size: 12px;
}
.nb-md-cell th { background: var(--bg2); font-weight: 500; color: var(--text); }
.nb-inline-code {
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

/* Code cell */
.nb-code-cell {
  border: 0.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
}
.nb-cell-in {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.nb-prompt {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 10px 8px;
  flex-shrink: 0;
  user-select: none;
  min-width: 64px;
  text-align: right;
  color: var(--text3);
  border-right: 0.5px solid var(--border);
  background: var(--bg2);
}
.nb-in-prompt { color: #58a6ff; }
.nb-code {
  flex: 1;
  margin: 0;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  background: var(--bg2);
  white-space: pre;
}
.nb-cell-out {
  border-top: 0.5px solid var(--border);
  background: var(--bg);
  padding: 8px 14px 8px 72px;
}
.nb-out-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  white-space: pre;
  line-height: 1.5;
}
.nb-out-stderr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #f85149;
  white-space: pre;
  background: rgba(248,81,73,.06);
  padding: 6px 8px;
  border-radius: 4px;
}
.nb-out-img { margin: 4px 0; }
.nb-out-img img { max-width: 100%; display: block; border-radius: 6px; }
.nb-out-html { font-size: 12px; overflow-x: auto; }

/* Python syntax highlight tokens */
.nb-str  { color: #a5d6ff; }
.nb-cmt  { color: #8b949e; font-style: italic; }
.nb-kw   { color: #ff7b72; }
.nb-bi   { color: #d2a8ff; }
.nb-dec  { color: #ffa657; }
.nb-num  { color: #79c0ff; }

@media (prefers-color-scheme: light) {
  .nb-str  { color: #0a3069; }
  .nb-cmt  { color: #6e7781; font-style: italic; }
  .nb-kw   { color: #cf222e; }
  .nb-bi   { color: #8250df; }
  .nb-dec  { color: #953800; }
  .nb-num  { color: #0550ae; }
}

/* Loading / error states */
.nb-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 28px;
  color: var(--text3);
  font-size: 13px;
}
.nb-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border2);
  border-top-color: var(--text2);
  border-radius: 50%;
  animation: nbSpin .7s linear infinite;
  display: inline-block;
}
@keyframes nbSpin { to { transform: rotate(360deg); } }
.nb-error {
  padding: 20px 28px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}
.nb-error a { color: var(--blue); }

/* ═══════════════════════════════════════════════════════════
   VAULT REDESIGN
   ═══════════════════════════════════════════════════════════ */

/* ── Strategy Selector ── */
.vault-selector {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.vs-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
}

.vs-questions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.vs-question {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vs-q-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  min-width: 130px;
  flex-shrink: 0;
}

.vs-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.vs-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  border: 0.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all .12s;
  font-family: var(--font-sans);
}
.vs-pill:hover { border-color: var(--border2); color: var(--text); }
.vs-pill.active { background: var(--text); color: var(--bg); border-color: transparent; }

.vs-recommendation {
  font-size: 12px;
  color: var(--text2);
  border-top: 0.5px solid var(--border);
  padding-top: 10px;
}

.vs-rec-star { color: #ca8a04; margin-right: 3px; }

/* ── Vault card improvements ── */

/* Signal-based top border — placed after category rules so cascade wins */
.vc-sig-long::before  { background: var(--green); }
.vc-sig-watch::before { background: var(--amber); }
.vc-sig-cash::before  { background: var(--border2); }

/* Recommended card: gold border highlight */
.vc-recommended {
  border-color: #ca8a04;
  box-shadow: 0 0 0 1px #ca8a0420;
}

/* Selected for comparison */
.vc-selected { border-color: var(--blue); }

.vc-description {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 7px;
}

.vc-best-in {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.vc-rec-star { color: #ca8a04; font-size: 10px; margin-left: 4px; }

.vc-footer-right { display: flex; align-items: center; gap: 8px; }

.vc-compare-btn {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 0.5px solid var(--border2);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all .12s;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.vc-compare-btn:hover { color: var(--text); background: var(--bg2); }
.vc-compare-btn.added { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.vc-compare-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Strategy Compare Panel ── */
.compare-panel {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-top: 2px solid var(--blue);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
}

.compare-title { font-size: 12px; font-weight: 500; }

.compare-clear {
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 2px 4px;
  border-radius: 3px;
}
.compare-clear:hover { color: var(--text2); background: var(--bg3); }

.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th {
  font-size: 11px;
  font-weight: 500;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
}
.compare-table td {
  padding: 9px 14px;
  font-size: 12px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.compare-table tbody tr:last-child td { border-bottom: none; }

.ct-metric-head {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  width: 130px;
}

.ct-metric {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  width: 130px;
  background: var(--bg2);
}

.ct-header-name { font-size: 12px; font-weight: 500; color: var(--text); }
.ct-header-cat  { font-size: 10px; color: var(--text3); margin-top: 1px; }

.comp-corr-low  { color: var(--green); }
.comp-corr-mid  { color: var(--amber); }
.comp-corr-high { color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   RISK MONITOR REDESIGN
   ═══════════════════════════════════════════════════════════ */

/* ── Section 1: Portfolio health check ── */
.rh-body {
  padding: 14px 16px;
}

.rh-summary {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 14px;
}
.rh-summary strong { color: var(--text); font-weight: 500; }

.rh-empty {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 14px;
}

.rh-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rh-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
}

.rh-regime-tag {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg2);
}

/* ── Section 2: Position sizing table ── */
.ps-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ps-input-label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}

.ps-input-box {
  display: flex;
  align-items: center;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  overflow: hidden;
}

.ps-dollar-sign {
  font-size: 12px;
  color: var(--text3);
  padding: 5px 0 5px 9px;
  font-family: var(--font-mono);
  pointer-events: none;
}

.ps-input {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 5px 9px 5px 3px;
  width: 90px;
  -moz-appearance: textfield;
}
.ps-input::-webkit-inner-spin-button,
.ps-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.ps-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.ps-table th {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  padding: 7px 14px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
}
.ps-table td {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
  font-size: 12px;
}
.ps-table tbody tr:last-child td { border-bottom: none; }

.ps-name { font-size: 12px; font-weight: 500; }
.ps-cat  { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }
.ps-num  { font-family: var(--font-mono); font-size: 12px; }
.ps-dollar { color: var(--text); }
.ps-dollar-header { text-align: left; }

.ps-total td {
  border-top: 0.5px solid var(--border2);
  border-bottom: none;
  background: var(--bg2);
  font-size: 12px;
  padding: 10px 14px;
}

.ps-cash td {
  border-bottom: none;
  font-size: 12px;
  color: var(--text3);
  background: var(--bg2);
  padding: 8px 14px;
}

/* ── Section 3: Correlation interpretation ── */
.corr-interpret {
  padding: 12px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.corr-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.55;
  padding-bottom: 6px;
}
.corr-note:not(:last-child) { border-bottom: 0.5px solid var(--border); }
.corr-note strong { color: var(--text); font-weight: 500; }

.corr-note-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  margin-top: 4px;
}
.corr-note-green { background: var(--green); }

/* ── Section 4: Risk scenarios ── */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 0.5px solid var(--border);
}

.scenario-card {
  padding: 16px;
  border-right: 0.5px solid var(--border);
  border-left: 3px solid transparent;
}
.scenario-card:last-child { border-right: none; }

.sc-amber  { border-left-color: var(--amber); }
.sc-orange { border-left-color: #d97706; }
.sc-blue   { border-left-color: var(--blue); }

.sc-icon {
  font-size: 16px;
  margin-bottom: 6px;
}

.sc-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.sc-body {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 10px;
}

.sc-action-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  padding: 3px 8px;
  background: var(--bg2);
  border-radius: 3px;
  border: 0.5px solid var(--border);
  display: inline-block;
}

/* ── Section 5: Drawdown tracker ── */
.dd-list {
  padding: 4px 0;
}

.dd-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
}
.dd-row:last-child { border-bottom: none; }

.dd-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dd-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dd-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.dd-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.dd-fill-green { background: var(--green); }
.dd-fill-amber { background: var(--amber); }
.dd-fill-red   { background: var(--red); }

.dd-pct {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  white-space: nowrap;
  min-width: 70px;
}

.dd-values {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.dd-cur { color: var(--text2); font-weight: 500; }
.dd-cur-warn { color: var(--amber); }
.dd-sep { color: var(--text3); }
.dd-max { color: var(--text3); font-size: 10px; }

/* ── Weekly Briefing Screen ──────────────────────────────────────────────── */

.brf-envelope {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.brf-env-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
}

.brf-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.brf-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brf-dot { color: var(--border2); }

.brf-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brf-section {
  border-bottom: 0.5px solid var(--border);
  display: flex;
  gap: 0;
}

.brf-section:last-child { border-bottom: none; }

.brf-section-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  min-width: 140px;
  padding: 16px 20px;
  border-right: 0.5px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.brf-lock-tag {
  font-size: 9px;
  background: var(--bg3);
  color: var(--text3);
  border: 0.5px solid var(--border2);
  border-radius: 20px;
  padding: 2px 7px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  align-self: center;
  white-space: nowrap;
}

.brf-section-body {
  flex: 1;
  padding: 14px 20px;
}

.brf-summary-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  margin: 0;
}

/* Gate (blur + overlay for free users) — premium frosted look */
.brf-gate {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 72px;
  border: 0.5px solid var(--border);
  background: var(--bg2);
}

.brf-gate-blur {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  opacity: .18;
  padding: 4px 0;
}

.brf-gate-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: transparent;
}

.brf-gate-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
}
.brf-gate-lock::before {
  content: "🔒";
  font-size: 14px;
}

/* Position rows */
.brf-pos-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 0.5px solid var(--border);
}

.brf-pos-row:last-child { border-bottom: none; }

.brf-pos-name {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brf-pos-tickers {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
  min-width: 80px;
}

.brf-pos-sharpe {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
  min-width: 60px;
  text-align: right;
}

/* Change rows */
.brf-change-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.brf-change-name {
  flex: 1;
  font-size: 12px;
  color: var(--text);
}

.brf-change-detail {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
}

/* Regime cells */
.brf-regime-row {
  display: flex;
  gap: 0;
}

.brf-regime-cell {
  flex: 1;
  padding-right: 20px;
}

.brf-regime-cell:not(:last-child) {
  border-right: 0.5px solid var(--border);
  margin-right: 20px;
}

.brf-rc-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 4px;
}

.brf-rc-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.brf-rc-sub {
  font-size: 11px;
  color: var(--text3);
}

/* Next week */
.brf-next-week {
  display: flex;
  gap: 32px;
}

.brf-nw-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 4px;
}

.brf-nw-val {
  font-size: 13px;
  color: var(--text);
}

/* Upgrade wall */
.brf-upgrade {
  padding: 24px 20px;
  text-align: center;
  background: var(--bg2);
  border-top: 0.5px solid var(--border);
}

.brf-upgrade-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.brf-upgrade-sub {
  font-size: 12px;
  color: var(--text3);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Email Preview Modal ──────────────────────────────────────────────────── */

.ep-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.ep-modal.open {
  display: flex;
}

.ep-panel {
  background: var(--bg);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg);
  width: min(760px, 96vw);
  height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

.ep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}

.ep-header-left { display: flex; flex-direction: column; gap: 2px; }

.ep-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.ep-sub {
  font-size: 11px;
  color: var(--text3);
}

.ep-close {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
}

.ep-close:hover { background: var(--border); color: var(--text); }

.ep-body {
  flex: 1;
  overflow: hidden;
}

.ep-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ── Notebook Detail Panel ────────────────────────────────────────────────── */

.nb-detail {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

.nb-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.nb-detail-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.nb-detail-num {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
}

.nb-detail-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.nb-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.nb-stat {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.nb-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 4px;
}

.nb-stat-val {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
}

.nb-detail-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  margin: 0;
}

.nb-detail-signal {
  border-top: 0.5px solid var(--border);
  padding-top: 16px;
}

.nb-ds-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 8px;
}

.nb-ds-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nb-ds-tickers {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text2);
}

.nb-colab-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity .15s;
}

.nb-colab-btn:hover { opacity: .85; }

.nb-contents {
  border-top: 0.5px solid var(--border);
  padding-top: 16px;
}

.nb-contents-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 10px;
}

.nb-contents-list {
  margin: 0;
  padding: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nb-contents-list li {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}

/* ── Strategy Explainer Panel ─────────────────────────────────────────────── */

.explainer-panel {
  background: var(--bg);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  animation: fadeSlideDown .2s ease;
  overflow: hidden;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.explainer-inner { padding: 20px 24px; }

.explainer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border);
}

.explainer-title { font-size: 18px; font-weight: 500; letter-spacing: -.02em; }

.explainer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.explainer-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
}

.explainer-difficulty { font-size: 12px; font-weight: 500; }
.explainer-time { font-size: 12px; color: var(--text2); }

.explainer-header-right { display: flex; align-items: center; gap: 10px; }

.explainer-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.explainer-close:hover { background: var(--bg2); }

.explainer-signal-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
}
.explainer-signal-badge.badge-long  { background: var(--green-bg); color: var(--green); }
.explainer-signal-badge.badge-cash  { background: var(--bg2); color: var(--text3); }
.explainer-signal-badge.badge-watch { background: var(--amber-bg); color: var(--amber); }

.explainer-signal-reason {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  border-left: 3px solid var(--green);
}

.explainer-reason-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green);
  white-space: nowrap;
  margin-top: 2px;
  flex-shrink: 0;
}

.explainer-reason-text { font-size: 13px; color: var(--text2); line-height: 1.5; }

.explainer-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}

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

.explainer-section { margin-bottom: 16px; }

.explainer-section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 6px;
}

.explainer-section-body { font-size: 13px; color: var(--text2); line-height: 1.65; }

.explainer-insight {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  font-style: italic;
  padding: 10px 14px;
  border-left: 3px solid var(--blue);
  background: var(--blue-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.explainer-logic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.explainer-logic-item {
  font-size: 13px;
  color: var(--text2);
  padding: 7px 10px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.explainer-logic-item::before {
  content: '→';
  color: var(--text3);
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
}

.explainer-when-fails {
  background: var(--red-bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.explainer-fails-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}

.explainer-fails-body { font-size: 13px; color: var(--text2); line-height: 1.5; }

.explainer-conditions { display: flex; gap: 14px; flex-wrap: wrap; }

.explainer-condition { display: flex; gap: 6px; align-items: center; }

.explainer-cond-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  white-space: nowrap;
}

.explainer-cond-value { font-size: 12px; color: var(--text2); }

.explainer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.explainer-stat {
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.explainer-stat-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
}

.explainer-stat-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.02em;
}

.explainer-chart-wrap { margin-bottom: 14px; }

.explainer-chart-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.explainer-holdings {
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.explainer-holdings-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.explainer-holding-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 12px;
}

.explainer-holding-row:last-child { border-bottom: none; }

.explainer-holding-ticker { font-family: var(--font-mono); font-weight: 500; }

.explainer-holding-weight { color: var(--green); font-family: var(--font-mono); }

.explainer-params { margin-bottom: 14px; }

.explainer-params-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 7px;
}

.explainer-params-sub { font-size: 11px; color: var(--text3); font-weight: 400; }

.explainer-param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 0.5px solid var(--border);
}

.explainer-param-row:last-child { border-bottom: none; }

.explainer-param-name { flex: 1; color: var(--text2); }

.explainer-param-default {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.explainer-param-range {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
}

.explainer-notebook-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 12px;
  transition: opacity .12s;
}

.explainer-notebook-btn:hover { opacity: .85; }

.explainer-learning { margin-top: 4px; }

.explainer-learning-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.explainer-learning-items { display: flex; gap: 6px; flex-wrap: wrap; }

.explainer-learn-btn {
  font-size: 12px;
  color: var(--blue);
  background: var(--blue-bg);
  border: 0.5px solid var(--blue);
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: opacity .12s;
}

.explainer-learn-btn:hover { opacity: .8; }

.explainer-loading {
  padding: 24px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* ── Signal History screen ─────────────────────────────────────────────── */

.hist-intro { margin-bottom: 14px; }
.hist-intro-title { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.hist-intro-sub { font-size: 13px; color: var(--text2); }

.hist-section { margin-bottom: 18px; }
.hist-section-label {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text3); margin-bottom: 8px;
}

.hist-summary-card {
  background: var(--bg2); border-radius: var(--radius-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 0;
}
.hist-summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}
.hist-summary-row:last-child { border-bottom: none; }
.hist-summary-key { color: var(--text2); }
.hist-summary-val {
  font-weight: 500; color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
}

.hist-state-bull { color: var(--green); }
.hist-state-transition { color: var(--amber); }
.hist-state-bear { color: var(--red); }

.hist-position-list {
  background: var(--bg); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.hist-position-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 0.5px solid var(--border);
}
.hist-position-row:last-child { border-bottom: none; }
.hist-pos-left { display: flex; flex-direction: column; gap: 2px; }
.hist-pos-name { font-size: 13px; font-weight: 500; }
.hist-pos-cat {
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
}
.hist-pos-right { display: flex; align-items: center; gap: 10px; }
.hist-pos-tickers {
  font-size: 12px; font-family: var(--font-mono); color: var(--text2);
}
.hist-empty {
  padding: 16px; text-align: center;
  font-size: 13px; color: var(--text3);
}

.hist-regime-note {
  background: var(--bg2); border-radius: var(--radius-lg);
  padding: 14px; display: flex; gap: 12px; align-items: flex-start;
}
.hist-regime-state {
  font-size: 20px; font-weight: 500;
  letter-spacing: -.025em; flex-shrink: 0;
}
.hist-regime-detail { font-size: 13px; color: var(--text2); line-height: 1.6; }

.hist-upgrade-note {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.hist-upgrade-icon { font-size: 20px; flex-shrink: 0; }
.hist-upgrade-text { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   NOTEBOOKS SCREEN — grid layout
   ═══════════════════════════════════════════════════════════ */

#screen-notebooks {
  overflow-y: auto;
  display: block !important;
}

/* (legacy viewer panel — kept for backwards compatibility) */
.nb-viewer-panel {
  display: none !important;
}

#nb-runner-frame {
  border: none !important;
}

/* Improved empty state */
.nb-empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.nb-empty-sub {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.7;
  max-width: 320px;
}
.nb-empty kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border: 0.5px solid var(--border2);
  border-radius: 3px;
  background: var(--bg2);
  color: var(--text2);
}

/* Quality badge: Full vs Skeleton */
.nb-quality-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.nb-quality-full     { background: var(--green-bg); color: var(--green); }
.nb-quality-skeleton { background: var(--bg3); color: var(--text3); }

/* ── Notebook grid (new card-based UI) ── */
#screen-notebooks.active {
  overflow-y: auto;
  display: block;
  padding: 0;
}
.nb-grid-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}
.nb-grid-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.nb-grid-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
}
.nb-grid-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}
.nb-grid-header .nb-search {
  width: 240px;
  flex-shrink: 0;
}
.nb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.nb-card {
  display: flex;
  align-items: stretch;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .12s, transform .12s, box-shadow .12s;
  position: relative;
}
.nb-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.nb-card-accent {
  width: 3px;
  flex-shrink: 0;
}
.nb-card-body {
  flex: 1;
  padding: 14px 12px;
  min-width: 0;
}
.nb-card-num {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  margin-bottom: 4px;
}
.nb-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
}
.nb-card-meta {
  font-size: 10px;
  color: var(--text3);
}
.nb-card-open {
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .12s;
}
.nb-card:hover .nb-card-open {
  opacity: 1;
  color: var(--blue);
}

/* ═══════════════════════════════════════════════════════════
   DESIGN IMPROVEMENTS — professional polish
   ═══════════════════════════════════════════════════════════ */

/* Sidebar brand */
.sb-brand {
  border-bottom: 0.5px solid var(--border);
}
.sb-wordmark {
  font-weight: 600;
  letter-spacing: -.02em;
}

/* Metric cards — subtle left accent */
.metric {
  border: 0.5px solid var(--border);
  border-left: 2px solid var(--border2);
  transition: border-color .12s;
}
.metric:hover { border-left-color: var(--blue); }

/* Signal table — better row treatment */
.signal-table tr.clickable:hover td {
  background: var(--bg2);
}

/* Cards — slightly more prominent header */
.card-header {
  background: var(--bg2);
}

/* Topbar — slightly taller for breathing room */
.topbar {
  min-height: 54px;
}

/* Buttons — slightly more polished */
.btn {
  font-weight: 500;
  transition: all .1s;
}

/* Vault card — border radius tweak */
.vault-card {
  border-radius: 10px;
}

/* nb-list-panel — slightly wider for badge */
.nb-list-panel {
  width: 300px;
}

/* nb-list-item — nicer active state */
.nb-list-item.active {
  background: var(--blue-bg);
  border-color: var(--blue);
}

/* Regime chart container */
.regime-chart-pad {
  padding: 12px 14px 10px;
}
.regime-chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text3);
  font-family: var(--font-mono);
}
.legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.ld-bull  { background: var(--green); }
.ld-trans { background: var(--amber); }
.ld-bear  { background: var(--red); }

/* Sizing table */
.sizing-guide-wrap { overflow-x: auto; }
.sizing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sizing-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  border-bottom: 0.5px solid var(--border);
  background: var(--bg2);
}
.sizing-table td {
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.sizing-table tr:last-child td { border-bottom: none; }
.sg-row { transition: background .1s; }
.sg-current { background: var(--bg2); }
.sg-cur-bull  td:first-child { border-left: 2px solid var(--green); }
.sg-cur-trans td:first-child { border-left: 2px solid var(--amber); }
.sg-cur-bear  td:first-child { border-left: 2px solid var(--red); }
.sg-regime-name { font-weight: 500; }
.sg-size { font-family: var(--font-mono); font-weight: 500; }
.sg-size-green { color: var(--green); }
.sg-size-red   { color: var(--red); }
.sg-note { color: var(--text2); font-size: 11px; }

/* Regime row */
.regime-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.rcard {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.rcard-regime-main { border-top: 2px solid var(--blue); }
.rcard-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 8px;
}
.rcard-value {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.03em;
  font-family: var(--font-mono);
  margin-bottom: 2px;
}
.rcard-sub {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 10px;
}
.regime-state-lg {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: 4px;
}
.regime-days-tag {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}
.regime-explainer {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 10px;
}
.regime-rec-box {
  background: var(--bg2);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text2);
  line-height: 1.6;
  font-family: var(--font-mono);
}
.regime-dist-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 4px;
}
.state-bar {
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  height: 6px;
}
.sb-bull  { background: var(--green); }
.sb-trans { background: var(--amber); }
.sb-bear  { background: var(--red); }
.state-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 4px;
}
.hurst-full {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.hurst-fill-full {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--blue));
  border-radius: 2px;
  transition: width .4s ease;
}
.hurst-full-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text3);
}
.rhg-gate { position: relative; min-height: 140px; overflow: hidden; }
.rhg-blur { filter: blur(4px); pointer-events: none; user-select: none; }
.rhg-color-band {
  display: flex;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 14px 8px;
}
.rhg-fake-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 0 14px 14px;
  height: 60px;
}
.rhg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: linear-gradient(to bottom, transparent, var(--bg) 60%);
}
.rhg-lock-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--amber-bg);
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.rhg-copy {
  font-size: 12px;
  color: var(--text2);
  max-width: 340px;
  line-height: 1.6;
}

/* Risk screen */
.risk-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Briefing screen */
.briefing-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
}

/* ticker-bar hidden — removed from layout */
.ticker-bar { display: none; }

/* ══════════════════════════════════════════════════════════
   SCREEN TRANSITIONS
   ══════════════════════════════════════════════════════════ */

.screen.active { animation: screenIn .18s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════════════
   VAULT DRAWER (right-side slide-in panel)
   ══════════════════════════════════════════════════════════ */

.vault-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.vault-backdrop.open { opacity: 1; pointer-events: auto; }

.vault-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(640px, 96vw);
  background: var(--bg);
  border-left: 0.5px solid var(--border);
  box-shadow: -12px 0 48px rgba(0,0,0,.14);
  z-index: 201;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.vault-drawer.open { transform: translateX(0); }

/* Loading spinner inside drawer */
@keyframes spin { to { transform: rotate(360deg); } }
.drawer-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}

/* ══════════════════════════════════════════════════════════
   VAULT CARD PREMIUM HOVER
   ══════════════════════════════════════════════════════════ */

.vault-card {
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.vault-card:hover {
  border-color: var(--border2);
  box-shadow: 0 6px 20px rgba(0,0,0,.07);
  transform: translateY(-1px);
}
.vc-description {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   SIGNAL HISTORY — NEW RICH LAYOUT
   ══════════════════════════════════════════════════════════ */

/* Snapshot bar */
.hist-snap-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  flex-wrap: wrap;
}
.hist-snap-title { font-size: 14px; font-weight: 500; color: var(--text); }
.hist-snap-sub   { font-size: 11px; color: var(--text3); font-family: var(--font-mono); margin-top: 2px; }
.hist-snap-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-snap-pill  {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 14px; border-radius: var(--radius);
  background: var(--bg2); border: 0.5px solid var(--border);
  min-width: 52px;
}
.hist-pill-long  { border-color: rgba(21,128,61,.3); background: var(--green-bg); }
.hist-pill-watch { border-color: rgba(146,64,14,.3); background: var(--amber-bg); }
.hist-pill-num   { font-size: 16px; font-weight: 500; line-height: 1; }
.hist-pill-lbl   { font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-top: 2px; }

/* Two-column body */
.hist-body-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 10px;
  align-items: start;
}
.hist-right-col { display: flex; flex-direction: column; gap: 10px; }

/* Strategy grid */
.hist-strat-grid { padding: 4px 0; }
.hist-cat-group  { border-bottom: 0.5px solid var(--border); }
.hist-cat-group:last-child { border-bottom: none; }
.hist-cat-label  {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 7px 14px 4px;
  display: block;
}
.hist-strat-row {
  display: grid;
  grid-template-columns: 1fr auto 90px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 0.5px solid var(--border);
}
.hist-strat-row:last-child { border-bottom: none; }
.hist-strat-row:hover { background: var(--bg2); }
.hist-strat-info    { min-width: 0; }
.hist-strat-name    { font-size: 12px; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-strat-tickers { font-size: 10px; color: var(--text3); font-family: var(--font-mono); }
.hist-conf-wrap     { display: flex; align-items: center; gap: 5px; }
.hist-conf-bar      { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.hist-conf-num      { font-size: 9px; color: var(--text3); font-family: var(--font-mono); white-space: nowrap; min-width: 26px; text-align: right; }

/* Changes list */
.hist-chg-list  { padding: 4px 0; }
.hist-chg-row   {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 12px;
  border-bottom: 0.5px solid var(--border);
}
.hist-chg-row:last-child { border-bottom: none; }
.hist-chg-icon  { font-size: 13px; font-weight: 600; flex-shrink: 0; width: 16px; text-align: center; }
.hist-chg-name  { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-chg-flow  { display: flex; align-items: center; font-size: 11px; flex-shrink: 0; }
.hist-chg-from  { color: var(--text3); }
.hist-chg-to    { font-weight: 500; }
.hist-chg-entered { color: var(--green); }
.hist-chg-exited  { color: var(--red); }
.hist-chg-neutral { color: var(--text3); }
.hist-chg-count   { font-size: 10px; color: var(--text3); font-family: var(--font-mono); }
.hist-no-changes  { padding: 18px 14px; font-size: 12px; color: var(--text3); }

/* Context card */
.hist-ctx-body  { padding: 10px 14px; display: flex; flex-direction: column; gap: 0; }
.hist-ctx-row   {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 0.5px solid var(--border); font-size: 12px;
}
.hist-ctx-row:last-of-type { border-bottom: none; }
.hist-ctx-label { color: var(--text3); }
.hist-ctx-val   { font-weight: 500; color: var(--text); }
.hist-ctx-note  {
  margin-top: 10px; padding: 10px 12px;
  background: var(--bg2); border-radius: var(--radius);
  font-size: 12px; color: var(--text2); line-height: 1.6;
}

/* 52-week heat grid */
.hist-heat-grid {
  display: flex; gap: 2px;
  padding: 14px 14px 10px;
  filter: blur(0);
}
.hist-heat-col {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  min-height: 60px;
}
.hist-heat-col > div { flex: 1; border-radius: 1px; }

.hist-heat-gate {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, rgba(var(--bg-rgb,255,255,255),.1) 0%, var(--bg) 55%);
  backdrop-filter: blur(4px);
}
.hist-heat-gate-inner {
  text-align: center;
  padding: 20px;
}

/* Intro header (kept for compatibility) */
.hist-intro { padding: 0 0 4px; }
.hist-intro-title { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.hist-intro-sub   { font-size: 12px; color: var(--text3); }
.hist-state-bull  { color: var(--green); }
.hist-state-bear  { color: var(--red); }
.hist-state-transition { color: var(--amber); }
