/* TradeVYZR theme layer (2026-10-09 style audit).
   Loaded LAST on every app page. Restyles the existing component classes onto the shared tokens (tokens.css) so the
   whole app gets one look: Inter for reading, Plus Jakarta Sans for titles and numbers, layered surfaces, the brand
   gradient for primary actions. Markup is unchanged; inline styles still win where they exist (being retired). */

/* ── type ─────────────────────────────────────────────────────────────────────────────────────────────────── */
body { font-family: var(--font-sans); }
h1, h2, h3, h4, .page-title, .card-title, .modal-title, .settings-card-title, .section-title {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.page-title { font-size: var(--fs-2xl); font-weight: 700; line-height: var(--lh-tight); }
.page-subtitle { font-size: var(--fs-md); color: var(--text-muted); margin-top: 4px; }
.text-muted { color: var(--text-muted) !important; }

/* uppercase micro-labels everywhere share one treatment */
.stat-label, .metric-label, .mp-metric-label, .admin-stat-label, .detail-label, .risk-label, .settings-label,
.screener-table th, .analytics-table th, .results-table th, .admin-table th, .pnl-breakdown-table th, .trades-summary-table th {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* big numbers */
.stat-value, .metric-value, .mp-metric-value, .admin-stat-value, .kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

/* ── header ───────────────────────────────────────────────────────────────────────────────────────────────── */
.header {
  background: var(--header-glass) !important;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--hairline) !important;
  box-shadow: none !important;
}

/* ── surfaces ─────────────────────────────────────────────────────────────────────────────────────────────── */
.dashboard-card, .settings-card, .stat-card, .card, .admin-card, .metric-card, .chart-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--highlight), var(--elev-1);
  backdrop-filter: none;
}
.dashboard-card:hover, .stat-card:hover { border-color: var(--hairline-strong); box-shadow: var(--highlight), var(--elev-1); transform: none; }
.card-header, .settings-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
}
.card-title { font-size: var(--fs-base); font-weight: 600; }

/* ── buttons ──────────────────────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-primary {
  background: var(--grad-brand);
  color: var(--ink-on-accent);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 4px 14px -4px color-mix(in srgb, var(--accent-purple) 60%, transparent);
}
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); background: var(--grad-brand); }
.btn-secondary, .btn-outline, .btn-default {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--hairline-strong);
  box-shadow: none;
}
.btn-secondary:hover, .btn-outline:hover, .btn-default:hover { background: var(--surface-3); border-color: var(--accent-purple); }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.btn-icon { min-width: 32px; padding: 0 8px; background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }

/* ── tabs: one segmented control everywhere ───────────────────────────────────────────────────────────────── */
.app-tabs, .settings-tab-bar {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  margin: 0 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
  max-width: 100%;
}
.app-tab, .settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
  white-space: nowrap;
}
.app-tab:hover, .settings-tab:hover { color: var(--text-primary) !important; background: var(--surface-3) !important; }
.app-tab.active, .settings-tab.active {
  background: var(--surface-1-solid) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--elev-1), inset 0 -2px 0 var(--accent-purple);
}
.app-tab.active i, .settings-tab.active i { color: var(--accent-purple); }

/* filter pills (Today / 1W / MTD …) + small toggles */
.filter-btn, .toggle-btn, .day-btn {
  border-radius: 7px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.filter-btn.active, .toggle-btn.active, .day-btn.active {
  background: var(--accent-soft) !important;
  color: var(--accent-purple) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-purple) 40%, transparent);
}

/* ── forms ────────────────────────────────────────────────────────────────────────────────────────────────── */
.form-input, .form-control, .form-select, .settings-form-group input:not([type=checkbox]):not([type=radio]),
.settings-form-group select, .control-group input:not([type=checkbox]):not([type=radio]), .control-group select {
  min-height: 34px;
  padding: 0 10px;
  background: var(--input-bg);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.form-input, textarea.form-control { padding: 8px 10px; min-height: 72px; }
.form-input:hover, .form-control:hover { border-color: color-mix(in srgb, var(--accent-purple) 45%, var(--hairline-strong)); }
.form-input:focus, .form-control:focus, .settings-form-group input:focus, .settings-form-group select:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: var(--focus-ring);
}
label, .form-label, .settings-form-group label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.settings-help, .form-help, .help-text { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.45; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-purple); width: 16px; height: 16px; }

/* ── tables ───────────────────────────────────────────────────────────────────────────────────────────────── */
.screener-table, .analytics-table, .results-table, .admin-table, .pnl-breakdown-table, .trades-summary-table,
.ht-table, .pe-table, .data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: var(--fs-md);
}
.screener-table th, .analytics-table th, .results-table th, .admin-table th, .pnl-breakdown-table th,
.trades-summary-table th, .ht-table th, .pe-table th, .data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  background: var(--surface-1-solid);
  border-bottom: 1px solid var(--hairline-strong);
  text-align: left;
  white-space: nowrap;
}
.screener-table td, .analytics-table td, .results-table td, .admin-table td, .pnl-breakdown-table td,
.trades-summary-table td, .ht-table td, .pe-table td, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.screener-table tbody tr, .analytics-table tbody tr, .results-table tbody tr, .admin-table tbody tr, .data-table tbody tr { transition: background-color .12s ease; }
.screener-table tbody tr:hover td, .analytics-table tbody tr:hover td, .results-table tbody tr:hover td,
.admin-table tbody tr:hover td, .pnl-breakdown-table tbody tr:hover td, .data-table tbody tr:hover td { background: var(--row-hover); }
.screener-table td:nth-child(2) { font-weight: 700; letter-spacing: .01em; }

/* ── badges / pills ───────────────────────────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.5;
}

/* ── modals ───────────────────────────────────────────────────────────────────────────────────────────────── */
.modal-content {
  background: var(--surface-1-solid);
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  box-shadow: var(--highlight), var(--elev-2);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.modal-title { font-size: var(--fs-lg); font-weight: 700; }
.modal-body { padding: 18px 20px; }
.modal-close { color: var(--text-muted); border-radius: 8px; }
.modal-close:hover { color: var(--text-primary); background: var(--surface-3); }

/* ── empty + loading states ───────────────────────────────────────────────────────────────────────────────── */
.empty-state { color: var(--text-muted); font-size: var(--fs-md); padding: 36px 16px; text-align: center; }
.empty-state i, .empty-state-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--accent-softer);
  color: var(--accent-purple);
  font-size: 18px;
}

/* ── scrollbars ───────────────────────────────────────────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* dense rows: buttons inside tables don't set the row height */
td .btn, td .btn-sm { min-height: 26px; padding: 0 10px; font-size: var(--fs-sm); }
.screener-table th, .screener-table td { padding: 8px 10px; }

/* =============================================================================================================
   APP SHELL — sidebar + header (reference: TRADEVYZR design system / Screener mockup)
   ============================================================================================================= */
