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

:root {
  --accent:    #2962ff;
  --accent-h:  #1e4ed8;
  --green:     #26a69a;
  --red:       #ef5350;
  --orange:    #ffa726;
  --yellow:    #ffca28;
  --purple:    #ab47bc;
  --radius:    6px;
}

/* ── Light Theme (default) ───────────────────────────────────────── */
[data-theme="light"], :root {
  --bg:        #f5f6fa;
  --bg-card:   #ffffff;
  --bg-input:  #eef0f5;
  --border:    #d1d5db;
  --text:      #1f2937;
  --text-dim:  #6b7280;
  --chart-bg:  #ffffff;
  --chart-text: #374151;
  --chart-grid: #e5e7eb;
  --table-stripe: #f9fafb;
  --shadow:    0 1px 3px rgba(0,0,0,0.08);
}

/* ── Dark Theme ──────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #0f1114;
  --bg-card:   #1a1d23;
  --bg-input:  #23272e;
  --border:    #2e333b;
  --text:      #e1e4ea;
  --text-dim:  #8b919c;
  --chart-bg:  #1a1d23;
  --chart-text: #8b919c;
  --chart-grid: #2e333b;
  --table-stripe: #1e2128;
  --shadow:    0 1px 3px rgba(0,0,0,0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  white-space: nowrap;
}

#main-nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 0.82rem;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--bg-input); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }

.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .theme-icon { font-size: 1rem; }

#connection-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
}
.status-disconnected { background: var(--red); color: #fff; }
.status-connected    { background: var(--green); color: #fff; }

/* Light theme specific overrides */
[data-theme="light"] .nav-btn.active { background: var(--accent); color: #fff; }
[data-theme="light"] .nav-btn:hover { background: var(--bg-input); }
[data-theme="light"] header { box-shadow: var(--shadow); }
[data-theme="light"] .toolbar,
[data-theme="light"] .dcust-card,
[data-theme="light"] .dash-analysis,
[data-theme="light"] .summary-card { box-shadow: var(--shadow); }
[data-theme="light"] select { color: var(--text); }
[data-theme="light"] .dash-table tbody tr:nth-child(even) { background: var(--table-stripe); }

/* ── Main ─────────────────────────────────────────────────────────── */
main { padding: 1rem 1.2rem; max-width: 1600px; margin: 0 auto; }

.tab { display: none; }
.tab.active { display: block; }

/* ── Toolbar ──────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.toolbar h4 { color: var(--text-dim); font-size: 0.8rem; margin-right: 0.5rem; }

.sub-toolbar {
  background: var(--bg-input);
  border-color: var(--border);
  margin-top: -0.4rem;
}

input, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-dim); }

.btn-primary, .btn-secondary, .btn-danger {
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: 0.85; }

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Advanced Options ─────────────────────────────────────────────── */
.advanced-options {
  margin-bottom: 0.8rem;
}
.advanced-options summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  user-select: none;
}
.advanced-options summary:hover { color: var(--text); }
.advanced-options[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.advanced-options .sub-toolbar { border-top: none; border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 120px;
}
.option-group label {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.option-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.3rem;
}

/* ── Chart ────────────────────────────────────────────────────────── */
.chart-row { display: flex; gap: 1rem; }

#chart-container {
  flex: 1;
  height: 480px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

#chart-info-panel {
  width: 260px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.8rem;
  overflow-y: auto;
  max-height: 480px;
  font-size: 0.8rem;
}
#chart-info-panel h3 { color: var(--accent); margin-bottom: 0.5rem; font-size: 0.9rem; }

