/* ══════════════════════════════════════════════════════════════════
   TRADETRACKER — GAP SCANNER STYLES V2

   Design direction: "refined terminal"
   - Dark-first with green/red duotone reserved for data
   - JetBrains Mono for data, Poppins for structure (app defaults)
   - Motion reserved for moments of value (appear, refresh, hover)
   - Heat map inspired by Finviz but cleaner, less ad-y

   All colors use CSS vars from main.css so the 3 themes just work.
   ══════════════════════════════════════════════════════════════════ */


/* Panel sizing (wider for heat map) */
#panelScanner {
  max-width: 1600px;
  margin: -32px auto 0;
  padding: 0 24px 32px;
  box-sizing: border-box;
}

.gs-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 32px;
}


/* ═══════════════════════════════════════════════════════════════
   TOP BAR — title + status + mode switch
   ═══════════════════════════════════════════════════════════════ */

.gs-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.gs-brand {
  min-width: 0;
  flex: 1;
}

.gs-title-line {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.gs-title {
  font-family: var(--title);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  line-height: 1;
}

.gs-sub {
  font-family: var(--title);
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 6px;
  letter-spacing: 0.05px;
}

.gs-sub-dot {
  margin: 0 6px;
  opacity: 0.4;
}

.gs-status-time {
  font-family: var(--mono);
  color: var(--text3);
  font-size: 11px;
}


/* ── Pulse indicator next to title ─────────────────────────── */
.gs-pulse-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text3);
  transition: border-color 0.3s;
}

.gs-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.gs-dot-live {
  background: var(--green) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
  animation: gs-pulse-live 2s ease-in-out infinite;
}
.gs-dot-pre      { background: var(--amber, #fbbf24) !important; }
.gs-dot-post     { background: var(--blue,  #60a5fa) !important; }
.gs-dot-closed   { background: var(--text3) !important; }
.gs-dot-offline  { background: var(--red) !important; }
.gs-dot-degraded {
  background: var(--amber, #fbbf24) !important;
  animation: gs-pulse-degraded 1.4s ease-in-out infinite;
}
.gs-dot-error {
  background: var(--red) !important;
  animation: gs-pulse-error 0.9s ease-in-out infinite;
}

@keyframes gs-pulse-live {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 8%,  transparent); }
}
@keyframes gs-pulse-degraded {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.5; }
}
@keyframes gs-pulse-error {
  0%, 100% { transform: scale(1);    }
  50%      { transform: scale(1.25); }
}


/* ═══════════════════════════════════════════════════════════════
   MODE SWITCH — Table / Heat Map
   ═══════════════════════════════════════════════════════════════ */

.gs-mode-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.gs-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--title);
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.gs-mode-btn svg { opacity: 0.85; }

.gs-mode-btn:hover { color: var(--text2); }

.gs-mode-btn:active { transform: scale(0.97); }

.gs-mode-btn.active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.gs-mode-btn.active svg { opacity: 1; }


/* ═══════════════════════════════════════════════════════════════
   SIDE ROW — Gainers / Losers + count + mode controls
   ═══════════════════════════════════════════════════════════════ */

.gs-side-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.gs-side-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.gs-side-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--title);
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.gs-side-btn svg {
  opacity: 0.7;
  transition: opacity 0.18s;
}

.gs-side-btn:hover { color: var(--text2); }
.gs-side-btn:hover svg { opacity: 1; }

