/* ─── RESET & BASE ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:          #0a0e27;
  --bg-panel:    #0f172a;
  --bg-row-alt:  #0d1220;
  --bg-hover:    #1e3048;
  --bg-selected: #1e3a5f;
  --border:      #334155;
  --border-cell: transparent;
  --amber:       #22d3ee;
  --amber-dim:   #334155;
  --green:       #10b981;
  --green-dim:   #065f46;
  --green-hi:    #10b981;
  --red:         #ef4444;
  --red-dim:     #7f1d1d;
  --yellow:      #f59e0b;
  --cyan:        #22d3ee;
  --cyan-dim:    #164e63;
  --white:       #f1f5f9;
  --grey:        #94a3b8;
  --grey-hi:     #cbd5e1;
  --font:        'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', 'Courier New', monospace;
  --cell-h:      28px;
}
html, body {
  height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

/* ─── LAYOUT ──────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─── HEADER BAR ──────────────────────────────────────────────────────────── */
#headerBar {
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  background: var(--bg-panel);
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
  padding: 0;
}
.hb-logo {
  font-size: 13px;
  font-weight: bold;
  color: var(--amber);
  letter-spacing: 0.10em;
  padding-right: 16px;
  border-right: 1px solid #334155;
  margin-right: 16px;
  white-space: nowrap;
}
.hb-tag {
  background: var(--amber);
  color: var(--bg);
  font-weight: bold;
  font-size: 10px;
  padding: 2px 5px;
  letter-spacing: 0.1em;
  margin-right: 6px;
}
.hb-label {
  font-size: 11px;
  color: var(--grey-hi);
  padding-right: 16px;
  border-right: 1px solid var(--border);
  margin-right: 12px;
}
.hb-clock {
  font-size: 13px;
  color: var(--green);
  letter-spacing: 0.06em;
  min-width: 165px;
}
.hb-spacer { flex: 1; }
.hb-stat {
  font-size: 11px;
  color: var(--grey-hi);
  margin-left: 16px;
  white-space: nowrap;
}
.hb-stat span { color: var(--cyan); }
.hb-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  margin-left: 14px;
  margin-right: 10px;
  flex-shrink: 0;
}
.hb-status.loading { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: pulse 0.6s infinite; }
.hb-status.err     { background: var(--red);   box-shadow: 0 0 6px var(--red); }

