/* FORCE REBUILD - Thu Aug  6 14:00:29 EDT 2026 */
/* ═══════════════════════════════════════════════════════════════
   DeltaTerra Investments | Market Risk Dashboard
   styles.css
   ═══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Brand palette (from logo) */
  --dt-red:    #e54b20;
  --dt-blue:   #2b4aaa;
  --dt-teal:   #007a60;
  --dt-sky:    #5bc4e0;
  --dt-dark:   #1f1f1f;

  /* Dashboard theme */
  --bg:        #0c1220;
  --surface:   #111c2e;
  --surface2:  #182438;
  --border:    #1f3050;
  --accent:    #5bc4e0;   /* sky blue: primary UI */
  --accent2:   #e54b20;   /* red: compare / risk */
  --accent3:   #f5b942;   /* amber: national */
  --text:      #e6ecf5;
  --text-muted:#6a85a6;
  --text-dim:  #334560;
  --risk-high: #e54b20;
  --risk-low:  #2ecc8a;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.5; min-height: 100vh; }

/* ── SITE GATE ── */
.site-gate { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.site-gate-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 320px; }
.site-gate-logo { height: 48px; filter: brightness(0) invert(1) opacity(0.9); }
.site-gate-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: 0.3px; text-align: center; }
.site-gate-sub { font-size: 12px; color: var(--text-muted); }
.site-gate-input { width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; color: var(--text); font-family: var(--font-body); font-size: 14px; padding: 10px 14px; outline: none; text-align: center; transition: border-color 0.2s; }
.site-gate-input:focus { border-color: var(--accent); }
.site-gate-btn { width: 100%; background: var(--accent); color: var(--bg); font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: 1px; padding: 10px; border: none; border-radius: 8px; cursor: pointer; transition: opacity 0.2s; }
.site-gate-btn:hover { opacity: 0.88; }
.site-gate-error { font-size: 12px; color: var(--risk-high); min-height: 16px; }

/* ── LOADING SCREEN ── */
.loading-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 999; transition: opacity 0.5s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-logo-img { height: 52px; margin-bottom: 6px; filter: brightness(0) invert(1) opacity(0.85); }
.loading-sub { font-family: var(--font-display); font-size: 11px; letter-spacing: 3px; color: var(--text-muted); margin-bottom: 20px; text-transform: uppercase; }
.loading-bar-wrap { width: 180px; height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; }
.loading-bar { height: 100%; background: var(--accent); animation: loadAnim 1.4s ease-in-out forwards; }
.loading-text { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; letter-spacing: 1.5px; font-family: var(--font-mono); }
@keyframes loadAnim { 0%{width:0%} 70%{width:75%} 100%{width:100%} }

