:root,
[data-theme="dark"] {

  --field-bg: #0a0e17;

  --bg: #0a0e17; --bg2: #0f1424; --card: #161c35; --text: #e0e6f0; --muted: #7a8599;

  --green: #26a69a; --red: #ef5350; --gold: #ffd700; --accent: #06b6d4; --blue: #2196F3;

  --border: rgba(255,255,255,.07); --chart-bg: #0f1424;
  --panel: #1a1f2e;
  --row-hover: rgba(255,255,255,.03);
  --row-active: rgba(6,182,212,.12);
  --modal-shadow: 0 24px 60px rgba(0,0,0,.55);
  --modal-scrim: rgba(0,0,0,.55);
  --dropdown-shadow: 0 6px 16px rgba(0,0,0,.4);
  --btn-on-bg: rgba(6,182,212,.16);
  --btn-on-text: #fff;
  --layout-ctl-btn-hover-bg: rgba(139,92,246,.22);
  --layout-ctl-btn-hover-text: #fff;
  --fg-inner-border: rgba(255,255,255,.05);
  --rrg-legend-bg: rgba(0,0,0,.12);
  --hsplit-hover: rgba(6,182,212,.18);
  --tip-shadow: 0 6px 18px rgba(0,0,0,.55);

  --filter-def-border: rgba(6,182,212,.72);
  --filter-def-glow: rgba(255,215,0,.22);
  --filter-def-bg: linear-gradient(135deg, rgba(6,182,212,.14) 0%, rgba(255,215,0,.09) 100%);
  --filter-def-text: #a8e8f0;
  --filter-def-ph: rgba(6,182,212,.82);

  /* Filter bar section tints */
  --fs-setup-bg: rgba(6,182,212,.08);
  --fs-setup-border: rgba(6,182,212,.22);
  --fs-setup-label: rgba(103,232,249,.88);
  --fs-volume-bg: rgba(33,150,243,.08);
  --fs-volume-border: rgba(33,150,243,.22);
  --fs-volume-label: rgba(144,202,249,.92);
  --fs-gap-bg: rgba(255,215,0,.07);
  --fs-gap-border: rgba(255,215,0,.2);
  --fs-gap-label: rgba(255,224,130,.9);
  --fs-mktcap-bg: rgba(38,166,154,.08);
  --fs-mktcap-border: rgba(38,166,154,.22);
  --fs-mktcap-label: rgba(128,203,196,.92);
  --fs-maslope-bg: rgba(171,71,188,.08);
  --fs-maslope-border: rgba(171,71,188,.22);
  --fs-maslope-label: rgba(206,147,216,.92);
  --fs-sector-bg: rgba(255,152,0,.08);
  --fs-sector-border: rgba(255,152,0,.24);
  --fs-sector-label: rgba(255,183,77,.95);
  --fs-grade-bg: rgba(255,215,0,.06);
  --fs-grade-border: rgba(255,215,0,.18);
  --fs-grade-label: rgba(255,213,79,.88);
  --fs-search-bg: rgba(224,230,240,.06);
  --fs-search-border: rgba(224,230,240,.14);
  --fs-search-label: rgba(176,190,197,.95);
  --btn-clear-bg: rgba(239,83,80,.16);
  --btn-clear-border: rgba(239,83,80,.55);
  --btn-clear-text: #ffb4b0;
  --btn-clear-hover-bg: rgba(239,83,80,.28);
  --btn-clear-hover-text: #fff;

  /* Layout controls + key volume filters (visual emphasis) */
  --layout-ctl-text: #c4b5fd;
  --layout-ctl-label: #a78bfa;
  --layout-ctl-bg: rgba(139,92,246,.14);
  --layout-ctl-border: rgba(167,139,250,.42);
  --layout-ctl-btn-on-bg: rgba(139,92,246,.32);
  --layout-ctl-btn-on-border: #a78bfa;
  --vol-hi-text: #e9d5ff;
  --vol-hi-label: #d8b4fe;
  --vol-hi-border: rgba(192,132,252,.48);
  --vol-hi-bg: rgba(139,92,246,.11);
  --vol-hi-input-bg: rgba(88,28,135,.22);

}