/* ─── TOOLBAR ─────────────────────────────────────────────────────────────── */
#toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
.tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tb-label {
  font-size: 10px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.tb-input {
  background: var(--bg);
  color: var(--white);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 12px;
  padding: 3px 6px;
  outline: none;
  height: 22px;
}
.tb-input::placeholder { color: var(--grey); }
.tb-input:focus { border-color: var(--amber); }
/* ─── Custom dropdown ─── */
.ts-dropdown { position: relative; display: inline-flex; }
.ts-dd-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 5px;
  background: var(--bg);
  color: var(--white);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 12px;
  padding: 3px 6px;
  height: 22px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.ts-dd-trigger:hover { border-color: var(--grey-hi); }
.ts-dropdown.open .ts-dd-trigger { border-color: var(--amber); }
.ts-dd-arrow { font-size: 9px; color: var(--grey); flex-shrink: 0; transition: transform 0.1s; }
.ts-dropdown.open .ts-dd-arrow { transform: rotate(180deg); color: var(--amber); }
.ts-dd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  min-width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--amber);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.ts-dropdown.open .ts-dd-menu { display: block; }
.ts-dd-item {
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 11px;
  color: var(--grey-hi);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.ts-dd-item:hover { background: var(--bg-hover); color: var(--white); }
.ts-dd-item.ts-dd-selected { color: var(--amber); }
#searchInput { width: 140px; }
.tb-sep { width: 1px; height: 18px; background: var(--border); }
.tb-btn {
  background: var(--bg);
  color: var(--grey-hi);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 11px;
  padding: 2px 8px;
  height: 22px;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tb-btn:hover  { background: var(--amber); color: var(--bg); }
.tb-btn.active { background: var(--amber); color: var(--bg); }
.tb-btn.green  { border-color: var(--green-dim); color: var(--green); }
.tb-btn.green:hover { background: var(--green); color: var(--bg); }
.tb-btn.red    { border-color: var(--red-dim); color: var(--red); }
.tb-btn.red:hover   { background: var(--red); color: var(--bg); }
#rowCount { font-size: 11px; color: var(--grey-hi); white-space: nowrap; }
.tb-range-row { display: flex; align-items: center; gap: 4px; }
.tb-score-min, .tb-score-max { width: 46px; }

/* ─── COLUMN TOGGLE ROW ───────────────────────────────────────────────────── */
#colRow {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  height: 22px;
  background: var(--bg-panel);
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#colRow::-webkit-scrollbar { height: 0; display: none; }
.col-toggle {
  font-size: 10px;
  color: var(--grey);
  padding: 0 8px;
  height: 22px;
  line-height: 22px;
  cursor: grab;
  border-right: 1px solid var(--border);
  letter-spacing: 0.05em;
  white-space: nowrap;
  touch-action: none;
}
.col-toggle:hover       { color: var(--amber); }
.col-toggle.on          { color: var(--amber); }
.col-toggle.on::before  { content: '✔ '; }
.col-toggle.dragging    { opacity: 0.3; cursor: grabbing; }
.col-toggle.drag-over   { border-left: 2px solid var(--amber); margin-left: -1px; }

/* ─── TABLE AREA ──────────────────────────────────────────────────────────── */
#tableWrap {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* ─── TABLE ───────────────────────────────────────────────────────────────── */
#dataTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
#dataTable thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
#dataTable thead th {
  background: #1e293b;
  border-bottom: 1px solid #475569;
  border-right: none;
  padding: 4px 8px;
  height: var(--cell-h);
  text-align: left;
  font-size: 9px !important;
  color: #64748b !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
#dataTable thead th:hover { color: var(--amber) !important; background: var(--bg-hover); }
.sort-badge {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  color: var(--amber);
  vertical-align: middle;
  letter-spacing: 0;
}
.sort-badge .sort-pos {
  color: var(--cyan);
  font-size: 8px;
  vertical-align: super;
  margin-left: 1px;
}

/* ─── SORT STACK STRIP ───────────────────────────────────────────────────── */
#sortStackBar {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
#sortStackBar.visible { display: flex; }
.ss-label {
  font-size: 10px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
  white-space: nowrap;
}
.ss-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  padding: 1px 6px;
  font-size: 11px;
  color: var(--amber);
  background: var(--bg-panel);
  white-space: nowrap;
}
.ss-pill .ss-dir { font-size: 10px; color: var(--cyan); }
.ss-pill .ss-num { font-size: 9px; color: var(--grey-hi); margin-right: 2px; }
.ss-pill .ss-rm  { margin-left: 4px; cursor: pointer; color: var(--grey); font-size: 11px; }
.ss-pill .ss-rm:hover { color: var(--red); }
.ss-pill:first-of-type { border-color: var(--amber); }
.ss-sep { font-size: 11px; color: var(--grey); }
.ss-clear { font-size: 10px; color: var(--grey); text-decoration: underline; cursor: pointer; margin-left: 4px; }
.ss-clear:hover { color: var(--amber); }

#dataTable tbody tr {
  border-bottom: 1px solid #1a2332;
  cursor: pointer;
  transition: background 0.08s;
}
#dataTable tbody tr:nth-child(even) { background: var(--bg-row-alt); }
#dataTable tbody tr:hover           { background: var(--bg-hover); }
#dataTable tbody tr.selected        { background: var(--bg-selected) !important; }
#dataTable tbody tr.selected td     { color: var(--white) !important; }

#dataTable td {
  height: var(--cell-h);
  padding: 4px 8px;
  border-right: none;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* column widths */
