:root {
  --tv-bg-main: #131722;
  --tv-bg-panel: #1e222d;
  --tv-bg-hover: #2a2e39;
  --tv-bg-active: #363a45;
  --tv-border: #2a2e39;
  --tv-text-primary: #d1d4dc;
  --tv-text-bright: #ffffff;
  --tv-text-muted: #787b86;
  --tv-blue: #2962ff;
  --tv-blue-hover: #1e53e5;
  --tv-blue-soft: rgba(41, 98, 255, 0.16);
  --tv-up: #089981;
  --tv-up-bg: rgba(8, 153, 129, 0.16);
  --tv-down: #f23645;
  --tv-down-bg: rgba(242, 54, 69, 0.16);
  --tv-gold: #f5a623;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--tv-bg-main);
  color: var(--tv-text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   TOP NAVIGATION BAR
   ========================================== */
.tv-topbar {
  height: 44px;
  background-color: var(--tv-bg-main);
  border-bottom: 1px solid var(--tv-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  user-select: none;
  z-index: 20;
}

.tv-topbar-left,
.tv-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tv-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--tv-text-bright);
  letter-spacing: -0.3px;
}

.tv-brand-accent {
  color: var(--tv-blue);
  margin-left: 1px;
}

.tv-divider {
  width: 1px;
  height: 22px;
  background-color: var(--tv-border);
  margin: 0 4px;
}

/* Symbol Search Button */
.tv-symbol-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tv-text-bright);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s, border-color 0.15s;
}

.tv-symbol-btn:hover {
  background-color: var(--tv-bg-hover);
  border-color: var(--tv-active);
}

.tv-symbol-label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.tv-exchange-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--tv-text-muted);
  background-color: var(--tv-bg-panel);
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Icon Buttons & Toolbar Buttons */
.tv-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--tv-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tv-icon-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-icon-btn.small {
  width: 26px;
  height: 26px;
}

.tv-icon-btn.favorited {
  color: var(--tv-gold);
}

.tv-btn-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tv-tf-btn,
.tv-type-btn,
.tv-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--tv-text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tv-tf-btn:hover,
.tv-type-btn:hover,
.tv-tool-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-tf-btn.active,
.tv-type-btn.active,
.tv-tool-btn.active {
  background-color: var(--tv-blue-soft);
  color: #5b8cff;
  font-weight: 600;
}

/* Status & Settings Button */
.tv-api-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 12px;
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
}

.tv-api-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--tv-gold);
}

.tv-api-status.connected .status-dot {
  background-color: var(--tv-up);
  box-shadow: 0 0 6px var(--tv-up);
}

.tv-api-status.error .status-dot {
  background-color: var(--tv-down);
}

.tv-settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 5px;
  border: 1px solid var(--tv-border);
  background-color: var(--tv-bg-panel);
  color: var(--tv-text-bright);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tv-settings-btn:hover {
  background-color: var(--tv-bg-hover);
  border-color: var(--tv-blue);
}

/* ==========================================
   MAIN WORKSPACE (DRAWING TOOLBAR + CHART + WATCHLIST)
   ========================================== */
.tv-workspace {
  display: grid;
  grid-template-columns: 48px 1fr 365px;
  height: calc(100vh - 44px);
  width: 100vw;
}

.tv-workspace.hide-drawing-toolbar {
  grid-template-columns: 1fr 365px;
}

.tv-workspace.hide-drawing-toolbar .tv-drawing-toolbar {
  display: none;
}

/* ==========================================
   LEFT SIDEBAR: TRADINGVIEW DRAWING TOOLBAR
   ========================================== */
.tv-drawing-toolbar {
  background-color: var(--tv-bg-main);
  border-right: 1px solid var(--tv-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  user-select: none;
  z-index: 15;
  overflow-y: auto;
}

.tv-drawing-toolbar::-webkit-scrollbar {
  width: 0;
}

.tv-draw-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.tv-draw-group-lbl {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--tv-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-bottom: 1px;
}

.tv-draw-sep {
  width: 28px;
  height: 1px;
  background-color: var(--tv-border);
  margin: 4px 0;
  flex-shrink: 0;
}

.tv-draw-btn,
.tv-draw-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tv-text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.tv-draw-btn:hover,
.tv-draw-action-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-draw-btn.active,
.tv-draw-action-btn.active {
  background-color: var(--tv-blue-soft);
  color: #5b8cff;
  border-color: rgba(41, 98, 255, 0.45);
}

.tv-draw-action-btn.danger:hover {
  background-color: var(--tv-down-bg);
  color: var(--tv-down);
}

/* ==========================================
   CENTER CHART PANEL
   ========================================== */
.tv-chart-area {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--tv-bg-main);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tv-main-chart-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tv-chart-container {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
}

/* Interactive SVG Drawing Overlay above Chart */
.tv-drawing-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - 62px);
  height: calc(100% - 26px);
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}