[data-theme="light"] {
  --field-bg: #ffffff;
  --bg: #eef1f6;
  --bg2: #ffffff;
  --card: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --green: #00796b;
  --red: #c62828;
  --gold: #f57f17;
  --accent: #0891b2;
  --blue: #1565c0;
  --border: rgba(15,23,42,.10);
  --chart-bg: #ffffff;
  --panel: #ffffff;
  --row-hover: rgba(15,23,42,.05);
  --row-active: rgba(8,145,178,.14);
  --modal-shadow: 0 24px 60px rgba(15,23,42,.18);
  --modal-scrim: rgba(15,23,42,.35);
  --dropdown-shadow: 0 8px 20px rgba(15,23,42,.12);
  --btn-on-bg: rgba(8,145,178,.16);
  --btn-on-text: #0e7490;
  --layout-ctl-btn-hover-bg: rgba(139,92,246,.18);
  --layout-ctl-btn-hover-text: #5b21b6;
  --fg-inner-border: rgba(15,23,42,.08);
  --rrg-legend-bg: rgba(15,23,42,.04);
  --hsplit-hover: rgba(8,145,178,.16);
  --tip-shadow: 0 6px 18px rgba(15,23,42,.14);

  --filter-def-border: rgba(8,145,178,.55);
  --filter-def-glow: rgba(245,127,23,.18);
  --filter-def-bg: linear-gradient(135deg, rgba(8,145,178,.10) 0%, rgba(245,127,23,.08) 100%);
  --filter-def-text: #0e7490;
  --filter-def-ph: rgba(8,145,178,.72);

  --fs-setup-bg: rgba(8,145,178,.08);
  --fs-setup-border: rgba(8,145,178,.22);
  --fs-setup-label: #0e7490;
  --fs-volume-bg: rgba(21,101,192,.07);
  --fs-volume-border: rgba(21,101,192,.20);
  --fs-volume-label: #1565c0;
  --fs-gap-bg: rgba(245,127,23,.08);
  --fs-gap-border: rgba(245,127,23,.22);
  --fs-gap-label: #e65100;
  --fs-mktcap-bg: rgba(0,121,107,.07);
  --fs-mktcap-border: rgba(0,121,107,.20);
  --fs-mktcap-label: #00695c;
  --fs-maslope-bg: rgba(123,31,162,.07);
  --fs-maslope-border: rgba(123,31,162,.20);
  --fs-maslope-label: #7b1fa2;
  --fs-sector-bg: rgba(239,108,0,.07);
  --fs-sector-border: rgba(239,108,0,.22);
  --fs-sector-label: #ef6c00;
  --fs-grade-bg: rgba(245,127,23,.07);
  --fs-grade-border: rgba(245,127,23,.18);
  --fs-grade-label: #ef6c00;
  --fs-search-bg: rgba(15,23,42,.04);
  --fs-search-border: rgba(15,23,42,.10);
  --fs-search-label: #475569;
  --btn-clear-bg: rgba(198,40,40,.10);
  --btn-clear-border: rgba(198,40,40,.42);
  --btn-clear-text: #b71c1c;
  --btn-clear-hover-bg: rgba(198,40,40,.18);
  --btn-clear-hover-text: #7f1d1d;

  --layout-ctl-text: #6d28d9;
  --layout-ctl-label: #7c3aed;
  --layout-ctl-bg: rgba(139,92,246,.10);
  --layout-ctl-border: rgba(124,58,237,.30);
  --layout-ctl-btn-on-bg: rgba(139,92,246,.20);
  --layout-ctl-btn-on-border: #7c3aed;
  --vol-hi-text: #5b21b6;
  --vol-hi-label: #6d28d9;
  --vol-hi-border: rgba(124,58,237,.34);
  --vol-hi-bg: rgba(139,92,246,.08);
  --vol-hi-input-bg: rgba(139,92,246,.10);
}

* { box-sizing: border-box; }

body { margin: 0; background: var(--bg); color: var(--text); font-family: Lato, system-ui, sans-serif; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex: 0 0 auto; background: linear-gradient(135deg, var(--bg), var(--bg2)); }

.top .genat { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }

.themeToggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 74px;
  justify-content: center;
  color: var(--muted);
}

.themeToggle:hover { color: var(--text); border-color: var(--accent); }

.themeIco-light,
.themeTxt-light { display: none; }

[data-theme="light"] .themeIco-dark,
[data-theme="light"] .themeTxt-dark { display: none; }

[data-theme="light"] .themeIco-light,
[data-theme="light"] .themeTxt-light { display: inline; }

.top h1 { margin: 0; font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.2px; }

.top h1 span { color: var(--accent); }

.nav a { color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; margin-right: 14px; }

.nav a.active { color: var(--gold); }

.meta { font-size: 11px; color: var(--muted); padding: 8px 20px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }

.bar { display: flex; gap: 8px; align-items: center; padding: 8px 20px; flex-wrap: wrap; flex: 0 0 auto; row-gap: 8px; }

.filterSection {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 5px;
  border-radius: 8px;
  border: 1px solid var(--fs-border, var(--border));
  background: var(--fs-bg, var(--bg2));
  max-width: 100%;
}

