/* ============================================================
   ZEROTRADE — INDIAN STOCK MARKET TERMINAL
   Dark Terminal Design System
   Fonts: Bricolage Grotesque + Geist Mono
   Palette: Volcanic Glass + Market Green/Red
   ============================================================ */

/* ── CSS VARIABLES ── */
:root {
  --bg-base:        #0A0C0A;
  --bg-surface:     #0F1210;
  --bg-elevated:    #141814;
  --bg-card:        #181D18;
  --bg-hover:       #1E251E;
  --border:         #242C24;
  --border-bright:  #2E3A2E;

  --text-primary:   #E8F0E8;
  --text-secondary: #8A9E8A;
  --text-muted:     #4A5E4A;
  --text-dim:       #2E3E2E;

  --green:          #00D09C;
  --green-dim:      #00A87C;
  --green-glow:     rgba(0, 208, 156, 0.15);
  --green-bg:       rgba(0, 208, 156, 0.08);

  --red:            #FF4757;
  --red-dim:        #CC3344;
  --red-glow:       rgba(255, 71, 87, 0.15);
  --red-bg:         rgba(255, 71, 87, 0.08);

  --gold:           #F0B90B;
  --gold-dim:       #C09008;
  --gold-bg:        rgba(240, 185, 11, 0.08);

  --blue:           #3B82F6;
  --blue-bg:        rgba(59, 130, 246, 0.08);

  --sidebar-w:      220px;
  --topbar-h:       56px;
  --ticker-h:       36px;

  --font-display:   'Bricolage Grotesque', sans-serif;
  --font-mono:      'Geist Mono', monospace;

  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;

  --shadow-card:    0 2px 12px rgba(0,0,0,0.4);
  --shadow-glow:    0 0 20px rgba(0, 208, 156, 0.1);
  --transition:     0.18s ease;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: var(--font-mono); }
table { border-collapse: collapse; width: 100%; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   TICKER TAPE
   ============================================================ */
.ticker-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--ticker-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  z-index: 1000;
  display: flex;
  align-items: center;
}

.ticker-tape {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: tickerScroll 60s linear infinite;
  will-change: transform;
}

.ticker-tape:hover { animation-play-state: paused; }

@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-right: 1px solid var(--border);
  height: var(--ticker-h);
}

.ticker-item .t-name { color: var(--text-secondary); font-weight: 500; }
.ticker-item .t-price { color: var(--text-primary); font-weight: 600; }
.ticker-item .t-chg.up   { color: var(--green); }
.ticker-item .t-chg.down { color: var(--red); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: var(--ticker-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--ticker-h));
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 32px; height: 32px;
  background: var(--green);
  color: var(--bg-base);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  transition: stroke var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(0, 208, 156, 0.2);
}

.nav-item.active svg { stroke: var(--green); }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--green);
  border-radius: 0 2px 2px 0;
}

.sidebar-bottom {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.market-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

.status-dot.closed { background: var(--red); box-shadow: 0 0 6px var(--red); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.status-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ist-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--ticker-h);
  min-height: calc(100vh - var(--ticker-h));
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  z-index: 800;
}

.sidebar-toggle {
  display: none;
  padding: 6px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}
.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  gap: 8px;
  transition: border-color var(--transition);
}

.topbar-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-glow);
}

.topbar-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.topbar-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 12px;
  padding: 9px 0;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 999;
  max-height: 280px;
  overflow-y: auto;
}

.search-dropdown.open { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.sri-left { display: flex; flex-direction: column; gap: 2px; }
.sri-symbol { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.sri-name   { font-size: 11px; color: var(--text-muted); }
.sri-exchange { font-family: var(--font-mono); font-size: 10px; color: var(--green); background: var(--green-bg); padding: 2px 6px; border-radius: 3px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.exchange-badges { display: flex; gap: 6px; }

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.badge-nse { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(59,130,246,0.2); }
.badge-bse { background: var(--gold-bg); color: var(--gold); border: 1px solid rgba(240,185,11,0.2); }

.topbar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--green-dim), var(--green));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg-base);
  cursor: pointer;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  display: none;
  padding: 20px;
  flex: 1;
  animation: fadeIn 0.2s ease;
}

.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

/* ============================================================
   INDICES ROW
   ============================================================ */
.indices-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.index-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}

.index-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.index-card:hover::before { background: var(--green); }

.index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.index-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.index-exchange {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 2px;
}

.index-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.index-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.index-change.positive { color: var(--green); }
.index-change.negative { color: var(--red); }