.gs-side-btn.active {
  background: var(--surface2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.gs-side-btn.active svg { opacity: 1; }

.gs-side-btn.gs-side-gain.active { color: var(--green); }
.gs-side-btn.gs-side-loss.active { color: var(--red); }

.gs-count {
  font-family: var(--title);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}

.gs-mode-controls {
  margin-left: auto;
}


/* ═══════════════════════════════════════════════════════════════
   ADVANCED FILTERS (table mode only)
   ═══════════════════════════════════════════════════════════════ */

.gs-advanced {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.2s;
}

.gs-advanced[open] {
  border-color: var(--border2, var(--border));
}

.gs-advanced-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  font-family: var(--title);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  transition: color 0.15s;
  user-select: none;
}
.gs-advanced-summary::-webkit-details-marker { display: none; }
.gs-advanced-summary::marker { display: none; }
.gs-advanced-summary:hover { color: var(--text); }

.gs-advanced-summary svg {
  opacity: 0.55;
  transition: transform 0.2s;
}
.gs-advanced[open] .gs-advanced-summary svg {
  transform: rotate(180deg);
  opacity: 0.85;
}

.gs-adv-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 28px;
  padding: 4px 18px 16px;
  border-top: 1px solid var(--border);
  margin-top: -1px;
  padding-top: 16px;
}