/* ── HEADER ── */
.header {
  background: #ffffff;
  border-bottom: 3px solid var(--dt-red);
  padding: 10px 28px;
  display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.header-logo img { height: 42px; display: block; }
.header-divider { width: 1px; height: 36px; background: #dde3ea; flex-shrink: 0; }
.header-title { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dt-dark); }
.header-subtitle { font-size: 11px; color: #6a7a8a; font-family: var(--font-body); margin-top: 2px; }
.header-spacer { margin-left: auto; }

/* ── TABS ── */
.tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; position: sticky; top: 65px; z-index: 99; }
.tab { padding: 12px 18px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; font-family: var(--font-display); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { display: none; }
.panel.active { display: block; }

/* ── TAB 1 LAYOUT ── */
.msa-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  grid-template-rows: 380px 1fr;
  grid-template-areas:
    "sidebar map"
    "charts charts";
  height: calc(100vh - 108px);
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar { grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-header { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.sidebar-title { font-family: var(--font-display); font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }

/* ── COMBOBOX ── */
.combo-wrap { position: relative; margin-bottom: 8px; }
.combo-input { width: 100%; background: var(--bg); border: 1.5px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--font-body); font-size: 12px; padding: 8px 28px 8px 32px; outline: none; transition: border-color 0.2s; cursor: text; }
.combo-input:focus { border-color: var(--accent); }
.combo-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.combo-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 11.5px; pointer-events: none; }
.combo-dropdown { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: var(--surface2); border: 1.5px solid var(--accent); border-radius: 6px; z-index: 300; max-height: 240px; overflow-y: auto; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.combo-dropdown.open { display: block; }
.combo-option { padding: 7px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 12px; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.combo-option:hover, .combo-option.highlighted { background: rgba(91,196,224,0.1); }
.combo-option:last-child { border-bottom: none; }
.combo-rank { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0; width: 28px; text-align: right; }
.combo-code { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); flex-shrink: 0; width: 38px; }
.combo-name { flex: 1; }
.combo-badge { font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.combo-badge.high { background: rgba(229,75,32,0.15); color: var(--risk-high); }
.combo-badge.low  { background: rgba(46,204,138,0.10); color: var(--risk-low); }

.klima-note { font-size: 11px; color: var(--text-dim); margin-top: 4px; margin-bottom: 8px; font-style: italic; line-height: 1.4; padding: 0 2px; }

/* ── TOGGLE ── */
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.toggle { width: 28px; height: 16px; background: var(--border); border-radius: 8px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--accent); }
.toggle::after { content: ''; position: absolute; width: 12px; height: 12px; background: white; border-radius: 50%; top: 2px; left: 2px; transition: left 0.2s; }
.toggle.on::after { left: 14px; }

/* ── RISK BADGE (shared) ── */
.risk-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; padding: 2px 4px; border-radius: 2px; text-transform: uppercase; flex-shrink: 0; font-family: var(--font-display); }
.risk-badge.high { background: rgba(229,75,32,0.15); color: var(--risk-high); }
.risk-badge.low  { background: rgba(46,204,138,0.10); color: var(--risk-low); }

/* ── MAP ── */
.map-row { grid-area: map; display: flex; height: 100%; min-width: 0; border-bottom: 1px solid var(--border); }
.map-container { flex: 1; position: relative; background: var(--surface); height: 100%; padding: 12px 20px; min-width: 0; }
#usa-svg { width: 100%; height: 100%; display: block; }
.state-path { fill: #162035; stroke: #1f3050; stroke-width: 0.7; }
.msa-dot { cursor: pointer; }
.msa-dot.selected-dot { stroke: white; stroke-width: 2.5; opacity: 1 !important; }
.msa-dot.compare-dot  { stroke: var(--accent2); stroke-width: 2.5; opacity: 1 !important; }
.msa-poly { cursor: pointer; transition: fill-opacity 0.15s; }
.msa-poly.msa-hover { fill-opacity: 1; stroke: #e6ecf5; stroke-width: 0.9; }
.msa-poly.selected-poly { stroke: white; stroke-width: 1.6; fill-opacity: 1; }
.msa-poly.compare-poly  { stroke: var(--accent2); stroke-width: 1.6; fill-opacity: 1; }
.map-controls-stack { position: absolute; top: 12px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 100; }
.map-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); background: rgba(17,28,46,0.85); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
.map-legend-foot { color: var(--text-dim); margin-left: 4px; }
.legend-grad { width: 90px; height: 7px; border-radius: 4px; background: linear-gradient(to right, rgb(105,15,15) 0%, rgb(250,215,215) 50%, rgb(210,225,250) 50%, rgb(20,50,140) 100%); }
.coverage-note { position: relative; }
.coverage-toggle { background: transparent; border: none; color: var(--text-muted); font-family: var(--font-body); font-size: 11.5px; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; line-height: 1; }
.coverage-toggle:hover { color: var(--text); }
.coverage-note.open .coverage-toggle { color: var(--accent); }
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid currentColor; background: transparent; color: inherit; font-size: 11px; font-weight: 700; font-family: var(--font-display); font-style: italic; line-height: 1; }
.coverage-label { font-family: var(--font-body); font-size: 11.5px; letter-spacing: 0.2px; }
.coverage-body { position: absolute; top: 22px; right: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 11.5px; color: var(--text); width: 220px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); display: none; line-height: 1.45; font-family: var(--font-body); z-index: 110; }
.coverage-note.open .coverage-body { display: block; }
.map-zoom-controls { display: flex; flex-direction: column; gap: 4px; }
.map-zoom-controls button { background: rgba(17,28,46,0.85); border: 1px solid var(--border); color: var(--text); width: 26px; height: 26px; cursor: pointer; font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1; padding: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.map-zoom-controls button:hover { background: rgba(91,196,224,0.15); border-color: var(--accent); color: var(--accent); }
#usa-svg { touch-action: none; }
#usa-svg.zoomed { cursor: grab; }
#usa-svg.panning { cursor: grabbing; }
.map-tooltip { position: fixed; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 11px; pointer-events: none; z-index: 200; display: none; max-width: 240px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); font-family: var(--font-body); }

/* ── STAT STRIP ── */
.stat-strip { display: flex; flex-direction: column; width: 264px; background: var(--surface); border-right: 1px solid var(--border); flex-shrink: 0; height: 100%; overflow-y: auto; }
.stat-card { padding: 14px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto; display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; }
.stat-card:last-child { border-bottom: none; }
.stat-card:first-child { flex: 0 0 auto; padding-top: 16px; padding-bottom: 16px; }
.stat-label { font-size: 9.5px; font-weight: 700; letter-spacing: 1.6px; color: var(--text-muted); text-transform: uppercase; font-family: var(--font-display); display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.stat-label-aux { display: none; }
.stat-line { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-msa-mini { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; font-family: var(--font-display); text-transform: uppercase; display: none; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.primary-mini { color: var(--accent); }
.compare-mini { color: var(--accent2); }
.stat-msa-name { font-family: var(--font-body); font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--text); }
.stat-msa-name.compare { color: var(--text); }
.stat-value-row { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.2px; line-height: 1.1; font-weight: 600; color: var(--text); }
.stat-value.compare { color: var(--text); }
.stat-change { font-size: 10.5px; font-family: var(--font-mono); letter-spacing: 0.2px; }
.stat-change.up   { color: var(--risk-low); }   /* ↑ positive = green */
.stat-change.down { color: var(--risk-high); }  /* ↓ negative = red */
.stat-asof { font-size: 9.5px; font-family: var(--font-mono); color: var(--text-dim); letter-spacing: 0.3px; margin-top: 4px; }
.stat-line.compare-line { display: none; }
/* Compare-on: switch each card to a 2-column grid; label spans top, primary | compare sit side-by-side, asof spans bottom */
.stat-strip.compare-on .stat-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "label   label"
    "primary compare"
    "asof    asof";
  column-gap: 14px;
  row-gap: 4px;
  align-content: start;
  flex: 0 0 auto;
}
.stat-strip.compare-on .stat-card > .stat-label   { grid-area: label; }
.stat-strip.compare-on .stat-card > .primary-line { grid-area: primary; display: flex; }
.stat-strip.compare-on .stat-card > .compare-line { grid-area: compare; display: flex; }
.stat-strip.compare-on .stat-card > .stat-asof    { grid-area: asof; text-align: right; }
.stat-strip.compare-on .stat-msa-mini { display: block; }
.stat-strip.compare-on .stat-value { font-size: 19px; }
.stat-strip.compare-on .stat-msa-name { font-size: 12px; }

/* ── CHART GRID ── */
.charts-area { grid-area: charts; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.charts-toggle-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); padding: 8px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.charts-grid { flex: 1; padding: 18px 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; overflow-y: auto; min-height: 0; align-items: stretch; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; position: relative; display: flex; flex-direction: column; }
.delta-toggle-wrap { position: absolute; top: 10px; right: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; z-index: 2; }
.delta-toggle-label { font-family: var(--font-display); font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); transition: color 0.15s; }
.delta-toggle-wrap:hover .delta-toggle-label { color: var(--text); }
.delta-toggle-wrap:has(.toggle.on) .delta-toggle-label { color: var(--text); }
.chart-label { font-size: 9.5px; font-weight: 700; letter-spacing: 1.8px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 3px; font-family: var(--font-display); }
.chart-title { font-family: var(--font-display); font-size: 14.5px; letter-spacing: 0.2px; color: var(--text); margin-bottom: 10px; font-weight: 600; }
.chart-title-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-muted); letter-spacing: 0.3px; margin-top: 1px; }
.chart-wrap { position: relative; flex: 1; min-height: 180px; }
.dq-no-data-overlay { position: absolute; inset: 0; background: rgba(15,25,45,0.82); display: flex; align-items: center; justify-content: center; font-size: 12px; font-family: var(--font-display); color: var(--text-muted); text-align: center; padding: 12px; border-radius: 6px; pointer-events: none; }
.dq-footnote { font-size: 10.5px; color: var(--text-dim); font-style: italic; padding: 8px 20px 12px; line-height: 1.5; }
.legend { display: flex; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── TAB 2: RISKIEST ── */
.section-header { padding: 14px 22px 0; }
.section-eyebrow { font-size: 11px; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 3px; font-family: var(--font-display); font-weight: 800; }
.section-title { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.5px; font-weight: 700; }
.section-desc { margin-top: 8px; max-width: 920px; font-size: 13px; line-height: 1.65; color: var(--text-muted); }
.section-desc strong { color: var(--text); font-weight: 600; }
.riskiest-layout { padding: 18px 22px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.riskiest-layout .chart-wrap { height: 195px; }

/* ── TAB 3: LOOKBACK ── */
.lookback-layout { padding: 14px 22px; }
.lookback-controls { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.lookback-right-controls { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-muted); }
.metric-pills { display: flex; gap: 5px; }
.pill { padding: 5px 12px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; border-radius: 20px; cursor: pointer; border: 1px solid var(--border); color: var(--text-muted); background: transparent; transition: all 0.2s; font-family: var(--font-display); }
.pill.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.candlestick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 9px; max-height: calc(100vh - 215px); overflow-y: auto; }
.candle-card { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 11px; cursor: pointer; transition: border-color 0.15s; }
.candle-card:hover { border-color: var(--accent); }
.candle-card.highest { border-left: 3px solid var(--risk-high); }
.candle-name { font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.candle-bar-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.candle-bar-label { font-size: 10.5px; color: var(--text-muted); width: 40px; flex-shrink: 0; font-family: var(--font-mono); }
.candle-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.candle-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.candle-val { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); width: 44px; text-align: right; flex-shrink: 0; }
.candle-change { font-family: var(--font-mono); font-size: 11px; text-align: right; margin-top: 1px; }
.candle-change.up   { color: var(--risk-low); }   /* ↑ positive = green */
.candle-change.down { color: var(--risk-high); }  /* ↓ negative = red */

/* ── TAB 4: CANDLESTICK ── */
.candle-top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px 0; }
.candle-top-row .section-header { padding: 0; flex-shrink: 1; min-width: 0; }
.candle-layout { padding: 14px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.candle-slider-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; width: 420px; flex-shrink: 0; }
.candle-slider-header { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; flex-wrap: wrap; }
.candle-slider-title { font-family: var(--font-display); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; color: var(--text-muted); text-transform: uppercase; }
.candle-slider-readout { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-family: var(--font-body); margin-left: auto; flex-wrap: wrap; }
.candle-slider-readout strong { color: var(--text); font-family: var(--font-mono); font-weight: 600; font-size: 11px; }
.candle-slider-arrow { color: var(--text-dim); }
.candle-slider-span { color: var(--accent); font-family: var(--font-mono); font-size: 11.5px; padding-left: 8px; border-left: 1px solid var(--border); margin-left: 2px; }
.candle-slider-foot { margin-top: 4px; font-size: 11px; color: var(--text-dim); font-style: italic; line-height: 1.4; cursor: help; }

