/* ============================================================
   Tradebot — TradingView-inspired dark terminal theme
   Mobile responsive + toggleable signals + CVD gauge
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- tokens ---------- */
:root {
  --bg-primary:    #131722;
  --bg-secondary:  #1e222d;
  --bg-tertiary:   #2a2e39;
  --bg-hover:      #363a45;
  --border:        #2a2e39;
  --border-light:  #363a45;

  --text-primary:  #d1d4dc;
  --text-secondary:#787b86;
  --text-muted:    #5d606b;

  --green:         #26a69a;
  --green-bright:  #00e676;
  --red:           #ef5350;
  --red-bright:    #ff5252;
  --blue:          #2196f3;
  --yellow:        #ffeb3b;
  --orange:        #ff9800;
  --purple:        #ab47bc;
  --purple-dim:    #7b1fa2;
  --cyan:          #26c6da;

  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;

  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-glow-green: 0 0 12px rgba(38,166,154,.3);
  --shadow-glow-red:   0 0 12px rgba(239,83,80,.3);
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* ---------- layout ---------- */
#app {
  display: grid;
  grid-template-rows: 48px auto 1fr auto;
  height: 100vh;
  width: 100vw;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__logo {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.02em;
  color: var(--text-primary);
}

.topbar__symbol {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.topbar__symbol .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.topbar__price {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 100px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__settings-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  transition: all .15s;
}
.topbar__settings-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* ---------- stats chips ---------- */
.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  transition: background .15s;
}

.stat-chip__value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.stat-chip--buy .stat-chip__value  { color: var(--green); }
.stat-chip--sell .stat-chip__value { color: var(--red); }

/* ---------- connection status ---------- */
.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: help;
}

.conn-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  transition: background .3s;
}

.conn-status__dot.connected {
  background: var(--green);
  box-shadow: var(--shadow-glow-green);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(38,166,154,.3); }
  50%      { box-shadow: 0 0 12px rgba(38,166,154,.6); }
}

/* ---------- metrics strip ---------- */
.metrics-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px 24px 16px; /* Added extra bottom padding to prevent gauge threshold labels from clipping */
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gauge {
  flex: 1;
  min-width: 140px;
  max-width: 280px;
  position: relative;
}

.gauge__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.gauge__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.gauge__value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 48px;
  margin-left: auto;
}

.gauge__side {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.gauge__side.buy  { color: var(--green); }
.gauge__side.sell { color: var(--red); }
.gauge__side.rising  { color: var(--green); }
.gauge__side.falling { color: var(--red); }
.gauge__side.flat    { color: var(--text-muted); }
.gauge__side.clear   { color: var(--green); }
.gauge__side.blocked { color: var(--red); }

/* ---------- toggle switch ---------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: all .2s;
}

.toggle__slider::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all .2s;
}

.toggle__input:checked + .toggle__slider {
  background: var(--green);
  border-color: var(--green);
}

.toggle__input:checked + .toggle__slider::before {
  left: 14px;
  background: #fff;
}

/* ---------- disabled gauge ---------- */
.gauge--disabled {
  opacity: 0.3;
  pointer-events: none;
}

.gauge--disabled .toggle {
  pointer-events: all;
  opacity: 1;
}

.gauge__off-badge {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  letter-spacing: .08em;
  z-index: 2;
}

.gauge--disabled .gauge__value,
.gauge--disabled .gauge__side {
  opacity: 0;
}

.gauge--disabled .gauge__off-badge {
  display: block;
}

/* Gauge track */
.gauge__track {
  position: relative;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: visible;
}

.gauge__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  width: 0%;
  transition: width .3s ease, background .3s ease;
}

.gauge__fill.hot {
  background: var(--orange);
}

.gauge__fill.fired {
  background: var(--green-bright);
  box-shadow: 0 0 8px rgba(0,230,118,.4);
}

/* OI gauge: centered, goes left/right */
.gauge__track--oi {
  overflow: visible;
}

.gauge__fill--oi {
  left: 50%;
  width: 0%;
  transform-origin: left;
  background: var(--purple);
  transition: width .3s ease, left .3s ease, background .3s ease;
}

.gauge__fill--oi.rising {
  background: var(--green);
}

.gauge__fill--oi.falling {
  background: var(--red);
}