/* ── Results Grid ─────────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.result-card, .quote-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  font-size: 0.82rem;
  transition: border-color 0.15s;
}
.result-card:hover { border-color: var(--accent); }
.result-card .title { font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.result-card .sub { color: var(--text-dim); font-size: 0.75rem; }
.result-card .badge, .badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.3rem;
}
.badge-stock   { background: #1565c0; color: #fff; }
.badge-crypto  { background: #f57f17; color: #fff; }
.badge-forex   { background: #2e7d32; color: #fff; }
.badge-index   { background: #6a1b9a; color: #fff; }
.badge-futures { background: #ad1457; color: #fff; }
.badge-default { background: var(--border); color: var(--text); }
.badge-info    { background: var(--accent); color: #fff; }
.badge-success { background: var(--green); color: #fff; }
.badge-warn    { background: var(--orange); color: #fff; }

.result-card .action-btn {
  margin-top: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.72rem;
}
.result-card .action-btn:hover { background: var(--accent-h); }

/* ── Quote Card ───────────────────────────────────────────────────── */
.quote-card {
  position: relative;
}
.quote-card .qname { font-weight: 700; font-size: 0.95rem; }
.quote-card .qprice { font-size: 1.6rem; font-weight: 700; margin: 0.3rem 0; }
.quote-card .qchange { font-size: 0.85rem; font-weight: 600; }
.quote-card .qmeta { color: var(--text-dim); font-size: 0.72rem; margin-top: 0.3rem; }
.quote-card .qclose {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
}
.price-up   { color: var(--green); }
.price-down { color: var(--red); }

/* ── TA ───────────────────────────────────────────────────────────── */
#ta-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}
.ta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  text-align: center;
}
.ta-card .period { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; }
.ta-label { color: var(--text-dim); font-size: 0.7rem; }
.ta-value { font-weight: 600; font-size: 0.85rem; }

/* ── Auth ─────────────────────────────────────────────────────────── */
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  max-width: 500px;
}
.auth-card h3 { margin-bottom: 0.8rem; font-size: 1rem; }
.form-group { margin-bottom: 0.6rem; }
.form-group label { display: block; color: var(--text-dim); font-size: 0.75rem; margin-bottom: 0.2rem; }
.form-group input { width: 100%; }

/* ── Indicator details ────────────────────────────────────────────── */
#indicator-details, #private-indicators, #drawings-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  white-space: pre-wrap;
  max-height: 500px;
  overflow-y: auto;
}

/* ── Studies list ─────────────────────────────────────────────────── */
#studies-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.study-tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.study-tag .remove {
  cursor: pointer;
  color: var(--red);
  font-weight: 700;
}

/* ── Strategy Report ──────────────────────────────────────────────── */
#strategy-panel, #graphic-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
}
#strategy-panel h4, #graphic-panel h4 {
  color: var(--accent);
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.metric-card {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 0.6rem;
  text-align: center;
}
.metric-card .metric-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}
.metric-card .metric-value {
  font-size: 1rem;
  font-weight: 700;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}
.trades-table th {
  background: var(--bg-input);
  padding: 0.4rem 0.6rem;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.trades-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.trades-table tr:hover { background: var(--bg-input); }
.trades-table-wrapper {
  max-height: 300px;
  overflow-y: auto;
}

/* Equity chart inside strategy */
#equity-chart-container {
  height: 200px;
  margin: 0.5rem 0;
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Graphic Data ─────────────────────────────────────────────────── */
.graphic-section {
  margin-bottom: 0.8rem;
}
.graphic-section h5 {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}
.graphic-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.4rem;
}
.graphic-item {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 0.5rem;
  font-size: 0.75rem;
}
.graphic-item .gi-type {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.graphic-item .gi-props {
  color: var(--text-dim);
}

/* ── Replay ───────────────────────────────────────────────────────── */
.replay-details {
  display: flex;
  gap: 2rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

/* ── Multi Fetch ──────────────────────────────────────────────────── */
.multi-fetch-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
#multi-fetch-results {
  margin-top: 0.5rem;
}
.multi-result-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  margin-bottom: 0.5rem;
}
.multi-result-section h5 {
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* ── From/To Results ──────────────────────────────────────────────── */
#fromto-results {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 0.8rem;
}