/* Dual-handle range slider */
.range-slider { position: relative; height: 44px; padding: 0 8px; }
.range-track { position: absolute; left: 8px; right: 8px; top: 18px; height: 4px; background: var(--border); border-radius: 2px; }
.range-fill { position: absolute; top: 18px; height: 4px; background: var(--accent); border-radius: 2px; pointer-events: none; }
.range-slider input[type=range] {
  position: absolute; left: 0; right: 0; top: 8px; width: 100%; height: 24px;
  background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; margin: 0;
}
.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  cursor: pointer; pointer-events: auto;
  box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0,0,0,0.4);
}
.range-slider input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  cursor: pointer; pointer-events: auto;
  box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0,0,0,0.4);
}
.range-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; }
.range-slider input[type=range]::-moz-range-track { background: transparent; }
.range-slider input[type=range]:focus { outline: none; }
.range-ticks { position: absolute; left: 8px; right: 8px; top: 30px; display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); pointer-events: none; }
.range-ticks span { transform: translateX(-50%); white-space: nowrap; }
.range-ticks span:first-child { transform: translateX(0); }
.range-ticks span:last-child { transform: translateX(0); text-align: right; }

/* Candlestick box-plot grid */
.candle-box-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.candle-box-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 14px; display: flex; flex-direction: column; }
.candle-box-card .chart-label { color: var(--text-muted); }
.candle-box-svg { width: 100%; height: 240px; display: block; }
.candle-box-svg .grid-line { stroke: #1a2d48; stroke-width: 0.6; stroke-dasharray: 2 3; }
.candle-box-svg .axis-line { stroke: var(--border); stroke-width: 1; }
.candle-box-svg .axis-text { fill: var(--text-muted); font-family: var(--font-body); font-size: 11px; }
.candle-box-svg .cat-text { fill: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 11.5px; letter-spacing: 0.5px; }
.candle-box-svg .median-line { stroke: var(--text); stroke-width: 1.8; }
.candle-box-svg .whisker-line { stroke-width: 1.4; }
.candle-box-svg .box-rect { stroke-width: 1.2; }
.candle-box-svg .outlier-dot { fill-opacity: 0.6; stroke-width: 0; }
.candle-box-svg .box-stat-label { fill: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }
.candle-box-svg .box-stat-median { fill: var(--text); font-weight: 600; }
.candle-box-stats { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.candle-box-stats strong { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin-left: 4px; }
.candle-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 11px; }
.candle-clamp-note { font-size: 11px; color: #f5b942; font-family: var(--font-mono); padding: 4px 8px; background: rgba(245,185,66,0.08); border-left: 2px solid #f5b942; border-radius: 2px; margin: 4px 0 6px; line-height: 1.4; }

/* Per-chart "Include outliers" toggle, sits at the end of the legend row */
.candle-box-card .legend { align-items: center; }
.outlier-toggle { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); cursor: pointer; user-select: none; margin-left: auto; padding: 2px 4px; border-radius: 4px; transition: color 0.15s; }
.outlier-toggle:hover { color: var(--text); }
.outlier-toggle.on { color: var(--text); }
.outlier-toggle .outlier-count { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.outlier-toggle.on .outlier-count { color: var(--accent); }

/* ── TAB 0: OVERVIEW ── */
.overview-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 28px 36px; display: flex; flex-direction: column; gap: 18px; }

.overview-hero { background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%); border: 1px solid var(--border); border-left: 3px solid var(--dt-red); border-radius: 10px; padding: 22px 26px; }
.overview-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.overview-hero-top .overview-eyebrow { margin-bottom: 0; }
.overview-asof-pill { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); background: rgba(91,196,224,0.08); border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px; letter-spacing: 0.3px; white-space: nowrap; }
.overview-eyebrow { font-family: var(--font-display); font-size: 11.5px; font-weight: 800; letter-spacing: 3px; color: var(--dt-red); text-transform: uppercase; margin-bottom: 8px; }
.overview-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: 0.3px; margin-bottom: 12px; }
.overview-lede { font-size: 14px; line-height: 1.65; color: var(--text-muted); }
.overview-lede strong { color: var(--text); font-weight: 600; }
.overview-lede em { color: var(--risk-high); font-style: normal; font-weight: 600; }