.filterSection[data-section]::before {
  content: attr(data-section);
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fs-label, var(--muted));
  flex: 0 0 auto;
  padding: 0 6px 0 3px;
  margin-right: 1px;
  border-right: 1px solid var(--fs-border, var(--border));
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.filterSection--setup { --fs-bg: var(--fs-setup-bg); --fs-border: var(--fs-setup-border); --fs-label: var(--fs-setup-label); }
.filterSection--volume { --fs-bg: var(--fs-volume-bg); --fs-border: var(--fs-volume-border); --fs-label: var(--fs-volume-label); }
.filterSection--gap { --fs-bg: var(--fs-gap-bg); --fs-border: var(--fs-gap-border); --fs-label: var(--fs-gap-label); }
.filterSection--mktcap { --fs-bg: var(--fs-mktcap-bg); --fs-border: var(--fs-mktcap-border); --fs-label: var(--fs-mktcap-label); }
.filterSection--maslope { --fs-bg: var(--fs-maslope-bg); --fs-border: var(--fs-maslope-border); --fs-label: var(--fs-maslope-label); }
.filterSection--sector { --fs-bg: var(--fs-sector-bg); --fs-border: var(--fs-sector-border); --fs-label: var(--fs-sector-label); }
.filterSection--grade { --fs-bg: var(--fs-grade-bg); --fs-border: var(--fs-grade-border); --fs-label: var(--fs-grade-label); }
.filterSection--search { --fs-bg: var(--fs-search-bg); --fs-border: var(--fs-search-border); --fs-label: var(--fs-search-label); }

.filterSection .filterGroup {
  background: transparent;
  border-color: var(--fg-inner-border);
  padding: 1px 5px;
}

.filterGroup { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg2); }

.filterGroup label { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; }

.filterGroup input { width: 52px; padding: 3px 5px; background: var(--field-bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 11px; font-family: inherit; }

.filterGroup .unit {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-left: 2px;
  user-select: none;
}

.filterGroup input.wide { width: 44px; }

.filterGroup input.symbol { width: 72px; }

.filterGroup input.gap { width: 40px; }

.filterGroup.gapMode { gap: 4px; }

.filterGroup.gapMode .btn { padding: 3px 8px; }

.filterGroup.mktCapMode .btn,

.filterGroup.gradeMode .btn,

.filterGroup.layoutMode .btn { padding: 3px 7px; font-size: 10.5px; }

.filterGroup input.invalid { border-color: var(--red); background: rgba(239,83,80,.08); }

.filterGroup input.filter-default,
.filterGroup input.is-default {
  color: var(--filter-def-text);
  border-color: var(--filter-def-border);
  background: var(--filter-def-bg);
  box-shadow: 0 0 0 1px var(--filter-def-glow);
}

.filterGroup input.filter-default::placeholder,
.filterGroup input.is-default::placeholder {
  color: var(--filter-def-ph);
  font-style: italic;
  opacity: 1;
}

.filterGroup select.filter-default,
.filterGroup select.is-default {
  color: var(--filter-def-text);
  border-color: var(--filter-def-border);
  background: var(--filter-def-bg);
  box-shadow: 0 0 0 1px var(--filter-def-glow);
  font-style: italic;
}

.btn.on.filter-default,
.btn.on.is-default {
  background: var(--filter-def-bg);
  border-color: var(--filter-def-border);
  color: var(--filter-def-text);
  box-shadow: 0 0 0 1px var(--filter-def-glow);
}

.filterGroup input.invalid.filter-default,
.filterGroup input.invalid.is-default {
  border-color: var(--red);
  background: rgba(239,83,80,.08);
  color: var(--text);
  box-shadow: none;
}

/* Key volume filters — % of 30D + 30d avg (distinct from Vol today) */
.filterGroup.volHighlight {
  background: var(--vol-hi-bg);
  border-color: var(--vol-hi-border);
  box-shadow: inset 0 0 0 1px rgba(192,132,252,.12);
}

.filterGroup.volHighlight label {
  color: var(--vol-hi-label);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.filterGroup.volHighlight input {
  color: var(--vol-hi-text);
  border-color: var(--vol-hi-border);
  background: var(--vol-hi-input-bg);
  font-weight: 700;
}

.filterGroup.volHighlight input.filter-default,
.filterGroup.volHighlight input.is-default {
  color: var(--filter-def-text);
  border-color: var(--filter-def-border);
  background: var(--filter-def-bg);
  box-shadow: 0 0 0 1px var(--filter-def-glow);
  font-weight: 700;
  font-style: italic;
}

.filterGroup.volHighlight input.filter-default::placeholder,
.filterGroup.volHighlight input.is-default::placeholder {
  color: var(--filter-def-ph);
  font-style: italic;
  opacity: 1;
}

.filterGroup.volHighlight input.invalid.filter-default,
.filterGroup.volHighlight input.invalid.is-default {
  border-color: var(--red);
  background: rgba(239,83,80,.08);
  color: var(--text);
  box-shadow: none;
  font-style: normal;
}

/* Layout controls — table layout + chart window */
.filterGroup.layoutCtl {
  background: var(--layout-ctl-bg);
  border-color: var(--layout-ctl-border);
  box-shadow: inset 0 0 0 1px rgba(167,139,250,.14);
}

.filterGroup.layoutCtl label {
  color: var(--layout-ctl-label);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 9.5px;
}

.filterGroup.layoutCtl .btn {
  color: var(--layout-ctl-text);
  font-weight: 800;
  border-color: rgba(167,139,250,.35);
  background: rgba(88,28,135,.18);
}

.filterGroup.layoutCtl .btn:hover {
  color: var(--layout-ctl-btn-hover-text);
  border-color: var(--layout-ctl-btn-on-border);
  background: var(--layout-ctl-btn-hover-bg);
}

.filterGroup.layoutCtl .btn.on {
  background: var(--layout-ctl-btn-on-bg);
  border-color: var(--layout-ctl-btn-on-border);
  color: var(--layout-ctl-btn-hover-text);
  box-shadow: 0 0 0 1px rgba(167,139,250,.25);
}

.btn.layoutCtl {
  color: var(--layout-ctl-text);
  font-weight: 800;
  background: var(--layout-ctl-bg);
  border-color: var(--layout-ctl-border);
  box-shadow: inset 0 0 0 1px rgba(167,139,250,.14);
}

.btn.layoutCtl:hover {
  color: var(--layout-ctl-btn-hover-text);
  border-color: var(--layout-ctl-btn-on-border);
  background: var(--layout-ctl-btn-hover-bg);
}

.filterGroup select { padding: 3px 6px; background: var(--field-bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 11px; font-family: inherit; cursor: pointer; }

.filterGroup.maSlopeMode { gap: 4px; max-width: 100%; flex-wrap: nowrap; align-items: center; }

.filterGroup.gradeMode { gap: 4px; max-width: 100%; flex-wrap: nowrap; align-items: center; }

.filterGroup.sectorMode { gap: 4px; max-width: 100%; flex-wrap: nowrap; align-items: center; }

.msDropdown {
  position: relative;
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  vertical-align: middle;
}

.sectorCombo { min-width: 110px; }

.gradeCombo { min-width: 88px; }

.maSlopeCombo { min-width: 96px; }

.rrgCombo { min-width: 96px; }

.msDropdown-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px 20px 3px 8px;
  min-height: 24px;
  max-height: 26px;
  min-width: 96px;
  max-width: min(200px, 30vw);
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  line-height: 1.2;
}

.msDropdown-trigger::after {
  content: '▾';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
}

.msDropdown.filter-default .msDropdown-trigger,
.msDropdown.is-default .msDropdown-trigger {
  color: var(--filter-def-text);
  border-color: var(--filter-def-border);
  background: var(--filter-def-bg);
  box-shadow: 0 0 0 1px var(--filter-def-glow);
  font-style: italic;
}

.msDropdown-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 120;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  max-height: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel, #1a1f2e);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: var(--dropdown-shadow);
}

.msDropdown-panel[hidden] { display: none !important; }

.msDropdown-search {
  flex: 0 0 auto;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--field-bg);
  outline: none;
  font-size: 10.5px;
  color: var(--text);
  font-family: inherit;
  padding: 5px 8px;
  width: 100%;
}