/* ── Toast ─────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-info    { background: var(--accent); color: #fff; }
.toast-success { background: var(--green); color: #fff; }
.toast-error   { background: var(--red); color: #fff; }

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

/* ── Symbol info key/value ────────────────────────────────────────── */
.info-row { display: flex; justify-content: space-between; padding: 0.15rem 0; border-bottom: 1px solid var(--border); }
.info-key { color: var(--text-dim); }
.info-val { color: var(--text); font-weight: 500; text-align: right; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* ── Dashboard IDX ────────────────────────────────────────────────── */
.dash-header {
  margin-bottom: 1rem;
}
.dash-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.dash-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.dash-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.dash-filters {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  flex: 1;
}

.dash-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 100px;
}
.dash-filter-group label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-lg {
  padding: 0.55rem 1.4rem;
  font-size: 0.9rem;
}

.dash-count {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* TradingView Premium Auth */
.dash-tv-auth {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.dash-tv-auth summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--purple);
  font-weight: 500;
}
.dash-tv-auth-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0.4rem 0;
  line-height: 1.4;
}
.dash-tv-auth-inputs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.dash-tv-auth-inputs input {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

/* Summary cards */
.dash-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
}
.summary-card .sc-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.summary-card .sc-value {
  font-size: 1.4rem;
  font-weight: 700;
}
.summary-card .sc-value.strong-buy { color: #00c853; }
.summary-card .sc-value.buy { color: var(--green); }
.summary-card .sc-value.neutral { color: var(--text-dim); }
.summary-card .sc-value.sell { color: var(--orange); }
.summary-card .sc-value.strong-sell { color: var(--red); }
.summary-card .sc-value.total { color: var(--accent); }

/* Search bar */
.dash-search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.dash-search-bar input {
  flex: 1;
  padding: 0.5rem 0.8rem;
}
.dash-search-bar select {
  min-width: 180px;
}

/* Table wrapper */
.dash-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: calc(100vh - 360px);
  min-height: 200px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  white-space: nowrap;
}