.overview-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 22px; }
.overview-section-title { font-family: var(--font-display); font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.overview-section p { font-size: 13px; line-height: 1.65; color: var(--text-muted); margin-bottom: 10px; }
.overview-section p:last-child { margin-bottom: 0; }
.overview-section p strong { color: var(--text); font-weight: 600; }
.overview-asof { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--accent); background: rgba(91,196,224,0.10); padding: 2px 8px; border-radius: 3px; letter-spacing: 0.5px; }

.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.overview-indicators { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.indicator-card { background: var(--surface2); border: 1px solid var(--border); border-top: 3px solid var(--text-dim); border-radius: 8px; padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.indicator-card.cat-catalyst   { border-top-color: #b4a06d; }
.indicator-card.cat-leading    { border-top-color: #7d9bb5; }
.indicator-card.cat-coincident { border-top-color: #9590b0; }
.indicator-card.cat-lagging    { border-top-color: #b67f6a; }
.indicator-tag { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text-dim); line-height: 1; margin-bottom: 4px; }
.indicator-card.cat-catalyst .indicator-tag   { color: rgba(180,160,109,0.60); }
.indicator-card.cat-leading .indicator-tag    { color: rgba(125,155,181,0.60); }
.indicator-card.cat-coincident .indicator-tag { color: rgba(149,144,176,0.60); }
.indicator-card.cat-lagging .indicator-tag    { color: rgba(182,127,106,0.60); }
.indicator-kind { font-family: var(--font-display); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; color: var(--text-muted); text-transform: uppercase; }
.indicator-headline { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text); margin-top: 2px; margin-bottom: 4px; }
.indicator-body { font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }

.observation { display: grid; grid-template-columns: 28px 1fr; gap: 12px; margin-bottom: 14px; }
.observation:last-child { margin-bottom: 0; }
.observation-num { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--accent); line-height: 1; }
.observation-body p { margin-bottom: 8px; }

.pill-inline { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; padding: 1px 7px; border-radius: 3px; font-family: var(--font-display); vertical-align: 1px; }
.pill-inline.risk { background: rgba(229,75,32,0.18); color: var(--risk-high); }
.pill-inline.rest { background: rgba(91,196,224,0.16); color: var(--accent); }

.overview-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nav-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px 16px; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.nav-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.nav-card-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 4px; }
.nav-card-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.nav-card-body { font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }

.sources-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sources-table thead th { font-family: var(--font-display); font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; color: var(--text-muted); text-transform: uppercase; text-align: left; padding: 8px 14px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.sources-table thead th:first-child { border-top-left-radius: 6px; }
.sources-table thead th:last-child { border-top-right-radius: 6px; }
.sources-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); line-height: 1.45; }
.sources-table tbody tr:last-child td { border-bottom: none; }
.sources-table tbody td:last-child { color: var(--text); font-weight: 500; }
.sources-table tbody td a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.sources-table tbody td a:hover { color: var(--text); border-bottom-color: var(--text); }

.overview-footer { text-align: center; font-size: 11.5px; color: var(--text-dim); font-family: var(--font-mono); padding: 8px 0; letter-spacing: 0.5px; }

.overview-disclosures p { font-size: 11.5px; line-height: 1.6; color: var(--text-dim); }
.overview-disclosures p strong { color: var(--text-muted); font-weight: 600; }

@media (max-width: 880px) {
  .overview-grid { grid-template-columns: 1fr; }
  .overview-indicators { grid-template-columns: repeat(2, 1fr); }
  .overview-nav { grid-template-columns: 1fr; }
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── VIEW SWITCHER (top-level) ── */
.view-switcher {
  display: flex;
  gap: 4px;
  background: #f0f4f8;
  border-radius: 8px;
  padding: 4px;
}
.view-switcher-tab {
  padding: 8px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6a7a8a;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.view-switcher-tab:hover { color: var(--dt-dark); }
.view-switcher-tab.active {
  background: var(--dt-dark);
  color: #ffffff;
}

/* ── TRADE RETURNS ANALYSIS PLACEHOLDER ── */
.tra-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: calc(100vh - 108px); gap: 12px; }
.tra-placeholder-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-display); }
.tra-placeholder-title { font-size: 28px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.tra-placeholder-body { font-size: 13px; color: var(--text-muted); }

.view { display: none; }
.view.active { display: block; }

/* CRT view uses a slightly bluer base shade to differentiate from MID */
body:has(#view-crt.active) { background: #0a1a30; }
body:has(#view-crt.active) .tabs.crt-tabs { background: #0e2240; }

.crt-panel { display: none; }
.crt-panel.active { display: block; }
.crt-panel.active#crt-panel-overview { display: flex; flex-direction: column; gap: 28px; }

/* ══ CRT SCREEN VIEW ══ */
.crt-wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.crt-hero {
  padding: 22px 26px 24px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-radius: 10px;
}
.crt-eyebrow {
  font-family: var(--font-display);
  font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
  margin-bottom: 8px;
}
.crt-title {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}
.crt-subtitle {
  font-size: 13.5px; line-height: 1.55; color: var(--text-muted);
  margin-top: 8px; max-width: 820px;
}
.crt-asof {
  margin-left: auto; align-self: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
  background: rgba(91,196,224,0.08); border: 1px solid rgba(91,196,224,0.25);
  padding: 5px 10px; border-radius: 4px;
}

.crt-section {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 22px 24px 24px;
}
.crt-section-head { margin-bottom: 18px; }
.crt-section-head-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.crt-section-head-top .crt-section-eyebrow { margin-bottom: 0; }
.crt-section-eyebrow {
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
  margin-bottom: 4px;
}
.crt-section-asof-pill { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); background: rgba(91,196,224,0.08); border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px; letter-spacing: 0.3px; white-space: nowrap; }
.crt-section-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; color: var(--text);
  letter-spacing: 0.2px;
}

/* ── CRT Target Screens password gate ── */
.crt-lock {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 80px 28px;
}
.crt-lock-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 32px 36px 28px;
  width: 360px; max-width: 100%;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
.crt-lock-icon { font-size: 30px; margin-bottom: 10px; }
.crt-lock-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 16px; color: var(--text); margin-bottom: 6px;
}
.crt-lock-sub {
  font-size: 12.5px; color: var(--text-muted);
  text-align: center; line-height: 1.5; margin-bottom: 18px;
}
.crt-lock-input {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
  padding: 9px 12px; outline: none; transition: border-color 0.2s;
  margin-bottom: 12px;
}
.crt-lock-input:focus { border-color: var(--accent); }
.crt-lock-btn {
  width: 100%; background: var(--accent); color: var(--bg);
  border: none; border-radius: 6px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700;
  font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 10px; transition: filter 0.2s;
}
.crt-lock-btn:hover { filter: brightness(1.08); }
.crt-lock-error {
  color: var(--risk-high); font-size: 12px;
  min-height: 16px; margin-top: 10px;
}
.crt-section-sub {
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 6px; line-height: 1.5;
  max-width: 880px;
}
.crt-section-sub #marketTradeMeta {
  display: inline-block; margin-left: 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
}