.tv-drawing-svg-overlay.drawing-active {
  pointer-events: all;
  cursor: crosshair;
}

.tv-drawing-svg-overlay .draw-hit-target {
  pointer-events: stroke;
  cursor: move;
}

.tv-drawing-svg-overlay .draw-fill-target {
  pointer-events: all;
  cursor: move;
}

.tv-drawing-svg-overlay .draw-handle {
  pointer-events: all;
  cursor: grab;
  transition: r 0.12s;
}

.tv-drawing-svg-overlay .draw-handle:hover {
  r: 6px;
}

/* Floating Style & Delete Bar for Selected Drawing */
.tv-drawing-floating-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
  border-radius: 6px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
}

.draw-float-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tv-text-bright);
  padding-right: 4px;
  border-right: 1px solid var(--tv-border);
}

.draw-color-swatches {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.draw-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}

.draw-color-dot:hover,
.draw-color-dot.active {
  transform: scale(1.18);
  border-color: #ffffff;
}

.draw-float-btn {
  background-color: var(--tv-bg-main);
  border: 1px solid var(--tv-border);
  color: var(--tv-text-primary);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  cursor: pointer;
}

.draw-float-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.draw-float-btn.active {
  background-color: var(--tv-blue-soft);
  color: #5b8cff;
  border-color: var(--tv-blue);
}

.draw-float-btn.danger:hover {
  background-color: var(--tv-down-bg);
  color: var(--tv-down);
  border-color: var(--tv-down);
}

/* Pill icon 'D' for Dividends */
.div-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--tv-blue);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.div-pill-icon.small {
  width: 15px;
  height: 15px;
  font-size: 9.5px;
}

/* TradingView-style 'D' Dividend Event Badges along bottom of main chart */
.tv-dividend-badges-track {
  position: absolute;
  left: 0;
  right: 65px;
  bottom: 28px;
  height: 24px;
  pointer-events: none;
  z-index: 13;
  overflow: hidden;
}

.tv-div-badge {
  position: absolute;
  bottom: 2px;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #1e222d;
  border: 1.5px solid #2962ff;
  color: #5b8cff;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: background 0.12s, color 0.12s, transform 0.12s;
}

.tv-div-badge:hover,
.tv-div-badge.active {
  background-color: #2962ff;
  color: #ffffff;
  transform: translateX(-50%) scale(1.18);
  z-index: 20;
}

/* Sub-Pane Below Main Chart: Dividend Payments ($) & Historical Yield (% TTM) */
.tv-dividend-pane {
  height: 165px;
  min-height: 140px;
  width: 100%;
  background-color: var(--tv-bg-main);
  border-top: 1px solid var(--tv-border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 11;
}

.tv-dividend-pane-header {
  height: 28px;
  padding: 0 12px;
  background-color: rgba(30, 34, 45, 0.75);
  border-bottom: 1px solid rgba(42, 46, 57, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  user-select: none;
}

.div-pane-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow: hidden;
}

.div-pane-title {
  font-weight: 600;
  color: var(--tv-text-bright);
}

.div-summary-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
  color: var(--tv-text-primary);
}

.div-summary-badge.yield-badge {
  color: #f5a623;
  border-color: rgba(245, 166, 35, 0.35);
  background-color: rgba(245, 166, 35, 0.1);
  font-weight: 600;
}

.div-summary-badge.muted {
  color: var(--tv-text-muted);
  font-family: var(--font-sans);
}

.div-hover-legend {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #5b8cff;
  margin-left: 4px;
}

.tv-pane-close-btn {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.tv-pane-close-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-dividend-chart-container {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* Rich Dividend Hover Tooltip (TradingView Style Popover Card) */
.tv-dividend-tooltip {
  position: absolute;
  z-index: 50;
  width: 276px;
  background-color: #1e222d;
  border: 1px solid #363a45;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  padding: 12px;
  pointer-events: none;
  color: var(--tv-text-primary);
  font-size: 12px;
}

.div-tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--tv-border);
}

.div-tt-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--tv-text-bright);
}