.index-sparkline {
  margin-top: 10px;
  height: 28px;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 12px;
  margin-bottom: 16px;
}

/* ── CHART PANEL ── */
.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title-group { display: flex; flex-direction: column; gap: 2px; }

.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.panel-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.interval-tabs {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.interval-btn {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}

.interval-btn:last-child { border-right: none; }
.interval-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.interval-btn.active { background: var(--green-bg); color: var(--green); }

.fullscreen-btn {
  padding: 6px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.fullscreen-btn svg { width: 14px; height: 14px; display: block; }
.fullscreen-btn:hover { border-color: var(--green); color: var(--green); }

.tradingview-widget-container {
  flex: 1;
  min-height: 420px;
}

#tradingview_chart,
#tradingview_advanced,
#tradingview_portfolio,
#tradingview_market_overview,
#tradingview_news {
  width: 100%;
  height: 100%;
}

/* ── RIGHT PANEL ── */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── QUICK TRADE ── */
.quick-trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.qt-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qt-symbol {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.qt-price {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.qt-change { font-family: var(--font-mono); font-size: 11px; }
.qt-change.positive { color: var(--green); }
.qt-change.negative { color: var(--red); }

.qt-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.qt-tab {
  padding: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}

.qt-tab[data-type="buy"].active  { color: var(--green); border-bottom-color: var(--green); background: var(--green-bg); }
.qt-tab[data-type="sell"].active { color: var(--red);   border-bottom-color: var(--red);   background: var(--red-bg); }
.qt-tab:hover { background: var(--bg-hover); }

.qt-form { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.qt-field { display: flex; flex-direction: column; gap: 4px; }
.qt-field label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.qt-select,
.qt-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.qt-select:focus,
.qt-input:focus { border-color: var(--green); }

.qt-select option { background: var(--bg-card); }

.qt-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.qt-summary span:first-child { color: var(--text-muted); }
.qt-summary span:last-child { font-family: var(--font-mono); font-weight: 600; color: var(--gold); }

.qt-submit {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all var(--transition);
}

.buy-btn  { background: var(--green); color: var(--bg-base); }
.sell-btn { background: var(--red);   color: #fff; }
.buy-btn:hover  { background: var(--green-dim); box-shadow: 0 0 12px var(--green-glow); }
.sell-btn:hover { background: var(--red-dim);   box-shadow: 0 0 12px var(--red-glow); }

/* ── MINI WATCHLIST ── */
.mini-watchlist {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1;
}

.mini-watchlist .panel-header { padding: 10px 14px; }

.text-btn {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  transition: opacity var(--transition);
}
.text-btn:hover { opacity: 0.7; }

.watchlist-items { padding: 4px 0; }

.wl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.wl-item:last-child { border-bottom: none; }
.wl-item:hover { background: var(--bg-hover); }

.wl-left { display: flex; flex-direction: column; gap: 2px; }
.wl-symbol { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.wl-name   { font-size: 10px; color: var(--text-muted); }

.wl-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.wl-price  { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.wl-change { font-family: var(--font-mono); font-size: 10px; }
.wl-change.up   { color: var(--green); }
.wl-change.down { color: var(--red); }

/* ============================================================
   MOVERS ROW
   ============================================================ */
.movers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.movers-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.movers-card .panel-header { padding: 10px 14px; }

.movers-table { font-size: 11px; }

.movers-table thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.movers-table th {
  padding: 7px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.movers-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
}

.movers-table tbody tr:last-child td { border-bottom: none; }
.movers-table tbody tr:hover { background: var(--bg-hover); cursor: pointer; }

.movers-table .sym { font-weight: 600; color: var(--text-primary); }
.movers-table .price { color: var(--text-secondary); }
.movers-table .up   { color: var(--green); font-weight: 600; }
.movers-table .down { color: var(--red);   font-weight: 600; }
.movers-table .vol  { color: var(--gold); }

/* ============================================================
   MARKETS SECTION
   ============================================================ */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.filter-btn.active { background: var(--green-bg); color: var(--green); border-color: rgba(0,208,156,0.3); }

.tv-widget-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 400px;
}

.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.stock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.stock-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.sc-symbol { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.sc-name   { font-size: 10px; color: var(--text-muted); margin-bottom: 10px; }
.sc-price  { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.sc-change { font-family: var(--font-mono); font-size: 11px; }
.sc-change.up   { color: var(--green); }
.sc-change.down { color: var(--red); }

/* ============================================================
   CHART SECTION
   ============================================================ */
.chart-symbol-search {
  display: flex;
  gap: 8px;
}

.chart-symbol-search input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  padding: 8px 14px;
  outline: none;
  width: 280px;
  transition: border-color var(--transition);
}

.chart-symbol-search input:focus { border-color: var(--green); }

.btn-primary {
  background: var(--green);
  color: var(--bg-base);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
}

.btn-primary:hover { background: var(--green-dim); box-shadow: 0 0 12px var(--green-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.btn-ghost:hover { border-color: var(--border-bright); color: var(--text-primary); }

.full-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.full-chart-container > div { width: 100%; height: 100%; }

/* ============================================================
   WATCHLIST SECTION
   ============================================================ */
.watchlist-add {
  display: flex;
  gap: 8px;
}

.watchlist-add input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  padding: 8px 14px;
  outline: none;
  width: 220px;
  transition: border-color var(--transition);
}

.watchlist-add input:focus { border-color: var(--green); }

.watchlist-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.wl-full-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition);
}

.wl-full-item:hover { border-color: var(--border-bright); background: var(--bg-hover); }

.wl-full-left { display: flex; flex-direction: column; gap: 3px; }
.wl-full-symbol { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text-primary); }
.wl-full-name   { font-size: 11px; color: var(--text-muted); }
.wl-full-sector { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.wl-full-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wl-full-price  { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text-primary); }
.wl-full-change { font-family: var(--font-mono); font-size: 12px; }
.wl-full-change.up   { color: var(--green); }
.wl-full-change.down { color: var(--red); }

.wl-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: all var(--transition);
  margin-left: 8px;
}
.wl-remove:hover { color: var(--red); background: var(--red-bg); }

/* ============================================================
   PORTFOLIO SECTION
   ============================================================ */
.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.portfolio-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pstat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pstat-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.pstat-value.positive { color: var(--green); }
.pstat-value.negative { color: var(--red); }

.portfolio-chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 300px;
  margin-bottom: 16px;
}

.portfolio-chart-wrap > div { width: 100%; height: 100%; }

.holdings-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-x: auto;
}

.holdings-table th {
  padding: 8px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.holdings-table td {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.holdings-table tbody tr:last-child td { border-bottom: none; }
.holdings-table tbody tr:hover { background: var(--bg-hover); cursor: pointer; }
.holdings-table .h-sym { font-weight: 700; color: var(--text-primary); }
.holdings-table .h-pos { color: var(--green); }
.holdings-table .h-neg { color: var(--red); }

/* ============================================================
   NEWS SECTION
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-source {
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.news-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.news-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: auto;
}

.news-tag.bullish { background: var(--green-bg); color: var(--green); }
.news-tag.bearish { background: var(--red-bg);   color: var(--red); }
.news-tag.neutral { background: var(--gold-bg);  color: var(--gold); }

.news-headline {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.news-summary {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

.news-stocks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.news-stock-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 { font-size: 15px; font-weight: 700; }

.modal-close {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 20px; }

.modal-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.modal-row:last-child { border-bottom: none; }
.modal-row span:first-child { color: var(--text-muted); }
.modal-row span:last-child  { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary { flex: 1; }
.modal-footer .btn-ghost   { flex: 1; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease;
  font-size: 12px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }

.toast-icon { font-size: 14px; }
.toast-msg  { color: var(--text-primary); font-weight: 500; }

/* ============================================================
   SPARKLINE CANVAS
   ============================================================ */
.sparkline-canvas { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .indices-row { grid-template-columns: repeat(3, 1fr); }
  .portfolio-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .right-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .movers-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-220px);
    width: 220px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .sidebar-toggle { display: flex; }

  .main-content { margin-left: 0; }

  .indices-row { grid-template-columns: repeat(2, 1fr); }
  .movers-row  { grid-template-columns: 1fr; }
  .right-panel { grid-template-columns: 1fr; }
  .portfolio-summary { grid-template-columns: repeat(2, 1fr); }
  .exchange-badges { display: none; }
  .section { padding: 12px; }
}

@media (max-width: 480px) {
  .indices-row { grid-template-columns: 1fr 1fr; }
  .topbar-search { max-width: 200px; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.positive { color: var(--green) !important; }
.negative { color: var(--red)   !important; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Glow effect on green numbers */
.glow-green { text-shadow: 0 0 8px rgba(0, 208, 156, 0.5); }
.glow-red   { text-shadow: 0 0 8px rgba(255, 71, 87, 0.5); }