.gs-filter {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.gs-filter label {
  font-family: var(--title);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.gs-pills {
  display: inline-flex;
  gap: 4px;
}

.gs-pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.14s;
}

.gs-pill:hover {
  background: var(--surface3, var(--surface2));
  color: var(--text);
  border-color: var(--border2, var(--border));
}

.gs-pill.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.gs-reset {
  margin-left: auto;
  font-family: var(--title);
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  background: transparent;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.gs-reset:hover {
  color: var(--text);
  border-color: var(--text3);
}


/* ═══════════════════════════════════════════════════════════════
   TABLE VIEW
   ═══════════════════════════════════════════════════════════════ */

.gs-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
  position: relative;
}

.gs-table {
  display: flex;
  flex-direction: column;
  font-family: var(--title);
}

.gs-thead {
  display: grid;
  grid-template-columns: minmax(140px, 2.2fr) 1fr 1fr 1.1fr 0.85fr 1fr 1fr;
  padding: 13px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.gs-th {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.75px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.gs-th.gs-col-sym { justify-content: flex-start; }
.gs-th.gs-col-price,
.gs-th.gs-col-chg,
.gs-th.gs-col-vol,
.gs-th.gs-col-rvol,
.gs-th.gs-col-float,
.gs-th.gs-col-mcap   { justify-content: flex-end; }

.gs-sortable { cursor: pointer; user-select: none; }
.gs-sortable:hover { color: var(--text); }

.gs-sort-asc::after  { content: ' ↑'; color: var(--green); margin-left: 3px; }
.gs-sort-desc::after { content: ' ↓'; color: var(--green); margin-left: 3px; }

.gs-tbody {
  max-height: calc(100vh - 380px);
  min-height: 280px;
  overflow-y: auto;
}

.gs-tr {
  display: grid;
  grid-template-columns: minmax(140px, 2.2fr) 1fr 1fr 1.1fr 0.85fr 1fr 1fr;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  align-items: center;
  position: relative;
  opacity: 1;
  /* Row entry animation disabled — was causing visual noise on every refresh.
     Rows now appear instantly. The `gs-tr-new` highlight (left bar) still
     marks tickers that entered the ranking for the first time. */
}

@keyframes gs-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.gs-tr:hover { background: var(--surface2); }
.gs-tr:last-child { border-bottom: none; }

.gs-tr-new {
  position: relative;
}
.gs-tr-new::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--green);
  opacity: 0;
  animation: gs-new-bar 2.5s ease-out forwards;
}

@keyframes gs-new-bar {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.gs-td {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
}

.gs-td.gs-col-sym {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.gs-td.gs-col-price,
.gs-td.gs-col-chg,
.gs-td.gs-col-vol,
.gs-td.gs-col-rvol,
.gs-td.gs-col-float,
.gs-td.gs-col-mcap {
  justify-content: flex-end;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* Small float highlight — tickers with < 20M float are tradeable
   squeeze territory. Amber accent draws the trader's eye. */
.gs-float-low {
  color: var(--amber, #fbbf24);
  font-weight: 700;
}

.gs-sym-wrap { display: flex; align-items: center; gap: 7px; }

.gs-sym {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}

.gs-traded {
  color: var(--green);
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 0 6px color-mix(in srgb, var(--green) 40%, transparent);
}

.gs-name {
  font-size: 10.5px;
  color: var(--text3);
  font-weight: 400;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gs-pos { color: var(--green); font-weight: 700; }
.gs-neg { color: var(--red);   font-weight: 700; }

.gs-rvol-hot {
  color: var(--amber, #fbbf24);
  font-weight: 700;
}


/* ═══════════════════════════════════════════════════════════════
   HEAT MAP VIEW — "Terminal mode"

   Design direction: trading terminal, not dashboard.
   - Fixed near-black canvas (#050608) regardless of app theme.
     Subtle radial vignette keeps eye centered.
   - Square tiles (no border-radius) — "data, not UI".
   - Matte greens/reds (not neon, not saturated). Professional money.
   - Typography: bold symbol, clear change%, secondary price/volume.
   - Hair-line borders that breathe when active.
   ═══════════════════════════════════════════════════════════════ */

.gs-hm {
  position: relative;
  padding: 12px;
  /* Pure near-black canvas. This overrides any theme var — heat map
     is its own world, not a themeable surface. */
  background:
    radial-gradient(ellipse at top, #0a0c10 0%, #050608 70%);
  min-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  /* Remove the surrounding card look — we want edge-to-edge canvas */
  border-radius: 0;
  overflow: hidden;
}

/* Force the view container to shed its card chrome when heatmap is active.
   The parent .gs-view has border + radius from table styles; we override
   because the heatmap is meant to feel like a panel, not a card. */
.gs-view:has(.gs-hm) {
  border: none;
  border-radius: 0;
  background: transparent;
}

/* Subtle horizontal scanline texture — barely visible but adds depth.
   Pure CSS, no images. Uses repeating-linear-gradient. */
.gs-hm::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(255, 255, 255, 0.012) 2px,
    rgba(255, 255, 255, 0.012) 3px
  );
  z-index: 0;
}

/* Top-right corner stamp — tiny label that screams "terminal" */
.gs-hm::after {
  content: 'LIVE MARKET HEAT';
  position: absolute;
  top: 14px;
  right: 18px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  z-index: 1;
  text-transform: uppercase;
}

.gs-hm-empty {
  min-height: 340px;
  justify-content: center;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}
.gs-hm-empty .gs-empty { color: rgba(255, 255, 255, 0.55); }
.gs-hm-empty .gs-empty-dim { color: rgba(255, 255, 255, 0.35); }


/* ── The single grid ───────────────────────────────────────────
   Dense packing: browser fills gaps left by big tiles with small ones.
   Columns calculated to fit ~16-20 on a laptop at non-fullscreen. */

.gs-hm-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  grid-auto-rows: 52px;
  grid-auto-flow: dense;
  gap: 2px;  /* Hair-line gap — tiles feel like a continuous field */
  flex: 1;
  align-content: start;
}


/* ── Tile base ───────────────────────────────────────────────── */

.gs-hm-tile {
  position: relative;
  border: none;
  cursor: default;  /* No longer clickable per product decision */
  padding: 0;
  overflow: hidden;
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.98);
  text-align: left;
  /* Square corners for terminal aesthetic */
  border-radius: 0;
  transition:
    transform 0.22s cubic-bezier(.3, .7, .2, 1),
    filter 0.2s,
    box-shadow 0.25s;
  /* Tile entry animation disabled — was causing visual noise on every refresh.
     Tiles now appear instantly. The `gs-hm-new` glow still marks tickers
     that entered the ranking for the first time. */
  isolation: isolate;
  background-color: #0d1015;  /* Fallback before gradient loads */
}

.gs-hm-tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
}

@keyframes gs-tile-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}


/* ── Size tiers ───────────────────────────────────────────────
   Aggressive hierarchy: big tiles dominate, small tiles recede.
   Only ~2-4 tiles should reach s4/s5 per snapshot. */
.gs-hm-s1 { grid-column: span 1; grid-row: span 1; }
.gs-hm-s2 { grid-column: span 1; grid-row: span 2; }
.gs-hm-s3 { grid-column: span 2; grid-row: span 2; }
.gs-hm-s4 { grid-column: span 3; grid-row: span 3; }
.gs-hm-s5 { grid-column: span 5; grid-row: span 5; }


/* ── Color system: matte, professional ─────────────────────────
   - Base shade is near-black (darker than canvas) so low-intensity
     tiles blend into the background, creating a sense of depth.
   - Top shade is a calibrated green/red, not pure RGB.
   - Inner stroke lightens with intensity — tiles "wake up" as they move.
   - Subtle gradient angle (165deg) feels less "generic dashboard". */

.gs-hm-up {
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, #0a0c10 calc((1 - var(--intensity)) * 100%), #16a66a calc(var(--intensity) * 100%)) 0%,
      color-mix(in srgb, #0a0c10 calc((1 - var(--intensity)) * 100%), #0c6d45 calc(var(--intensity) * 100%)) 100%
    );
  box-shadow: inset 0 0 0 1px rgba(32, 200, 130, calc(0.08 + var(--intensity) * 0.32));
}

.gs-hm-down {
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, #0d0a0b calc((1 - var(--intensity)) * 100%), #d93345 calc(var(--intensity) * 100%)) 0%,
      color-mix(in srgb, #0d0a0b calc((1 - var(--intensity)) * 100%), #8c1f2a calc(var(--intensity) * 100%)) 100%
    );
  box-shadow: inset 0 0 0 1px rgba(225, 70, 88, calc(0.08 + var(--intensity) * 0.32));
}

/* Hover: lift just enough to feel alive, NOT floating card */
.gs-hm-tile:hover {
  transform: translateY(-1px);
  filter: brightness(1.18);
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.7);
}


/* ── Content typography: refined hierarchy ─────────────────────
   Symbol is the hero (heavy, tight kerning).
   Change % is secondary (readable, less weight).
   Meta (price + volume) is tertiary, appears only on big tiles. */

.gs-hm-sym {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1;
  color: #ffffff;
  /* Crisp text on gradient bg */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.gs-hm-chg {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
}

.gs-hm-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1px;
}

.gs-hm-price {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.gs-hm-sep {
  opacity: 0.35;
}

.gs-hm-vol {
  color: rgba(255, 255, 255, 0.55);
}


/* ── Per-size typography scale
   Calibrated so the hierarchy reads at any tile size. */

.gs-hm-s2 .gs-hm-sym { font-size: 13px; }
.gs-hm-s2 .gs-hm-chg { font-size: 11px; }
.gs-hm-s2 .gs-hm-tile-inner { padding: 8px 10px; }

.gs-hm-s3 .gs-hm-sym { font-size: 17px; letter-spacing: 0.5px; }
.gs-hm-s3 .gs-hm-chg { font-size: 13px; font-weight: 600; }
.gs-hm-s3 .gs-hm-tile-inner { padding: 10px 12px; }

.gs-hm-s4 .gs-hm-sym { font-size: 28px; font-weight: 800; letter-spacing: 0.6px; }
.gs-hm-s4 .gs-hm-chg { font-size: 18px; font-weight: 600; }
.gs-hm-s4 .gs-hm-meta { font-size: 11px; }
.gs-hm-s4 .gs-hm-tile-inner { padding: 14px 18px; }

.gs-hm-s5 .gs-hm-sym { font-size: 52px; font-weight: 800; letter-spacing: 0.8px; }
.gs-hm-s5 .gs-hm-chg { font-size: 30px; font-weight: 700; }
.gs-hm-s5 .gs-hm-meta { font-size: 12px; }
.gs-hm-s5 .gs-hm-tile-inner { padding: 18px 22px; }


/* ── New-tile glow: brief flash when a ticker first appears ── */
.gs-hm-new {
  /* Entry animation removed (was causing visual noise on every refresh).
     Only the glow remains — marks tickers that just entered the ranking. */
  animation: gs-tile-glow 2.2s ease-out 0.25s;
}

@keyframes gs-tile-glow {
  0%   { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 18px rgba(255, 255, 255, 0.22); }
  100% { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0),   0 0 0 rgba(255, 255, 255, 0);      }
}


/* ═══════════════════════════════════════════════════════════════
   FULLSCREEN MODE

   Activated via body.gs-fullscreen class. Hides the app sidebar &
   main chrome so the scanner canvas fills the viewport.
   ═══════════════════════════════════════════════════════════════ */

.gs-fs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.gs-fs-btn:hover {
  color: var(--text);
  background: var(--surface2);
}
.gs-fs-btn.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--text3);
}