/* ── Section 1: Portfolio summary table + disclosures (two columns) ── */
.portfolio-layout {
  display: flex;
  align-items: stretch;
  gap: 28px;
}
.portfolio-summary-section { flex: 0 0 auto; }
.portfolio-disclosures {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.portfolio-disclosures p { font-size: 11.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 10px; }
.portfolio-disclosures p:last-child { margin-bottom: 0; }
.portfolio-disclosures p strong { color: var(--text-muted); font-weight: 600; }

.portfolio-table-wrap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  /* Narrower default; drag the bottom-right corner to resize. */
  width: 460px;
  min-width: 320px;
  max-width: 100%;
  resize: horizontal;
}
.portfolio-table { width: 100%; }
.portfolio-table thead th:last-child { text-align: right; }
.portfolio-table tbody td:first-child { width: 65%; }
.portfolio-table tbody td:last-child {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.pf-info-wrap {
  position: relative;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}
.pf-row-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--text-dim);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display); font-size: 9px; font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 120ms, border-color 120ms;
}
.pf-row-info:hover { color: var(--text); border-color: var(--text); }
.pf-info-wrap.open .pf-row-info { color: var(--accent); border-color: var(--accent); }
.pf-info-pop {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  width: 280px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
  white-space: normal;
  text-align: left;
  z-index: 200;
}
.pf-info-pop::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -6px;
  transform: translateY(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: var(--surface2);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pf-info-wrap.open .pf-info-pop { display: block; }
.portfolio-table tr.pf-divider td { padding: 0; height: 20px; background: transparent; border: none; border-bottom: 2px solid var(--text-dim); }

/* ── Sections 2 & 3 tables ── */
.crt-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.crt-table thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700; font-size: 10.5px;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.crt-table thead th:first-child { text-align: left; }
.crt-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.crt-table tbody td:first-child {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}
.crt-table tbody tr:last-child td { border-bottom: none; }
.crt-table tbody tr:hover td { background: rgba(91,196,224,0.04); }

/* color positive/negative numbers */
.num-pos { color: #4ade80; }
.num-neg { color: #f87171; }

.thematic-table-wrap { overflow-x: auto; }
.thematic-hpa-ref td { font-size: 12px; color: var(--text); padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: right; font-family: var(--font-mono); }
.thematic-hpa-ref td:first-child { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--text); }
.thematic-hpa-spacer td { padding: 3px 0; border-bottom: 2px solid var(--border); }

/* Thematic scenario clickable rows + expand */
.crt-table .th-hint {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: none;
  color: var(--text-dim);
  margin-left: 4px;
}
.crt-table tr.thematic-row { cursor: pointer; }
.crt-table tr.thematic-row:hover td { background: rgba(91,196,224,0.07); }
.thematic-chevron {
  display: inline-block;
  width: 12px;
  color: var(--accent);
  font-size: 10px;
  transition: transform 0.15s ease;
  margin-right: 2px;
}
.crt-table tr.thematic-row.open .thematic-chevron { transform: rotate(90deg); }
.crt-table tr.thematic-desc-row td {
  background: var(--bg);
  padding: 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: normal;
}
.thematic-desc-body {
  padding: 12px 16px 14px 28px;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
  margin: 4px 8px 4px 12px;
  background: rgba(91,196,224,0.04);
  border-radius: 0 4px 4px 0;
}

.market-tables {
  display: flex; flex-direction: column;
  gap: 20px;
}
.market-table-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px 16px;
}
.market-table-title {
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.market-toggle-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin-bottom: 14px;
}
.market-toggle-label {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted);
  margin-right: 4px;
}
.market-toggle-pill {
  font-family: var(--font-display); font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
  transition: all 0.15s; letter-spacing: 0.2px;
}
.market-toggle-pill:hover { color: var(--text); border-color: var(--accent); }
.market-toggle-pill.active {
  color: var(--text); background: rgba(91,196,224,0.12);
  border-color: var(--accent);
}
.market-table-wrap { overflow-x: auto; }
.market-table-wrap .metric-line { line-height: 1.35; }
.market-table-wrap .metric-line + .metric-line { margin-top: 2px; }
.market-table-wrap .metric-bond { color: var(--text); }
.market-table-wrap .metric-return { margin-top: 3px; }
.market-table-wrap .return-bubble {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid currentColor;
  line-height: 1.3;
}
.market-table-wrap .return-bubble.num-pos { background: rgba(74,222,128,0.12); }
.market-table-wrap .return-bubble.num-neg { background: rgba(248,113,113,0.12); }