.div-tt-freq {
  font-size: 10.5px;
  font-weight: 600;
  color: #5b8cff;
  background-color: var(--tv-blue-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.div-tt-amount-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.div-tt-amount {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--tv-text-bright);
}

.div-tt-amount-sub {
  font-size: 11px;
  color: var(--tv-text-muted);
  font-weight: 400;
}

.div-tt-chg {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.div-tt-chg.up {
  color: var(--tv-up);
  background-color: var(--tv-up-bg);
}

.div-tt-chg.down {
  color: var(--tv-down);
  background-color: var(--tv-down-bg);
}

.div-tt-chg.neutral {
  color: var(--tv-text-muted);
  background-color: var(--tv-bg-main);
}

.div-tt-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.div-tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.div-tt-label {
  color: var(--tv-text-muted);
}

.div-tt-val {
  font-family: var(--font-mono);
  color: var(--tv-text-bright);
  font-weight: 500;
}

.div-tt-val.highlight-yield {
  color: #f5a623;
  font-weight: 700;
}

.tv-chart-bottombar {
  height: 32px;
  background-color: var(--tv-bg-main);
  border-top: 1px solid var(--tv-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  user-select: none;
  z-index: 12;
}

.tv-range-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tv-range-btn {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tv-range-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-range-btn.active {
  color: #5b8cff;
  background-color: var(--tv-blue-soft);
}

.tv-today-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--tv-text-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tv-today-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

/* TradingView Floating "Scroll to Real-Time / Today" Button on Chart Canvas */
.tv-floating-today-btn {
  position: absolute;
  bottom: 42px;
  right: 82px;
  z-index: 14;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: rgba(30, 34, 45, 0.92);
  border: 1px solid var(--tv-border);
  color: var(--tv-text-bright);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}

.tv-floating-today-btn:hover {
  background-color: var(--tv-bg-hover);
  border-color: var(--tv-blue);
  transform: scale(1.06);
}

.tv-bottombar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tv-history-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tv-text-muted);
}

.tv-scale-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
}

.tv-scale-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--tv-text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tv-scale-btn.adj-btn {
  width: auto;
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.tv-scale-btn:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

.tv-scale-btn.active {
  background-color: var(--tv-blue);
  color: #ffffff;
}

/* Top-Left Legend Overlay */
.tv-chart-legend {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(19, 23, 34, 0.72);
  backdrop-filter: blur(4px);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(42, 46, 57, 0.6);
}

.tv-legend-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tv-legend-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #fff;
  padding: 1px;
}

.tv-legend-company {
  font-size: 15px;
  font-weight: 700;
  color: var(--tv-text-bright);
}

.tv-legend-dot {
  color: var(--tv-text-muted);
}

.tv-legend-tf,
.tv-legend-exchange {
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-text-muted);
}

.tv-legend-ohlc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  flex-wrap: wrap;
}

.ohlc-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ohlc-label {
  color: var(--tv-text-muted);
  font-weight: 500;
}

.ohlc-val {
  color: var(--tv-text-bright);
}

.ohlc-val.up,
.ohlc-change.up {
  color: var(--tv-up);
}

.ohlc-val.down,
.ohlc-change.down {
  color: var(--tv-down);
}

/* Loader & Toast */
.tv-chart-loader {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(19, 23, 34, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--tv-text-bright);
  font-size: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--tv-border);
  border-top-color: var(--tv-blue);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tv-chart-toast {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
  color: var(--tv-text-bright);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ==========================================
   RIGHT SIDEBAR: WATCHLIST / FAVORITOS
   ========================================== */
.tv-watchlist {
  background-color: var(--tv-bg-main);
  border-left: 1px solid var(--tv-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

.tv-watchlist-header {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--tv-border);
  background-color: var(--tv-bg-panel);
}

.tv-watchlist-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--tv-text-bright);
  cursor: pointer;
}

.tv-watchlist-title:hover {
  color: #5b8cff;
}

.wl-collapse-btn {
  font-size: 10px;
  color: var(--tv-text-muted);
}

.tv-watchlist.watchlist-collapsed .tv-watchlist-cols,
.tv-watchlist.watchlist-collapsed .tv-watchlist-items {
  display: none !important;
}

@media (min-width: 901px) {
  .tv-watchlist.watchlist-collapsed .tv-watchlist-detail {
    flex: 1 1 auto;
    height: auto !important;
    max-height: none;
  }
}

.tv-watchlist-title svg {
  color: var(--tv-gold);
}

.tv-watchlist-count {
  font-size: 11px;
  color: var(--tv-text-muted);
  background-color: var(--tv-bg-main);
  padding: 1px 6px;
  border-radius: 10px;
}