.dash-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.dash-table th {
  background: var(--bg-input);
  padding: 0.5rem 0.6rem;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.dash-table th:hover {
  color: var(--accent);
}
.dash-table th.sorted-asc::after {
  content: ' \25B2';
  font-size: 0.6rem;
}
.dash-table th.sorted-desc::after {
  content: ' \25BC';
  font-size: 0.6rem;
}

.dash-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.dash-table tbody tr {
  transition: background 0.12s;
}
.dash-table tbody tr:hover {
  background: rgba(41, 98, 255, 0.08);
}

.dash-table .col-ticker {
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.dash-table .col-ticker:hover {
  text-decoration: underline;
}
.dash-table .col-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
}
.dash-table .col-price {
  font-weight: 600;
}
.dash-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Signal badges */
.signal-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.signal-strong-buy { background: rgba(0,200,83,0.15); color: #00c853; }
.signal-buy { background: rgba(38,166,154,0.15); color: var(--green); }
.signal-neutral { background: rgba(139,145,156,0.12); color: var(--text-dim); }
.signal-sell { background: rgba(255,167,38,0.15); color: var(--orange); }
.signal-strong-sell { background: rgba(239,83,80,0.15); color: var(--red); }

/* RSI coloring */
.rsi-overbought { color: var(--red); }
.rsi-oversold { color: var(--green); }
.rsi-neutral { color: var(--text-dim); }

/* Dashboard load/empty states */
.dash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dash-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Detail row action button */
.dash-table .btn-chart {
  background: linear-gradient(135deg, var(--accent), #1a7f5a);
  color: #fff;
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
}
.dash-table .btn-chart:hover {
  background: linear-gradient(135deg, var(--accent-h), #1f9b6e);
  box-shadow: 0 0 6px rgba(38, 166, 154, 0.3);
}
.dash-table .btn-detail {
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
}
.dash-table .btn-detail:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ── Inline Analysis Panel ─────────────────────────────────────── */
.dash-analysis {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  margin-top: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.dash-analysis-header h3 {
  font-size: 1.2rem;
  color: var(--text);
}
.dash-analysis-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* Real-time Quote Bar */
.dash-quote-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.7rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  align-items: center;
  position: relative;
}
.dq-item {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}
.dq-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dq-value {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dq-price-big {
  font-size: 1.3rem;
}
.dq-live {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--green);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Chart + indicators row */
.dash-chart-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-chart-container {
  flex: 1;
  height: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.dash-indicators-panel {
  width: 220px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.8rem;
  overflow-y: auto;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dash-indicators-panel h4 {
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0;
}
.dash-indic-controls {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.dash-indic-controls select {
  width: 100%;
}
.dash-indic-controls button {
  width: 100%;
}

#dash-indic-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  overflow-y: auto;
}
.dash-indic-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
  font-size: 0.72rem;
}
.dash-indic-tag .indic-name {
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-indic-tag .indic-remove {
  cursor: pointer;
  color: var(--red);
  font-weight: 700;
  margin-left: 0.3rem;
  font-size: 0.85rem;
}

/* Strategy section */
.dash-strategy-section {
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.8rem;
}
.dash-strategy-section h4 {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.dash-strategy-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dash-strategy-controls select {
  flex: 1;
}
#dash-strategy-result {
  max-height: 400px;
  overflow-y: auto;
}

/* Modal */
.dash-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.dash-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}
.dash-modal-close:hover { color: var(--text); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.detail-item {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 0.6rem;
}
.detail-item .di-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.detail-item .di-value {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── Dashboard IDX Custom ─────────────────────────────────────────── */
.dcust-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dcust-summary .dcust-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dcust-signals {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.dcust-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.dcust-card:hover {
  border-color: var(--accent);
}

.dcust-card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}

.dcust-card-rank {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 32px;
}

.dcust-card-title {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.dcust-ticker {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.dcust-name {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.dcust-card-badges {
  display: flex;
  gap: 0.3rem;
}

.dcust-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.setup-buy-support {
  background: rgba(38, 166, 154, 0.15);
  color: #26a69a;
  border: 1px solid rgba(38, 166, 154, 0.3);
}
.setup-breakout {
  background: rgba(41, 98, 255, 0.15);
  color: #2962ff;
  border: 1px solid rgba(41, 98, 255, 0.3);
}
.setup-trend-following {
  background: rgba(255, 167, 38, 0.15);
  color: #ffa726;
  border: 1px solid rgba(255, 167, 38, 0.3);
}

.trend-up {
  background: rgba(38, 166, 154, 0.15);
  color: #26a69a;
  border: 1px solid rgba(38, 166, 154, 0.3);
}
.trend-sideways {
  background: rgba(255, 202, 40, 0.15);
  color: #ffca28;
  border: 1px solid rgba(255, 202, 40, 0.3);
}
.trend-down {
  background: rgba(239, 83, 80, 0.15);
  color: #ef5350;
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.dcust-card-body {
  padding: 0.8rem 1rem;
}

.dcust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.dcust-field {
  padding: 0.4rem;
}
.dcust-field-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}
.dcust-field-value {
  font-size: 0.85rem;
  font-weight: 600;
}

.dcust-entry { color: var(--green); }
.dcust-sl { color: var(--red); }
.dcust-tp { color: var(--accent); }

.dcust-reason {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.6rem;
}
.dcust-reason strong {
  color: var(--text);
}

.dcust-card-actions {
  display: flex;
  gap: 0.4rem;
}

.dcust-modal-content {
  max-width: 700px;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chart-row { flex-direction: column; }
  #chart-info-panel { width: 100%; max-height: 200px; }
  #chart-container { height: 320px; }
  header { flex-wrap: wrap; }
  .strategy-metrics { grid-template-columns: repeat(2, 1fr); }
  .graphic-items { grid-template-columns: 1fr; }
  .dash-toolbar { flex-direction: column; align-items: stretch; }
  .dash-filters { flex-direction: column; }
  .dash-summary { grid-template-columns: repeat(2, 1fr); }
  .dash-table { font-size: 0.72rem; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .dash-chart-row { flex-direction: column; }
  .dash-indicators-panel { width: 100%; max-height: 200px; }
  .dash-chart-container { height: 300px; }
  .dash-quote-bar { gap: 0.3rem; }
  .dq-item { min-width: 60px; }
  .dcust-grid { grid-template-columns: 1fr 1fr; }
  .dcust-card-header { flex-wrap: wrap; }
  .dcust-card-badges { width: 100%; margin-top: 0.3rem; }
}