.msDropdown-search::placeholder { color: var(--muted); opacity: .85; }

.msDropdown-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 3px 0;
  max-height: 200px;
}

.msDropdown-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msDropdown-opt:hover { background: rgba(6,182,212,.12); }

.msDropdown-opt input[type="checkbox"],
.msDropdown-opt input[type="radio"] {
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.msDropdown-optLbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.msDropdown-opt--quick {
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  padding-bottom: 5px;
}

.msDropdown-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
}

.msDropdown-bar--clear {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 4px 8px 5px;
  border-top: 1px solid var(--border);
}

.msDropdown-clear {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msDropdown-clear:hover { color: var(--text); }

.msDropdown-footer-spacer { flex: 1 1 auto; }

.msDropdown-footer label { color: var(--muted); font-weight: 700; white-space: nowrap; }

.msDropdown-footer select {
  padding: 2px 4px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
}

.msDdCnt { color: var(--muted); font-size: 10px; font-weight: 400; }

.msDropdown-empty { padding: 6px 8px; font-size: 11px; color: var(--muted); }

.msDropdown-optLbl.grade-lbl-Ap,
.msDropdown-optLbl.grade-lbl-A,
.msDropdown-optLbl.grade-lbl-Am { color: var(--gold); font-weight: 800; }

.msDropdown-optLbl.grade-lbl-Bp,
.msDropdown-optLbl.grade-lbl-B { color: var(--accent); font-weight: 700; }

.msDropdown-optLbl.grade-lbl-Cp,
.msDropdown-optLbl.grade-lbl-C { color: var(--muted); font-weight: 700; }

.grpc .maColor { width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; background: var(--field-bg); vertical-align: middle; }

.grpc .maColor::-webkit-color-swatch-wrapper { padding: 1px; }

.grpc .maColor::-webkit-color-swatch { border: none; border-radius: 3px; }

.btn { padding: 4px 9px; background: var(--field-bg); border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit; }

.btn:hover { color: var(--text); }

.btn.on { background: var(--btn-on-bg); border-color: var(--accent); color: var(--btn-on-text); }

.btnClearFilters,
#btnVolClear.btnClearFilters {
  background: var(--btn-clear-bg);
  border-color: var(--btn-clear-border);
  color: var(--btn-clear-text);
  box-shadow: inset 0 0 0 1px rgba(239,83,80,.15);
}