.tv-watchlist-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.tv-watchlist-cols {
  display: grid;
  grid-template-columns: 1fr 78px 82px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--tv-text-muted);
  border-bottom: 1px solid var(--tv-border);
}

.col-last,
.col-chg {
  text-align: right;
}

.tv-watchlist-items {
  flex: 1 1 0%;
  min-height: 60px;
  overflow-y: auto;
}

.tv-watchlist-items::-webkit-scrollbar {
  width: 5px;
}

.tv-watchlist-items::-webkit-scrollbar-thumb {
  background: var(--tv-border);
  border-radius: 3px;
}

.watchlist-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 78px 82px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(42, 46, 57, 0.45);
  cursor: pointer;
  transition: background 0.12s;
}

.watchlist-row:hover {
  background-color: var(--tv-bg-hover);
}

.watchlist-row.active {
  background-color: var(--tv-blue-soft);
  border-left: 3px solid var(--tv-blue);
  padding-left: 9px;
}

.wl-symbol-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wl-logo-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background-color: var(--tv-bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  color: var(--tv-text-bright);
  border: 1px solid var(--tv-border);
}

.wl-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #ffffff;
  padding: 2px;
}

.wl-ticker-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wl-ticker {
  font-weight: 600;
  font-size: 13px;
  color: var(--tv-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl-name {
  font-size: 11px;
  color: var(--tv-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl-price-cell {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tv-text-bright);
}

.wl-chg-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.wl-chg-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  min-width: 64px;
  text-align: right;
}

.wl-chg-badge.up {
  color: var(--tv-up);
  background-color: var(--tv-up-bg);
}

.wl-chg-badge.down {
  color: var(--tv-down);
  background-color: var(--tv-down-bg);
}

.wl-chg-badge.neutral {
  color: var(--tv-text-muted);
  background-color: var(--tv-bg-panel);
}

/* Remove button on row hover */
.wl-remove-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background-color: var(--tv-bg-panel);
  color: var(--tv-text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}

.watchlist-row:hover .wl-remove-btn {
  display: inline-flex;
}

.wl-remove-btn:hover {
  background-color: var(--tv-down);
  color: #fff;
}

/* Vertical Splitter / Resize Handle above Detail Panel */
.tv-detail-resizer {
  height: 14px;
  background-color: var(--tv-bg-main);
  border-top: 1px solid var(--tv-border);
  border-bottom: 1px solid var(--tv-border);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
  transition: background 0.15s;
}

.tv-detail-resizer:hover,
.tv-detail-resizer.dragging {
  background-color: var(--tv-bg-hover);
}

.resizer-grip {
  width: 36px;
  height: 4px;
  border-top: 1px solid var(--tv-text-muted);
  border-bottom: 1px solid var(--tv-text-muted);
  opacity: 0.7;
}

.tv-detail-resizer:hover .resizer-grip,
.tv-detail-resizer.dragging .resizer-grip {
  border-color: var(--tv-blue);
  opacity: 1;
}

.resizer-expand-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  font-size: 9px;
  cursor: pointer;
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1;
}

.resizer-expand-btn:hover {
  background-color: var(--tv-bg-active);
  color: var(--tv-text-bright);
}

/* Watchlist Detail Bottom Panel (Resizable & Scrollable) */
.tv-watchlist-detail {
  height: 430px;
  min-height: 140px;
  max-height: calc(100vh - 130px);
  background-color: var(--tv-bg-panel);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.tv-watchlist-detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tv-watchlist-detail-scroll::-webkit-scrollbar {
  width: 6px;
}

.tv-watchlist-detail-scroll::-webkit-scrollbar-thumb {
  background: var(--tv-bg-active);
  border-radius: 3px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #ffffff;
  padding: 2px;
  border: 1px solid var(--tv-border);
}

.detail-titles {
  min-width: 0;
  flex: 1;
}

.detail-symbol-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-symbol {
  font-weight: 700;
  font-size: 15px;
  color: var(--tv-text-bright);
}

.detail-exchange {
  font-size: 10px;
  color: var(--tv-text-muted);
  background: var(--tv-bg-main);
  padding: 2px 5px;
  border-radius: 3px;
}

.detail-name {
  font-size: 12px;
  color: var(--tv-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
}

.detail-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--tv-text-bright);
}

.detail-change {
  font-size: 12.5px;
  font-weight: 600;
}

.detail-change.up {
  color: var(--tv-up);
}

.detail-change.down {
  color: var(--tv-down);
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stat-box {
  background-color: var(--tv-bg-main);
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid rgba(42, 46, 57, 0.5);
}

.stat-label {
  font-size: 10.5px;
  color: var(--tv-text-muted);
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--tv-text-primary);
  font-weight: 600;
}

.stat-val.highlight-blue {
  color: #5b8cff;
}

.stat-val.highlight-gold {
  color: #f5a623;
}

.stat-val.up {
  color: var(--tv-up);
}

.stat-val.down {
  color: var(--tv-down);
}

/* Detail Sections */
.detail-section {
  border-top: 1px solid var(--tv-border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tv-text-bright);
}

.detail-section-title svg {
  color: #5b8cff;
}

/* Circular Payout Ratio Card (SVG Donut Gauge) */
.payout-card {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.payout-donut-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.payout-donut-svg {
  transform: rotate(-90deg);
}

.donut-track {
  stroke: #2a2e39;
}

.donut-progress {
  stroke: #089981;
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

.payout-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.payout-donut-val {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tv-text-bright);
  line-height: 1.1;
}

.payout-donut-sub {
  font-size: 9.5px;
  color: var(--tv-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.payout-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.payout-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.payout-lbl {
  color: var(--tv-text-muted);
}

.payout-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--tv-text-bright);
}

.payout-status-pill {
  margin-top: 2px;
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background-color: var(--tv-bg-panel);
  color: var(--tv-text-muted);
}

.payout-status-pill.healthy {
  background-color: var(--tv-up-bg);
  color: var(--tv-up);
}

.payout-status-pill.moderate {
  background-color: rgba(245, 166, 35, 0.16);
  color: #f5a623;
}

.payout-status-pill.high {
  background-color: var(--tv-down-bg);
  color: var(--tv-down);
}

/* Subsection Header & Last 10 Annual Dividends List */
.detail-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--tv-text-primary);
  margin-top: 2px;
}