.gauge__center-line {
  position: absolute;
  top: -2px;
  left: 50%;
  width: 1px;
  height: 10px;
  background: var(--text-muted);
  z-index: 2;
}

/* Absorption gauge */
.gauge__fill--abs {
  background: var(--cyan);
  transition: width .3s ease, background .3s ease;
}

.gauge__fill--abs.clear {
  background: var(--green);
}

.gauge__fill--abs.blocked {
  background: var(--red);
}

/* CVD gauge: centered like OI */
.gauge__track--cvd {
  overflow: visible;
}

.gauge__fill--cvd {
  left: 50%;
  width: 0%;
  transform-origin: left;
  background: var(--blue);
  transition: width .3s ease, left .3s ease, background .3s ease;
}

.gauge__fill--cvd.cvd-positive {
  background: var(--green);
}

.gauge__fill--cvd.cvd-negative {
  background: var(--red);
}

/* Threshold markers */
.gauge__threshold {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 10px;
  background: var(--yellow);
  z-index: 1;
  opacity: .7;
}

.gauge__threshold-label {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--yellow);
  white-space: nowrap;
  padding: 0 4px;
}

/* ---------- status pills ---------- */
.gauge__status-pills {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

.status-pills-label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.pill {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  background: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all .3s ease;
  cursor: help;
  min-width: 36px;
  text-align: center;
  white-space: nowrap;
}

.pill.active {
  color: #fff;
  border-color: transparent;
}

.pill.active.green {
  background: var(--green);
  box-shadow: 0 0 10px rgba(38,166,154,.4);
}

.pill.active.red {
  background: var(--red);
  box-shadow: 0 0 10px rgba(239,83,80,.4);
}

.pill.active.blue {
  background: var(--blue);
  box-shadow: 0 0 10px rgba(33,150,243,.4);
}

.pill.active.purple {
  background: var(--purple);
  box-shadow: 0 0 10px rgba(171,71,188,.4);
}

.pill.dimmed {
  opacity: 0.35;
  border-style: dashed;
}

/* ---------- chart area ---------- */
.chart-area {
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  cursor: default;
}

#chart {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* Plotly modebar styling override */
.chart-area .modebar {
  top: 8px !important;
  right: 70px !important; /* Shifted left to avoid covering the Y-axis numbers */
}
.chart-area .modebar-btn path {
  fill: var(--text-muted) !important;
}
.chart-area .modebar-btn:hover path {
  fill: var(--text-primary) !important;
}
.chart-area .modebar-btn.active path {
  fill: var(--blue) !important;
}

/* ---------- no-candles overlay ---------- */
.chart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  z-index: 5;
  transition: opacity .4s;
}

.chart-overlay.hidden { opacity: 0; pointer-events: none; }

.chart-overlay__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.chart-overlay.connected .chart-overlay__spinner {
  border-top-color: var(--green);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chart-overlay__text {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
  text-align: center;
  line-height: 1.6;
}

/* ---------- inspector panel ---------- */
.inspector {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s ease, padding .3s ease;
}

.inspector.open {
  max-height: 200px;
  padding: 12px 16px;
}

.inspector__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.inspector__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}

.inspector__close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: background .15s, color .15s;
}

.inspector__close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.inspector__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 24px;
}

.inspector__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inspector__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.inspector__value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.inspector__value.buy  { color: var(--green); }
.inspector__value.sell { color: var(--red); }
.inspector__value.positive { color: var(--green); }
.inspector__value.negative { color: var(--red); }

/* ---------- pin button ---------- */
.pin-btn {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  z-index: 6;
  transition: all .15s;
  font-size: 13px;
}

.pin-btn__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
}

.pin-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.pin-btn.active {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(33,150,243,.08);
}

/* ---------- settings modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}

.modal__header {
  padding: 24px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal__close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all .15s;
}

.modal__close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal__body {
  padding: 16px 20px 20px;
}

.modal__note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--blue);
}

/* Setting toggle grid */
.setting--toggles {
  margin-bottom: 16px;
}

.setting__toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.setting__toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all .15s;
}

.setting__toggle-item:hover {
  border-color: var(--border-light);
  background: var(--bg-tertiary);
}

.setting__toggle-item input[type="checkbox"] {
  accent-color: var(--green);
  width: 14px;
  height: 14px;
}

.setting__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Individual setting */
.setting {
  margin-bottom: 20px;
}