.gs-fs-icon-close { display: none; }
body.gs-fullscreen .gs-fs-btn .gs-fs-icon-open  { display: none; }
body.gs-fullscreen .gs-fs-btn .gs-fs-icon-close { display: block; }

.gs-header-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Fullscreen styles — apply when body.gs-fullscreen is on ── */

body.gs-fullscreen .sidebar,
body.gs-fullscreen .sidebar-overlay,
body.gs-fullscreen header {
  display: none !important;
}

body.gs-fullscreen .app,
body.gs-fullscreen #appRoot {
  padding: 0 !important;
  margin: 0 !important;
}

body.gs-fullscreen #panelScanner {
  max-width: none;
  margin: 0;
  padding: 16px 20px 0;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

body.gs-fullscreen .gs-shell {
  flex: 1;
  min-height: 0;
  padding-top: 0;
}

body.gs-fullscreen .gs-hm {
  min-height: 0;
  flex: 1;
}

body.gs-fullscreen .gs-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.gs-fullscreen .gs-view .gs-hm,
body.gs-fullscreen .gs-view .gs-table {
  flex: 1;
  min-height: 0;
}

body.gs-fullscreen .gs-tbody {
  max-height: none;
  flex: 1;
}


/* ═══════════════════════════════════════════════════════════════
   TOOLTIP — heat map hover
   ═══════════════════════════════════════════════════════════════ */