.col-ticker   { width: 60px; }
.col-company  { width: 170px; font-size: 11px !important; color: #cbd5e1 !important; }
.col-exch     { width: 46px; color: var(--grey-hi) !important; font-size: 11px !important; }
.col-price    { width: 72px; text-align: right !important; }
.col-chg      { width: 60px; text-align: right !important; }
.col-chgpct   { width: 68px; text-align: right !important; }
.col-wchg     { width: 68px; text-align: right !important; }
.col-mchg     { width: 68px; text-align: right !important; }
.col-mktcap   { width: 70px; text-align: right !important; }
.col-pe       { width: 58px; text-align: right !important; }
.col-fwdpe    { width: 64px; text-align: right !important; }
.col-peg      { width: 52px; text-align: right !important; }
.col-pb       { width: 52px; text-align: right !important; }
.col-ps       { width: 52px; text-align: right !important; }
.col-eveb     { width: 78px; text-align: right !important; }
.col-evrev    { width: 64px; text-align: right !important; }
.col-eps      { width: 56px; text-align: right !important; }
.col-vol      { width: 58px; text-align: right !important; color: var(--grey-hi) !important; font-size: 11px !important; }
.col-atgt     { width: 72px; text-align: right !important; }
.col-aupside  { width: 68px; text-align: right !important; }
.col-bear     { width: 68px; text-align: right !important; }
.col-base     { width: 68px; text-align: right !important; }
.col-bull     { width: 68px; text-align: right !important; }
.col-ptpos    { width: 58px; text-align: right !important; }
.col-score    { width: 52px; text-align: center !important; font-weight: bold; }
.col-delta-ts { width: 52px; text-align: center !important; font-weight: bold; }
.col-date     { width: 84px; font-size: 10px !important; color: var(--grey) !important; }

/* ticker link */
.t-link { color: var(--amber); text-decoration: none; font-weight: bold; letter-spacing: 0.04em; }
.t-link:hover { color: var(--green-hi); }

/* score badges */
.score-cell { display: block; text-align: center; font-weight: bold; font-size: 11px; }
.s-hi    { color: var(--green-hi); }   /* 80+ */
.s-good  { color: var(--green); }      /* 65–79 */
.s-mid   { color: var(--yellow); }     /* 45–64 */
.s-low   { color: var(--amber); }      /* 30–44 */
.s-bad   { color: var(--red); }        /* <30 */
.s-null  { color: var(--border); }

/* price changes */
.up  { color: var(--green); }
.dn  { color: var(--red); }

/* company name */
.co-name { color: var(--white); font-size: 11px; }

/* ─── DETAIL PANEL ────────────────────────────────────────────────────────── */
#detailPanel {
  position: fixed;
  right: 0; top: 32px; bottom: 20px;
  width: 320px;
  background: var(--bg-panel);
  border-left: 2px solid var(--amber-dim);
  overflow-y: auto;
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.15s ease;
  padding: 0;
}
#detailPanel.open { transform: translateX(0); }
#detailClose {
  position: absolute; top: 6px; right: 8px;
  color: var(--grey); cursor: pointer; font-size: 16px; line-height: 1;
}
#detailClose:hover { color: var(--amber); }
#detailContent { padding: 12px 14px; }
.dp-ticker { font-size: 20px; font-weight: bold; color: var(--amber); letter-spacing: 0.08em; }
.dp-company { font-size: 11px; color: var(--grey-hi); margin-top: 2px; }
.dp-price   { font-size: 22px; color: var(--white); margin-top: 8px; }
.dp-chg     { font-size: 13px; margin-top: 2px; }
.dp-section { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.dp-section-title { font-size: 10px; color: var(--grey); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.dp-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.dp-row-label { font-size: 11px; color: var(--grey-hi); }
.dp-row-val   { font-size: 12px; font-weight: bold; }
.dp-score-bar {
  height: 4px; margin-top: 2px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.dp-score-bar-fill { height: 4px; border-radius: 2px; }
.dp-link {
  display: block; text-align: center; margin-top: 14px;
  background: var(--amber); color: var(--bg);
  padding: 6px; font-weight: bold; font-size: 12px;
  text-decoration: none; letter-spacing: 0.08em;
}
.dp-link:hover { background: var(--green); color: var(--bg); }

/* ─── STATUS BAR ──────────────────────────────────────────────────────────── */
#statusBar {
  height: 20px;
  background: var(--bg-row-alt);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 16px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--grey);
}
#statusBar span { color: var(--grey-hi); }
.sb-key { color: var(--amber-dim); }

/* ─── SKELETON ROWS ──────────────────────────────────────────────────── */
@keyframes sk-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.sk {
  display: inline-block;
  height: 10px;
  max-width: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #1e293b 25%, #263348 50%, #1e293b 75%);
  background-size: 800px 10px;
  animation: sk-shimmer 1.6s infinite linear;
  vertical-align: middle;
}
/* width variants */
.sk-xs  { width: 28px; }
.sk-sm  { width: 42px; }
.sk-md  { width: 64px; }
.sk-lg  { width: 96px; }
.sk-xl  { width: 130px; }
.sk-full{ width: 90%; }
/* delay variants so rows don’t all pulse in sync */
.sk-d1 { animation-delay: 0.1s; }
.sk-d2 { animation-delay: 0.3s; }
.sk-d3 { animation-delay: 0.5s; }
.sk-d4 { animation-delay: 0.7s; }
.sk-d5 { animation-delay: 0.9s; }
#guestOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#guestOverlay.visible { display: flex; }
.go-box {
  pointer-events: all;
  background: #0f172a;
  border: 1px solid #334155;
  padding: 36px 44px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
.go-logo  { font-size: 18px; font-weight: bold; color: #22d3ee; letter-spacing: 0.15em; margin-bottom: 6px; }
.go-title { font-size: 12px; color: #475569; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 22px; }
.go-desc  { font-size: 12px; color: #64748b; line-height: 1.8; margin-bottom: 26px; }
.go-desc em { color: #94a3b8; font-style: normal; }
.go-btn {
  background: #22d3ee;
  color: #0a0e27;
  font-family: var(--font);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.1em;
  padding: 10px 22px;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid #22d3ee;
  cursor: pointer;
  flex: 1;
  text-align: center;
}
.go-btn:hover { background: #06b6d4; border-color: #06b6d4; }
.go-btn-outline {
  background: transparent;
  color: #64748b;
  font-family: var(--font);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.1em;
  padding: 10px 22px;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid #334155;
  cursor: pointer;
  flex: 1;
  text-align: center;
}
.go-btn-outline:hover { border-color: #475569; color: #94a3b8; }
.go-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.go-sub { font-size: 10px; color: var(--grey); letter-spacing: 0.05em; }

/* ─── ANIMATIONS ──────────────────────────────────────────────────────────── */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

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

/* ─── TOOLTIP ─────────────────────────────────────────────────────────────── */
#colTip {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  background: #1e293b;
  border: 1px solid var(--amber);
  color: var(--white);
  font-size: 11px;
  line-height: 1.55;
  padding: 7px 10px;
  max-width: 220px;
  white-space: normal;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  display: none;
}
#colTip .ct-title {
  color: var(--amber);
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 3px;
  letter-spacing: 0.06em;
}
#colTip .ct-body {
  color: var(--grey-hi);
  font-size: 10px;
  line-height: 1.6;
}

/* ─── COMPANY POPUP ───────────────────────────────────────────────────────── */
#companyPopup {
  position: fixed;
  z-index: 301;
  pointer-events: none;
  width: 310px;
  background: #111827;
  border: 1px solid var(--amber);
  color: var(--white);
  font-size: 11px;
  line-height: 1.55;
  padding: 10px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.7);
  display: none;
}
#companyPopup .cp-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
}
#companyPopup .cp-ticker {
  color: var(--amber);
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
#companyPopup .cp-name {
  color: var(--grey-hi);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#companyPopup .cp-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
#companyPopup .cp-sector-tag {
  background: var(--cyan-dim);
  color: var(--cyan);
  font-size: 9px;
  padding: 2px 6px;
  letter-spacing: 0.05em;
  border: 1px solid rgba(34,211,238,0.25);
}
#companyPopup .cp-desc {
  color: var(--grey-hi);
  font-size: 10px;
  line-height: 1.65;
  margin-bottom: 8px;
}
#companyPopup .cp-competitors-label {
  color: var(--grey);
  font-size: 9px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