.sidebar {
  width: 272px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
}
.sidebar.collapsed { width: 84px; }
body.has-sidebar { padding-left: 272px; }
body.has-sidebar.sidebar-collapsed { padding-left: 84px; }
.sidebar-header {
  height: 84px;
  padding: 0 16px;
  justify-content: flex-start;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo { display: flex; align-items: center; justify-content: flex-start; gap: 0; width: 100%; min-width: 0; text-decoration: none; }
/* both assets are cropped to their ink bounds (logo_mark.png / tradevyzr_wordmark.png), so sizes here are what you see */
.sidebar-logo-img { height: 44px; width: auto; max-width: none; flex: none; filter: none; }
.sidebar-wordmark { height: 16px; width: auto; min-width: 0; margin-left: -4px; max-width: 100%; flex: 0 1 auto; object-fit: contain; object-position: left center; transition: opacity .2s; }
.sidebar.collapsed .sidebar-header { padding: 0; justify-content: center; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .sidebar-logo-img { height: 32px; }
.sidebar.collapsed .sidebar-wordmark { display: none; }
body:has(.header) .sidebar-toggle { display: none; }   /* the header's menu button collapses it */
.sidebar-toggle { background: var(--primary); border: 2px solid var(--bg-primary); top: 26px; }

.sidebar-nav { padding: 14px 12px; gap: 4px; }
.sidebar .nav-item {
  padding: 11px 14px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  color: rgba(226, 232, 240, 0.78);
}
.sidebar .nav-item i, .sidebar .nav-item .nav-icon { width: 22px; min-width: 22px; font-size: 17px; }
.sidebar .nav-label, .nav-label {
  margin-left: 12px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.sidebar .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar .nav-item:hover i, .sidebar .nav-item:hover .nav-icon { transform: none; color: #fff; }
.sidebar .nav-item.active {
  background: var(--grad-active);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.45);
}
.sidebar .nav-item.active::after { display: none; }
.sidebar .nav-item.active i { color: #6ee7b7; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer .nav-item, .theme-toggle, [data-theme="light"] .theme-toggle {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  color: rgba(226, 232, 240, 0.78);
  list-style: none;
}
.theme-toggle .toggle-label, [data-theme="light"] .theme-toggle .toggle-label { margin-left: 12px; font-size: 15px; color: inherit; }
.theme-toggle i, [data-theme="light"] .theme-toggle i { width: 22px; min-width: 22px; font-size: 17px; color: inherit; }
.theme-toggle:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar.collapsed .sidebar-nav, .sidebar.collapsed .sidebar-footer { padding-left: 10px; padding-right: 10px; }
.sidebar.collapsed .nav-item, .sidebar.collapsed .theme-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .toggle-label { display: none; }

/* header: slim bar, controls right-aligned (logo lives in the sidebar) */
.header {
  height: 64px;
  padding: 0 24px;
  background: var(--header-glass) !important;
}
.header-content { justify-content: flex-start; gap: 12px; }
.header-logo { display: none; }
.header-menu-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
}
.header-menu-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.header-controls-left { margin-left: auto; gap: 10px; }
.header-account-group, .header-toggle-group, .header-user-trigger {
  height: 40px;
  padding: 0 14px;
  background: var(--card-bg);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  box-shadow: var(--elev-1);
  color: var(--text-primary);
}
.header-account-group i { color: var(--primary); }
.custom-select-trigger { color: var(--text-primary); font-size: var(--fs-md); font-weight: 500; }
.header-balance { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; border-left: 1px solid var(--hairline-strong); padding-left: 12px; }
.header-toggle-label { color: var(--text-secondary); font-size: var(--fs-md); }
.header-user-trigger { gap: 10px; padding: 0 12px 0 6px; font-weight: 600; }
.header-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
[data-theme="dark"] .header-avatar, :root:not([data-theme="light"]) .header-avatar { background: #24324d; }
.header-user-arrow { color: var(--text-muted); font-size: 11px; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary) !important; }
.main-content, .page-content { --page-pad: 28px; }

/* =============================================================================================================
   PAGE FRAME
   ============================================================================================================= */
.page-header, .dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 20px;
  padding: 0;
  background: none;
  border: 0;
}
.page-title, .dashboard-header h2 { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.page-subtitle { font-size: 15px; color: var(--text-secondary); margin: 6px 0 0; }

/* segmented controls: date ranges, $/% toggles, panel tabs */
.date-filters, .stats-toggle, .equity-toggle, .drawdown-toggle, .tabs-header {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.date-filters .filter-btn, .stats-toggle .toggle-btn, .equity-toggle .toggle-btn, .drawdown-toggle .toggle-btn, .tabs-header .tab-btn {
  min-height: 30px;
  padding: 0 12px;
  border: 0 !important;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-md);
  font-weight: 600;
  box-shadow: none !important;
}
.date-filters .filter-btn:hover, .tabs-header .tab-btn:hover { color: var(--text-primary); background: var(--surface-3); }
.date-filters .filter-btn.active, .stats-toggle .toggle-btn.active, .equity-toggle .toggle-btn.active,
.drawdown-toggle .toggle-btn.active, .tabs-header .tab-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .15) !important;
}

/* =============================================================================================================
   DASHBOARD
   ============================================================================================================= */
.stats-header-row { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.stats-title { font-size: var(--fs-lg); font-weight: 600; color: var(--text-primary); text-transform: none; letter-spacing: 0; }
.stats-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stats-cards-secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.stats-cards .stat-card { padding: 16px 18px; text-align: left; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.stat-head { display: flex; align-items: center; gap: 10px; }
.stat-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-size: 14px; flex: none; }
.tone-green { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.tone-red { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.tone-blue { background: color-mix(in srgb, var(--secondary) 14%, transparent); color: var(--secondary); }
.tone-teal { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.tone-violet { background: rgba(139, 92, 246, .14); color: #8b5cf6; }
.tone-slate { background: var(--surface-3); color: var(--text-secondary); }
.tone-amber { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.stats-cards .stat-label { font-size: var(--fs-md); font-weight: 500; color: var(--text-secondary); text-transform: none; letter-spacing: 0; }
.stats-cards .stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stats-cards-secondary .stat-value { font-size: var(--fs-xl); }
.stat-value.profit, .positive, .profit { color: var(--success); }
.stat-value.loss, .negative, .loss { color: var(--danger); }
.dashboard-grid { gap: 20px; }
.dashboard-grid .dashboard-card { padding: 18px 20px; margin: 0; }
.card-header-inline, .chart-header-with-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-header-inline h3, .chart-header-with-toggle h3, .calendar-card h3 { font-size: var(--fs-lg); font-weight: 600; margin: 0; }
.tabs-header { margin-bottom: 14px; }

/* =============================================================================================================
   SCREENER
   ============================================================================================================= */
.filter-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 20px;
  margin: 0 0 20px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--highlight), var(--elev-1);
  flex-wrap: wrap;
}
.filter-toolbar .screener-controls { display: flex; flex: 1; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-toolbar .control-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-toolbar .control-group label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); margin: 0; }
.filter-toolbar #rulesSelect { min-width: 240px; }
.input-with-addon { display: flex; gap: 6px; align-items: center; }
.input-with-addon .form-input { width: 130px; }
.input-addon { min-height: 34px; min-width: 34px; }
.input-narrow { width: 100px; }
.input-date { width: 160px; }
.btn-lg { min-height: 40px; padding: 0 18px; font-size: var(--fs-base); border-radius: 10px; }
.filter-toolbar .action-buttons { margin-left: auto; }

.card-header-split { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-heading .card-title, #screenerCard .card-title { font-size: 20px; font-weight: 700; margin: 0; }
.card-subtitle { font-size: var(--fs-md); color: var(--text-secondary); margin: 4px 0 0; }
.card-header-actions { display: flex; align-items: center; gap: 20px; }
.purchase-plan-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid var(--hairline-strong);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.chip-toggle input { width: 15px; height: 15px; margin: 0; }
.chip-amber { background: var(--amber-soft); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: color-mix(in srgb, var(--warning) 80%, var(--text-primary)); }
.chip-amber input { accent-color: var(--warning); }
.segmented-radio { gap: 2px !important; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--hairline); }
.segmented-radio label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 7px; font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }
.segmented-radio input { accent-color: var(--warning); width: 14px; height: 14px; margin: 0; }
.plan-summary { padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); font-size: var(--fs-sm); font-weight: 600; }
.table-meta { padding: 0 2px 10px; font-size: var(--fs-sm); color: var(--text-muted); }
.table-meta-live::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 8px; vertical-align: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--hairline); }