.sub-muted {
  font-size: 10px;
  color: var(--tv-text-muted);
  font-weight: 500;
}

.annual-div-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--tv-bg-main);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(42, 46, 57, 0.7);
}

.annual-div-row {
  display: grid;
  grid-template-columns: 38px 1fr 56px 58px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.ad-year {
  font-family: var(--font-mono);
  color: var(--tv-text-muted);
  font-weight: 600;
}

.ad-bar-track {
  height: 7px;
  background-color: var(--tv-bg-panel);
  border-radius: 4px;
  overflow: hidden;
}

.ad-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2962ff, #5b8cff);
  border-radius: 4px;
}

.ad-amount {
  font-family: var(--font-mono);
  text-align: right;
  color: var(--tv-text-bright);
  font-weight: 600;
}

.ad-growth {
  font-family: var(--font-mono);
  text-align: right;
  font-size: 10.5px;
  font-weight: 600;
}

.ad-growth.up {
  color: var(--tv-up);
}

.ad-growth.down {
  color: var(--tv-down);
}

.ad-growth.neutral {
  color: var(--tv-text-muted);
}

/* 5-Year Financials Mini Bar Chart & Table */
.fin-bars-chart {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fin-bars-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--tv-text-muted);
}

.fin-leg-items {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.fin-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fin-leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.fin-leg-dot.rev {
  background-color: #2962ff;
}

.fin-leg-dot.net {
  background-color: #089981;
}

.fin-leg-dot.margin {
  background-color: #f5a623;
  border-radius: 50%;
}

.fin-bars-cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  height: 88px;
  align-items: flex-end;
  padding-top: 4px;
}

.fin-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.fin-bar-margin-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: #f5a623;
  line-height: 1;
  white-space: nowrap;
}

.fin-bar-margin-tag.negative {
  color: var(--tv-down);
}

.fin-bar-pair {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 4px;
  height: 54px;
  width: 100%;
  justify-content: center;
  border-bottom: 1px solid rgba(42, 46, 57, 0.8);
}

.fin-bar {
  width: 12px;
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  transition: height 0.25s ease;
}

.fin-bar.rev {
  background-color: #2962ff;
}

.fin-bar.net,
.fin-bar.ni {
  background-color: #089981;
}

.fin-bar.net.negative,
.fin-bar.ni.negative {
  background-color: #f23645;
}

.fin-bar-year {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--tv-text-muted);
  font-weight: 600;
}

/* 5-Year Financials Table */
.fin-table-wrap {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  overflow-x: auto;
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}

.fin-table th,
.fin-table td {
  padding: 6px 5px;
  text-align: right;
  border-bottom: 1px solid rgba(42, 46, 57, 0.45);
  white-space: nowrap;
}