#companyPopup .cp-competitors {
  color: var(--grey-hi);
  font-size: 10px;
  line-height: 1.6;
}
#companyPopup .cp-loading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
#companyPopup .cp-skel {
  height: 9px;
  background: linear-gradient(90deg, #1e293b 25%, #263348 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: cp-shimmer 1.4s infinite;
  border-radius: 2px;
}
#companyPopup .cp-skel.w-full  { width: 100%; }
#companyPopup .cp-skel.w-3q    { width: 75%; }
#companyPopup .cp-skel.w-half  { width: 50%; }
@keyframes cp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT THEME  —  scoped to html[data-theme="light"]
   Toggle applied by JS (localStorage key: ts-terminal-theme)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLE OVERRIDES ────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg:          #f8fafc;
  --bg-panel:    #f1f5f9;
  --bg-row-alt:  #e8edf5;
  --bg-hover:    #dbeafe;
  --bg-selected: #bfdbfe;
  --border:      #cbd5e1;
  --border-cell: transparent;
  --amber:       #0284c7;
  --amber-dim:   #bae6fd;
  --green:       #059669;
  --green-dim:   #a7f3d0;
  --green-hi:    #059669;
  --red:         #dc2626;
  --red-dim:     #fecaca;
  --yellow:      #d97706;
  --cyan:        #0ea5e9;
  --cyan-dim:    #e0f2fe;
  --white:       #0f172a;
  --grey:        #64748b;
  --grey-hi:     #334155;
}