/* screener results table: clean light header, sortable */
.screener-table th { background: var(--card-bg); color: var(--text-secondary); cursor: pointer; user-select: none; }
.screener-table th:hover { color: var(--text-primary); }
.screener-table th[aria-sort]::after, .screener-table th.sortable::after { content: '\2195'; margin-left: 4px; opacity: .35; font-size: 10px; }
.screener-table th.sorted-asc::after { content: '\25B2'; opacity: .9; color: var(--primary); }
.screener-table th.sorted-desc::after { content: '\25BC'; opacity: .9; color: var(--primary); }
.screener-table th:last-child::after { content: none; }
.screener-table td { height: 52px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sym { display: block; font-weight: 700; font-size: var(--fs-base); color: var(--text-primary); }
.sym-sub { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
.screener-table tr.purchase-plan-active-trade td { background: color-mix(in srgb, var(--secondary) 7%, transparent); }
.screener-table tr.purchase-plan-highlight td { background: color-mix(in srgb, var(--warning) 9%, transparent); }
.screener-table tr.live-filtered-row td { opacity: .5; }

/* badges (signals, trade actions, status) */
.badge-sc { background: #fce7f3; color: #be185d; }
:root:not([data-theme="light"]) .badge-sc { background: rgba(236, 72, 153, .16); color: #f472b6; }
.badge-buy, .badge-active, .badge-call { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 30%, transparent); }
.badge-hold { background: var(--blue-soft); color: var(--secondary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--secondary) 30%, transparent); }
.badge-roll { background: var(--amber-soft); color: var(--warning); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent); }
.badge-exit, .badge-put { background: var(--red-soft); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-emergency { background: var(--danger); color: #fff; }
.badge-unmanaged, .badge-closed { background: var(--surface-3); color: var(--text-secondary); }
.badge.is-clickable { cursor: pointer; }
.badge-action, .badge-status { text-transform: uppercase; letter-spacing: .04em; }

/* active trades: navy data header, grouped rows, totals */
.trades-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.trades-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 11px 12px;
  background: var(--navy);
  color: #e2e8f0;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  border: 0;
}
:root:not([data-theme="light"]) .trades-table thead th { background: #0a1222; }
.trades-table thead th:first-child { border-top-left-radius: 10px; }
.trades-table thead th:last-child { border-top-right-radius: 10px; }
.trades-table thead th.num { text-align: right; }
.trades-table thead th.sortable { cursor: pointer; user-select: none; }
.trades-table thead th.sortable:hover { color: #fff; }
.trades-table .sort-ind::after { content: '\2195'; margin-left: 4px; opacity: .45; font-size: 10px; }
.trades-table th[aria-sort="ascending"] .sort-ind::after { content: '\25B2'; opacity: 1; color: #5eead4; }
.trades-table th[aria-sort="descending"] .sort-ind::after { content: '\25BC'; opacity: 1; color: #5eead4; }
.trades-table td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); color: var(--text-primary); vertical-align: middle; font-variant-numeric: tabular-nums; }
.trades-table td.num { text-align: right; }
.trades-table td.muted, .trades-table .muted { color: var(--text-muted); }
.trades-table .cell-sub { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
.trades-table tr.group-parent td { background: var(--surface-2); font-weight: 600; cursor: pointer; }
.trades-table tr.group-parent:hover td, .trades-table tr.trade-row:hover td { background: var(--row-hover); }
.trades-table tr.group-child td:first-child { padding-left: 22px; }
.trades-table tr.is-last-child td { border-bottom-color: var(--hairline-strong); }
.trades-table .expand-icon { color: var(--secondary); margin-right: 6px; font-size: 11px; }
.trades-table tr.totals-row td {
  background: color-mix(in srgb, var(--primary) 7%, var(--card-bg));
  border-top: 2px solid var(--hairline-strong);
  border-bottom: 0;
  font-weight: 700;
  font-size: var(--fs-base);
}
.btn-outline.btn-warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.btn-secondary-solid { background: #1d6fa5; color: #fff; border-color: transparent; box-shadow: 0 4px 14px -6px rgba(29, 111, 165, .7); }
.btn-secondary-solid:hover { background: #185d8b; }
.pnl-summary { text-align: right; padding-right: 20px; border-right: 1px solid var(--hairline-strong); }
.pnl-total, #totalPnlDisplay { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pnl-daily, #dailyPnlDisplay { font-size: var(--fs-md); margin-top: 2px; }
.pnl-basis, #costBasisDisplay { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }

/* empty states inside cards */
.empty-state-message { background: var(--card-bg); border: 1px solid var(--hairline); border-radius: 14px; padding: 22px 28px; box-shadow: var(--elev-1); text-align: center; max-width: 520px; margin: 0 auto; }
.empty-state-message h3 { font-size: var(--fs-xl); font-weight: 700; margin: 0 0 6px; color: var(--text-primary); }
.empty-state-message p { font-size: var(--fs-md); color: var(--text-secondary); margin: 0; }

/* =============================================================================================================
   RESPONSIVE
   ============================================================================================================= */
@media (max-width: 1280px) {
  .stats-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-cards-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) and (min-width: 769px) {
  /* tablet: icon-only sidebar */
  body.has-sidebar { padding-left: 84px; }
  .sidebar { width: 84px; }
  .sidebar .sidebar-header { padding: 0; justify-content: center; }
  .sidebar .sidebar-wordmark, .sidebar .nav-label, .sidebar .toggle-label { display: none; }
  .sidebar .nav-item, .sidebar .theme-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
}
@media (max-width: 1024px) {
  .filter-toolbar .action-buttons { margin-left: 0; width: 100%; }
  .filter-toolbar .action-buttons .btn { width: 100%; }
}
@media (max-width: 768px) {
  body.has-sidebar, body.has-sidebar.sidebar-collapsed { padding-left: 0; }
  .sidebar { width: 272px; }
  .header { padding: 0 12px 0 64px; }
  .header-toggle-label, .header-username, .header-balance { display: none; }
  .stats-cards, .stats-cards-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .page-title, .dashboard-header h2 { font-size: var(--fs-2xl); }
  .card-header-actions { width: 100%; justify-content: space-between; }
  .pnl-summary { text-align: left; border: 0; padding: 0; }
  .filter-toolbar .control-group, .filter-toolbar #rulesSelect { width: 100%; min-width: 0; }
}

/* classes from the Screener/Active Trades JS refactor */
.trades-table tr.trade-row.is-even td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.trades-table th.center, .trades-table td.center, .trades-table td.actions-cell { text-align: center; }
.trades-table .strong { font-weight: 700; }
.trades-table .expand-spacer { display: inline-block; width: 17px; }
.trades-table .row-actions { display: inline-flex; gap: 6px; justify-content: center; }
.trades-table .is-stale { color: var(--warning); }
.trades-table .stale-ind { margin-left: 4px; color: var(--warning); font-size: var(--fs-xs); }
.trades-table .totals-label { letter-spacing: .04em; text-transform: uppercase; }
.trades-table .value-cell { white-space: nowrap; }
.screener-table td.rank-cell { color: var(--text-secondary); font-weight: 600; width: 48px; }
.screener-table td.sector-cell { color: var(--text-secondary); white-space: nowrap; }
.screener-table td.actions-cell { text-align: right; }
.track-btn { min-width: 76px; }

/* dashboard KPI cards: beat the legacy centered analytics card rules */
.stats-cards .stat-card { text-align: left; align-items: stretch; transform: none; }
.stats-cards .stat-card::before { display: none; }
.stats-cards .stat-card:hover { transform: none; border-color: var(--hairline-strong); box-shadow: var(--highlight), var(--elev-1); }
.stats-cards .stat-card .stat-head { justify-content: flex-start; }
.stats-cards .stat-card .stat-icon { margin: 0; width: 32px; height: 32px; font-size: 14px; }
.stats-cards .stat-card .stat-label { margin: 0; font-size: var(--fs-md); text-transform: none; letter-spacing: 0; }
.stats-cards-secondary .stat-card { padding: 14px 16px; }
.stats-cards-secondary .stat-card .stat-icon { width: 28px; height: 28px; font-size: 12px; margin: 0; }
.stats-cards-secondary .stat-card .stat-label { font-size: var(--fs-md); }
.stats-cards-secondary .stat-card .stat-value { font-size: var(--fs-xl); }
.stats-cards .stat-card.tone-none .stat-icon { display: none; }

/* screener toolbar: one row on desktop, no legacy inner panel */
.filter-toolbar .screener-controls { background: none; border: 0; padding: 0; box-shadow: none; flex-wrap: nowrap; }
.filter-toolbar #rulesSelect { min-width: 200px; max-width: 280px; }
.input-with-addon .form-input { width: 112px; }
.input-narrow { width: 92px; }
.filter-toolbar #riskPercentage { width: 72px; }
.filter-toolbar #screenerSymbolUniverse { width: 140px; }
@media (max-width: 1360px) { .filter-toolbar .screener-controls { flex-wrap: wrap; } }
.screener-table tbody tr td { background: var(--card-bg); }
.screener-table tbody tr:hover td { background: var(--row-hover); }

/* screener toolbar fits one row at 1440 (sidebar open) */
.filter-toolbar { gap: 12px; }
.filter-toolbar .screener-controls { gap: 12px; }
.filter-toolbar #rulesSelect { min-width: 190px; max-width: 240px; }
.input-date { width: 150px; }
.filter-toolbar #screenerSymbolUniverse { width: 130px; }
@media (max-width: 1360px) { .filter-toolbar .screener-controls { flex-wrap: wrap; } }
@media (min-width: 1361px) { .filter-toolbar { flex-wrap: nowrap; } }

/* active trades scroll sideways inside the card instead of clipping */
#tradesContainer { overflow-x: auto; }
.trades-table { min-width: 1180px; }

/* figures use the UI font with tabular digits, never the legacy monospace */
/* (legacy Courier figure fonts were replaced at the source in style.css) */

/* mobile containment */
.calendar-card .calendar-grid { overflow-x: auto; }
.empty-table-background { overflow: hidden; max-width: 100%; }
@media (max-width: 768px) {
  .mobile-menu-toggle { display: none !important; }        /* the header's menu button opens the sidebar */
  .header { padding: 0 12px; }
  .main-content, .page-content { max-width: 100vw; overflow-x: clip; }
  .calendar-card { min-width: 0; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 768px) {
  .header-controls-left { gap: 6px; }
  .header-account-group, .header-toggle-group, .header-user-trigger { padding: 0 8px; gap: 6px; }
  .custom-select-wrapper { min-width: 0; }
  .custom-select-trigger { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .header-user-arrow { display: none; }
  .date-filters { max-width: 100%; overflow-x: auto; }
  .dashboard-controls { max-width: 100%; }
}

/* =============================================================================================================
   BACKTESTING (2026-10-10) — one config card with the four engine modes as tabs, shared runs table below.
   Markup: templates/dashboard.html #backtestingPage · table renderer: static/js/backtest_runs_table.js
   ============================================================================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bt-page .page-header { margin-bottom: 18px; }
.bt-page .dashboard-card { padding: 0; margin: 0 0 20px; }
.bt-page .dashboard-card:hover { transform: none; }

/* mode tabs: underline tabs across the top of the config card */
.bt-mode-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--hairline); overflow-x: auto; scrollbar-width: none; }
.bt-mode-tabs::-webkit-scrollbar { display: none; }
.bt-mode-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 48px; padding: 0 14px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--text-secondary); font: 600 var(--fs-base)/1 var(--font-sans); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.bt-mode-tab i { font-size: 14px; color: var(--text-muted); }
.bt-mode-tab:hover { color: var(--text-primary); }
.bt-mode-tab.active { color: var(--text-primary); border-bottom-color: var(--primary); }
.bt-mode-tab.active i { color: var(--primary); }
.bt-mode-tab:focus-visible { box-shadow: inset var(--focus-ring); border-radius: 6px 6px 0 0; }

/* config panel */
.bt-panel { padding: 18px 20px 20px; scroll-margin-top: 140px; }
.bt-panel-head { margin-bottom: 16px; }
.bt-panel-title, .bt-section-title { margin: 0; font-size: var(--fs-xl); font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.bt-panel-desc { margin: 4px 0 0; max-width: 980px; font-size: var(--fs-md); line-height: var(--lh-body); color: var(--text-secondary); }
.bt-group + .bt-group { margin-top: 14px; }
.bt-group-label { margin-bottom: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.bt-grid { display: grid; gap: 14px 16px; align-items: end; }
.bt-grid-strategy { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bt-grid-strategy > .bt-span-2 { grid-column: span 2; }
.bt-grid-sweep { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
.bt-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bt-field > label, .bt-field-label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.bt-optional { font-weight: 400; color: var(--text-muted); }
.bt-page .form-input { width: 100%; min-height: 38px; }
.bt-input-group { display: flex; align-items: stretch; min-width: 0; }
.bt-input-group .form-input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bt-input-affix {
  display: inline-grid; place-items: center; min-width: 38px; padding: 0 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-muted); font-size: var(--fs-md); font-weight: 600;
}
.bt-input-group .bt-input-prefix { order: -1; border-left: 1px solid var(--border); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.bt-input-group:has(.bt-input-prefix) .form-input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.bt-chip { min-height: 38px; justify-content: flex-start; background: var(--surface-2); }

/* advanced settings disclosure */
.bt-advanced { margin-top: 16px; border: 1px solid var(--hairline-strong); border-radius: var(--radius-md); background: var(--surface-2); }
.bt-advanced > summary {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px;
  list-style: none; cursor: pointer; border-radius: var(--radius-md); color: var(--text-secondary);
}
.bt-advanced > summary::-webkit-details-marker { display: none; }
.bt-advanced > summary:hover { color: var(--text-primary); }
.bt-advanced > summary:focus-visible { box-shadow: var(--focus-ring); }
.bt-advanced-title { font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); }
.bt-advanced-hint { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-advanced-caret { margin-left: auto; font-size: 12px; transition: transform .2s ease; }
.bt-advanced[open] > summary { border-bottom: 1px solid var(--hairline); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.bt-advanced[open] .bt-advanced-caret { transform: rotate(180deg); }
.bt-advanced-body { display: grid; gap: 18px; padding: 16px; background: var(--card-bg); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.bt-advanced-label { margin-bottom: 10px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.bt-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 500; color: var(--text-primary); cursor: pointer; }
.bt-check-block { align-items: flex-start; }
.bt-check-block input { margin-top: 2px; }
.bt-check-block strong { display: block; font-weight: 600; }
.bt-check-block .form-help { display: block; margin-top: 2px; }
.bt-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 14px 0 0; padding: 0; border: 0; }
.bt-checks legend { float: left; margin-right: 6px; padding: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }

/* footer: description + primary action */
.bt-footer { display: flex; align-items: flex-end; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.bt-footer-desc { flex: 1; }
.bt-footer-meta { flex: 1; align-self: center; font-size: var(--fs-md); color: var(--text-secondary); }
.bt-footer-meta strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.bt-footer .btn-lg { min-height: 40px; min-width: 168px; }
.bt-run-status { min-height: 0; margin-top: 8px; font-size: var(--fs-md); color: var(--text-secondary); }
.bt-run-status:empty { display: none; }
.bt-run-status[data-tone="success"] { color: var(--success); }
.bt-run-status[data-tone="error"] { color: var(--danger); }

/* running / progress */
.bt-running { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--surface-2); }
.bt-running-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.bt-running-list { display: grid; gap: 10px; }
.bt-running-item { padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--card-bg); }
.bt-running-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.bt-running-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-primary); }
.bt-running-pct { font-size: var(--fs-md); font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bt-running-msg { margin-top: 6px; font-size: var(--fs-sm); color: var(--text-muted); }
.bt-running-msg:empty { display: none; }
.bt-progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bt-progress-fill { height: 100%; border-radius: inherit; background: var(--secondary); transition: width .3s ease; }

/* history cards */
.bt-history-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px 14px; }
.bt-history-head .card-subtitle { margin-top: 3px; }
.bt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bt-toolbar .form-input, .bt-toolbar .btn { min-height: 36px; }
.bt-page .bt-toolbar-select { width: 190px; }
.bt-page .bt-toolbar-status { width: 150px; }
.bt-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--hairline); }
.bt-seg-btn { min-height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); font: 600 var(--fs-md)/1 var(--font-sans); cursor: pointer; }
.bt-seg-btn:hover { color: var(--text-primary); background: var(--surface-3); }
.bt-seg-btn.active { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .15); }
.bt-search { position: relative; }
.bt-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); pointer-events: none; }
.bt-page .bt-search .form-input { width: 210px; padding-left: 32px; }
.bt-history-stack > .dashboard-card { margin-bottom: 20px; }
.bt-loading { padding: 36px 16px; }
.bt-empty { padding: 40px 16px 44px; }
.bt-empty-title { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 700; color: var(--text-primary); }
.bt-empty p { margin: 0; }
.bt-empty-error i { color: var(--danger); }

/* runs table */
.bt-table-wrap { border-top: 1px solid var(--hairline); }
.bt-table { min-width: 1080px; }
.bt-table th { padding: 0 12px; height: 40px; background: var(--surface-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.bt-table td { padding: 10px 12px; vertical-align: middle; }
.bt-table tbody tr:last-child td { border-bottom: 0; }
.bt-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.bt-sort i { font-size: 10px; opacity: .45; }
.bt-sort:hover, .bt-sort.is-active { color: var(--text-primary); }
.bt-sort.is-active i { opacity: 1; color: var(--primary); }
.bt-sort:focus-visible { box-shadow: var(--focus-ring); border-radius: 4px; }
th.num .bt-sort { flex-direction: row-reverse; }

/* strategy column stays visible while the metrics scroll sideways */
.bt-table th.bt-col-strategy, .bt-table td.bt-col-strategy { position: sticky; left: 0; z-index: 1; min-width: 250px; max-width: 320px; background: var(--card-bg); box-shadow: 1px 0 0 var(--hairline); }
.bt-table thead th.bt-col-strategy { z-index: 3; background: linear-gradient(var(--surface-2), var(--surface-2)), var(--card-bg); }
.bt-table td.bt-col-strategy:has(.bt-expand) { padding-left: 8px; }
.bt-strategy-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.bt-strategy-cell { min-width: 0; flex: 1; }
/* translucent row tints are layered over the card color so the sticky column stays opaque */
.bt-runs-table tbody tr.bt-run-row:hover td, .bt-click-row:hover td { background: linear-gradient(var(--row-hover), var(--row-hover)), var(--card-bg); }
.bt-run-row { cursor: pointer; }
.bt-run-row.is-expanded td, .bt-runs-table tbody tr.bt-run-row.is-expanded:hover td { background: linear-gradient(var(--surface-2), var(--surface-2)), var(--card-bg); border-bottom-color: transparent; }
.bt-expand { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; }
.bt-expand i { font-size: 11px; transition: transform .15s ease; }
.bt-expand:hover { background: var(--surface-3); color: var(--text-primary); }
.bt-expand:focus:not(:focus-visible) { box-shadow: none; }
.bt-expand[aria-expanded="true"] i { transform: rotate(90deg); color: var(--primary); }
.bt-run-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bt-run-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; background: none; border: 0; font: 600 var(--fs-md)/1.35 var(--font-sans); color: var(--text-primary); text-align: left; cursor: pointer; }
button.bt-run-name:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.bt-run-name.is-static { cursor: inherit; }
.bt-run-sub { display: block; max-width: 300px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-muted); }
.bt-run-error { color: var(--danger); }
.bt-run-error i { margin-right: 2px; }
.bt-rating-mini { flex: none; font-size: 9px; color: var(--warning); letter-spacing: 1px; }
.bt-cell-sub { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.bt-cell-sub-strong { color: var(--text-primary); font-size: var(--fs-md); }
.bt-nowrap { white-space: nowrap; }
.bt-muted { color: var(--text-muted); }
.bt-mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.bt-pos { color: var(--success); font-weight: 600; }
.bt-neg { color: var(--danger); font-weight: 600; }
.bt-warn { color: var(--warning); font-weight: 600; }
.bt-row-best td { background: color-mix(in srgb, var(--success) 6%, var(--card-bg)); }
.bt-col-actions { width: 56px; text-align: right; }
/* actions stay reachable at the right edge while the metrics scroll */
.bt-table th.bt-col-actions, .bt-table td.bt-col-actions { position: sticky; right: 0; z-index: 1; padding-left: 8px; padding-right: 12px; background: var(--card-bg); box-shadow: -1px 0 0 var(--hairline); }
.bt-table thead th.bt-col-actions { z-index: 3; background: linear-gradient(var(--surface-2), var(--surface-2)), var(--card-bg); }
.bt-row-controls { display: inline-flex; gap: 2px; justify-content: flex-end; }
.bt-icon-danger { color: var(--danger); }
.bt-icon-danger:hover { background: var(--red-soft); color: var(--danger); }
.bt-click-row { cursor: pointer; }
.bt-click-row:focus-visible td { box-shadow: inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.bt-table-foot { padding: 10px 20px 14px; border-top: 1px solid var(--hairline); font-size: var(--fs-sm); color: var(--text-muted); }

/* status + tag pills */
.bt-status { white-space: nowrap; text-transform: none; letter-spacing: 0; font-weight: 600; }
.bt-status-completed { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.bt-status-running { background: var(--blue-soft); color: var(--secondary); }
.bt-status-queued { background: var(--surface-3); color: var(--text-secondary); }
.bt-status-failed { background: var(--red-soft); color: var(--danger); }
.bt-status-cancelled { background: var(--amber-soft); color: color-mix(in srgb, var(--warning) 85%, var(--text-primary)); }
.bt-mini-progress { display: block; width: 72px; height: 3px; margin-top: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bt-mini-progress span { display: block; height: 100%; background: var(--secondary); }
.bt-tag { flex: none; background: var(--surface-3); color: var(--text-secondary); font-weight: 600; letter-spacing: .02em; text-transform: none; }
.bt-tag-warn { background: var(--amber-soft); color: color-mix(in srgb, var(--warning) 85%, var(--text-primary)); }

/* expanded row */
.bt-run-detail > td { padding: 0 !important; background: var(--surface-2); border-bottom: 1px solid var(--hairline-strong); }
.bt-run-detail:hover > td { background: var(--surface-2) !important; }
.bt-detail { position: sticky; left: 0; display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; width: min(100%, calc(100vw - 340px)); max-width: 1180px; padding: 4px 20px 20px 46px; }
.bt-detail-main { display: grid; gap: 16px; min-width: 0; }
.bt-detail-label { margin-bottom: 8px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.bt-detail-text { margin: 0; font-size: var(--fs-md); color: var(--text-primary); }
.bt-kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bt-kv { display: flex; flex-direction: column; gap: 3px; padding: 9px 12px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--card-bg); min-width: 0; }
.bt-kv-label { font-size: var(--fs-sm); color: var(--text-muted); }
.bt-kv-value { font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bt-kv-value.bt-pos { color: var(--success); }
.bt-kv-value.bt-neg { color: var(--danger); }
.bt-kv-value.bt-warn { color: var(--warning); }
.bt-code { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; color: var(--text-secondary); }
.bt-error-block { margin: 0 0 6px; padding: 10px 12px; max-height: 220px; overflow: auto; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: var(--radius-md); background: var(--red-soft); color: var(--text-primary); font: 400 var(--fs-sm)/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.bt-error-block.is-note { border-color: var(--hairline-strong); background: var(--surface-2); }
.bt-detail-side { display: flex; flex-direction: column; gap: 6px; }
.bt-detail-actions { display: grid; gap: 8px; margin-top: 14px; }
.bt-detail-actions .btn { justify-content: flex-start; width: 100%; min-height: 32px; }
.bt-page .bt-detail-actions .btn-danger, .bt-page .bt-history .btn-danger { background: var(--red-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.bt-page .bt-detail-actions .btn-danger:hover, .bt-page .bt-history .btn-danger:hover { background: var(--danger); color: #fff; }
.bt-page .bt-detail-actions .btn-secondary { background: var(--card-bg); }
.bt-stars { display: inline-flex; gap: 2px; }
.bt-star { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--hairline-strong); font-size: 15px; cursor: pointer; }
.bt-star.is-on { color: var(--warning); }
.bt-stars:hover .bt-star { color: color-mix(in srgb, var(--warning) 70%, transparent); }
.bt-stars .bt-star:hover ~ .bt-star { color: var(--hairline-strong); }
.bt-star:focus-visible { box-shadow: var(--focus-ring); }

/* row actions menu (positioned in JS, appended to <body>) */
.bt-menu { position: fixed; z-index: 10050; min-width: 200px; padding: 6px; border: 1px solid var(--hairline-strong); border-radius: 10px; background: var(--surface-1-solid); box-shadow: var(--elev-2); }
.bt-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--text-primary); font: 500 var(--fs-md)/1 var(--font-sans); text-align: left; cursor: pointer; }
.bt-menu-item i { width: 16px; text-align: center; color: var(--text-muted); }
.bt-menu-item:hover, .bt-menu-item:focus-visible { background: var(--surface-3); outline: none; box-shadow: none; }
.bt-menu-item.is-danger, .bt-menu-item.is-danger i { color: var(--danger); }
.bt-menu-item.is-danger:hover, .bt-menu-item.is-danger:focus-visible { background: var(--red-soft); }
.bt-menu-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text-primary); }

/* sweep */
.bt-sweep-progress { display: flex; align-items: center; gap: 14px; padding: 0 20px 12px; }
.bt-sweep-progress .bt-progress { flex: 1; height: 8px; }
.bt-progress-text { min-width: 90px; text-align: right; font-size: var(--fs-md); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bt-sweep-live { max-height: 220px; overflow-y: auto; padding: 0 20px 16px; }
.bt-sweep-live-row { display: flex; gap: 14px; padding: 5px 0; border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bt-sweep-live-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); color: var(--text-primary); }
.bt-page #sweepParametersContainer .form-help { margin: 0; font-style: italic; }

@media (max-width: 1180px) {
  .bt-grid-sweep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-detail { grid-template-columns: minmax(0, 1fr); }
  .bt-detail-actions { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 900px) {
  .bt-grid-strategy, .bt-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-grid-strategy > .bt-span-2 { grid-column: 1 / -1; }
  .bt-toolbar { width: 100%; }
  .bt-page .bt-toolbar-select, .bt-page .bt-toolbar-status, .bt-search, .bt-page .bt-search .form-input { flex: 1 1 160px; width: auto; }
}
@media (max-width: 640px) {
  .bt-panel, .bt-history-head { padding-left: 16px; padding-right: 16px; }
  .bt-mode-tabs { padding: 0 8px; }
  .bt-grid-strategy, .bt-grid-3, .bt-grid-sweep { grid-template-columns: minmax(0, 1fr); }
  .bt-grid-strategy > .bt-span-2 { grid-column: auto; }
  .bt-footer { flex-direction: column; align-items: stretch; }
  .bt-footer .btn-lg { width: 100%; }
  .bt-advanced-hint { display: none; }
  .bt-table th.bt-col-strategy, .bt-table td.bt-col-strategy { min-width: 200px; max-width: 220px; }
  .bt-detail { padding-left: 16px; width: calc(100vw - 32px); }
}

/* =============================================================================================================
   SIGNAL EXPLORER (2026-10-15) — toolbar, summary strip, chart cards. Markup: dashboard.html #signalsPage
   ============================================================================================================= */
.sx-page .page-header { align-items: flex-start; margin-bottom: 16px; }
.sx-page .dashboard-card { padding: 0; margin: 0 0 16px; }
.sx-page .dashboard-card:hover { transform: none; }
.sx-muted { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 400; margin: 0; }
.sx-pos { color: var(--success); }
.sx-neg { color: var(--danger); }

/* one segmented control for view / period pickers (buttons keep .btn for the JS selectors) */
.sx-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--hairline); flex: none; }
.sx-seg .btn { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); font-size: var(--fs-md); font-weight: 600; box-shadow: none; }
.sx-seg .btn:hover { background: var(--surface-3); color: var(--text-primary); }
.sx-seg .btn.active { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .15); }
#signalSubNav .btn.active { background: var(--card-bg); color: var(--text-primary); box-shadow: var(--elev-1), inset 0 0 0 1px var(--hairline-strong); }
#signalSubNav .btn.active i { color: var(--primary); }

/* toolbar */
.sx-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.sx-toolbar .form-input, .sx-toolbar .btn { min-height: 38px; }
.sx-search { position: relative; flex: 0 1 260px; min-width: 180px; }
.sx-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-muted); pointer-events: none; }
.sx-page .sx-search .form-input { width: 100%; padding-left: 34px; padding-right: 32px; font-weight: 600; text-transform: uppercase; }
.sx-page .sx-search .form-input::placeholder { text-transform: none; font-weight: 400; }
.sx-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; }
.sx-search-clear:hover { background: var(--surface-3); color: var(--text-primary); }
.sx-page .signal-search-dropdown { top: calc(100% + 4px); background: var(--surface-1-solid); border: 1px solid var(--hairline-strong); border-radius: 10px; box-shadow: var(--elev-2); padding: 4px; }
.sx-page .signal-search-item { border-radius: 7px; font-family: var(--font-sans); color: var(--text-primary); }
.sx-dropdown { position: relative; display: inline-block; }
.sx-dropdown-toggle { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 220px; font-weight: 600; color: var(--text-primary); cursor: pointer; text-align: left; }
.sx-dropdown-toggle i { font-size: 11px; color: var(--text-muted); }
.sx-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 1000; min-width: 290px; max-height: 340px; overflow-y: auto; padding: 6px; background: var(--surface-1-solid); border: 1px solid var(--hairline-strong); border-radius: 10px; box-shadow: var(--elev-2); }
.sx-menu-head { padding: 6px 8px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); color: var(--text-muted); }
.sx-compare.active { background: var(--accent-soft); border-color: var(--primary); color: var(--text-primary); }
.sx-page .sx-ob { width: auto; min-width: 170px; }
.sx-compare-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex-basis: 100%; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--surface-2); }
.sx-compare-bar[style*="display: none"] { display: none !important; }
.sx-compare-bar label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-secondary); }
.sx-page .sx-compare-bar .form-input { width: auto; min-height: 34px; }
.sx-compare-bar input[type=range] { flex: 1; min-width: 180px; max-width: 420px; accent-color: var(--primary); }