.fin-table th:first-child,
.fin-table td:first-child {
  text-align: left;
  padding-left: 8px;
}

.fin-table th:last-child,
.fin-table td:last-child {
  padding-right: 8px;
}

.fin-table th {
  color: var(--tv-text-muted);
  font-weight: 600;
  background-color: rgba(30, 34, 45, 0.6);
}

.fin-table td {
  font-family: var(--font-mono);
  color: var(--tv-text-primary);
}

.fin-table td.val-pos {
  color: var(--tv-up);
  font-weight: 600;
}

.fin-table td.val-neg {
  color: var(--tv-down);
  font-weight: 600;
}

.fin-table tr:last-child td {
  border-bottom: none;
}

/* ==========================================
   GERALDINE WEISS VALUATION SECTION
   ========================================== */
.gw-title-row {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.gw-title-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gw-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gw-period-selector {
  display: inline-flex;
  background-color: var(--tv-bg-main);
  border: 1px solid var(--tv-border);
  border-radius: 5px;
  overflow: hidden;
}

.gw-period-btn {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background 0.15s, color 0.15s;
}

.gw-period-btn:hover {
  color: var(--tv-text-bright);
  background-color: var(--tv-bg-hover);
}

.gw-period-btn.active {
  background-color: var(--tv-blue);
  color: #ffffff;
}

.gw-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background-color: var(--tv-bg-main);
  color: var(--tv-text-muted);
  border: 1px solid var(--tv-border);
}

.gw-status-badge.undervalued {
  background-color: var(--tv-up-bg);
  color: var(--tv-up);
  border-color: rgba(8, 153, 129, 0.35);
}

.gw-status-badge.fair {
  background-color: var(--tv-blue-soft);
  color: #5b8cff;
  border-color: rgba(41, 98, 255, 0.35);
}

.gw-status-badge.overvalued {
  background-color: var(--tv-down-bg);
  color: var(--tv-down);
  border-color: rgba(242, 54, 69, 0.35);
}

.gw-warning-box {
  background-color: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gw-warning-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f5a623;
}

.gw-warning-text {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--tv-text-primary);
}

.gw-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gw-channel-card {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gw-channel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
}

.gw-ch-lbl {
  color: var(--tv-text-muted);
}

.gw-ch-val,
.gw-ch-pct {
  font-family: var(--font-mono);
  color: var(--tv-text-bright);
}

.gw-channel-bar-track {
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(8, 153, 129, 0.35) 0%, rgba(41, 98, 255, 0.35) 50%, rgba(242, 54, 69, 0.35) 100%);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(42, 46, 57, 0.8);
}

.gw-channel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #089981, #2962ff, #f23645);
  border-right: 2px solid #ffffff;
  transition: width 0.25s ease;
}

.gw-channel-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--tv-text-muted);
}

.gw-targets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.gw-targets-grid.two-cols {
  grid-template-columns: repeat(2, 1fr);
}

.gw-target-box {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gw-target-box.undervalued {
  border-top: 2px solid var(--tv-up);
}

.gw-target-box.fair {
  border-top: 2px solid #2962ff;
}

.gw-target-box.overvalued {
  border-top: 2px solid var(--tv-down);
}

.gw-target-lbl {
  font-size: 9.5px;
  color: var(--tv-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gw-target-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--tv-text-bright);
}

.gw-target-box.undervalued .gw-target-val {
  color: var(--tv-up);
}

.gw-target-box.overvalued .gw-target-val {
  color: var(--tv-down);
}

.gw-target-dist {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--tv-text-primary);
}

.gw-target-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--tv-text-muted);
}

.gw-chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--tv-text-muted);
}

.gw-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gw-leg-line {
  width: 12px;
  height: 2.5px;
  border-radius: 2px;
  display: inline-block;
}

.gw-leg-line.price {
  background-color: #ffffff;
}

.gw-leg-line.over {
  background-color: #f23645;
}

.gw-leg-line.fair {
  background-color: #2962ff;
}

.gw-leg-line.under {
  background-color: #089981;
}

.gw-chart-container {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  padding: 6px 4px 2px;
  position: relative;
  height: 185px;
  user-select: none;
}

.gw-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  cursor: crosshair;
}

.gw-hover-readout {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.6);
  border-radius: 5px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--tv-text-muted);
  line-height: 1.45;
}

.gw-notices-box {
  background-color: var(--tv-bg-main);
  border: 1px solid rgba(42, 46, 57, 0.7);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  color: var(--tv-text-muted);
  line-height: 1.4;
}