.btnClearFilters:hover,
#btnVolClear.btnClearFilters:hover {
  background: var(--btn-clear-hover-bg);
  border-color: rgba(239,83,80,.72);
  color: var(--btn-clear-hover-text);
}

.btn[data-ma].on { color: var(--btn-on-text); }

.btn[data-ma].na { opacity: 0.55; border-style: dashed; }

.layout { display: flex; flex: 1; min-height: 0; min-width: 0; }

.layoutStack { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }

.layoutStack.mode-table .chartPane,

.layoutStack.mode-table .hsplit { display: none !important; }

.layoutStack.mode-table .tableDock,
.layoutStack.mode-table #tableDockSlot {
  flex: 1 1 0 !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  border-top: none;
  background: var(--bg2);
}

.layoutStack.mode-table .tablePane {
  flex: 1 1 0;
  min-height: 0;
}

.layoutStack.mode-chart .tableDock,

.layoutStack.mode-chart .hsplit { display: none !important; }

.layoutStack.mode-pop .tableDock,

.layoutStack.mode-pop .hsplit { display: none !important; }

.layoutStack.mode-dock .chartPane { flex: 1 1 0; min-height: 140px; }

.chartPane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg2); width: 100%; }

.hsplit { flex: 0 0 10px; cursor: row-resize; background: transparent; border-top: 1px solid var(--border); touch-action: none; position: relative; z-index: 4; }

.hsplit:hover, .hsplit.active { background: var(--hsplit-hover); border-color: var(--accent); }

body.resizing-h { cursor: row-resize !important; user-select: none; }

.tableDock { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; min-width: 0; background: var(--bg2); border-top: 1px solid var(--border); overflow: hidden; }

.tableDock-hd { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }

.tableDock-hd .title { font-size: 12px; font-weight: 900; letter-spacing: .4px; }

.tablePane { overflow-x: auto; overflow-y: auto; flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }

.tablemodal { display: none; position: fixed; inset: 0; z-index: 10040; pointer-events: none; }

.tablemodal.open { display: block; }

.tablepanel { position: absolute; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--modal-shadow); min-width: 420px; min-height: 120px; width: min(920px,72vw); height: min(640px,78vh); left: 16px; top: 120px; overflow: hidden; pointer-events: auto; isolation: isolate; }

.tablemodal-hd { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: grab; user-select: none; flex: 0 0 auto; background: var(--card); touch-action: none; }

.tablemodal-hd.dragging { cursor: grabbing; }

.tablemodal-hd .title { font-size: 13px; font-weight: 900; flex: 1; letter-spacing: .5px; }

.tablemodal-body { flex: 1; min-height: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }

.tablemodal-body .tablePane { flex: 1; min-height: 0; min-width: 0; overflow-x: auto; overflow-y: auto; }

.tablemodal-resize { position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; cursor: nwse-resize; z-index: 101; touch-action: none; pointer-events: auto; }

.tablemodal-resize::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); opacity: .85; pointer-events: none; }

.earn-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.news-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 6; }

.gtip-news .news-item { margin-top: 8px; line-height: 1.35; }

.gtip-news .news-item a { color: var(--accent, #06b6d4); text-decoration: underline; }

.gtip-news .news-item a:hover { color: var(--text, #e8eef7); }

.vp-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.maSlopeBar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 14px; font-size: 11px; border-bottom: 1px solid var(--border); background: rgba(6,182,212,.04); flex: 0 0 auto; }

.maSlopeLbl { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 800; margin-right: 2px; }

.slopeBadge { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border); background: var(--field-bg); }

.slopeBadge.up { color: var(--green); border-color: var(--green); background: rgba(38,166,154,.12); }

.slopeBadge.dn { color: var(--red); border-color: var(--red); background: rgba(239,83,80,.12); }

.slopeBadge.flat { color: var(--muted); }

.slopeBadge.na { color: var(--muted); border-style: dashed; opacity: .7; }

td.maSlopes { white-space: nowrap; overflow: visible; text-overflow: clip; }

.maDeg { display: inline-block; font-size: 10px; font-weight: 700; margin-right: 5px; white-space: nowrap; }

.maDeg.up { color: var(--green); }

.maDeg.dn { color: var(--red); }

.setupTag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .3px; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--border); }