/* ─── GLOBAL ──────────────────────────────────────────────────────────────── */
html[data-theme="light"] body { background: var(--bg); color: var(--white); }

/* ─── HEADER ──────────────────────────────────────────────────────────────── */
html[data-theme="light"] #headerBar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
html[data-theme="light"] #headerBar a { border-color: var(--border) !important; color: var(--grey) !important; }
html[data-theme="light"] #headerBar a:hover { color: var(--amber) !important; }
html[data-theme="light"] .hb-logo { border-right-color: var(--border) !important; }

/* ─── TOOLBAR ─────────────────────────────────────────────────────────────── */
html[data-theme="light"] #toolbar { background: var(--bg-panel); border-bottom: 1px solid var(--border); }
html[data-theme="light"] .tb-input { background: var(--bg); color: var(--white); border-color: var(--border); }
html[data-theme="light"] .tb-input::placeholder { color: var(--grey); }
html[data-theme="light"] .tb-input:focus { border-color: var(--amber); }
html[data-theme="light"] .tb-btn { background: var(--bg); color: var(--grey-hi); border-color: var(--border); }
html[data-theme="light"] .tb-btn:hover   { background: var(--amber); color: #fff; }
html[data-theme="light"] .tb-btn.active  { background: var(--amber); color: #fff; }
html[data-theme="light"] .tb-btn.green   { border-color: var(--green-dim); color: var(--green); }
html[data-theme="light"] .tb-btn.green:hover { background: var(--green); color: #fff; }
html[data-theme="light"] .tb-btn.red     { border-color: var(--red-dim); color: var(--red); }
html[data-theme="light"] .tb-btn.red:hover { background: var(--red); color: #fff; }

/* ─── DROPDOWN ────────────────────────────────────────────────────────────── */
html[data-theme="light"] .ts-dd-trigger { background: var(--bg); color: var(--white); border-color: var(--border); }
html[data-theme="light"] .ts-dd-trigger:hover { border-color: var(--grey-hi); }
html[data-theme="light"] .ts-dropdown.open .ts-dd-trigger { border-color: var(--amber); }
html[data-theme="light"] .ts-dd-menu { background: var(--bg-panel); border-color: var(--amber); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
html[data-theme="light"] .ts-dd-item { color: var(--grey-hi); }
html[data-theme="light"] .ts-dd-item:hover { background: var(--bg-hover); color: var(--white); }
html[data-theme="light"] .ts-dd-item.ts-dd-selected { color: var(--amber); }

/* ─── COLUMN TOGGLE ROW ───────────────────────────────────────────────────── */
html[data-theme="light"] #colRow { background: var(--bg-panel); border-bottom: 1px solid var(--border); }

/* ─── SORT STACK BAR ──────────────────────────────────────────────────────── */
html[data-theme="light"] #sortStackBar { background: var(--bg-panel); border-bottom: 1px solid var(--border); }

/* ─── TABLE HEADER OVERRIDES (hardcoded hex in dark rules) ───────────────── */
html[data-theme="light"] #dataTable thead th {
  background: #e2e8f0;
  border-bottom: 1px solid #94a3b8;
  color: #64748b;
}
html[data-theme="light"] #dataTable thead th:hover { background: var(--bg-hover); color: var(--amber); }
html[data-theme="light"] #dataTable tbody tr { border-bottom: 1px solid #dde3ec; }
html[data-theme="light"] #dataTable tbody tr:nth-child(even) { background: var(--bg-row-alt); }
html[data-theme="light"] #dataTable tbody tr:hover           { background: var(--bg-hover); }
html[data-theme="light"] #dataTable tbody tr.selected        { background: var(--bg-selected) !important; }
html[data-theme="light"] .col-company { color: #334155 !important; }

/* ─── DETAIL PANEL ────────────────────────────────────────────────────────── */
html[data-theme="light"] #detailPanel { background: var(--bg-panel); border-left-color: var(--amber); }

/* ─── STATUS BAR ──────────────────────────────────────────────────────────── */
html[data-theme="light"] #statusBar { background: var(--bg-row-alt); border-top: 1px solid var(--border); color: var(--grey); }
html[data-theme="light"] #statusBar span { color: var(--grey-hi); }

/* ─── SHIMMER SKELETON ────────────────────────────────────────────────────── */
html[data-theme="light"] .sk {
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
  background-size: 800px 10px;
}
html[data-theme="light"] #companyPopup .cp-skel {
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
  background-size: 200% 100%;
}

/* ─── TOOLTIP & COMPANY POPUP ─────────────────────────────────────────────── */
html[data-theme="light"] #colTip { background: var(--bg-panel); border-color: var(--amber); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
html[data-theme="light"] #companyPopup { background: var(--bg-panel); border-color: var(--amber); box-shadow: 0 8px 28px rgba(0,0,0,0.15); }
html[data-theme="light"] .cp-sector-tag { background: var(--cyan-dim); border-color: rgba(14,165,233,0.25); }

/* ─── GUEST OVERLAY ───────────────────────────────────────────────────────── */
html[data-theme="light"] .go-box   { background: var(--bg-panel); border-color: var(--border); box-shadow: 0 16px 48px rgba(0,0,0,0.15); }
html[data-theme="light"] .go-logo  { color: var(--amber); }
html[data-theme="light"] .go-title { color: var(--grey); }
html[data-theme="light"] .go-desc  { color: var(--grey-hi); }
html[data-theme="light"] .go-desc em { color: var(--white); }
html[data-theme="light"] .go-btn         { background: var(--amber); color: #fff; border-color: var(--amber); }
html[data-theme="light"] .go-btn:hover   { background: var(--cyan); border-color: var(--cyan); }
html[data-theme="light"] .go-btn-outline { color: var(--grey-hi); border-color: var(--border); }
html[data-theme="light"] .go-btn-outline:hover { border-color: var(--grey); color: var(--white); }

/* ─── SCROLLBARS ──────────────────────────────────────────────────────────── */
html[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--grey); }

/* ─── THEME TOGGLE SLIDER ─────────────────────────────────────────────────── */
/* 28×16px pill, knob 12px — sits just left of the stats in the header */
.theme-switch {
  position: relative; display: inline-flex; align-items: center;
  width: 28px; height: 16px; flex-shrink: 0; margin: 0 8px; cursor: pointer;
}
.theme-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.theme-switch-slider {
  position: absolute; inset: 0;
  background: #334155; border-radius: 16px;
  transition: background 0.2s;
}
.theme-switch-slider::before {
  content: ''; position: absolute;
  left: 2px; top: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #94a3b8;
  transition: transform 0.2s, background 0.2s;
}
.theme-switch input:checked + .theme-switch-slider         { background: #bae6fd; }
.theme-switch input:checked + .theme-switch-slider::before { transform: translateX(12px); background: #0284c7; }