.gw-notice-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.gw-notice-item.warn {
  color: #f5a623;
}

.gw-notice-item.danger {
  color: var(--tv-down);
}

.gw-notice-item.ok {
  color: var(--tv-up);
}

.gw-notice-disclaimer {
  margin-top: 2px;
  padding-top: 5px;
  border-top: 1px solid rgba(42, 46, 57, 0.55);
  font-size: 9.5px;
  color: var(--tv-text-muted);
  font-style: italic;
}

/* ==========================================
   MODALS (SEARCH & API SETTINGS)
   ========================================== */
.tv-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}

.hidden {
  display: none !important;
}

.tv-modal {
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 92%;
  max-width: 620px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tv-border);
}

.tv-modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--tv-text-bright);
}

.tv-modal-close {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.tv-modal-close:hover {
  background-color: var(--tv-bg-hover);
  color: var(--tv-text-bright);
}

/* Search Modal Specifics */
.tv-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--tv-border);
  background-color: var(--tv-bg-main);
}

.tv-search-input-wrap .search-icon {
  color: var(--tv-text-muted);
  margin-right: 10px;
  flex-shrink: 0;
}

#symbolSearchInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--tv-text-bright);
  font-size: 14px;
  font-family: var(--font-sans);
}

.clear-input-btn {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  cursor: pointer;
  padding: 2px 6px;
}

.tv-search-filters {
  display: flex;
  gap: 6px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--tv-border);
}