.setupTag.setup-fresh { color: var(--green); border-color: var(--green); background: rgba(38,166,154,.12); }

.setupTag.setup-carryover { color: var(--accent); border-color: var(--accent); background: rgba(6,182,212,.10); }

.maDeg.flat, .maDeg.na { color: var(--muted); }

.slopeLine { font-weight: 700; }

.grade-a-plus { color: var(--gold); font-weight: 900; text-shadow: 0 0 8px rgba(255, 215, 0, 0.35); }

.grade-a { color: var(--gold); font-weight: 800; }

.grade-a-minus { color: var(--gold); font-weight: 700; opacity: 0.88; }

.grade-b-plus { color: var(--accent); font-weight: 800; }

.grade-b { color: var(--accent); font-weight: 700; opacity: 0.92; }

.grade-c-plus { color: var(--muted); font-weight: 700; }

.grade-c { color: var(--muted); font-weight: 600; opacity: 0.85; }

.gtip { position: fixed; display: none; max-width: 320px; background: var(--bg2); border: 1px solid var(--accent); border-radius: 7px; padding: 9px 11px; font-size: 11.5px; line-height: 1.45; color: var(--text); z-index: 100000; pointer-events: none; box-shadow: var(--tip-shadow); white-space: pre-line; }

.gtip.gtip-rich { max-width: 360px; padding: 10px 12px; white-space: normal; line-height: 1.5; }

.gtip.gtip-grade {
  max-width: 280px;
  max-height: min(72vh, 380px);
  overflow-y: auto;
  padding: 8px 10px;
}

.gtip.gtip-lastvs {
  max-width: 300px;
  padding: 9px 11px;
  border-width: 2px;
}

.gtip-rich .tip-section { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.gtip-rich .tip-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.gtip-rich .tip-head { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 11px; letter-spacing: 0.02em; }

.gtip-rich .tip-body { color: var(--muted); font-size: 11.5px; }

.gtip-rich .tip-grade { font-weight: 900; }

.gtip-rich .tip-score { font-weight: 700; }

.gtip-rich .tip-max { color: var(--muted); font-weight: 600; }

.gtip-rich .tip-points-pos { font-weight: 700; color: var(--green); }

.gtip-rich .tip-points-zero { font-weight: 700; color: var(--red); }

.gtip-rich .tip-points-neg { font-weight: 700; color: var(--red); }

.gtip-rich .tip-points-partial { font-weight: 700; color: var(--gold); }

.gtip-rich .tip-breakdown { list-style: none; margin: 4px 0 0; padding: 0; }

.gtip-rich .tip-breakdown-item { margin: 7px 0 0; padding: 4px 0 4px 8px; border-left: 2px solid var(--border); font-size: 11px; line-height: 1.45; }

.gtip-rich .tip-breakdown-item:first-child { margin-top: 2px; }

.gtip-rich .tip-label { font-weight: 600; color: var(--text); margin-right: 4px; }

.gtip-rich .tip-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }

.tip-grade-hd {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.tip-grade-sym {
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--text);
}

.tip-grade-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tip-grade-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.tip-grade-row:last-child { border-bottom: none; }

.tip-grade-label {
  font-weight: 600;
  color: var(--muted);
}