.setting__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.setting__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting__value-display {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  min-width: 48px;
  text-align: right;
}

.setting__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.setting__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 0 6px rgba(33,150,243,.3);
}

.setting__slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
}

.setting__select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}

.setting__select:focus {
  border-color: var(--blue);
}

.setting__select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.setting__hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal__btn-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.modal__save-btn {
  flex: 1;
  padding: 10px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.modal__save-btn:hover {
  background: #1e88e5;
  box-shadow: 0 4px 12px rgba(33,150,243,.3);
}

.modal__reset-btn {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.modal__reset-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--orange);
}

.modal__status {
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
  color: var(--green);
  min-height: 18px;
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ============================================================
   ANIMATIONS
   ============================================================ */

.price-active-pulse {
  color: var(--blue);
  animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================
   MOBILE RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---------- Tablet / Large Phone (≤ 768px) ---------- */
@media (max-width: 768px) {
  #app {
    grid-template-rows: auto auto 1fr auto;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
    height: auto;
  }

  .topbar__left {
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar__price {
    font-size: 14px;
    min-width: auto;
  }

  .metrics-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 12px;
    overflow-x: visible;
  }

  .gauge {
    max-width: none;
    min-width: 0;
  }

  .gauge__status-pills {
    grid-column: 1 / -1;
    margin-left: 0;
    padding-left: 0;
    justify-content: center;
    flex-wrap: wrap;
  }

  .setting__toggle-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .inspector.open {
    max-height: 280px;
  }

  .inspector__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 16px;
  }
}

/* ---------- Phone (≤ 480px) ---------- */
@media (max-width: 480px) {
  #app {
    grid-template-rows: auto auto 1fr auto;
  }

  .topbar {
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .topbar__left {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .topbar__logo {
    font-size: 14px;
  }

  .topbar__symbol, .stat-chip {
    display: none; /* Hide on small screens */
  }

  .topbar__price {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
  }

  .topbar__right {
    display: flex;
    align-items: center;
  }

  .conn-status {
    display: none; /* Hide conn status text on mobile */
  }

  .conn-status__dot {
    display: block; /* Still show dot somewhere? Maybe not needed */
  }

  .metrics-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px 10px;
  }

  .gauge__header {
    margin-bottom: 4px;
    gap: 4px;
  }

  .gauge__label {
    font-size: 9px;
  }

  .gauge__value {
    font-size: 10px;
    min-width: 36px;
  }

  .gauge__side {
    font-size: 9px;
  }

  .toggle {
    width: 24px;
    height: 14px;
  }

  .toggle__slider::before {
    width: 8px;
    height: 8px;
  }

  .toggle__input:checked + .toggle__slider::before {
    left: 12px;
  }

  .gauge__status-pills {
    grid-column: 1 / -1;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .gauge__status-pills {
    background: var(--bg-tertiary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin: 8px 10px 10px 10px;
    justify-content: space-between;
  }
  
  .status-pills-label {
    display: none; /* Hide label on mobile to save space, the pills explain themselves */
  }

  .pill {
    font-size: 10px;
    padding: 3px 6px;
    min-width: 32px;
  }

  .modebar {
    display: none !important;
  }

  /* Chart */
  .chart-area {
    min-height: 300px;
  }

  .pin-btn {
    bottom: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Inspector — slide up drawer */
  .inspector {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    border-top: 2px solid var(--blue);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  }

  .inspector.open {
    max-height: 60vh;
    padding: 12px;
    overflow-y: auto;
  }

  .inspector__grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
  }

  .inspector__label {
    font-size: 10px;
  }

  .inspector__value {
    font-size: 12px;
  }

  /* Settings — full screen */
  .modal-backdrop.open {
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal__header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
  }

  .modal__body {
    padding: 12px 16px 24px;
  }

  .setting__toggle-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .setting__toggle-item {
    padding: 6px 10px;
    font-size: 11px;
  }

  .setting__slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }

  .setting__slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }
}
@media (max-width: 480px) { .chart-area .modebar { display: none !important; } }

.topbar__symbol-select { background: transparent; color: inherit; border: none; font-size: inherit; font-family: inherit; font-weight: inherit; outline: none; cursor: pointer; }
.topbar__symbol-select option { background: var(--bg-dark); color: var(--text-main); }