/* Market Scenarios: left-justify the label columns (Spread Widening, Spread @
   Settle, Percent above) and divide them from the scenario/date columns. */
#marketUnifiedTable thead th:nth-child(1),
#marketUnifiedTable tbody td:nth-child(1),
#marketUnifiedTable thead th:nth-child(2),
#marketUnifiedTable tbody td:nth-child(2),
#marketUnifiedTable thead th:nth-child(3),
#marketUnifiedTable tbody td:nth-child(3) { text-align: left; }
#marketUnifiedTable thead th:nth-child(3),
#marketUnifiedTable tbody td:nth-child(3) { border-left: 2px solid var(--border); }
#marketUnifiedTable thead th.mkt-pct-col {
  white-space: normal;
  min-width: 150px;
  max-width: 200px;
  vertical-align: bottom;
}

/* ── Section 4: CRT column filter panel ── */
.crt-filter-panel {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.crt-filter-master-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.crt-filter-master {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.crt-filter-master:hover { color: var(--text); }
.crt-filter-master.active {
  background: var(--accent);
  color: var(--dt-dark);
  border-color: var(--accent);
}
.crt-filter-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}
.crt-filter-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crt-filter-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: start;
  padding: 6px 0;
}
.crt-filter-section-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text);
  padding-top: 6px;
  border-left: 3px solid var(--border);
  padding-left: 10px;
  line-height: 1.35;
}
.crt-filter-section.sec-0 .crt-filter-section-name { border-left-color: #5bc4e0; }
.crt-filter-section.sec-1 .crt-filter-section-name { border-left-color: #f5b942; }
.crt-filter-section.sec-2 .crt-filter-section-name { border-left-color: #a78bfa; }
.crt-filter-section.sec-3 .crt-filter-section-name { border-left-color: #2ecc8a; }
.crt-filter-section.sec-4 .crt-filter-section-name { border-left-color: #e54b20; }
.crt-filter-section.sec-5 .crt-filter-section-name { border-left-color: #5bc4e0; }
.crt-filter-section.sec-6 .crt-filter-section-name { border-left-color: #f5b942; }
.crt-filter-section.sec-7 .crt-filter-section-name { border-left-color: #a78bfa; }
.crt-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.crt-filter-btn {
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 0.2px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1.3;
  max-width: 220px;
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.crt-filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.crt-filter-btn.active {
  background: rgba(91,196,224,0.18);
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 880px) {
  .crt-filter-section { grid-template-columns: 1fr; }
  .crt-filter-section-name { border-left: none; border-top: 2px solid var(--border); padding-left: 0; padding-top: 8px; }
}

/* ── Section 4: CRT screen wide table ── */
.crt-screen-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  max-height: 78vh;
  overflow-y: auto;
}
.crt-screen-table {
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  width: max-content;
  min-width: 100%;
}
.crt-screen-table thead.crt-sections-row th {
  background: var(--surface2);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700; font-size: 10.5px;
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  position: sticky; top: 0; z-index: 3;
}
.crt-screen-table thead.crt-headers-row th {
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 600; font-size: 10px;
  letter-spacing: 0.5px; text-transform: none;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: right;
  vertical-align: bottom;
  white-space: pre-line;
  line-height: 1.35;
  position: sticky;
  top: 37px;
  z-index: 2;
}
.crt-screen-table thead.crt-headers-row th:first-child {
  text-align: left;
}
.crt-screen-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.crt-screen-table tbody td:first-child {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  position: sticky; left: 0;
  z-index: 1;
  border-right: 2px solid var(--border);
}
.crt-screen-table thead.crt-sections-row th:first-child,
.crt-screen-table thead.crt-headers-row th:first-child {
  position: sticky; left: 0;
  z-index: 4;
  background: var(--surface2);
  border-right: 2px solid var(--border);
}
.crt-screen-table tbody tr:hover td { background: rgba(91,196,224,0.04); }
.crt-screen-table tbody tr:hover td:first-child { background: var(--surface2); }
.col-resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; z-index: 1; }
.col-resize-handle:hover { background: var(--accent); opacity: 0.5; }

/* section-group color stripes */
.crt-screen-table .sec-0 { border-left: 3px solid #5bc4e0; }
.crt-screen-table .sec-1 { border-left: 3px solid #f5b942; }
.crt-screen-table .sec-2 { border-left: 3px solid #a78bfa; }
.crt-screen-table .sec-3 { border-left: 3px solid #2ecc8a; }
.crt-screen-table .sec-4 { border-left: 3px solid #e54b20; }
.crt-screen-table .sec-5 { border-left: 3px solid #5bc4e0; }
.crt-screen-table .sec-6 { border-left: 3px solid #f5b942; }
.crt-screen-table .sec-7 { border-left: 3px solid #a78bfa; }

/* ── CRT Overview tab: content, disclosures, footer ── */
.crt-paths { grid-template-columns: repeat(3, 1fr); }
.crt-overview-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.crt-overview-p { font-size: 13px; line-height: 1.65; color: var(--text-muted); margin: 0 0 10px; }
.crt-overview-p:last-child { margin-bottom: 0; }
.crt-overview-p strong { color: var(--text); font-weight: 600; }
.crt-overview-list { margin: 0; padding-left: 18px; display: grid; gap: 7px; }
.crt-overview-list li { font-size: 13px; line-height: 1.5; color: var(--text-muted); padding-left: 4px; }
.crt-overview-list li::marker { color: var(--accent); }

/* ── CRT Overview: Historical HY spreads chart ── */
.hy-highlight {
  margin: 4px 0 18px;
  padding: 16px 22px;
  background: rgba(91,196,224,0.10);
  border: 1.5px solid var(--accent);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  box-shadow: 0 4px 18px rgba(91,196,224,0.10);
}
.hy-highlight strong {
  color: var(--accent);
  font-weight: 800;
}
.hy-chart-layout { display: grid; grid-template-columns: 1fr 188px; gap: 20px; align-items: stretch; }
.hy-chart-canvas-wrap { position: relative; height: 540px; min-width: 0; }
.hy-pct-panel {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px;
  align-self: center;
}
.hy-pct-title {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 800;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted);
  line-height: 1.35;
}
.hy-pct-table { width: 100%; border-collapse: collapse; }
.hy-pct-table td { padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.hy-pct-table tr:last-child td { border-bottom: none; }
.hy-pct-lvl { color: var(--text-muted); font-family: var(--font-mono); }
.hy-pct-val { color: var(--text); font-weight: 700; text-align: right; font-family: var(--font-mono); }
.hy-current {
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px;
}
.hy-current-label { font-size: 10.5px; color: var(--text-muted); line-height: 1.4; margin-bottom: 4px; }
.hy-current-val {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent3);
}
.hy-pct-foot { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

@media (max-width: 880px) {
  .hy-chart-layout { grid-template-columns: 1fr; }
  .hy-chart-canvas-wrap { height: 460px; }
}
.crt-disclosures p { font-size: 11.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 10px; }
.crt-disclosures p:last-child { margin-bottom: 0; }
.crt-disclosures p strong { color: var(--text-muted); font-weight: 600; }
.crt-screen-footnotes { margin-top: 28px; padding: 20px 24px; border-top: 1px solid var(--border); }
.crt-screen-footnotes + .crt-screen-footnotes { border-top: none; padding-top: 0; margin-top: 0; }
.csf-heading { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); text-decoration: underline; margin-bottom: 12px; }
.csf-list { margin: 0; padding-left: 18px; list-style-type: decimal; }
.csf-list li { font-size: 11px; line-height: 1.55; color: var(--text-dim); margin-bottom: 6px; padding-left: 4px; }
.csf-list li:last-child { margin-bottom: 0; }
.crt-footer { text-align: center; font-size: 11.5px; color: var(--text-dim); font-family: var(--font-mono); padding: 8px 0; letter-spacing: 0.5px; }

/* ── HOME SCREEN ── */
.home-wrap {
  min-height: calc(100vh - 65px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8vh;
}
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 52px;
}
.home-logo { height: 64px; margin-bottom: 20px; filter: brightness(0) invert(1) opacity(0.85); }
.home-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: 0.3px; }
.home-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 920px;
  width: 100%;
  padding: 0 24px;
}
.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px 26px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  border-top: 3px solid var(--accent);
}
.home-card:hover { border-color: var(--accent); background: var(--surface2); transform: translateY(-3px); }
.home-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.home-card-body { font-size: 13px; line-height: 1.65; color: var(--text-muted); }

@media (max-width: 1024px) {
  .portfolio-layout { flex-direction: column; align-items: stretch; }
  .portfolio-summary-section { flex: 0 0 auto; }
}

@media (max-width: 880px) {
  .crt-wrap { padding: 18px 14px 36px; }
  .crt-hero { padding: 18px 18px 20px; }
  .crt-title { font-size: 22px; }
  .crt-section { padding: 18px 14px 18px; }
  .crt-overview-cols { grid-template-columns: 1fr; gap: 18px; }
  .crt-paths { grid-template-columns: 1fr; }
  .view-switcher-tab { padding: 6px 10px; font-size: 10px; letter-spacing: 1px; }
}