.tip-grade-metric {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tip-lastvs-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tip-lastvs-sym {
  font-weight: 900;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.tip-lastvs-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.tip-lastvs--fail { border-color: var(--red); }
.tip-lastvs--fail .tip-lastvs-badge { background: rgba(239, 68, 68, 0.2); color: var(--red); }

.tip-lastvs--fade { border-color: var(--gold); }
.tip-lastvs--fade .tip-lastvs-badge { background: rgba(255, 215, 0, 0.18); color: var(--gold); }

.tip-lastvs--reclaim { border-color: var(--green); }
.tip-lastvs--reclaim .tip-lastvs-badge { background: rgba(34, 197, 94, 0.2); color: var(--green); }

.tip-lastvs--bounce { border-color: var(--accent); }
.tip-lastvs--bounce .tip-lastvs-badge { background: rgba(6, 182, 212, 0.18); color: var(--accent); }

.tip-lastvs--extend { border-color: var(--green); }
.tip-lastvs--extend .tip-lastvs-badge { background: rgba(34, 197, 94, 0.2); color: var(--green); }

.tip-lastvs-compare {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tip-lastvs-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tip-lastvs-k {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tip-lastvs-arrow {
  color: var(--muted);
  font-weight: 700;
}

.tip-lastvs-meta {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chart-dock-slot { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chart-dock { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }

.ctrls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }

.chart-hd { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; margin-right: 6px; flex: 0 0 auto; min-width: 0; position: relative; padding-right: 34px; }

.chart-hd .btnTv { position: absolute; top: 0; right: 0; font-size: 10px; padding: 2px 7px; letter-spacing: 0.5px; line-height: 1.2; }

.chart-hd .title { font-size: 15px; font-weight: 900; letter-spacing: 1px; margin-right: 0; }

.chart-hd .chart-sub { font-size: 11px; line-height: 1.25; max-width: min(320px, 42vw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart-hd .chart-sub:empty { display: none; }

.grpc { display: flex; align-items: center; gap: 5px; }

.grpc .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-right: 2px; }

.chartLabels { padding: 10px 14px; font-size: 12px; line-height: 1.45; border-bottom: 1px solid var(--border); flex: 0 0 auto; }

body.compact-details .meta,

body.compact-details .chartLabels { display: none; }

#chartwrap { flex: 1; position: relative; min-height: 160px; }

#chart { position: absolute; inset: 0; }

.chartmodal { display: none; position: fixed; inset: 0; z-index: 10050; background: var(--modal-scrim); padding: 16px; }

.chartmodal.open { display: block; }

.chartpanel { position: absolute; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--modal-shadow); min-width: 520px; min-height: 420px; width: min(1180px,92vw); height: min(820px,88vh); left: 50%; top: 50%; transform: translate(-50%,-50%); overflow: hidden; pointer-events: auto; isolation: isolate; }

.chartmodal-hd { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: grab; user-select: none; touch-action: none; flex: 0 0 auto; background: var(--card); }

.chartmodal-hd.dragging { cursor: grabbing; }

.chartmodal-hd .title { font-size: 14px; font-weight: 900; flex: 1; letter-spacing: .5px; }

.chartmodal-hd .btn { font-size: 10px; padding: 3px 8px; }

.chartmodal-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.chartmodal-body .chart-dock { flex: 1; }

.chartmodal-body #chartwrap { flex: 1; min-height: 200px; }

.chartmodal-resize { position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; cursor: nwse-resize; z-index: 101; touch-action: none; pointer-events: auto; }

.chartmodal-resize::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); opacity: .85; pointer-events: none; }

.chartmodal-resize:hover::after { border-color: var(--accent); opacity: 1; }

.tablemodal-resize:hover::after { border-color: var(--accent); opacity: 1; }

.modal-resize-s {
  position: absolute;
  left: 8px;
  right: 28px;
  bottom: 0;
  height: 10px;
  cursor: row-resize;
  z-index: 100;
  touch-action: none;
  pointer-events: auto;
}

.modal-resize-s::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 3px;
  margin: -1.5px 0 0 -18px;
  border-radius: 2px;
  background: var(--muted);
  opacity: .55;
  pointer-events: none;
}

.modal-resize-s:hover::before,
.modal-resize-s.active::before { background: var(--accent); opacity: 1; }

.modal-resize-s:hover,
.modal-resize-s.active { background: rgba(6,182,212,.22); }

body.resizing-modal-s { cursor: row-resize !important; user-select: none; }

body.resizing-modal-se { cursor: nwse-resize !important; user-select: none; }

body.chart-pop { margin: 0; height: 100vh; overflow: hidden; background: var(--bg2); }

body.chart-pop .chart-pop-shell { display: flex; flex-direction: column; height: 100vh; min-height: 0; }

body.chart-pop .chart-dock { flex: 1; min-height: 0; }

.closebtn { border: none; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; }

#gapTable { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: auto; }

thead th[data-sort="symbol"] { min-width: 72px; }

thead th[data-sort="company"] { min-width: 120px; }

thead th[data-sort="industry"] { min-width: 100px; }

thead th[data-sort="gap_pct"],
thead th[data-sort="gap_vs_atr"],
thead th[data-sort="atr14"],
thead th[data-sort="atr_pct"],
thead th[data-sort="open"],
thead th[data-sort="last"],
thead th[data-sort="vol_today"],
thead th[data-sort="vol30"],
thead th[data-sort="vol_vs_30"],
thead th[data-sort="sma5"],
thead th[data-sort="pct_vs_sma5"],
thead th[data-sort="pct_last_vs_sma5"],
thead th[data-sort="sma20"] { min-width: 78px; }

thead th[data-sort="ma_deg_5"] { min-width: 200px; }

thead th[data-sort="grade"],
thead th[data-sort="last_er"],
thead th[data-sort="next_er"] { min-width: 72px; }

thead th[data-sort="mktval_mm"] { min-width: 80px; }

th, td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

th { font-size: 10px; color: var(--muted); text-transform: uppercase; position: sticky; top: 0; background: var(--bg2); z-index: 1; overflow: visible; }

th.sortable { cursor: pointer; user-select: none; }

th.sortable:hover { color: var(--text); }

th.sort-asc::after { content: ' ▲'; color: var(--accent); }

th.sort-desc::after { content: ' ▼'; color: var(--accent); }

th.sortable[data-sort-rank]::before {
  content: attr(data-sort-rank);
  display: inline-block;
  min-width: 12px;
  margin-right: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.4;
  color: #041018;
  background: var(--accent);
  vertical-align: 1px;
}

th.sortable[data-sort-rank="2"]::before,
th.sortable[data-sort-rank="3"]::before {
  background: rgba(6, 182, 212, 0.55);
  color: var(--text);
}

thead th[data-sort] { position: sticky; top: 0; z-index: 2; }

.colResizeGrip { position: absolute; right: -3px; top: 0; width: 10px; height: 100%; cursor: col-resize; z-index: 5; touch-action: none; pointer-events: auto; border-right: 2px solid transparent; }

.colResizeGrip:hover, body.resizing-col .colResizeGrip.active { background: rgba(6,182,212,.35); border-right-color: var(--accent); }

body.resizing-col .tablePane { touch-action: none; }

body.resizing-col { cursor: col-resize !important; user-select: none; }

tr.data-row { cursor: pointer; }

tr.data-row:hover td { background: var(--row-hover); }

tr.data-row.active td { background: var(--row-active); }

.sym { font-weight: 900; }

.ind { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

.pos { color: var(--green); }

.neg { color: var(--red); }

.better { color: var(--gold); font-weight: 800; }

.muted { color: var(--muted); }

.badge { display: inline-block; font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 6px; background: rgba(255,215,0,.15); color: var(--gold); border: 1px solid rgba(255,215,0,.4); margin-left: 4px; }

.rrgLegend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--rrg-legend-bg);
  white-space: nowrap;
  cursor: help;
  letter-spacing: 0.02em;
}

.rrgLegend[hidden] { display: none !important; }

.rrgLegend .rrg-badge { margin-left: 0; cursor: inherit; }

.rrg-badge {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.rrg-badge--leading {
  background: rgba(255,215,0,.2);
  color: var(--gold);
  border: 1px solid rgba(255,215,0,.55);
}

.rrg-badge--improving {
  background: rgba(38,166,154,.18);
  color: #6ee7b7;
  border: 1px solid rgba(38,166,154,.5);
}

.rrg-badge--lagging {
  background: rgba(239,83,80,.18);
  color: #fca5a5;
  border: 1px solid rgba(239,83,80,.5);
}

.rrg-badge--weakening {
  background: rgba(251,146,60,.18);
  color: #fdba74;
  border: 1px solid rgba(251,146,60,.5);
}

tr.data-row.rrg-bonus--leading td:first-child {
  box-shadow: inset 3px 0 0 rgba(255,215,0,.8);
}

tr.data-row.rrg-bonus--leading td {
  background: rgba(255,215,0,.06);
}

tr.data-row.rrg-bonus--leading:hover td {
  background: rgba(255,215,0,.1);
}

tr.data-row.rrg-bonus--leading.active td {
  background: rgba(255,215,0,.14);
}

tr.data-row.rrg-bonus--leading.active td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}

tr.data-row.rrg-bonus--improving td:first-child {
  box-shadow: inset 3px 0 0 rgba(38,166,154,.85);
}

tr.data-row.rrg-bonus--improving td {
  background: rgba(38,166,154,.07);
}

tr.data-row.rrg-bonus--improving:hover td {
  background: rgba(38,166,154,.11);
}

tr.data-row.rrg-bonus--improving.active td {
  background: rgba(6,182,212,.16);
}

tr.data-row.rrg-bonus--improving.active td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

tr.data-row.rrg-bonus--lagging td:first-child {
  box-shadow: inset 3px 0 0 rgba(239,83,80,.85);
}

tr.data-row.rrg-bonus--lagging td {
  background: rgba(239,83,80,.07);
}

tr.data-row.rrg-bonus--lagging:hover td {
  background: rgba(239,83,80,.11);
}

tr.data-row.rrg-bonus--lagging.active td {
  background: rgba(239,83,80,.14);
}

tr.data-row.rrg-bonus--lagging.active td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}

tr.data-row.rrg-bonus--weakening td:first-child {
  box-shadow: inset 3px 0 0 rgba(251,146,60,.85);
}

tr.data-row.rrg-bonus--weakening td {
  background: rgba(251,146,60,.07);
}

tr.data-row.rrg-bonus--weakening:hover td {
  background: rgba(251,146,60,.11);
}

tr.data-row.rrg-bonus--weakening.active td {
  background: rgba(251,146,60,.14);
}

tr.data-row.rrg-bonus--weakening.active td:first-child {
  box-shadow: inset 3px 0 0 #fb923c;
}

[data-theme="light"] .rrg-badge--improving { color: #047857; }

[data-theme="light"] .rrg-badge--lagging { color: #b91c1c; }

[data-theme="light"] .rrg-badge--weakening { color: #c2410c; }

[data-theme="light"] .grade-a-plus { text-shadow: none; }

.empty { padding: 24px; color: var(--muted); text-align: center; }