.filter-chip {
  background-color: var(--tv-bg-main);
  border: 1px solid var(--tv-border);
  color: var(--tv-text-primary);
  padding: 4px 11px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.filter-chip.active {
  background-color: var(--tv-blue);
  border-color: var(--tv-blue);
  color: #ffffff;
}

.tv-search-results {
  max-height: 360px;
  overflow-y: auto;
}

.search-result-item {
  display: grid;
  grid-template-columns: 34px 110px 1fr auto 34px;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(42, 46, 57, 0.45);
  cursor: pointer;
  transition: background 0.12s;
}

.search-result-item:hover {
  background-color: var(--tv-bg-hover);
}

.sr-symbol {
  font-weight: 700;
  color: var(--tv-text-bright);
  font-size: 13.5px;
}

.sr-name {
  color: var(--tv-text-primary);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-exchange {
  font-size: 11px;
  color: var(--tv-text-muted);
  background-color: var(--tv-bg-main);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.sr-fav-btn {
  background: transparent;
  border: none;
  color: var(--tv-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.sr-fav-btn.favorited {
  color: var(--tv-gold);
}

.sr-fav-btn:hover {
  background-color: var(--tv-bg-active);
}

.tv-modal-footer-hint {
  padding: 8px 18px;
  background-color: var(--tv-bg-main);
  border-top: 1px solid var(--tv-border);
  font-size: 11.5px;
  color: var(--tv-text-muted);
  text-align: center;
}

kbd {
  background-color: var(--tv-bg-panel);
  border: 1px solid var(--tv-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--tv-text-bright);
}

/* Settings Modal Specifics */
.settings-modal {
  max-width: 500px;
}

.tv-settings-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-desc {
  color: var(--tv-text-primary);
  line-height: 1.5;
  font-size: 12.5px;
}

.settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-text-bright);
}

.api-input-group {
  display: flex;
  gap: 6px;
}

#fmpApiKeyInput {
  flex: 1;
  background-color: var(--tv-bg-main);
  border: 1px solid var(--tv-border);
  border-radius: 5px;
  padding: 9px 12px;
  color: var(--tv-text-bright);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

#fmpApiKeyInput:focus {
  border-color: var(--tv-blue);
}

.api-test-result {
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.4;
}

.api-test-result.success {
  background-color: var(--tv-up-bg);
  color: #3fe0c5;
  border: 1px solid var(--tv-up);
}

.api-test-result.error {
  background-color: var(--tv-down-bg);
  color: #ff808b;
  border: 1px solid var(--tv-down);
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.settings-actions-right {
  display: flex;
  gap: 8px;
}

.btn-primary,
.btn-outline,
.btn-secondary {
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.btn-primary {
  background-color: var(--tv-blue);
  border: 1px solid var(--tv-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--tv-blue-hover);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--tv-border);
  color: var(--tv-text-bright);
}

.btn-outline:hover {
  background-color: var(--tv-bg-hover);
}

.btn-secondary {
  background-color: transparent;
  border: none;
  color: var(--tv-text-muted);
}

.btn-secondary:hover {
  color: var(--tv-text-bright);
}

@media (max-width: 900px) {
  /* Top Navigation Bar: horizontal scroll & compact buttons on mobile */
  .tv-topbar {
    height: 44px;
    padding: 0 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    gap: 4px;
  }

  .tv-topbar::-webkit-scrollbar {
    display: none;
  }

  .tv-topbar-left,
  .tv-topbar-right {
    flex-shrink: 0;
    gap: 3px;
  }

  .tv-brand-text {
    display: none;
  }

  .tv-type-btn span,
  .tv-tool-btn .tv-tool-text,
  .tv-settings-btn span,
  #apiStatusText {
    display: none;
  }

  .tv-api-status {
    padding: 4px 6px;
  }

  .tv-tf-btn,
  .tv-type-btn,
  .tv-tool-btn {
    padding: 0 7px;
    height: 28px;
    font-size: 12px;
  }

  .tv-divider {
    margin: 0 2px;
    height: 18px;
  }

  /* Workspace on Mobile: Vertical stack -> 1. Chart, 2. Favorites, 3. Separator, 4. Company Info */
  .tv-workspace,
  .tv-workspace.hide-drawing-toolbar {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 44px);
    height: calc(100dvh - 44px);
    width: 100vw;
    overflow: hidden;
  }

  /* Drawing Toolbar on Mobile: hidden by default, floating drawer when toggled */
  .tv-drawing-toolbar {
    display: none !important;
  }

  .tv-drawing-toolbar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 44px;
    left: 0;
    bottom: 0;
    width: 46px;
    z-index: 45;
    background-color: rgba(19, 23, 34, 0.96);
    backdrop-filter: blur(6px);
    border-right: 1px solid var(--tv-border);
    box-shadow: 6px 0 20px rgba(0, 0, 0, 0.65);
  }

  /* 1. Main Chart Area on Top */
  .tv-chart-area {
    flex: 1 1 0%;
    min-height: 175px;
    width: 100%;
  }

  .tv-chart-legend {
    top: 6px;
    left: 8px;
    padding: 4px 8px;
    max-width: calc(100% - 76px);
  }

  .tv-legend-company {
    font-size: 13px;
  }

  .tv-legend-ohlc-row {
    font-size: 10.5px;
    gap: 6px;
  }

  .tv-drawing-floating-bar {
    top: auto;
    bottom: 34px;
    max-width: 94%;
    flex-wrap: wrap;
    justify-content: center;
    padding: 4px 8px;
  }

  .tv-chart-bottombar {
    height: 30px;
    padding: 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
  }

  .tv-chart-bottombar::-webkit-scrollbar {
    display: none;
  }

  .tv-range-buttons,
  .tv-bottombar-right {
    flex-shrink: 0;
  }

  .tv-history-info {
    display: none;
  }

  .tv-range-btn {
    padding: 2px 6px;
    font-size: 11px;
  }

  .tv-today-btn span {
    display: none;
  }

  .tv-dividend-pane {
    height: 125px;
    min-height: 110px;
  }

  /* 2. Watchlist + Company Detail Section Below Chart */
  .tv-watchlist {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tv-watchlist-header {
    height: 32px;
    padding: 0 10px;
    flex-shrink: 0;
  }

  .tv-watchlist-cols {
    padding: 4px 10px;
    font-size: 10.5px;
    flex-shrink: 0;
  }

  /* Favorite Tickers List right below the chart */
  .tv-watchlist-items {
    flex: 0 0 auto;
    height: 122px;
    min-height: 58px;
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .watchlist-row {
    padding: 6px 10px;
  }

  /* Vertical Splitter / Resize Handle on Mobile (Touch-friendly) */
  .tv-detail-resizer {
    height: 22px;
    touch-action: none;
    background-color: #181c27;
    border-top: 1px solid #363a45;
    border-bottom: 1px solid #363a45;
  }

  .resizer-grip {
    width: 48px;
    height: 5px;
  }

  .resizer-expand-btn {
    width: 28px;
    height: 20px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 3. Company Information Section Below Favorites */
  .tv-watchlist-detail {
    display: flex !important;
    height: 230px;
    min-height: 75px;
    max-height: calc(100dvh - 220px);
  }

  .tv-watchlist-detail-scroll {
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .payout-card {
    padding: 8px;
    gap: 10px;
  }

  .gw-targets-grid {
    grid-template-columns: 1fr;
  }

  .gw-targets-grid.two-cols {
    grid-template-columns: 1fr 1fr;
  }
}