.gs-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  min-width: 180px;
  max-width: 240px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  font-family: var(--title);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.13s ease, transform 0.13s ease;
}

.gs-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.gs-tt-sym {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.4px;
  line-height: 1;
}

.gs-tt-name {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gs-tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--text3);
}

.gs-tt-row span { color: var(--text3); }

.gs-tt-row strong {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.gs-tt-row strong.gs-pos { color: var(--green); }
.gs-tt-row strong.gs-neg { color: var(--red); }

.gs-tt-hint {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.2px;
  opacity: 0.75;
}


/* ═══════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════ */

.gs-empty {
  padding: 80px 24px;
  text-align: center;
  font-family: var(--title);
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
}

.gs-empty-dim {
  color: var(--text3);
  font-size: 12px;
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  #panelScanner {
    padding: 0 14px 24px;
    margin: 0 auto;
  }

  .gs-shell { padding-top: 18px; gap: 14px; }
  .gs-title { font-size: 21px; }
  .gs-sub   { font-size: 11px; }

  .gs-top {
    flex-direction: column;
    gap: 12px;
  }

  .gs-mode-switch {
    align-self: flex-start;
  }

  .gs-mode-btn span,
  .gs-side-btn span { display: inline; }

  .gs-adv-body {
    padding: 4px 14px 14px;
    gap: 12px 16px;
  }
  .gs-reset { margin-left: 0; }

  .gs-side-row { gap: 10px; }
  .gs-mode-controls { margin-left: 0; width: 100%; }

  /* Table: hide market cap + rvol on small screens */
  .gs-thead,
  .gs-tr {
    grid-template-columns: minmax(100px, 1.8fr) 0.9fr 0.9fr 1fr;
    padding: 10px 14px;
  }
  .gs-col-rvol,
  .gs-col-float,
  .gs-col-mcap {
    display: none;
  }

  .gs-name { max-width: 130px; }

  /* Heat map: tighter grid on mobile, bigger gap than desktop
     to compensate for smaller tiles where edges would blur */
  .gs-hm {
    padding: 8px;
    min-height: calc(100vh - 240px);
  }
  .gs-hm::after {
    font-size: 8px;
    letter-spacing: 1.2px;
    top: 10px;
    right: 12px;
  }
  .gs-hm-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    grid-auto-rows: 46px;
    gap: 2px;
  }
  /* Compress size tiers on mobile — big tiles still big but
     proportional to available canvas */
  .gs-hm-s3 { grid-column: span 2; grid-row: span 2; }
  .gs-hm-s4 { grid-column: span 2; grid-row: span 2; }
  .gs-hm-s5 { grid-column: span 3; grid-row: span 3; }

  /* Typography — mobile-calibrated hierarchy */
  .gs-hm-sym { font-size: 10px; }
  .gs-hm-chg { font-size: 9.5px; }
  .gs-hm-s2 .gs-hm-sym { font-size: 11px; }
  .gs-hm-s2 .gs-hm-chg { font-size: 10px; }
  .gs-hm-s3 .gs-hm-sym { font-size: 14px; }
  .gs-hm-s3 .gs-hm-chg { font-size: 11px; }
  .gs-hm-s4 .gs-hm-sym { font-size: 19px; }
  .gs-hm-s4 .gs-hm-chg { font-size: 13px; }
  .gs-hm-s5 .gs-hm-sym { font-size: 26px; }
  .gs-hm-s5 .gs-hm-chg { font-size: 17px; }

  .gs-hm-s4 .gs-hm-meta,
  .gs-hm-s5 .gs-hm-meta { display: none; }

  .gs-hm-s4 .gs-hm-tile-inner,
  .gs-hm-s5 .gs-hm-tile-inner { padding: 10px 12px; }

  /* Fullscreen button: shrink on mobile */
  .gs-fs-btn { width: 32px; height: 32px; }
  .gs-header-actions { flex-wrap: wrap; }

  /* Fullscreen mode adjustments on mobile */
  body.gs-fullscreen #panelScanner {
    padding: 10px 10px 0;
  }
}