/* today's signal */
.sx-today { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid; font-size: var(--fs-md); }
.sx-today strong { font-weight: 700; }
.sx-today span { margin-left: auto; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sx-today.is-buy { background: color-mix(in srgb, var(--success) 10%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.sx-today.is-sell { background: var(--red-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.sx-today.is-both { background: var(--amber-soft); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: color-mix(in srgb, var(--warning) 80%, var(--text-primary)); }

/* summary strip */
.sx-page .sx-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0; padding: 14px 18px; }
.sx-summary > * { padding: 2px 24px; }
.sx-summary > * + *:not(.sx-perf-btn) { border-left: 1px solid var(--hairline); }
.sx-summary > :first-child { padding-left: 0; }
.sx-summary-id { display: flex; align-items: center; gap: 12px; }
.sx-seg-badge { padding: 5px 12px; border-radius: 7px; font-size: var(--fs-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.sx-symbol { font-size: var(--fs-xl); font-weight: 700; color: var(--text-primary); letter-spacing: .01em; }
.sx-stat { display: flex; flex-direction: column; gap: 2px; }
.sx-stat-value { font-size: var(--fs-xl); font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sx-stat-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-secondary); }
.sx-stat-label i, .sx-card-title i { font-size: 11px; color: var(--text-muted); cursor: help; }
.sx-summary-counts { display: flex; gap: 20px; margin-left: auto; font-size: var(--fs-md); color: var(--text-secondary); }
.sx-summary-counts strong { font-size: var(--fs-base); font-variant-numeric: tabular-nums; margin-right: 4px; }
.sx-summary > .sx-summary-counts { border-left: 0; }
.sx-perf-btn { padding-left: 14px; padding-right: 14px; }
.sx-perf-btn i { color: var(--secondary); }

/* chart cards */
.sx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px 6px; }
.sx-card-head-wrap { align-items: flex-end; padding-bottom: 12px; }
.sx-card-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--text-primary); }
.sx-card-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.sx-set-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.sx-set-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--hairline); font-size: var(--fs-md); }
.sx-set-name { font-weight: 700; color: var(--text-primary); }
.sx-set-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sx-swatch { width: 10px; height: 10px; border-radius: 3px; }
.sx-overlay-legend { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-secondary); }
.sx-price-chart { position: relative; height: 460px; padding: 4px 12px 12px; transition: height .2s ease; }
.sx-price-card.is-expanded .sx-price-chart { height: min(78vh, 900px); }
.sx-state { padding: 56px 16px; text-align: center; color: var(--text-muted); }
.sx-state i { font-size: 28px; opacity: .5; margin-bottom: 10px; }
.sx-state .spinner { margin: 0 auto 10px; }
.sx-state p { margin: 0; font-size: var(--fs-md); }
.sx-layers { position: absolute; top: 8px; right: 12px; z-index: 11; width: 220px; overflow: hidden; background: var(--surface-1-solid); border: 1px solid var(--hairline-strong); border-radius: 10px; box-shadow: var(--elev-2); }
.sx-layers-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); font-weight: 700; color: var(--text-primary); }
.sx-layers-body { padding: 6px 0; }
.sx-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sx-grid-2 > .dashboard-card { margin-bottom: 16px; }
.sx-mini-chart { position: relative; height: 170px; padding: 0 12px 10px; }
.sx-personality-chart { height: 190px; }
.sx-wide-chart { position: relative; height: 320px; padding: 4px 12px 12px; }
.sx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--fs-sm); color: var(--text-secondary); }
.sx-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sx-legend-item strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sx-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.sx-dot.is-dash { width: 12px; height: 0; border-radius: 0; background: none; border-top: 2px dashed var(--c); }
.sx-dot.is-bar { border-radius: 2px; opacity: .75; }

/* sectors */
.sx-quick { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.sx-sector-table td, .sx-sector-table th { white-space: nowrap; }
.sx-page #signalSectorsTableBody tr { cursor: pointer; }
.sx-page #signalSectorsTableBody tr.sector-active td { background: var(--accent-softer); }
.sx-page #signalSectorsTableBody tr.sector-active td:first-child { box-shadow: inset 3px 0 0 var(--primary); font-weight: 700; }
.sx-page #signalSectorsTableBody tr:focus-visible td { box-shadow: inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.sx-sector-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; }
.sx-muted-num { color: var(--text-muted); }

/* performance modal */
.sx-modal { position: fixed; inset: 0; z-index: 1200; justify-content: center; align-items: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.sx-modal-content { width: 100%; max-width: 920px; max-height: 90vh; overflow-y: auto; background: var(--surface-1-solid); border: 1px solid var(--hairline-strong); border-radius: 14px; box-shadow: var(--elev-2); }
.sx-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--hairline); }
.sx-modal-head .sx-muted { margin-top: 3px; }
.sx-modal-body { padding: 18px 20px 20px; }
.sx-perf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.sx-perf-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--surface-2); }
.sx-perf-label { font-size: var(--fs-sm); color: var(--text-muted); }
.sx-perf-value { font-size: var(--fs-xl); font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sx-perf-value.is-small { font-size: var(--fs-lg); }
.sx-perf-segments { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.sx-perf-chart { position: relative; height: 380px; }

@media (max-width: 1100px) {
  .sx-summary > * { padding: 6px 16px; }
  .sx-summary-counts { margin-left: 0; }
}
@media (max-width: 900px) {
  .sx-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .sx-perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .sx-search { flex: 1 1 100%; }
  .sx-dropdown, .sx-dropdown-toggle { flex: 1 1 auto; min-width: 0; width: 100%; }
  .sx-price-chart { height: 340px; padding: 4px 6px 8px; }
  .sx-summary > * { border-left: 0 !important; padding: 6px 12px 6px 0; }
}

/* ── Accounts page ─────────────────────────────────────────── */
.acct-stats-primary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .acct-stats-primary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .acct-stats-primary, .stats-cards-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Charts sit directly on their card (no inset grey panel) — overrides analytics-dashboard.css */
.dashboard-card .chart-wrapper,
[data-theme="light"] .dashboard-card .chart-wrapper { background: transparent; border: 0; border-radius: 0; padding: 4px 0 0; }
#historyTable td, #ledgerTable td { font-weight: 400; }
#historyTable .hist-group-cell { white-space: nowrap; }
#historyTable .hist-group-cell .badge { margin-left: 6px; vertical-align: 1px; }
#historyTable .expand-icon { font-size: 10px; color: var(--text-muted); width: 12px; margin-right: 6px; transition: transform .15s ease; }
#historyTable .expand-icon.is-open { transform: rotate(90deg); }
#historyTable .hist-group-count { margin-left: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
#historyTable .hist-group-count::before { content: '×'; }

/* ── Screener: consolidated columns + expandable detail row (2026-10-16) ── */
#screenerTable .screener-table td:nth-child(2) { font-weight: 600; letter-spacing: 0; }
#screenerTable .screener-table th.sx-expand-col, #screenerTable td.sx-expand-cell { width: 28px; padding-left: 8px; padding-right: 0; }
#screenerTable th.sx-expand-col::after { content: none; }
#screenerTable .sx-expand-btn { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-grid; place-items: center; }
#screenerTable .sx-expand-btn:hover { background: var(--surface-3); color: var(--text-primary); }
#screenerTable .sx-expand-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
#screenerTable .sx-expand-btn i { font-size: 10px; transition: transform .15s ease; }
#screenerTable tr.is-expanded .sx-expand-btn i { transform: rotate(90deg); }
#screenerTable tr.is-expanded td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
#screenerTable td .cv { white-space: nowrap; }
#screenerTable td .cs { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; margin-top: 2px; font-weight: 400; }
#screenerTable td .cs.positive { color: var(--success); }
#screenerTable td .cs.negative { color: var(--danger); }
#screenerTable td .cs-unit { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
#screenerTable td.symbol-cell .cv { display: flex; align-items: center; gap: 6px; }
#screenerTable td.symbol-cell .sym { font-weight: 700; }
#screenerTable td.symbol-cell .sym-sub { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
#screenerTable td.risk-cell .position-pct-cell { font-weight: 600; }
#screenerTable .screener-detail-row td { height: auto; padding: 0; background: var(--surface-2); }
#screenerTable .screener-detail-row:hover td { background: var(--surface-2); }
#screenerTable .sx-detail { padding: 14px 18px 14px 46px; }
#screenerTable .sx-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 24px; }
#screenerTable .sx-detail-label { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 2px; }
#screenerTable .sx-detail-value { font-size: var(--fs-md); color: var(--text-primary); font-weight: 500; white-space: normal; }
#screenerTable .sx-detail-note { margin-top: 12px; font-size: var(--fs-sm); color: var(--warning); }
#screenerTable .sx-detail-actions { margin-top: 12px; }
@media (max-width: 640px) { #screenerTable .sx-detail { padding-left: 14px; } }
#screenerTable .rec-option-none { color: var(--text-muted); }
#screenerTable td.recommended-option-cell { white-space: nowrap; }

/* ── Journal ── */
.journal-stats-row.stats-cards { margin-bottom: 16px; }
.day-stat-label { text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); color: var(--text-muted); }
#screenerTable .sx-detail-sub { display: block; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }

/* ── Analytics + shared chart cards ── */
/* Charts sit on the card: the global .chart-container inset panel (style.css) and the
   light-mode net-daily-pnl box are dropped inside cards. */
.dashboard-card .chart-container,
[data-theme="light"] .net-daily-pnl-card .chart-container { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.analytics-chart-card { background: var(--card-bg); border-color: var(--card-border, var(--border)); }
.analytics-chart-card .card-header { background: transparent; }
.analytics-chart-card .card-title { letter-spacing: 0; }
.analytics-header { margin-bottom: 16px; }
.analytics-table td.muted, .strategy-performance-table td.muted, table td.muted { color: var(--text-muted); }

/* ── Settings ── */
.settings-grid { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); max-width: 1280px; align-items: start; gap: 16px; }
@media (max-width: 640px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-card { backdrop-filter: none; }
.settings-card-icon { width: 36px; height: 36px; border-radius: 9px; font-size: 15px; }
.settings-card-icon.tone-green, .settings-card-icon.tone-blue, .settings-card-icon.tone-amber,
.settings-card-icon.tone-violet, .settings-card-icon.tone-red, .settings-card-icon.tone-teal { background-image: none; }

/* ── Marketplace ── */
#marketplacePage .mp-browse-header { padding: 16px 0 12px; border: 0; background: none; }
#marketplacePage .mp-filters { margin-top: 0; }
#marketplacePage .mp-empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--text-muted); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); }
#marketplacePage .mp-empty i { font-size: 28px; color: var(--text-muted); margin-bottom: 10px; display: block; }
#marketplacePage .mp-empty h3 { font-size: var(--fs-base); color: var(--text-primary); margin: 0 0 4px; }
#marketplacePage .mp-empty p { margin: 0; font-size: var(--fs-md); }

/* ── Admin ── */
#adminPage .btn-danger { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); box-shadow: none; }
#adminPage .btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
#adminPage .pipeline-selector-btn { background: transparent; color: var(--text-secondary); border: 0; border-radius: 6px; padding: 6px 14px; font-weight: 500; font-size: var(--fs-md); cursor: pointer; }
#adminPage .pipeline-selector-btn.active { background: var(--card-bg); color: var(--text-primary); box-shadow: var(--shadow-sm, 0 1px 2px rgba(15,23,42,.08)); }
#adminPage .admin-stat-label { text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); color: var(--text-muted); }