/* ═══════════════════════════════════════════════════════════════
   THEME OVERRIDES — tooltip stays readable across themes

   Note: .gs-hm itself always uses its own dark canvas regardless
   of app theme (no override needed — it's set in the base styles).
   Only the floating tooltip (chrome) needs theme tweaks.
   ═══════════════════════════════════════════════════════════════ */

body.light .gs-tooltip,
body.warm .gs-tooltip {
  background: #1a1d24;
  color: #fff;
  border-color: rgba(255,255,255,0.1);
}
body.light .gs-tooltip .gs-tt-sym,
body.warm .gs-tooltip .gs-tt-sym {
  color: #fff;
}
body.light .gs-tooltip .gs-tt-row strong,
body.warm .gs-tooltip .gs-tt-row strong {
  color: #fff;
}
body.light .gs-tooltip .gs-tt-name,
body.light .gs-tooltip .gs-tt-row span,
body.light .gs-tooltip .gs-tt-hint,
body.warm .gs-tooltip .gs-tt-name,
body.warm .gs-tooltip .gs-tt-row span,
body.warm .gs-tooltip .gs-tt-hint {
  color: rgba(255,255,255,0.55);
}
body.light .gs-tooltip .gs-tt-hint,
body.warm .gs-tooltip .gs-tt-hint {
  border-top-color: rgba(255,255,255,0.1);
}


/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION — respect user preference
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .gs-tr,
  .gs-hm-tile,
  .gs-pulse,
  .gs-tr-new::before,
  .gs-hm-new {
    animation: none !important;
  }
  .gs-tr-new::before { display: none; }
  .gs-hm-tile,
  .gs-side-btn,
  .gs-mode-btn { transition: none !important; }
}
