:root {
  /* Brandbook-aligned palette — Vibrant Blue primary, Bright Royal Blue hover */
  --blue: #156AFF;         /* Vibrant Blue (brandbook primary) */
  --blue-bright: #0457FF;  /* Bright Royal Blue */
  --blue-deep: #0040C2;    /* Deeper press state */
  --blue-soft: #E4EEFF;    /* Soft blue tint backgrounds */
  --blue-softer: #F2F6FF;  /* Softest blue tint */
  --blue-tint: #4A8AFF;    /* Lighter arc tint */
  --navy: #0A0E1A;         /* Midnight Navy (brandbook) */
  --space: #1A2640;        /* Space Blue (brandbook) */
  --ink: #1A2640;          /* headline navy (website --fg-1) */
  --text: #1A2640;         /* body navy (website --fg-2) */
  --muted: #767D8C;        /* neutral slate (matches production app, not lavender) */
  --subtle: #A1A6B0;       /* neutral light grey */
  --border: #E6E8EC;       /* neutral hairline */
  --border-soft: #F0F1F4;
  --bg: #F4F5F7;           /* neutral white-grey canvas (production app) */
  --white: #FFFFFF;
  --panel: #FFFFFF;
  --green: #10B981;
  --green-soft: #D1FAE5;
  --red: #EF4444;
  --red-soft: #FEE2E2;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --shadow-sm: 0 1px 2px rgba(12,20,117,0.04);
  --shadow: 0 1px 2px rgba(12,20,117,0.05);
  --shadow-md: 0 2px 8px rgba(12,20,117,0.06);
  --shadow-lg: 0 6px 16px -6px rgba(12,20,117,0.10);
}


body.dark {
  /* === BRAND TOKENS (stable across themes) === */
  --brand-navy: #0A0E1A;
  --brand-space: #1A2640;
  --brand-blue: #156AFF;
  --brand-blue-bright: #0457FF;
  --brand-blue-deep: #0040C2;

  /* === SEMANTIC TOKENS (theme-aware) === */
  --blue: #3B82F6;
  --blue-bright: #60A5FA;
  --blue-deep: #2563EB;
  --blue-soft: rgba(59,130,246,0.16);
  --blue-softer: rgba(59,130,246,0.08);
  --blue-tint: #7DA9FF;

  --navy: #E7EAF0;
  --space: #0C0D10;
  --ink: #F1F5F9;
  --text: #D6DAE3;
  --muted: #8B92A3;
  --subtle: #5C6271;

  --border: #272930;
  --border-soft: #1F2128;

  --bg: #0E0F12;
  --white: #17181C;
  --panel: #17181C;
  --surface-hover: #1F2128;
  --surface-sunken: #0F1014;
  --input-bg: #0F1014;

  --green: #34D399;
  --green-soft: rgba(52,211,153,0.14);
  --green-icon-fg: #34D399;
  --red: #F87171;
  --red-soft: rgba(248,113,113,0.14);
  --red-icon-fg: #F87171;
  --amber: #FBBF24;
  --amber-soft: rgba(251,191,36,0.14);
  --amber-icon-fg: #FBBF24;

  --tag-green-fg: #6EE7B7;
  --tag-red-fg: #FCA5A5;
  --tag-amber-fg: #FCD34D;
  --tag-blue-fg: #93C5FD;
  --tag-purple-fg: #C4B5FD;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 40px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);

  --topbar-bg: rgba(14,15,18,0.85);
  --video-bg: #000000;

  --discord-bg-from: #1E1B4B;
  --discord-bg-to: #312E81;
  --discord-border: #5865F2;

  --journal-green-from: rgba(52,211,153,0.18);
  --journal-green-to: rgba(52,211,153,0.10);
  --journal-red-from: rgba(248,113,113,0.20);
  --journal-red-to: rgba(248,113,113,0.10);
  --journal-empty-bg: #15161B;

  --leader-bg: rgba(251,191,36,0.10);
  --leader-border: #FBBF24;
  --leader-drop-active-bg: rgba(251,191,36,0.22);

  --header-grad-from: #0A0E1A;
  --header-grad-to: #1A2640;
}

/* Ensure :root also has stable brand tokens + new semantic aliases so light mode doesn't break */
:root {
  --brand-navy: #0A0E1A;
  --brand-space: #1A2640;
  --brand-blue: #156AFF;
  --brand-blue-bright: #0457FF;
  --brand-blue-deep: #0040C2;
  --surface-hover: #F4F5F7;
  --surface-sunken: #F4F5F7;
  --input-bg: #FFFFFF;
  --video-bg: #000000;
}

/* === DARK MODE COMPREHENSIVE OVERRIDES (spec-driven, single source of truth) === */

body.dark {
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}

/* ---- Universal surfaces ---- */
body.dark .card,
body.dark .stat-card,
body.dark .action-tile,
body.dark .sidebar,
body.dark .instrument,
body.dark .ai-popup,
body.dark .modal,
body.dark .ai-panel,
body.dark .form-section,
body.dark .connection-row,
body.dark .foryou-card,
body.dark .platform-card,
body.dark .group-assigned-row,
body.dark .ai-suggestion,
body.dark .leaderboard-card,
body.dark .lb-row,
body.dark .marquee-card,
body.dark .trophy-mini,
body.dark .pnl-stat-card,
body.dark .ai-pulse,
body.dark .ai-msg.bot,
body.dark .cs-card,
body.dark .profile-side-card {
  background: var(--panel) !important;
  color: var(--text);
  border-color: var(--border) !important;
  box-shadow: var(--shadow);
}

body.dark .card:hover,
body.dark .stat-card:hover,
body.dark .action-tile:hover,
body.dark .instrument:hover,
body.dark .foryou-card:hover,
body.dark .connection-row:hover,
body.dark .ai-suggestion:hover,
body.dark .lb-row:hover,
body.dark .group-assigned-row:hover,
body.dark .platform-card:hover {
  background: var(--surface-hover) !important;
  border-color: var(--blue) !important;
  box-shadow: var(--shadow-md);
}

body.dark .profile-card,
body.dark .nav-item:hover {
  background: var(--surface-hover) !important;
}

/* ---- Inputs ---- */
body.dark .form-input,
body.dark input,
body.dark textarea,
body.dark select,
body.dark .auth-input,
body.dark .ai-input,
body.dark .contract-checkbox,
body.dark .risk-value-input {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

body.dark .form-input::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder,
body.dark .auth-input::placeholder {
  color: var(--subtle);
}

body.dark .form-input:focus,
body.dark input:focus,
body.dark textarea:focus,
body.dark select:focus,
body.dark .auth-input:focus {
  border-color: var(--blue) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.22);
}

/* ---- Sidebar / Topbar ---- */
body.dark .sidebar {
  background: #101115 !important;
  border-color: var(--border) !important;
}

body.dark .topbar {
  background: var(--topbar-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--border) !important;
}

body.dark .topbar::before {
  background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, rgba(59,130,246,0.06) 40%, transparent 62%);
}

/* ---- Headlines and text hierarchy ---- */
body.dark .page-title,
body.dark .stat-value,
body.dark .chart-value,
body.dark .instrument-price,
body.dark .connection-name,
body.dark .empty-title,
body.dark .section-title,
body.dark .chart-title,
body.dark .chart-empty-title,
body.dark .form-title,
body.dark .modal-title,
body.dark .platform-card-name,
body.dark .group-account-row .account-balance,
body.dark .group-assigned-row .mono,
body.dark .risk-value-display,
body.dark .cockpit-stat-value,
body.dark .instrument-symbol,
body.dark .profile-name,
body.dark .pnl-stat-value,
body.dark .lb-title {
  color: var(--ink) !important;
}

body.dark .stat-label,
body.dark .stat-meta,
body.dark .form-label,
body.dark .form-subtitle,
body.dark .foryou-desc,
body.dark .help-icon,
body.dark .empty-desc,
body.dark .profile-email,
body.dark .journal-trades,
body.dark .nav-item,
body.dark .cockpit-stat-label,
body.dark .csl-label,
body.dark .lb-sub,
body.dark .lb-row-meta,
body.dark .marquee-card-meta,
body.dark .pnl-stat-label {
  color: var(--muted);
}

body.dark .nav-label,
body.dark .onboarding-eyebrow,
body.dark .community-eyebrow,
body.dark .auth-form-eyebrow,
body.dark .profile-section-label {
  color: var(--subtle);
}

/* ---- Navigation ---- */
body.dark .nav-item.active {
  background: var(--blue-soft) !important;
  color: var(--blue) !important;
}

body.dark .nav-item.active::after {
  background: var(--blue);
}

body.dark .nav-item.ai-coach {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(37,99,235,0.06));
  border: 1px solid rgba(59,130,246,0.20);
}

body.dark .nav-item .nav-icon {
  color: var(--muted);
}

body.dark .nav-item.active .nav-icon {
  color: var(--blue);
}

/* ---- Tables ---- */
body.dark table,
body.dark .table-wrap {
  background: transparent;
  border-color: var(--border);
}

body.dark table thead th {
  background: var(--surface-sunken) !important;
  color: var(--muted) !important;
  border-color: var(--border) !important;
}

body.dark table tbody tr:hover {
  background: rgba(59,130,246,0.06) !important;
}

body.dark table tbody td {
  border-color: var(--border-soft) !important;
  color: var(--text);
}

body.dark table tfoot td {
  background: var(--surface-sunken) !important;
  color: var(--ink) !important;
}

/* ---- Modal ---- */
body.dark .modal {
  background: var(--panel) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

body.dark .modal-backdrop {
  background: rgba(0,0,0,0.72);
}

body.dark .modal-header,
body.dark .modal-footer {
  background: transparent;
  border-color: var(--border);
}

body.dark .modal-close {
  color: var(--muted);
}

body.dark .modal-close:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

/* ---- Credits card (stable brand gradient) ---- */
body.dark .credits-card {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 100%) !important;
  color: #FFFFFF;
}

body.dark .credits-card::before {
  background: radial-gradient(circle, rgba(21,106,255,0.55), transparent 70%);
}

body.dark .credits-card::after {
  background: radial-gradient(circle, rgba(21,106,255,0.22), transparent 65%);
}

body.dark .credits-label {
  color: rgba(255,255,255,0.65);
}

body.dark .credits-amount {
  color: #FFFFFF;
}

/* ---- Onboarding banner ---- */
body.dark .onboarding-banner {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 60%, var(--brand-blue) 140%) !important;
  color: #FFFFFF;
}

body.dark .onboarding-banner::before {
  background: radial-gradient(ellipse 140% 90% at 50% -40%, rgba(21,106,255,0.28) 0%, rgba(21,106,255,0.14) 32%, transparent 33%), radial-gradient(ellipse 170% 110% at 50% -55%, rgba(21,106,255,0.18) 0%, rgba(21,106,255,0.08) 42%, transparent 43%);
}

body.dark .onboarding-banner::after {
  background: radial-gradient(circle, rgba(21,106,255,0.42), transparent 62%);
}

body.dark .onboarding-title {
  color: #FFFFFF;
}

body.dark .onboarding-sub {
  color: rgba(255,255,255,0.72);
}

body.dark .onboarding-eyebrow {
  color: #A5B4FC;
  background: rgba(165,180,252,0.12);
  border: 1px solid rgba(165,180,252,0.25);
}

/* ---- Auth ---- */
body.dark .auth-marketing {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 50%, #1E2547 100%);
}

body.dark .auth-screen,
body.dark .auth-form-side {
  background: var(--bg);
}

body.dark .auth-form-title,
body.dark .auth-marketing-headline {
  color: var(--ink);
}

body.dark .auth-form-sub {
  color: var(--muted);
}

body.dark .auth-submit {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-bright) 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(21,106,255,0.40);
}

body.dark .auth-google {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--border);
}

body.dark .auth-divider {
  color: var(--muted);
}

body.dark .auth-demo-hint {
  background: linear-gradient(135deg, var(--blue-softer) 0%, rgba(59,130,246,0.04) 100%);
  border-color: var(--blue-soft);
  color: var(--text);
}

body.dark .auth-input {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

body.dark .auth-error {
  color: var(--red);
}

body.dark .auth-footer {
  color: var(--subtle);
}

body.dark .auth-feature-icon {
  background: rgba(59,130,246,0.16);
  color: var(--blue);
}

body.dark .auth-toggle a {
  color: var(--blue);
}

body.dark .auth-stats {
  border-top: 1px solid rgba(255,255,255,0.10);
}

body.dark .auth-stat-value {
  color: #FFFFFF;
}

body.dark .auth-stat-label {
  color: rgba(255,255,255,0.65);
}

/* ---- Brand blue gradient tiles ---- */
body.dark .platform-icon,
body.dark .onb-footer-icon,
body.dark .coach-spotlight-icon {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-bright) 100%) !important;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(21,106,255,0.35);
}

/* ---- Icon buttons ---- */
body.dark .icon-btn {
  background: var(--panel);
  border-color: var(--border);
  color: var(--muted);
}

body.dark .icon-btn:hover {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(59,130,246,0.35);
}

body.dark .notif-dot {
  border-color: var(--panel);
}

/* ---- Status / live dot ---- */
body.dark .status-pill {
  background: var(--green-soft);
  color: var(--green);
}

body.dark .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.25);
}

/* ---- Filter tabs / tabs / chips ---- */
body.dark .filter-tab {
  color: var(--muted);
  background: transparent;
}

body.dark .filter-tab:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

body.dark .filter-tab.active {
  background: var(--panel) !important;
  color: var(--blue) !important;
  box-shadow: var(--shadow-sm);
}

body.dark .filter-tabs {
  background: var(--surface-sunken);
  border-color: var(--border);
}

body.dark .tab {
  color: var(--muted);
}

body.dark .tab.active {
  color: var(--blue) !important;
  border-color: var(--blue) !important;
  background: transparent !important;
}

body.dark .chip {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

body.dark .chip:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}

body.dark .chip.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue);
}

/* ---- Tags ---- */
body.dark .tag-blue {
  background: var(--blue-soft) !important;
  color: var(--tag-blue-fg) !important;
}

body.dark .tag-green {
  background: var(--green-soft) !important;
  color: var(--tag-green-fg) !important;
}

body.dark .tag-red {
  background: var(--red-soft) !important;
  color: var(--tag-red-fg) !important;
}

body.dark .tag-amber {
  background: var(--amber-soft) !important;
  color: var(--tag-amber-fg) !important;
}

body.dark .lb-tag-blue {
  background: var(--blue-soft);
  color: var(--tag-blue-fg);
}

body.dark .lb-tag-green {
  background: var(--green-soft);
  color: var(--tag-green-fg);
}

body.dark .lb-tag-red {
  background: var(--red-soft);
  color: var(--tag-red-fg);
}

body.dark .lb-tag-purple {
  background: rgba(168,85,247,0.14);
  color: var(--tag-purple-fg);
}

/* ---- Stat icons (pastel tiles) ---- */
body.dark .stat-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

body.dark .stat-icon.green {
  background: var(--green-soft) !important;
  color: var(--green-icon-fg) !important;
}

body.dark .stat-icon.amber {
  background: var(--amber-soft) !important;
  color: var(--amber-icon-fg) !important;
}

body.dark .stat-icon.red {
  background: var(--red-soft) !important;
  color: var(--red-icon-fg) !important;
}

body.dark .action-icon {
  background: var(--blue-softer);
  color: var(--blue);
}

body.dark .action-tile:hover .action-icon {
  background: var(--blue);
  color: #FFFFFF;
}

body.dark .empty-icon {
  background: var(--blue-softer) !important;
  color: var(--blue) !important;
}

/* ---- Toggles ---- */
body.dark .toggle {
  background: var(--surface-hover);
}

body.dark .toggle::after {
  background: var(--muted);
}

body.dark .toggle.on {
  background: var(--blue);
}

body.dark .toggle.on::after {
  background: #FFFFFF;
}

body.dark .switch .slider {
  background-color: var(--surface-hover);
}

body.dark .switch input:checked + .slider {
  background-color: var(--blue);
}

/* ---- Buttons ---- */
body.dark .btn-primary {
  background: var(--blue) !important;
  color: #FFFFFF !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

body.dark .btn-primary:hover {
  background: var(--blue-bright) !important;
}

body.dark .btn-outline {
  background: transparent !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

body.dark .btn-outline:hover {
  background: var(--surface-hover) !important;
  border-color: var(--blue) !important;
  color: var(--ink) !important;
}

body.dark .btn-ghost {
  color: var(--muted) !important;
  background: transparent !important;
}

body.dark .btn-ghost:hover {
  background: var(--surface-hover) !important;
  color: var(--ink) !important;
}

body.dark .btn-danger {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

body.dark .btn-danger:hover {
  background: #B91C1C !important;
}

body.dark .btn-white {
  background: #FFFFFF !important;
  color: var(--brand-navy) !important;
}

body.dark .btn-white:hover {
  background: #F1F5F9 !important;
}

/* ---- Danger zone ---- */
body.dark .danger-zone {
  background: var(--red-soft);
  border-color: rgba(248,113,113,0.30);
}

body.dark .danger-title {
  color: var(--red) !important;
}

/* ---- Cockpit ---- */
body.dark .cockpit-toolbar {
  background: var(--surface-sunken) !important;
  border-color: var(--border) !important;
}

body.dark .cockpit-statsbar,
body.dark .csl-label,
body.dark .cockpit-stat-label {
  color: var(--muted);
}

body.dark .csl-val,
body.dark .cockpit-stat-value {
  color: var(--ink);
}

body.dark .csl-on {
  color: var(--green);
}

body.dark .cockpit-resizer {
  background: var(--border);
}

body.dark .cockpit-resizer-grip {
  background: var(--muted);
}

body.dark .cockpit-settings-pop,
body.dark .cs-card,
body.dark .cs-card-collapsible {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

body.dark .cs-icon-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

body.dark .cs-icon-blue {
  background: var(--blue-softer);
  color: var(--blue);
}

body.dark .cs-divider {
  background: var(--border);
}

body.dark .cs-card-title {
  color: var(--ink);
}

body.dark .cs-card-sub {
  color: var(--muted);
}

body.dark .cs-section-label {
  color: var(--subtle);
}

/* ---- Delta colors ---- */
body.dark .delta-up,
body.dark .marquee-card-pnl.gain,
body.dark .lb-row-value.gain,
body.dark .pnl-stat-value.pnl-stat-profit,
body.dark .journal-pnl.green,
body.dark .trophy-mini-stat .gain {
  color: var(--green) !important;
}

body.dark .delta-down,
body.dark .marquee-card-pnl.loss,
body.dark .lb-row-value.loss,
body.dark .journal-pnl.red,
body.dark .trophy-mini-stat .loss {
  color: var(--red) !important;
}

/* ---- Risk ---- */
body.dark .risk-heads-up {
  background: linear-gradient(135deg, rgba(251,191,36,0.14) 0%, rgba(251,191,36,0.07) 100%);
  border-color: rgba(251,191,36,0.35);
  color: var(--amber);
}

body.dark .risk-heads-up svg {
  color: var(--amber);
}

body.dark .coach-quote-note {
  background: var(--amber-soft);
  color: var(--amber);
}

body.dark .risk-btn-save {
  color: var(--green);
}

body.dark .risk-btn-save:hover {
  background: var(--green-soft);
}

body.dark .risk-btn-cancel {
  color: var(--red);
}

body.dark .risk-btn-cancel:hover {
  background: var(--red-soft);
}

body.dark .risk-conn-header {
  background: var(--surface-sunken);
}

body.dark .risk-conn-header:hover {
  background: var(--surface-hover);
}

body.dark .risk-conn-body {
  background: var(--panel);
}

body.dark .risk-value-display {
  background: var(--surface-hover);
  color: var(--ink);
}

body.dark .risk-value-display:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

body.dark #riskRecommendationBlock {
  background: var(--panel);
  border-color: var(--border);
  border-left-color: var(--blue);
}

/* ---- Group dropzones ---- */
body.dark .group-dropzone-leader {
  border-color: var(--leader-border);
  background: var(--leader-bg);
}

body.dark .group-dropzone-leader.drop-active {
  background: var(--leader-drop-active-bg);
  box-shadow: 0 0 0 3px rgba(251,191,36,0.40);
}

body.dark .group-dropzone-followers {
  border-color: var(--blue);
  background: var(--blue-softer);
}

body.dark .group-account-row:hover {
  background: var(--blue-softer);
}

/* ---- AI FAB / Coach ---- */
body.dark .ai-fab {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-bright) 100%);
  box-shadow: 0 8px 24px rgba(21,106,255,0.45);
}

body.dark .ai-fab-badge {
  border-color: var(--bg);
}

body.dark .ai-header {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 100%) !important;
  color: #FFFFFF;
}

body.dark .ai-name {
  color: #FFFFFF;
}

body.dark .ai-status {
  color: rgba(255,255,255,0.65);
}

body.dark .ai-messages {
  background: var(--bg);
}

body.dark .ai-msg.bot {
  background: var(--surface-hover);
  color: var(--text);
}

body.dark .ai-msg.user {
  background: var(--blue);
  color: #FFFFFF;
}

body.dark .ai-input-wrap {
  background: var(--panel);
  border-color: var(--border);
}

body.dark .ai-popup {
  background: var(--panel) !important;
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

body.dark .ai-popup::after {
  background: var(--panel) !important;
  border-right-color: var(--border);
  border-bottom-color: var(--border);
}

body.dark .ai-popup-title {
  color: var(--ink);
}

body.dark .ai-popup-sub,
body.dark .ai-popup-body {
  color: var(--muted);
}

body.dark .ai-pulse {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

body.dark .ai-pulse.aggressive {
  background: linear-gradient(135deg, rgba(255,107,53,0.10) 0%, var(--panel) 70%);
  border-left: 3px solid #FF8A55;
}

body.dark .ai-pulse.aggressive.severe {
  background: linear-gradient(135deg, rgba(220,38,38,0.14) 0%, var(--panel) 70%);
  border-left: 3px solid #F87171;
}

body.dark .ai-pulse-btn.primary {
  background: var(--blue);
  color: #FFFFFF;
}

body.dark .ai-pulse-btn.primary:hover {
  background: var(--blue-bright);
}

body.dark .ai-pulse.aggressive .ai-pulse-btn.primary {
  background: #FF8A55;
  border-color: #FF8A55;
}

body.dark .ai-pulse.aggressive.severe .ai-pulse-btn.primary {
  background: #F87171;
  border-color: #F87171;
}

body.dark .coach-spotlight-card {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 4px rgba(59,130,246,0.30);
}

body.dark .coach-spotlight-dim {
  background: rgba(0,0,0,0.75);
}

body.dark .coach-spotlight-title {
  color: var(--ink);
}

body.dark .coach-spotlight-body {
  color: var(--muted);
}

body.dark .coach-highlight {
  box-shadow: 0 0 0 3px var(--blue), 0 0 0 6px rgba(59,130,246,0.35);
}

/* ---- Onb footer ---- */
body.dark .onb-footer {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.20);
}

/* ---- Toast ---- */
body.dark .toast {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

body.dark .toast.success {
  border-left: 3px solid var(--green);
}

body.dark .toast.error {
  border-left: 3px solid var(--red);
}

/* ---- Tooltip ---- */
body.dark .ts-tooltip {
  background: var(--surface-hover);
  color: var(--ink);
  border: 1px solid var(--border);
}

/* ---- Firm / platform logos stay light ---- */
body.dark .firm-logo,
body.dark .platform-logo-full {
  background: #FFFFFF;
  border-color: var(--border);
}

body.dark .platform-logo-full .plf-text {
  color: var(--brand-navy);
}

/* ---- Calendar ---- */
body.dark .cal-day-header {
  background: var(--surface-sunken);
  color: var(--muted);
}

body.dark .cal-day {
  background: var(--panel);
  border-color: var(--border);
}

body.dark .cal-day.today {
  background: linear-gradient(180deg, var(--blue-soft) 0%, var(--panel) 100%);
}

body.dark .cal-event {
  background: var(--blue-softer);
  color: var(--blue);
}

body.dark .cal-event.high {
  background: var(--red-soft);
  color: var(--red);
  border-left-color: var(--red);
}

body.dark .cal-event.med {
  background: var(--amber-soft);
  color: var(--amber);
  border-left-color: var(--amber);
}

/* ---- Journal ---- */
body.dark .journal-day.empty {
  background: var(--journal-empty-bg);
}

body.dark .journal-day.green {
  background: linear-gradient(135deg, var(--journal-green-from) 0%, var(--journal-green-to) 100%);
  border-color: rgba(52,211,153,0.25);
}

body.dark .journal-day.red {
  background: linear-gradient(135deg, var(--journal-red-from) 0%, var(--journal-red-to) 100%);
  border-color: rgba(248,113,113,0.25);
}

body.dark .journal-date {
  color: var(--text);
}

/* ---- For-you / Discord ---- */
body.dark .foryou-card.foryou-discord {
  background: linear-gradient(135deg, var(--discord-bg-from) 0%, var(--discord-bg-to) 100%) !important;
  border-color: var(--discord-border) !important;
  color: #FFFFFF;
}

body.dark .foryou-card.foryou-discord .foryou-title {
  color: #FFFFFF;
}

body.dark .foryou-card.foryou-discord .foryou-desc {
  color: rgba(255,255,255,0.72);
}

/* ---- Community / marquee / pnl share ---- */
body.dark .community-hero {
  background: linear-gradient(135deg, var(--brand-blue-deep) 0%, var(--brand-blue) 55%, var(--brand-blue-bright) 120%);
  color: #FFFFFF;
  box-shadow: 0 10px 30px -12px rgba(21,106,255,0.45);
}

body.dark .community-title,
body.dark .community-sub {
  color: #FFFFFF;
}

body.dark .marquee-card {
  background: linear-gradient(135deg, var(--brand-blue-deep) 0%, var(--brand-blue) 100%);
  border-color: rgba(255,255,255,0.10);
  color: #FFFFFF;
}

body.dark .pnl-card {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 100%);
  color: #FFFFFF;
}

body.dark .pnl-stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
}

body.dark .pnl-table-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
}

body.dark .pnl-toolbar {
  background: var(--panel);
  border-color: var(--border);
}

body.dark .pnl-tool-btn {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

body.dark .pnl-customize-menu {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

/* ---- Leaderboard medals ---- */
body.dark .lb-row.rank-1 .lb-rank {
  background: linear-gradient(135deg, #F59E0B, #B45309);
  color: #FFFFFF;
}

body.dark .lb-row.rank-2 .lb-rank {
  background: linear-gradient(135deg, #94A3B8, #475569);
  color: #FFFFFF;
}

body.dark .lb-row.rank-3 .lb-rank {
  background: linear-gradient(135deg, #C2410C, #7C2D12);
  color: #FFFFFF;
}

body.dark .lb-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

body.dark .lb-icon.red {
  background: var(--red-soft);
  color: var(--red);
}

body.dark .lb-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

body.dark .lb-icon.purple {
  background: rgba(168,85,247,0.14);
  color: #C4B5FD;
}

/* ---- Live indicators ---- */
body.dark .ai-status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.30);
}

body.dark .live-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52,211,153,0.20);
}

/* ---- Contracts modal ---- */
body.dark .contract-row {
  background: var(--panel);
  border-color: var(--border);
}

body.dark .contract-row:hover {
  background: var(--surface-hover);
}

body.dark .contract-status-imported {
  background: var(--green-soft);
  color: var(--green);
}

body.dark .contract-status-available {
  background: var(--surface-hover);
  color: var(--muted);
  border-color: var(--border);
}

body.dark .contract-checkbox {
  background: var(--input-bg);
  border-color: var(--border);
}

body.dark .contract-checkbox:checked {
  background: var(--blue);
  border-color: var(--blue);
}

body.dark .contract-action-btn.add:hover {
  background: var(--blue-deep);
  color: #FFFFFF;
}

body.dark .conn-delete-btn {
  color: var(--red);
}

body.dark .conn-delete-btn:hover {
  background: var(--red-soft);
}

/* ---- Profile ---- */
body.dark .profile-side-avatar {
  border-color: var(--panel);
}

body.dark .profile-social {
  background: var(--surface-sunken);
  border-color: var(--border);
}

/* ---- Nav badge / alert ---- */
body.dark .nav-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

body.dark .nav-badge.pulse {
  background: var(--red);
  color: #FFFFFF;
}

body.dark .has-alert::after {
  background: var(--red);
}

body.dark .help-icon:hover {
  color: var(--blue);
}

body.dark .section-link {
  color: var(--blue);
}

body.dark .empty-state {
  background: transparent;
  color: var(--muted);
}

/* ---- Progress dots ---- */
body.dark .step-progress .dot.done,
body.dark .onb-footer-progress .dot.done {
  background: var(--green);
}

body.dark .onb-footer-progress .dot.active,
body.dark .step-progress .dot.active {
  background: var(--blue);
}

body.dark .onb-footer-progress .dot {
  background: rgba(255,255,255,0.15);
}

body.dark .step-progress .dot {
  background: var(--border);
}

/* ---- Outage banner ---- */
body.dark .globalOutageBanner,
body.dark #globalOutageBanner {
  background: linear-gradient(135deg, #7F1D1D 0%, #DC2626 100%);
  color: #FFFFFF;
}

/* ---- Wordmark + logo ---- */
body.dark .logo-text,
body.dark .auth-logo-text {
  color: var(--brand-blue);
}

body.dark .sidebar-header .logo-svg path {
  fill: var(--brand-blue);
  stroke: var(--brand-blue);
}

/* ---- Charts ---- */
body.dark .chart-svg .grid line {
  stroke: var(--border);
}

body.dark .chart-svg text {
  fill: var(--muted);
}

body.dark .yt-icon-bg {
  background: #CC0000;
}

/* ---- Fallback inline-style overrides (kept narrower than before; remaining
   inline 'background:white' / 'color:var(--navy)' attributes are replaced at
   the source via inline_fixes, but these guards remain for any 3rd-party HTML). ---- */
body.dark [style*="background:white"],
body.dark [style*="background: white"] {
  background: var(--panel) !important;
}

body.dark [style*="color:var(--navy)"] {
  color: var(--ink) !important;
}

/* Platform picker cards in Add Connection */
.platform-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.platform-card:hover {
  border-color: var(--blue);
  transform: none;
}

.platform-card.selected {
  border-color: var(--blue);
  background: var(--blue-softer);
  box-shadow: 0 0 0 3px rgba(21,106,255,0.1);
}

body.dark .platform-card {
  background: #181C24;
  border-color: var(--border);
}

body.dark .platform-card.selected {
  background: rgba(107,130,255,0.1);
  border-color: var(--blue);
}

.platform-card-logo {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.platform-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
}

body.dark .platform-card-name { color: var(--ink); }

@media (max-width: 768px) {
  #platformGrid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Group modal dropzones */
.group-dropzone {
  min-height: 140px;
  border: 2px dashed;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.group-dropzone-leader {
  border-color: #FCD34D;
  background: #FFFBEB;
}

body.dark .group-dropzone-leader {
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.08);
}

.group-dropzone-followers {
  border-color: #BFDBFE;
  background: var(--blue-softer);
}

body.dark .group-dropzone-followers {
  border-color: var(--blue);
  background: rgba(65, 90, 245, 0.08);
}

.group-dropzone-empty {
  text-align: center;
  padding: 16px 0;
  margin: auto 0;
}

.group-assigned-row {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

body.dark .group-assigned-row {
  background: #181C24;
}

.group-assigned-row .mono {
  font-weight: 600;
  flex: 1;
  color: var(--navy);
}

body.dark .group-assigned-row .mono { color: var(--ink); }

.group-account-row {
  display: grid;
  grid-template-columns: 30px 24px 1.4fr 1fr 0.8fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
  font-size: 12.5px;
  transition: background 0.15s;
}

.group-account-row:hover {
  background: var(--blue-softer);
}

body.dark .group-account-row:hover {
  background: rgba(65, 90, 245, 0.06);
}

.group-account-row:last-child { border-bottom: none; }

.group-account-row .drag-handle {
  color: var(--subtle);
  cursor: grab;
  display: flex;
  justify-content: center;
}

.group-account-row input[type="checkbox"] {
  accent-color: var(--blue);
  width: 15px; height: 15px;
  cursor: pointer;
}

.group-account-row .account-balance {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--navy);
}

body.dark .group-account-row .account-balance { color: var(--ink); }

/* Risk Management nested groups */
.risk-conn-group {
  border-top: 1px solid var(--border);
}

.risk-conn-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
}

body.dark .risk-conn-header {
  background: #101319;
}

.risk-conn-header:hover {
  background: var(--border-soft);
}

body.dark .risk-conn-header:hover {
  background: #161B33;
}

.risk-conn-arrow {
  transition: transform 0.2s;
  color: var(--muted);
}

.risk-conn-body {
  background: white;
}

body.dark .risk-conn-body {
  background: #181C24;
}

.risk-account-row {
  padding: 5px 20px 5px 48px;
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr 1fr 1.4fr 1fr 1.2fr;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--border-soft);
}

.risk-value-display {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  padding: 4px 8px;
  background: var(--border-soft);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

body.dark .risk-value-display {
  background: #1E2738;
  color: var(--ink);
}

.risk-value-display:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.risk-value-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 2px 4px;
}

body.dark .risk-value-input {
  background: #181C24;
  border-color: var(--blue);
}

.risk-value-input input {
  border: none;
  outline: none;
  font-size: 12px;
  padding: 2px 4px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  background: transparent;
  color: var(--text);
}

.risk-btn-save, .risk-btn-cancel {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  width: 22px; height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.risk-btn-save { color: #10B981; }
.risk-btn-save:hover { background: #D1FAE5; }
.risk-btn-cancel { color: #EF4444; }
.risk-btn-cancel:hover { background: #FEE2E2; }

body.dark .risk-btn-save:hover { background: rgba(52,211,153,0.15); }
body.dark .risk-btn-cancel:hover { background: rgba(248,113,113,0.15); }

/* ======================================================
   INLINE ONBOARDING BANNER — appears at top of each page
   ====================================================== */
.onb-footer {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: white;
  border-radius: 14px;
  padding: 14px 16px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 20px rgba(15,23,42,0.15), 0 0 0 1px rgba(21,106,255,0.15);
  margin-bottom: 20px;
  position: relative;
  animation: onbFooterIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onb-footer.show { display: flex; }

body.dark .onb-footer {
  background: linear-gradient(135deg, #181C24 0%, #20242E 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(107,130,255,0.2);
}

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

.onb-footer-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #156AFF 0%, #0457FF 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-weight: 800;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 4px 12px rgba(21,106,255,0.3);
  position: relative;
}

.onb-footer-icon::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 13px;
  border: 2px solid rgba(21,106,255,0.35);
  animation: onbIconPulse 2s ease-in-out infinite;
}

@keyframes onbIconPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0; }
}

.onb-footer-content {
  flex: 1;
  min-width: 0;
}

.onb-footer-step {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 3px;
}

.onb-footer-title {
  font-weight: 700;
  font-size: 14px;
  color: white;
  margin-bottom: 2px;
}

.onb-footer-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}

.onb-footer-progress {
  display: flex;
  gap: 3px;
  margin-top: 8px;
  max-width: 260px;
}

.onb-footer-progress .dot {
  height: 3px;
  flex: 1;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  transition: background 0.3s;
}

.onb-footer-progress .dot.done { background: #10B981; }
.onb-footer-progress .dot.active { background: #156AFF; }

.onb-footer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.onb-footer-actions .btn {
  white-space: nowrap;
  padding: 7px 16px;
  font-size: 12px;
}

.onb-footer-actions .btn-ghost {
  color: rgba(255,255,255,0.65) !important;
}

.onb-footer-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.08) !important;
  color: white !important;
}

.onb-footer-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}

.onb-footer-close:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

@media (max-width: 768px) {
  .onb-footer {
    padding: 12px 14px;
    gap: 10px;
  }
  .onb-footer-desc { display: none; }
  .onb-footer-actions .btn { padding: 6px 12px; }
}

/* Welcome modal step rows */
.welcome-step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.welcome-step-row:hover {
  background: white;
}

body.dark .welcome-step-row:hover {
  background: #1E2738;
}

.welcome-step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}

.welcome-step-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy);
  text-align: left;
}

body.dark .welcome-step-title { color: var(--ink); }

.welcome-step-sub {
  font-size: 11.5px;
  color: var(--muted);
  text-align: left;
  margin-top: 1px;
}

/* ======================================================
   AUTH SCREEN (login / register)
   ====================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  overflow: hidden;
}

.auth-screen.hidden { display: none; }

/* Left side — form */
.auth-form-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  overflow-y: auto;
  min-width: 0;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-logo svg { width: 32px; height: 32px; }

.auth-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.01em;
}

body.dark .auth-logo-text { color: var(--blue); }

.auth-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.auth-form {
  width: 100%;
  max-width: 380px;
}

.auth-form-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--blue-softer);
  color: var(--blue);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.auth-form-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

body.dark .auth-form-title { color: var(--ink); }

.auth-form-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-field-label a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-field-label a:hover { text-decoration: underline; }

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

body.dark .auth-input {
  background: #0F1524;
  border-color: var(--border);
}

.auth-input::placeholder { color: var(--subtle); }

.auth-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21,106,255,0.12);
}

.auth-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
  display: none;
}

.auth-error.show { display: block; }

.auth-submit {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #156AFF 0%, #0457FF 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(21,106,255,0.25);
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(21,106,255,0.35);
}

.auth-submit:active { transform: translateY(0); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-google {
  width: 100%;
  padding: 11px 16px;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}

body.dark .auth-google {
  background: #0F1524;
  color: var(--ink);
}

.auth-google:hover {
  background: var(--bg);
  border-color: var(--text);
}

body.dark .auth-google:hover {
  background: #1E2738;
}

.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
}

.auth-toggle a {
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.auth-toggle a:hover { text-decoration: underline; }

.auth-demo-hint {
  background: linear-gradient(135deg, var(--blue-softer) 0%, #F0F4FF 100%);
  border: 1px solid var(--blue-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

body.dark .auth-demo-hint {
  background: rgba(21,106,255,0.08);
  border-color: rgba(21,106,255,0.25);
}

.auth-demo-hint strong { color: var(--blue); }

.auth-demo-hint code {
  background: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid var(--border);
}

body.dark .auth-demo-hint code {
  background: #101319;
  color: var(--ink);
}

.auth-footer {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  padding-top: 16px;
}

.auth-footer a {
  color: var(--text);
  text-decoration: underline;
}

/* Right side — marketing panel */
.auth-marketing {
  width: 480px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0A0E1A 0%, #1A2640 50%, #1E2547 100%);
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-marketing::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(21,106,255,0.35), transparent 60%);
  border-radius: 50%;
}

.auth-marketing::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -100px;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(16,185,129,0.2), transparent 60%);
  border-radius: 50%;
}

.auth-marketing > * { position: relative; z-index: 1; }

.auth-marketing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(21,106,255,0.2);
  color: #A5B4FC;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  border: 1px solid rgba(21,106,255,0.3);
  width: fit-content;
}

.auth-marketing-headline {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.auth-marketing-sub {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  margin-bottom: 32px;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.auth-feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.auth-feature-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.auth-feature-content {
  flex: 1;
}

.auth-feature-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.auth-feature-desc {
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
}

.auth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.auth-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.auth-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .auth-marketing { display: none; }
  .auth-form-side { padding: 24px; }
}

/* Profile page social pills */
.profile-social {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.profile-social:hover {
  background: var(--blue-softer);
  color: var(--blue);
  border-color: var(--blue-soft);
}

body.dark .profile-social {
  background: #1E2738;
  border-color: var(--border);
}

body.dark .profile-social:hover {
  background: rgba(21,106,255,0.15);
}

@media (max-width: 1200px) {
  #page-profile > div:last-child { grid-template-columns: 1fr !important; }
}

/* === Community Leaderboard === */
.community-hero {
  background: linear-gradient(135deg, #0040C2 0%, #156AFF 55%, #4A8AFF 120%);
  border-radius: 16px;
  padding: 28px 32px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px -12px rgba(21,106,255,0.35);
}

/* Brandbook concentric arcs — echoing the cover pages */
.community-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 140% 95% at 50% -40%, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.08) 32%, transparent 33%),
    radial-gradient(ellipse 170% 115% at 50% -55%, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.05) 42%, transparent 43%),
    radial-gradient(ellipse 200% 135% at 50% -75%, rgba(255,255,255,0.07) 0%, transparent 50%);
  pointer-events: none;
}

.community-hero::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.22), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

.community-hero-content { position: relative; z-index: 1; }

.community-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.community-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.community-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 22px;
}

.community-stat-strip {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.cs-stat-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}

.cs-stat-lbl {
  font-size: 11.5px;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cs-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.15);
}

/* Marquee */
.community-marquee-wrap { margin-bottom: 22px; }

.community-marquee-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: live-pulse 1.4s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

.community-marquee {
  overflow: hidden;
  position: relative;
  border-radius: 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
}

.community-marquee-track {
  display: flex;
  gap: 12px;
  animation: marquee-scroll 60s linear infinite;
  width: max-content;
}

.community-marquee:hover .community-marquee-track { animation-play-state: paused; }

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee-card {
  flex: 0 0 240px;
  background: linear-gradient(135deg, #0040C2 0%, #156AFF 100%);
  border-radius: 12px;
  padding: 12px 14px;
  color: white;
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}

.marquee-card:hover { transform: none; }

.marquee-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
}

.marquee-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
}

.marquee-card-handle {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.marquee-card-flag { font-size: 13px; }

.marquee-card-pnl {
  font-size: 22px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.01em;
  position: relative;
  line-height: 1.1;
}

.marquee-card-pnl.gain { color: #22D67D; }
.marquee-card-pnl.loss { color: #FB7185; }

.marquee-card-meta {
  font-size: 10.5px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
  position: relative;
}

/* Leaderboard grid */
.leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 1100px) {
  .leaderboard-grid { grid-template-columns: 1fr; }
}

.leaderboard-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

body.dark .leaderboard-card { background: #181C24; border-color: var(--border); }

.lb-best { border-top: 3px solid var(--green); }
.lb-worst { border-top: 3px solid var(--red); }
.lb-conn { border-top: 3px solid var(--blue); }
.lb-blown { border-top: 3px solid #A855F7; }

.lb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.lb-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lb-icon-green { background: rgba(16,185,129,0.13); color: var(--green); }
.lb-icon-red   { background: rgba(239,68,68,0.13);  color: var(--red); }
.lb-icon-blue  { background: var(--blue-softer);    color: var(--blue); }
.lb-icon-purple { background: rgba(168,85,247,0.13); color: #A855F7; }

body.dark .lb-icon-green { background: rgba(16,185,129,0.18); }
body.dark .lb-icon-red   { background: rgba(239,68,68,0.18); }
body.dark .lb-icon-blue  { background: rgba(21,106,255,0.18); }
body.dark .lb-icon-purple { background: rgba(168,85,247,0.2); }

.lb-title { font-size: 14.5px; font-weight: 700; color: var(--navy); line-height: 1.2; }
body.dark .lb-title { color: var(--ink); }

.lb-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.lb-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.lb-tag-green { background: rgba(16,185,129,0.13); color: #047857; }
.lb-tag-red { background: rgba(239,68,68,0.13); color: #B91C1C; }
.lb-tag-blue { background: var(--blue-softer); color: var(--blue); }
.lb-tag-purple { background: rgba(168,85,247,0.13); color: #7C3AED; }

body.dark .lb-tag-green { color: #34D399; background: rgba(16,185,129,0.18); }
body.dark .lb-tag-red { color: #FB7185; background: rgba(239,68,68,0.18); }
body.dark .lb-tag-blue { color: #A5B4FC; background: rgba(21,106,255,0.18); }
body.dark .lb-tag-purple { color: #C084FC; background: rgba(168,85,247,0.2); }

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 6px;
}

.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg); }
body.dark .lb-row:hover { background: rgba(255,255,255,0.03); }

.lb-rank {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

body.dark .lb-rank { background: #1E2738; }

.lb-row.rank-1 .lb-rank { background: linear-gradient(135deg, #FBBF24, #F59E0B); color: white; }
.lb-row.rank-2 .lb-rank { background: linear-gradient(135deg, #D1D5DB, #9CA3AF); color: white; }
.lb-row.rank-3 .lb-rank { background: linear-gradient(135deg, #FB923C, #C2410C); color: white; }

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
}

.lb-row-info { flex: 1; min-width: 0; }
.lb-row-handle {
  font-weight: 600;
  color: var(--navy);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
body.dark .lb-row-handle { color: var(--ink); }

.lb-row-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.lb-row-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 14px;
  text-align: right;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.lb-row-value.gain { color: var(--green); }
.lb-row-value.loss { color: var(--red); }
.lb-row-value.neutral { color: var(--navy); }
body.dark .lb-row-value.neutral { color: var(--ink); }

/* === Import Contracts modal === */
.contracts-table-head {
  display: grid;
  grid-template-columns: 32px 100px 1fr 80px;
  gap: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}

.contract-row {
  display: grid;
  grid-template-columns: 32px 100px 1fr 80px;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
  transition: background 0.1s;
}

.contract-row:hover { background: var(--bg); }
body.dark .contract-row:hover { background: rgba(255,255,255,0.03); }

.contract-row.imported { background: rgba(16,185,129,0.04); }
body.dark .contract-row.imported { background: rgba(16,185,129,0.08); }

.contract-checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  background: white;
  margin: 0;
}

.contract-checkbox:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.contract-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

body.dark .contract-checkbox { background: #2A3447; }

.contract-status-imported {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(16,185,129,0.15);
  color: #059669;
}
body.dark .contract-status-imported {
  background: rgba(16,185,129,0.18);
  color: #34D399;
}

.contract-status-available {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.contract-symbol { font-weight: 700; color: var(--navy); font-size: 14px; font-family: 'JetBrains Mono', monospace; }
body.dark .contract-symbol { color: var(--ink); }
.contract-name { font-size: 11.5px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

.contract-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
}

.contract-action-btn:hover { background: var(--bg); color: var(--text); }

.contract-action-btn.add {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.contract-action-btn.add:hover { background: var(--blue-dark, #2D44C9); color: white; }

body.dark .contract-action-btn { background: #1E2738; border-color: var(--border); color: var(--ink); }
body.dark .contract-action-btn:hover { background: #2A3447; }

/* === Cockpit Settings popover === */
.cockpit-settings-wrap {
  position: relative;
  display: inline-block;
}

.cockpit-settings-btn {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
}

.cockpit-settings-pop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.16);
  padding: 14px;
  z-index: 200;
  max-height: 80vh;
  overflow-y: auto;
}

.cockpit-settings-pop.open { display: block; }

body.dark .cockpit-settings-pop {
  background: #181C24;
  border-color: var(--border);
}

.cs-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding: 0 4px;
}

.cs-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}

body.dark .cs-card {
  background: #1E2738;
  border-color: var(--border);
}

.cs-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.cs-card-collapsible .cs-card-row {
  cursor: pointer;
  user-select: none;
}

.cs-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cs-icon-amber {
  background: #FEF3C7;
  color: #F59E0B;
}

.cs-icon-blue {
  background: var(--blue-softer);
  color: var(--blue);
}

body.dark .cs-icon-amber { background: rgba(245,158,11,0.15); }
body.dark .cs-icon-blue { background: rgba(21,106,255,0.18); }

.cs-card-text {
  flex: 1;
  min-width: 0;
}

.cs-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

body.dark .cs-card-title { color: var(--ink); }

.cs-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.cs-chevron {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.cs-card-collapsible.expanded .cs-chevron { transform: rotate(180deg); }

.cs-protect-expand {
  display: none;
}

.cs-card-collapsible.expanded .cs-protect-expand {
  display: block;
}

.cs-divider {
  height: 1px;
  background: var(--border-soft);
}

.cs-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cs-refresh-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 4px;
}

.cs-refresh-btn:hover { background: var(--bg); }

body.dark .cs-refresh-btn { background: #1E2738; border-color: var(--border); color: var(--ink); }
body.dark .cs-refresh-btn:hover { background: #2A3447; }

/* === PnL Card toolbar === */
.pnl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
}

body.dark .pnl-toolbar { background: #181C24; border-bottom-color: var(--border); }

.pnl-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.pnl-tool-btn:hover { background: var(--bg); border-color: var(--border); }

body.dark .pnl-tool-btn { background: #1E2738; border-color: var(--border); color: var(--ink); }
body.dark .pnl-tool-btn:hover { background: #2A3447; }

.pnl-tool-toggle {
  cursor: pointer;
  user-select: none;
}

.pnl-tool-toggle input { display: none; }
.pnl-tool-toggle .pnl-check-icon {
  width: 14px;
  height: 14px;
  padding: 2px;
  border-radius: 4px;
  background: transparent;
  border: 1.5px solid var(--border);
  color: transparent;
  flex-shrink: 0;
}
.pnl-tool-toggle input:checked ~ .pnl-check-icon {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.pnl-tool-danger {
  color: var(--red);
  border-color: #FEE2E2;
}
.pnl-tool-danger:hover {
  background: #FEF2F2;
  border-color: #FECACA;
}

body.dark .pnl-tool-danger {
  background: #1E2738;
  color: #FB7185;
  border-color: rgba(251,113,133,0.3);
}

.pnl-customize-wrap {
  position: relative;
}

.pnl-customize-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  z-index: 100;
  display: none;
}
.pnl-customize-menu.open { display: block; }

body.dark .pnl-customize-menu { background: #1E2738; border-color: var(--border); }

.pnl-customize-title {
  padding: 8px 12px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}

body.dark .pnl-customize-title { color: var(--ink); }

.pnl-customize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}

.pnl-customize-row:hover { background: var(--bg); }
body.dark .pnl-customize-row:hover { background: rgba(255,255,255,0.05); }

.pnl-customize-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  background: white;
  flex-shrink: 0;
  margin: 0;
}

.pnl-customize-row input[type="checkbox"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}

.pnl-customize-row input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

body.dark .pnl-customize-row input[type="checkbox"] { background: #2A3447; }

.pnl-customize-row-divider {
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
  padding-top: 11px;
}

/* Affiliate code pill on PnL card */
.pnl-code-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.pnl-code-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
}

.pnl-code-value {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.04em;
  border: 1.5px solid #60A5FA;
  border-radius: 8px;
  padding: 4px 12px;
  background: rgba(96,165,250,0.1);
}

/* === PnL Card (shareable result image) === */
.pnl-card {
  background: linear-gradient(135deg, #0040C2 0%, #156AFF 55%, #4A8AFF 100%);
  border-radius: 24px;
  padding: 24px 26px;
  color: white;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 820px;
  /* Fixed height — card must never grow or shrink with account count.
     The accounts list inside scrolls/fades when there are too many rows. */
  height: 620px;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}

.pnl-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  pointer-events: none;
}

.pnl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.pnl-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
}

.pnl-date {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  margin-top: 12px;
}

.pnl-card-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  position: relative;
  z-index: 1;
  /* Fill remaining vertical space inside the fixed-height card and let
     children manage their own overflow (account list scrolls). */
  flex: 1;
  min-height: 0;
}

.pnl-stats-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

/* First two stat cards (Total Accounts, Total Balance) — equal smaller size */
.pnl-stat-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* Third stat card (Total Profit) gets more vertical weight — the hero stat */
.pnl-stat-card:last-child {
  flex: 1.8;
}

.pnl-stat-card:last-child .pnl-stat-label {
  margin-bottom: 12px;
}

.pnl-stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  margin-bottom: 4px;
}

.pnl-stat-value {
  font-size: 30px;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.pnl-stat-profit {
  font-size: 52px;
  color: white;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Auto-shrink for longer values so they don't overflow or wrap.
   The [data-digits] attribute is set in JS based on the formatted value length. */
.pnl-stat-profit[data-digits="medium"] { font-size: 44px; }  /* $10k – $99k */
.pnl-stat-profit[data-digits="large"]  { font-size: 36px; }  /* $100k – $999k */
.pnl-stat-profit[data-digits="xlarge"] { font-size: 30px; }  /* $1M+ */

.pnl-stat-profit.loss { color: #FB7185; }
.pnl-stat-profit.gain-color { color: #22D67D; }

.pnl-table-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  /* Constrain height to parent grid cell and let the inner list handle overflow */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pnl-account-list-wrap {
  /* Scrollable viewport with a fade-out mask at the bottom so extra rows
     look visibly clipped rather than pushing the card taller. */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent 100%);
}
.pnl-account-list-wrap::-webkit-scrollbar { display: none; }

.pnl-table-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-bottom: 14px;
}

.pnl-table-head {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pnl-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
  color: white;
  align-items: center;
}

.pnl-row:last-child { border-bottom: none; }

.pnl-row .acc-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.pnl-row .balance {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: rgba(255,255,255,0.95);
}

.pnl-row .pnl-val {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.pnl-row .pnl-val.gain { color: #22D67D; }
.pnl-row .pnl-val.loss { color: #FB7185; }

.pnl-card-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.pnl-card-footer .pnl-author { justify-self: start; }
.pnl-card-footer .pnl-code-banner { justify-self: center; margin-top: 0; }
.pnl-card-footer .pnl-footer-right { justify-self: end; }

.pnl-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pnl-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.pnl-author-name {
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.pnl-footer-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pnl-footer-text {
  text-align: right;
}

.pnl-footer-url {
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.pnl-footer-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

.pnl-qr {
  background: white;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

/* Trophies carousel on profile page */
.trophy-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 14px;
  scroll-snap-type: x mandatory;
}

.trophy-carousel::-webkit-scrollbar { height: 6px; }
.trophy-carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.trophy-mini {
  flex: 0 0 280px;
  background: linear-gradient(135deg, #0040C2 0%, #156AFF 100%);
  border-radius: 12px;
  padding: 14px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
  scroll-snap-align: start;
  border: 1px solid rgba(255,255,255,0.06);
}

.trophy-mini:hover { transform: none; }

.trophy-mini::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
}

.trophy-mini-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
}

.trophy-mini-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.trophy-mini-date {
  font-size: 10.5px;
  color: rgba(255,255,255,0.65);
}

.trophy-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  position: relative;
}

.trophy-mini-stat {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 10px;
}

.trophy-mini-stat .lbl { font-size: 9.5px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.05em; }
.trophy-mini-stat .val { font-size: 14px; font-weight: 700; margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.trophy-mini-stat .val.gain { color: #22D67D; }
.trophy-mini-stat .val.loss { color: #FB7185; }

.trophy-mini-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 10.5px;
  color: rgba(255,255,255,0.6);
  position: relative;
}

/* Profile side card */
.profile-side-card {
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}

.profile-side-header {
  background: linear-gradient(135deg, #0040C2 0%, #156AFF 55%, #4A8AFF 100%);
  height: 100px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
}

.profile-side-poweredby {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.profile-side-poweredby strong {
  font-weight: 700;
  color: white;
}

.profile-side-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: -42px;
  position: relative;
  z-index: 2;
}

.profile-side-avatar {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border: 4px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 30px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

body.dark .profile-side-avatar {
  border-color: #181C24;
}

.profile-side-body {
  padding: 12px 20px 22px;
  text-align: center;
}

.profile-side-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 6px;
}

body.dark .profile-side-name { color: var(--ink); }

.profile-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
}

.profile-side-box {
  margin-top: 6px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text);
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-side-box.empty {
  color: var(--muted);
  font-style: italic;
}

body.dark .profile-side-box {
  background: #101319;
}

.profile-social {
  cursor: pointer;
  transition: all 0.15s;
}

.profile-social.has-link {
  background: var(--blue-softer);
  color: var(--blue);
  border-color: var(--blue-soft);
}

body.dark .profile-social.has-link {
  background: rgba(21,106,255,0.15);
  color: #A5B4FC;
}

/* === Settings tab content tables === */
.settings-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.settings-detail-row span { color: var(--muted); }
.settings-detail-row strong { color: var(--navy); font-weight: 600; }
body.dark .settings-detail-row strong { color: var(--ink); }

.settings-feature-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text);
}
.settings-feature-row:last-child { border-bottom: none; }

/* Notifications table */
.notif-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.notif-header {
  display: grid;
  grid-template-columns: 1.4fr 2.2fr 80px 80px;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  align-items: center;
}
body.dark .notif-header { background: #0F1524; }

.notif-section-label {
  padding: 8px 18px;
  background: var(--bg);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
}
body.dark .notif-section-label { background: #0F1524; }

.notif-row {
  display: grid;
  grid-template-columns: 1.4fr 2.2fr 80px 80px;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.notif-row:last-child { border-bottom: none; }
.notif-name { font-weight: 600; color: var(--navy); font-size: 13px; }
body.dark .notif-name { color: var(--ink); }
.notif-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Drag-and-drop visual states for group modal */
.group-account-row {
  cursor: grab;
}
.group-account-row.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.group-account-row .drag-handle {
  cursor: grab;
}
.group-dropzone {
  transition: all 0.2s;
}
.group-dropzone.drop-active {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(21,106,255,0.25);
}
.group-dropzone-leader.drop-active {
  background: #FFF7E0;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.35);
}
body.dark .group-dropzone-leader.drop-active {
  background: rgba(245,158,11,0.18);
}

/* Chart empty states */
.chart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  min-height: 160px;
  gap: 8px;
}

.chart-empty-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-top: 6px;
}

.chart-empty-desc {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.5;
}

/* For You continuously scrolling marquee */
.foryou-marquee {
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  border-radius: 14px;
  mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
}

.foryou-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: foryouScroll 50s linear infinite;
}

.foryou-marquee:hover .foryou-track {
  animation-play-state: paused;
}

@keyframes foryouScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.foryou-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
  width: 340px;
  flex-shrink: 0;
}

.foryou-card:hover {
  transform: none;
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}

body.dark .foryou-card {
  background: var(--white);
  border-color: var(--border);
}

.foryou-card.foryou-promo {
  background: var(--white);
  border-color: var(--border);
}

body.dark .foryou-card.foryou-promo {
  background: var(--white) !important;
  border-color: var(--border) !important;
}

.foryou-card.foryou-discord {
  background: linear-gradient(135deg, #EEF0FF 0%, #E0E4FF 100%);
  border-color: #C7D2FE;
}

body.dark .foryou-card.foryou-discord {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%) !important;
  border-color: #5865F2 !important;
}

.foryou-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.foryou-content {
  flex: 1;
  min-width: 0;
}

.foryou-title {
  font-weight: 700;
  color: var(--navy);
  font-size: 13.5px;
  margin-bottom: 2px;
}

body.dark .foryou-title { color: var(--ink); }

.foryou-desc {
  font-size: 11.5px;
  color: var(--muted);
}

.foryou-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* AI Coach highlight pulse - used when Coach directs user somewhere */
.coach-highlight {
  animation: coachPulse 1.8s ease-in-out infinite;
  position: relative;
  z-index: 100;
  border-radius: 12px;
}

@keyframes coachPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(21,106,255,0.7), 0 0 0 0 rgba(21,106,255,0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(21,106,255,0), 0 0 0 16px rgba(21,106,255,0);
  }
}

/* Floating tooltip for coach — attached to body so it never clips */
.coach-tooltip {
  position: fixed;
  background: var(--blue);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(21,106,255,0.45);
  pointer-events: none;
  z-index: 10000;
  animation: coachTipBounce 1.2s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coach-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--blue);
}

@keyframes coachTipBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

body.dark .coach-tooltip { background: var(--blue); }
body.dark .coach-tooltip::after { border-top-color: var(--blue); }

/* Onboarding spotlight overlay - dims background + shows centered coaching card */
.coach-spotlight {
  position: fixed;
  inset: 0;
  z-index: 9800;
  pointer-events: none;
  display: none;
}

.coach-spotlight.show { display: block; }

.coach-spotlight-dim {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: coachDimIn 0.3s ease;
}

@keyframes coachDimIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.coach-spotlight-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: white;
  color: var(--text);
  border-radius: 16px;
  padding: 24px 28px;
  width: 440px;
  max-width: calc(100vw - 48px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.4), 0 0 0 4px rgba(21,106,255,0.2);
  pointer-events: auto;
  animation: coachCardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

body.dark .coach-spotlight-card {
  background: #181C24;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 4px rgba(107,130,255,0.25);
}

@keyframes coachCardIn {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.coach-spotlight-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #156AFF, #0457FF);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: white;
  position: relative;
}

.coach-spotlight-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 2px solid rgba(21,106,255,0.3);
  animation: coachIconPulse 2s ease-in-out infinite;
}

@keyframes coachIconPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 0; }
}

.coach-spotlight-step {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.coach-spotlight-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
}

body.dark .coach-spotlight-title { color: var(--ink); }

.coach-spotlight-body {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.coach-spotlight-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 auto;
}

.coach-spotlight-actions .btn {
  min-width: 160px;
  justify-content: center;
}

.coach-spotlight-progress {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 16px;
}

.coach-spotlight-progress .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.coach-spotlight-progress .dot.active { background: var(--blue); width: 18px; border-radius: 3px; }
.coach-spotlight-progress .dot.done { background: var(--blue); opacity: 0.5; }


* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

.app {
  display: grid;
  grid-template-columns: 60px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 20px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Subtle brandbook arc accent behind logo */
.sidebar-header::before {
  display: none;
}

.logo-svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.logo-text {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #156AFF;
  position: relative;
  z-index: 1;
}

.profile-card {
  margin: 10px 12px 6px;
  padding: 8px 10px;
  background: var(--blue-softer);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.profile-card:hover { background: var(--blue-soft); border-color: var(--blue-soft); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 12.5px; font-weight: 600; color: var(--navy); line-height: 1.2; }
.profile-email { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; margin-top: 1px; }

/* Scrollable nav middle section */
.sidebar-nav-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-nav-wrap::-webkit-scrollbar { width: 4px; }
.sidebar-nav-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section { padding: 2px 12px; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1px;
  transition: all 0.15s;
  position: relative;
  user-select: none;
}

.nav-item:hover { background: var(--border-soft); }

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
}

.nav-item.active .nav-icon { color: var(--blue); }

.nav-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--blue);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.pulse {
  background: var(--red);
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.nav-item.has-alert {
  animation: navBlink 2s ease-in-out infinite;
  position: relative;
}

.nav-item.has-alert::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--red);
  border-radius: 2px;
  animation: navBlink 2s ease-in-out infinite;
}

@keyframes navBlink {
  0%, 100% { background: var(--red-soft); }
  50% { background: transparent; }
}

.nav-item.has-alert:hover { background: var(--red-soft) !important; }

.nav-item.ai-coach .nav-icon {
  color: var(--blue);
}

.nav-item.ai-coach {
  background: linear-gradient(135deg, rgba(21,106,255,0.08), rgba(4,87,255,0.04));
  border: 1px solid rgba(21,106,255,0.15);
}


.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.credits-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--space) 100%);
  border-radius: 10px;
  padding: 9px 12px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.credits-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(21,106,255,0.5), transparent 70%);
  border-radius: 50%;
}

/* Second subtle arc for brandbook layering */
.credits-card::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -20px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(21,106,255,0.18), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}


.credits-label { font-size: 10px; color: rgba(255,255,255,0.6); font-weight: 500; }
.credits-amount { font-size: 16px; font-weight: 700; margin-top: 1px; position: relative; line-height: 1.2; }
.credits-amount span { font-size: 11px; color: rgba(255,255,255,0.6); font-weight: 500; margin-left: 4px; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: visible;
}

/* Subtle brandbook arc — barely there, just enough to echo the covers */
.topbar::before {
  content: '';
  position: absolute;
  top: -120px; right: -40px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(21,106,255,0.05) 0%, rgba(21,106,255,0.025) 40%, transparent 62%);
  border-radius: 50%;
  pointer-events: none;
  clip-path: inset(0 0 0 0);
}

body.dark .topbar::before {
  background: radial-gradient(circle, rgba(74,138,255,0.07) 0%, rgba(74,138,255,0.03) 40%, transparent 62%);
}

.topbar > * { position: relative; z-index: 1; }


.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 19px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--green-soft);
  color: #065F46;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}


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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0.1); }
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
  position: relative;
}

.icon-btn:hover { background: var(--blue-softer); color: var(--blue); border-color: var(--blue-soft); }
.icon-btn svg { width: 16px; height: 16px; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid white;
}


.content {
  padding: 24px 28px 48px;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

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

.onboarding-banner {
  background: linear-gradient(135deg, #0A0E1A 0%, #1A2640 60%, #156AFF 140%);
  border-radius: 16px;
  padding: 28px 32px;
  color: white;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -12px rgba(10,14,26,0.35);
}

/* Brandbook arcs — subtle concentric curves in the dark banner */
.onboarding-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 140% 90% at 50% -40%, rgba(21,106,255,0.22) 0%, rgba(21,106,255,0.12) 32%, transparent 33%),
    radial-gradient(ellipse 170% 110% at 50% -55%, rgba(21,106,255,0.15) 0%, rgba(21,106,255,0.07) 42%, transparent 43%),
    radial-gradient(ellipse 200% 130% at 50% -75%, rgba(21,106,255,0.10) 0%, transparent 50%);
  pointer-events: none;
}

.onboarding-banner::after {
  content: '';
  position: absolute;
  top: -30%; right: -8%;
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(21,106,255,0.35), transparent 62%);
  border-radius: 50%;
  pointer-events: none;
}


.onboarding-content { flex: 1; position: relative; z-index: 1; }
.onboarding-eyebrow {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 10px;
}
.onboarding-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.onboarding-sub { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 16px; max-width: 520px; }

.onboarding-steps { display: flex; gap: 8px; margin-bottom: 16px; }

.step-progress {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.step-progress.done { background: var(--blue); }
.step-progress.active { background: rgba(255,255,255,0.25); }
.step-progress.active::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 50%;
  background: var(--blue);
  border-radius: 4px;
}


.onboarding-actions { display: flex; gap: 10px; position: relative; z-index: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  box-shadow: 0 1px 2px rgba(16,24,40,0.05);
}
.btn-primary:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
  box-shadow: 0 1px 2px rgba(16,24,40,0.08);
}

.btn-white { background: white; color: var(--navy); }
.btn-white:hover { background: rgba(255,255,255,0.9); }

.btn-ghost { background: transparent; color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.2); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }

.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #DC2626; }


.btn-sm { padding: 6px 12px; font-size: 13px; }

.onboarding-dismiss {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.onboarding-dismiss:hover { background: rgba(255,255,255,0.2); color: white; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.stat-card:hover { border-color: var(--blue-soft); box-shadow: var(--shadow-md); }

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.stat-icon svg { width: 14px; height: 14px; }
.stat-icon.green { background: var(--green-soft); color: #047857; }
.stat-icon.amber { background: var(--amber-soft); color: #B45309; }
.stat-icon.red { background: var(--red-soft); color: #B91C1C; }


.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }

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

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-icon {
  width: 14px; height: 14px;
  color: var(--subtle);
  cursor: help;
}

.section-link {
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.section-link:hover { text-decoration: underline; }

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.action-tile {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-family: inherit;
}

.action-tile:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-lg);
  transform: none;
}

.action-tile:hover .action-icon { background: var(--blue); color: white; }

.action-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--blue-softer);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.action-icon svg { width: 18px; height: 18px; }

.action-content { flex: 1; }
.action-title { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.action-desc { font-size: 11.5px; color: var(--muted); }

.instruments-scroll {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.instrument {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
}

.instrument:hover { border-color: var(--blue-soft); box-shadow: var(--shadow-sm); }

.instrument-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

.instrument-flag {
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}


.instrument-symbol { font-size: 11px; font-weight: 700; color: var(--navy); }
.instrument-price { font-size: 15px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.instrument-delta { font-size: 11px; margin-top: 2px; font-weight: 600; }

.table-wrap { overflow-x: auto; }

/* Cockpit fills the viewport (no page scroll); the resizer drags the boundary so
   the Order history section slides up/down. Both panes keep a min height so
   neither can disappear off-screen (matches the production app). */
body.cockpit-active .main { height: 100vh; min-height: 0; overflow: hidden; }
body.cockpit-active .content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
}
body.cockpit-active #page-cockpit.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}
/* Cockpit stats bar — plain inline label:value pairs like production, no card. */
.cockpit-statsbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 4px 2px 14px;
  font-size: 13px;
}
.cockpit-statsbar-left,
.cockpit-statsbar-right { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cockpit-statline { white-space: nowrap; }
.csl-label { color: var(--muted); }
.csl-val { color: var(--navy); font-weight: 700; margin-left: 2px; }
.csl-val.csl-on { color: var(--green); }
.csl-val.csl-off { color: var(--muted); }
.cockpit-group-select {
  height: 28px;
  padding: 0 24px 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  margin-right: 4px;
}
.cockpit-split {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  margin-top: 0;
}

/* Positions empty state: center content within the 320px card.
   Selectors are scoped to #cockpitTableWrap / #cockpitAccountsList only
   so the order history table below is not affected. */
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitTableWrap thead {
  display: none;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitTableWrap {
  overflow: visible;
  display: flex;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitTableWrap table {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitAccountsList {
  display: flex;
  flex: 1;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitAccountsList tr {
  display: flex;
  flex: 1;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitAccountsList td {
  display: flex;
  flex: 1;
}
.cockpit-split:has(#cockpitAccountsList td[colspan]) #cockpitAccountsList .empty-state {
  flex: 1;
  min-height: 0;
}
.cockpit-accounts-pane {
  flex: 0 0 auto;
  height: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
}
.cockpit-accounts-pane > .cockpit-overview { flex: 0 0 auto; }
#cockpitTableWrap {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}
.cockpit-orderhistory {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.oh-tabsbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.oh-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cockpit-oh-card {
  flex: 1 1 0;
  min-height: 0;
  margin-bottom: 0;
  padding: 0;
  overflow: auto;
}
/* Sticky column-header row so it stays the top of the pane when collapsed. */
.oh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.oh-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
}
.oh-table tbody td { border-bottom: none; }
.cockpit-resizer {
  height: 24px;
  margin: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  position: relative;
  touch-action: none;
  user-select: none;
}
.cockpit-resizer::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--border);
  transform: translateY(-50%);
  transition: background 0.15s;
}
.cockpit-resizer-grip {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  transition: background 0.15s, width 0.15s;
}
.cockpit-resizer:hover .cockpit-resizer-grip,
.cockpit-resizer.dragging .cockpit-resizer-grip { background: var(--blue); width: 60px; }
.cockpit-resizer.dragging::before { background: var(--blue); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  height: 40px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

tbody td {
  padding: 5px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

tbody tr:hover { background: var(--blue-softer); }
tbody td[colspan] { border-bottom: none; }
tbody tr:has(td[colspan]) { pointer-events: none; }

/* Cockpit table — compact button padding */
#page-cockpit tbody td {
  padding: 5px 16px;
}
#page-cockpit tbody td .btn { padding-top: 3px; padding-bottom: 3px; }
#page-cockpit tbody td:nth-child(3) .firm-logo { background: transparent; border: none; border-radius: 0; }
#page-cockpit thead th {
  padding: 0 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.tag-green { background: var(--green-soft); color: #065F46; }
.tag-red { background: var(--red-soft); color: #991B1B; }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-amber { background: var(--amber-soft); color: #92400E; }


.chart-title { font-size: 13px; color: var(--muted); font-weight: 500; }
.chart-value { font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -0.02em; margin-top: 2px; }
.chart-svg { width: 100%; height: 140px; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.empty-icon {
  width: 56px; height: 56px;
  background: var(--blue-softer);
  border-radius: 14px;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.empty-icon svg { width: 28px; height: 28px; }

.empty-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; max-width: 380px; margin-left: auto; margin-right: auto; }

.connection-row {
  padding: 5px 20px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.7fr 1fr 0.9fr 120px 70px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
}

.connection-row:last-child { border-bottom: none; }
.connection-row:hover { background: var(--blue-softer); }

/* Production-style column header for the connections table. */
.connection-head {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 0 20px;
  height: 40px;
  align-items: center;
}
.connection-head:hover { background: transparent; }

/* Red delete button (Delete column) — matches production. */
.conn-delete-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(16,24,40,0.05);
}
.conn-delete-btn:hover { background: #DC2626; }

.connection-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--navy);
}

.platform-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #156AFF, #0457FF);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.platform-logo-full {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  height: 22px;
  overflow: hidden;
}
.platform-logo-full img { max-height: 13px; max-width: 72px; width: auto; height: auto; object-fit: contain; display: block; flex-shrink: 0; }
.platform-logo-full .plf-text { font-size: 11px; font-weight: 800; color: #1A2640; letter-spacing: -0.01em; white-space: nowrap; }

.firm-logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}


.toggle {
  position: relative;
  width: 36px; height: 20px;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.toggle.on { background: var(--blue); }
.toggle.on::after { transform: translateX(16px); }


.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-tabs {
  display: inline-flex;
  background: var(--border-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s;
  font-family: inherit;
}

.filter-tab.active { background: white; color: var(--blue); box-shadow: var(--shadow-sm); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-day-header {
  background: var(--bg);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day {
  background: white;
  padding: 10px 12px;
  min-height: 120px;
  position: relative;
}

.cal-day.today { background: linear-gradient(180deg, var(--blue-softer) 0%, white 100%); }
.cal-day.today .cal-date { color: var(--blue); font-weight: 700; }

.cal-date { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }

.cal-event {
  font-size: 10.5px;
  padding: 3px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
  background: var(--blue-softer);
  color: var(--blue);
  border-left: 2px solid var(--blue);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.cal-event.high { background: #FEF2F2; color: #991B1B; border-left-color: var(--red); }
.cal-event.med { background: #FEF3C7; color: #92400E; border-left-color: var(--amber); }


.cal-event-time { font-weight: 600; opacity: 0.7; font-size: 9.5px; }

.journal-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.journal-day {
  background: white;
  padding: 12px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s;
}

.journal-day:hover:not(.empty) { transform: scale(1.02); z-index: 2; box-shadow: var(--shadow-md); }
.journal-day.green { background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%); }
.journal-day.red { background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%); }
.journal-day.empty { background: #FAFBFC; cursor: default; }


.journal-date { font-size: 11px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.journal-pnl { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.journal-pnl.green { color: #047857; }
.journal-pnl.red { color: #B91C1C; }


.journal-trades { font-size: 10px; color: var(--muted); font-weight: 500; }

/* === Dark mode: economic calendar + journaling calendar === */
body.dark .cal-day { background: var(--white); }
body.dark .cal-day.today { background: linear-gradient(180deg, var(--blue-soft) 0%, var(--white) 100%); }
body.dark .cal-event.high { background: rgba(248,113,113,0.14); color: #FCA5A5; }
body.dark .cal-event.med { background: rgba(251,191,36,0.14); color: #FCD34D; }
body.dark .journal-day { background: var(--white); }
body.dark .journal-day.green { background: linear-gradient(135deg, #0E3A2C 0%, #064E3B 100%); }
body.dark .journal-day.red { background: linear-gradient(135deg, #43161B 0%, #7F1D1D 100%); }
body.dark .journal-day.empty { background: #121A2E; }
body.dark .journal-pnl.green { color: var(--green); }
body.dark .journal-pnl.red { color: var(--red); }

.cockpit-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.contract-chips-scroll::-webkit-scrollbar { height: 4px; }
.contract-chips-scroll::-webkit-scrollbar-track { background: transparent; }
.contract-chips-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.contract-chips-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-soft); }
.chip-close { color: var(--subtle); cursor: pointer; width: 12px; height: 12px; }
.chip-close:hover { color: var(--red); }

.cockpit-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
body.dark .cockpit-overview { background: #101319; border-bottom-color: var(--border); }

.cockpit-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.cockpit-stat-label { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.cockpit-stat-value { font-size: 16px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -0.015em; margin-top: 2px; }
.cockpit-stat-value.green { color: var(--green); }


.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  position: relative;
  font-family: inherit;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); }
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

.form-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.form-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.form-subtitle { font-size: 12px; color: var(--muted); margin-bottom: 20px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text); }

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  width: 100%;
}

.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,106,255,0.1); }
.form-input:disabled { background: var(--bg); color: var(--muted); }

.form-input-with-icon { position: relative; }


.danger-zone { border: 1px solid #FEE2E2; background: #FEFAFA; }
.danger-title { color: var(--red); }

/* Tooltips render as a single floating element on <body> (see initTooltips in
   app.js) so they are never clipped by overflow containers or screen edges. */
.ts-tooltip {
  position: fixed;
  background: #1A2640;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 280px;
  /* Preserve \n line breaks for multi-line tooltips (e.g. drawdown details) */
  white-space: pre-line;
  box-shadow: 0 4px 12px rgba(10,14,26,0.18), 0 6px 20px rgba(0,0,0,0.18);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.ts-tooltip.show { opacity: 1; }
body.dark .ts-tooltip {
  background: #2A2E38;
  border: 1px solid rgba(255,255,255,0.06);
  color: #FFFFFF;
}

/* Make help icons keyboard-focusable so the focusin handler in initTooltips
   actually fires for keyboard-only users. The transparent ::after expands
   the hit target to ~22x22 without changing the SVG size. */
.help-icon {
  position: relative;
  padding: 2px;
  box-sizing: content-box;
  outline: none;
}
.help-icon::after {
  content: "";
  position: absolute;
  inset: -4px;
}
.help-icon:focus-visible {
  outline: 2px solid var(--brand-primary, #156AFF);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Disabled toggles still need to bubble hover for our data-tooltip system.
   Browsers vary on whether disabled controls fire mouse events — pin both
   explicitly so the Critical notification toggles always surface the
   "Always on" tooltip. */
[data-tooltip] .toggle[disabled],
.toggle[aria-disabled="true"],
.toggle[style*="cursor:not-allowed"] {
  cursor: not-allowed;
  pointer-events: auto;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 400px;
  animation: toastIn 0.3s ease forwards;
  pointer-events: auto;
}

.toast.success { background: #047857; }
.toast.error { background: #B91C1C; }


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

@keyframes toastOut {
  to { opacity: 0; transform: translateY(20px); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}

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

.modal {
  background: white;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.25s ease;
}

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

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

.modal-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--border-soft);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* PnL Card modal — sticky footer so Save/Download are always visible */
#modalPnLCard .modal {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
}
#modalPnLCard .modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
#modalPnLCard .modal-footer {
  flex-shrink: 0;
  background: var(--white);
  position: sticky;
  bottom: 0;
}
body.dark #modalPnLCard .modal-footer { background: #181C24; }

/* === AI Coach mode selection cards === */
.ai-mode-card {
  display: block;
  cursor: pointer;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: white;
  transition: all 0.15s ease;
  padding: 16px;
}
.ai-mode-card:hover { border-color: var(--blue); }
.ai-mode-card .ai-mode-inner { pointer-events: none; }
.ai-mode-card .ai-mode-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); color: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.ai-mode-card input[type="radio"]:checked ~ .ai-mode-inner .ai-mode-check {
  background: var(--blue); border-color: var(--blue); color: white;
}
.ai-mode-card:has(input:checked) { border-color: var(--blue); background: var(--blue-softer); }
body.dark .ai-mode-card { background: var(--panel); }
body.dark .ai-mode-card:has(input:checked) { background: rgba(21,106,255,0.12); }

/* === AI watch items (grid of things Sync monitors) === */
.ai-watch-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; background: var(--bg); border-radius: 8px;
  border: 1px solid var(--border-soft);
}
.ai-watch-item > span { font-size: 20px; flex-shrink: 0; }
.ai-watch-title { font-weight: 600; font-size: 13px; color: var(--navy); margin-bottom: 2px; }
.ai-watch-sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
body.dark .ai-watch-title { color: var(--ink); }

/* === Proactive Pulse notifications (slide in from right) === */
.ai-pulse-stack {
  position: fixed; top: 80px; right: 20px; z-index: 900;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.ai-pulse {
  pointer-events: auto;
  background: white; border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 10px; padding: 14px 14px 14px 16px;
  width: 340px; max-width: calc(100vw - 40px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  animation: pulseSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.ai-pulse.aggressive {
  border-left-color: #ff6b35;
  background: linear-gradient(135deg, #fff9f5 0%, #fff 70%);
}
.ai-pulse.aggressive.severe {
  border-left-color: #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #fff 70%);
}
@keyframes pulseSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.ai-pulse.leaving { animation: pulseSlideOut 0.25s ease-in forwards; }
@keyframes pulseSlideOut {
  to { opacity: 0; transform: translateX(100%); }
}
.ai-pulse-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.ai-pulse-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #156AFF, #0457FF);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white;
}
.ai-pulse.aggressive .ai-pulse-avatar {
  background: linear-gradient(135deg, #ff6b35, #dc2626);
}
.ai-pulse-name { font-weight: 700; font-size: 13px; color: var(--navy); }
.ai-pulse-tag {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-left: auto;
}
.ai-pulse-close {
  background: none; border: none; cursor: pointer;
  padding: 2px; color: var(--muted); display: flex;
  align-items: center; justify-content: center;
}
.ai-pulse-close:hover { color: var(--navy); }
.ai-pulse-body {
  font-size: 13px; color: var(--navy); line-height: 1.45;
  margin-bottom: 10px;
}
.ai-pulse-actions {
  display: flex; gap: 8px;
}
.ai-pulse-btn {
  font-size: 12px; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: white;
  color: var(--navy); cursor: pointer; font-weight: 600;
  font-family: inherit;
}
.ai-pulse-btn.primary {
  background: var(--blue); color: white; border-color: var(--blue);
}
.ai-pulse-btn.primary:hover { background: #0457FF; }
.ai-pulse.aggressive .ai-pulse-btn.primary {
  background: #ff6b35; border-color: #ff6b35;
}
.ai-pulse.aggressive.severe .ai-pulse-btn.primary {
  background: #dc2626; border-color: #dc2626;
}
body.dark .ai-pulse { background: var(--panel); }
body.dark .ai-pulse-name { color: var(--ink); }
body.dark .ai-pulse-body { color: var(--ink); }

.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #156AFF 0%, #0457FF 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(21,106,255,0.4);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s;
  animation: aiPulse 3s infinite;
}


@keyframes aiPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(21,106,255,0.4); }
  50% { box-shadow: 0 8px 32px rgba(21,106,255,0.6), 0 0 0 8px rgba(21,106,255,0.1); }
}

.ai-fab:hover { transform: scale(1.05); }
.ai-fab svg { width: 24px; height: 24px; }

.ai-fab-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}


.ai-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 720px;
  max-width: calc(100vw - 48px);
  height: 640px;
  max-height: calc(100vh - 48px);
  background: white;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  z-index: 950;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ai-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 940;
  display: none;
  animation: backdropIn 0.2s ease;
}

.ai-panel-backdrop.open { display: block; }

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ai-panel.open { display: flex; animation: aiPanelIn 0.3s ease; }

@keyframes aiPanelIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.ai-header {
  padding: 16px;
  background: linear-gradient(135deg, #0A0E1A 0%, #1A2640 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}


.ai-header::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(21,106,255,0.4), transparent 60%);
  border-radius: 50%;
}


.ai-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #156AFF, #0457FF);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}


.ai-avatar svg { width: 20px; height: 20px; }

.ai-info { flex: 1; position: relative; z-index: 1; }
.ai-name { font-size: 14px; font-weight: 700; }
.ai-status { font-size: 11px; color: rgba(255,255,255,0.7); display: flex; align-items: center; gap: 4px; }
.ai-status-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }


.ai-close {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.ai-close:hover { background: rgba(255,255,255,0.25); }

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.ai-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  animation: msgIn 0.25s ease;
}

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

.ai-msg.bot {
  align-self: flex-start;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.ai-msg.user {
  align-self: flex-end;
  background: var(--blue);
  color: white;
  border-bottom-right-radius: 4px;
}


.ai-msg strong { font-weight: 700; }

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
  margin-left: 4px;
}

.ai-suggestion {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.ai-suggestion:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-softer); }

.ai-input-wrap {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: white;
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.ai-input:focus { border-color: var(--blue); }

.ai-send {
  width: 36px; height: 36px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-send:hover { background: var(--blue-bright); }
.ai-send svg { width: 16px; height: 16px; }

.ai-typing {
  display: inline-flex;
  gap: 3px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.ai-typing span {
  width: 6px; height: 6px;
  background: var(--subtle);
  border-radius: 50%;
  animation: typing 1.3s infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ai-popup {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 320px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 820;
  display: none;
  animation: popupIn 0.4s ease;
}

.ai-popup.show { display: block; }

@keyframes popupIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-popup::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: white;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

.ai-popup-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-popup-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #156AFF, #0457FF);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}


.ai-popup-title { font-size: 13px; font-weight: 700; color: var(--navy); }
.ai-popup-sub { font-size: 11px; color: var(--muted); }

.ai-popup-body { font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 12px; }
.ai-popup-body strong { color: var(--navy); }

.ai-popup-actions { display: flex; gap: 8px; }

.ai-popup-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  border-radius: 6px;
}
.ai-popup-close:hover { background: var(--border-soft); color: var(--text); }

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .instruments-scroll { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 16px; }
  .onboarding-banner { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: 1fr; }
  .instruments-scroll { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .ai-panel { width: calc(100vw - 16px); right: 8px; bottom: 8px; }
  .ai-popup { width: calc(100vw - 48px); }
}

/* ======================================================
   FINAL DARK MODE CONSOLIDATION (spec-driven, end-of-file)
   These rules sit at the end so they win against any
   legacy scattered body.dark rules earlier in the sheet.
   ====================================================== */
body.dark .group-assigned-row { background: var(--panel); }
body.dark .group-dropzone-leader { border-color: var(--leader-border); background: var(--leader-bg); }
body.dark .group-dropzone-leader.drop-active { background: var(--leader-drop-active-bg); box-shadow: 0 0 0 3px rgba(251,191,36,0.40); }
body.dark .group-dropzone-followers { border-color: var(--blue); background: var(--blue-softer); }
body.dark .group-account-row:hover { background: var(--blue-softer); }
body.dark .risk-conn-header { background: var(--surface-sunken); }
body.dark .risk-conn-header:hover { background: var(--surface-hover); }
body.dark .risk-conn-body { background: var(--panel); }
body.dark .risk-value-display { background: var(--surface-hover); color: var(--ink); }
body.dark .risk-value-input { background: var(--input-bg); border-color: var(--blue); }
body.dark .risk-btn-save:hover { background: var(--green-soft); }
body.dark .risk-btn-cancel:hover { background: var(--red-soft); }
body.dark .onb-footer { background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-space) 100%); box-shadow: 0 8px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.20); }
body.dark .leaderboard-card { background: var(--panel); border-color: var(--border); }
body.dark .lb-icon-green { background: var(--green-soft); }
body.dark .lb-icon-red { background: var(--red-soft); }
body.dark .lb-icon-blue { background: var(--blue-soft); }
body.dark .lb-icon-purple { background: rgba(168,85,247,0.14); }
body.dark .lb-tag-green { color: var(--tag-green-fg); background: var(--green-soft); }
body.dark .lb-tag-red { color: var(--tag-red-fg); background: var(--red-soft); }
body.dark .lb-tag-blue { color: var(--tag-blue-fg); background: var(--blue-soft); }
body.dark .lb-tag-purple { color: var(--tag-purple-fg); background: rgba(168,85,247,0.14); }
body.dark .lb-row:hover { background: rgba(59,130,246,0.06); }
body.dark .lb-rank { background: var(--surface-hover); }
body.dark .contract-row:hover { background: var(--surface-hover); }
body.dark .contract-row.imported { background: var(--green-soft); }
body.dark .contract-checkbox { background: var(--input-bg); }
body.dark .contract-action-btn { background: var(--surface-hover); border-color: var(--border); color: var(--ink); }
body.dark .contract-action-btn:hover { background: var(--blue-softer); }
body.dark .cockpit-settings-pop { background: var(--panel); border-color: var(--border); box-shadow: var(--shadow-lg); }
body.dark .cs-card { background: var(--panel); border-color: var(--border); }
body.dark .cs-icon-amber { background: var(--amber-soft); color: var(--amber); }
body.dark .cs-icon-blue { background: var(--blue-softer); color: var(--blue); }
body.dark .cs-refresh-btn { background: var(--surface-hover); border-color: var(--border); color: var(--ink); }
body.dark .cs-refresh-btn:hover { background: var(--blue-soft); }
body.dark .pnl-toolbar { background: var(--panel); border-bottom-color: var(--border); }
body.dark .pnl-tool-btn { background: var(--surface-hover); border-color: var(--border); color: var(--text); }
body.dark .pnl-tool-btn:hover { background: var(--blue-soft); }
body.dark .pnl-customize-menu { background: var(--panel); border-color: var(--border); box-shadow: var(--shadow-lg); }
body.dark .pnl-customize-row:hover { background: var(--surface-hover); }
body.dark .pnl-customize-row input[type="checkbox"] { background: var(--input-bg); }
body.dark .notif-header { background: var(--surface-sunken); }
body.dark .notif-section-label { background: var(--surface-sunken); }
body.dark .cockpit-overview { background: var(--surface-sunken); border-bottom-color: var(--border); }
body.dark .ts-tooltip { background: var(--surface-hover); border: 1px solid var(--border); color: var(--ink); }
body.dark #modalPnLCard .modal-footer { background: var(--panel); }
body.dark .cal-day { background: var(--panel); }
body.dark .cal-day.today { background: linear-gradient(180deg, var(--blue-soft) 0%, var(--panel) 100%); }
body.dark .cal-event.high { background: var(--red-soft); color: var(--red); }
body.dark .cal-event.med { background: var(--amber-soft); color: var(--amber); }
body.dark .journal-day { background: var(--panel); }
body.dark .journal-day.green { background: linear-gradient(135deg, var(--journal-green-from) 0%, var(--journal-green-to) 100%); border-color: rgba(52,211,153,0.25); }
body.dark .journal-day.red { background: linear-gradient(135deg, var(--journal-red-from) 0%, var(--journal-red-to) 100%); border-color: rgba(248,113,113,0.25); }
body.dark .journal-day.empty { background: var(--journal-empty-bg); }
body.dark .foryou-card { background: var(--panel); }
body.dark .ai-mode-card { background: var(--panel); }
body.dark .ai-mode-card:has(input:checked) { background: var(--blue-soft); }

/* ============================================================
   ICON-ONLY SIDEBAR — Slim sidebar redesign
   ============================================================ */

/* Sidebar header: center logo, hide text */
.sidebar-header {
  padding: 16px 0;
  justify-content: center;
  gap: 0;
}
.logo-text { display: none; }
.logo-svg { width: 26px; height: 26px; }

/* Hide profile card */
.profile-card { display: none; }

/* Hide section labels */
.nav-label { display: none; }

/* Tighter section padding */
.nav-section { padding: 2px 8px; }

/* Icon-only nav items: center icon, hide text via font-size trick */
.nav-item {
  justify-content: center;
  padding: 9px;
  gap: 0;
  font-size: 0 !important;
  width: 44px;
  margin: 2px auto;
  border-radius: 10px;
}
/* Keep icons visible and properly sized */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
/* Restore icon color so it's not 0-sized inherited color */
.nav-item.active .nav-icon { color: var(--blue); }

/* Hide badges in slim mode */
.nav-badge { display: none !important; }

/* Hide credits footer */
.sidebar-footer { display: none; }

/* Hide status pill in topbar */
.status-pill { display: none; }

/* Topbar user avatar — rounded square like the reference UI */
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
  user-select: none;
}
.topbar-avatar:hover { opacity: 0.82; }

/* ============================================================
   MAIN BODY — flex row: content + help panel
   ============================================================ */
.main {
  display: flex !important;
  flex-direction: column;
}
.main-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.main-body .content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* ============================================================
   HELP & SUPPORT PANEL
   ============================================================ */
.hsp {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--white);
  display: none;
  flex-direction: column;
  overflow-y: auto;
}
.hsp.open { display: flex; }

.hsp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 2;
}
.hsp-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.12s;
}
.hsp-close:hover { background: var(--border-soft); color: var(--text); }

.hsp-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.hsp-item:hover { background: var(--bg); }
.hsp-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  background: var(--white);
}
.hsp-item-content { flex: 1; min-width: 0; }
.hsp-item-title { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.hsp-item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hsp-chevron { color: var(--subtle); flex-shrink: 0; }

.hsp-community {
  padding: 20px;
  flex-shrink: 0;
}
.hsp-community-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.hsp-community-text { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.hsp-discord-banner {
  border-radius: 12px;
  background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
  padding: 18px 16px 16px;
  position: relative;
  overflow: hidden;
  min-height: 90px;
}
.hsp-discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: #5865F2;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
  font-family: inherit;
  transition: opacity 0.15s;
}
.hsp-discord-btn:hover { opacity: 0.9; }

/* Dark mode: help panel */
body.dark .hsp { background: var(--panel); }
body.dark .hsp-header { background: var(--panel); border-bottom-color: var(--border); }
body.dark .hsp-item-icon { background: var(--bg); border-color: var(--border); }
body.dark .hsp-item:hover { background: rgba(255,255,255,0.04); }
body.dark .hsp-community-title { color: var(--text); }

/* ============================================================
   AVATAR DROPDOWN
   ============================================================ */
.avatar-dropdown-wrap { position: relative; }

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(10,14,26,0.14), 0 2px 8px rgba(0,0,0,0.08);
  display: none;
  overflow: hidden;
  z-index: 300;
}
.avatar-dropdown.open { display: block; }

.avatar-dropdown-user {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.avatar-dropdown-name { font-size: 13px; font-weight: 700; color: var(--navy); }
.avatar-dropdown-email { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.avatar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.avatar-dropdown-item:hover { background: var(--bg); }
.avatar-dropdown-item svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.avatar-dropdown-item.danger { color: var(--red); }
.avatar-dropdown-item.danger svg { color: var(--red); }

/* Dark mode: avatar dropdown */
body.dark .avatar-dropdown {
  background: #1E2330;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
body.dark .avatar-dropdown-user { border-bottom-color: rgba(255,255,255,0.06); }
body.dark .avatar-dropdown-item:hover { background: rgba(255,255,255,0.05); }
body.dark .avatar-dropdown-name { color: #fff; }
body.dark .avatar-dropdown-email { color: rgba(255,255,255,0.45); }
body.dark .avatar-dropdown-item { color: rgba(255,255,255,0.8); }
body.dark .avatar-dropdown-item svg { color: rgba(255,255,255,0.4); }

/* Icon buttons: match dark mode background */
body.dark .icon-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}
body.dark .icon-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}

/* Dark mode: keep sidebar border visible */
body.dark .sidebar { border-right-color: var(--border); }

/* Sidebar tooltips: force right-side placement so they don't clip off the slim rail */
.sidebar .nav-item .ts-tooltip,
aside.sidebar [data-tooltip] .ts-tooltip { left: calc(100% + 10px) !important; top: 50% !important; transform: translateY(-50%) !important; }

/* Active item: remove left-border indicator, keep soft background only */
.nav-item.active::after { display: none; }
.nav-item.active {
  background: var(--blue-soft);
}

/* AI coach item still readable in icon-only mode */
.nav-item.ai-coach { background: linear-gradient(135deg, rgba(21,106,255,0.10), rgba(4,87,255,0.05)); }
.nav-item.ai-coach .nav-icon { color: var(--blue); }

/* ============================================================
   SIDEBAR PRECISION — match reference exactly
   ============================================================ */

/* Larger icons: 20px matches reference weight */
.nav-icon {
  width: 20px;
  height: 20px;
}

/* More breathing room between icon items */
.nav-item {
  margin: 3px auto;
}

/* Bottom section: hide Help Book button, center Settings icon */
.sidebar > .nav-section > div {
  justify-content: center !important;
}
.sidebar > .nav-section button.nav-item {
  display: none !important;
}
.sidebar > .nav-section .nav-item[data-page="settings"] {
  flex: none !important;
}

/* Dark mode: stronger active bg — matches reference blue glow */
body.dark .nav-item.active {
  background: rgba(21, 106, 255, 0.18);
}
body.dark .nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
}
body.dark .nav-item.active:hover {
  background: rgba(21, 106, 255, 0.24);
}
body.dark .nav-item.ai-coach {
  background: rgba(21, 106, 255, 0.10);
}

/* ============================================================
   GLOBAL DESIGN SYSTEM — consistent style across all pages
   ============================================================ */

/* Dark mode: table consistency */
body.dark table { border-collapse: collapse; }
body.dark th {
  background: var(--panel);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
body.dark td {
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
body.dark tr:hover td { background: rgba(255,255,255,0.025); }

/* Dark mode: all form inputs */
body.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.dark textarea,
body.dark select {
  background: var(--bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
body.dark input::placeholder,
body.dark textarea::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}
body.dark input:focus:not([type="checkbox"]):not([type="radio"]),
body.dark textarea:focus,
body.dark select:focus {
  border-color: var(--blue) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(21,106,255,0.12) !important;
}

/* Dark mode: modal overlays */
body.dark .modal-overlay,
body.dark .modal-bg,
body.dark .overlay-bg {
  background: rgba(0, 0, 0, 0.65) !important;
}
body.dark .modal-card,
body.dark .modal-body,
body.dark .modal-wrap {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
}
body.dark .modal-header {
  border-bottom-color: var(--border) !important;
}
body.dark .modal-footer {
  border-top-color: var(--border) !important;
  background: var(--bg) !important;
}

/* Dark mode: tabs */
body.dark .tab-item,
body.dark .tabs-item,
body.dark [role="tab"] {
  color: var(--muted);
}
body.dark .tab-item:hover,
body.dark .tabs-item:hover,
body.dark [role="tab"]:hover {
  color: var(--text);
}
body.dark .tab-item.active,
body.dark .tabs-item.active,
body.dark [role="tab"][aria-selected="true"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* Dark mode: dropdown menus */
body.dark .dropdown-menu,
body.dark .select-dropdown,
body.dark .menu-popup {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
body.dark .dropdown-item:hover,
body.dark .menu-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Dark mode: tooltips */
body.dark .tooltip,
body.dark [class*="tooltip"] {
  background: var(--navy);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
}

/* Dark mode: badges/pills */
body.dark .badge,
body.dark .pill,
body.dark .tag {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Dark mode: empty-state icons */
body.dark .empty-icon,
body.dark .empty-state-icon {
  background: var(--bg);
  border-color: var(--border);
  color: var(--muted);
}

/* Dark mode: section dividers */
body.dark hr,
body.dark .divider {
  border-color: var(--border);
}

/* Dark mode: code / mono blocks */
body.dark code,
body.dark pre {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Dark mode: scrollbars global */
body.dark * {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
body.dark *::-webkit-scrollbar { width: 5px; height: 5px; }
body.dark *::-webkit-scrollbar-track { background: transparent; }
body.dark *::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
body.dark *::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Light mode: scrollbars global */
body:not(.dark) * {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
body:not(.dark) *::-webkit-scrollbar { width: 5px; height: 5px; }
body:not(.dark) *::-webkit-scrollbar-track { background: transparent; }
body:not(.dark) *::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
body:not(.dark) *::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Card: ensure consistent radius + shadow across all pages */
.card,
.settings-card,
.panel-card,
.info-card,
.stat-card,
.onb-card {
  border-radius: 14px !important;
  overflow: hidden;
}

/* Buttons: ensure consistent border-radius */
.btn,
button.btn-primary,
button.btn-secondary,
button.btn-ghost,
button.btn-outline,
button.btn-danger {
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

/* Dark mode: primary buttons */
body.dark .btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
body.dark .btn-primary:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
}
body.dark .btn-ghost,
body.dark .btn-outline,
body.dark .btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
body.dark .btn-ghost:hover,
body.dark .btn-outline:hover,
body.dark .btn-secondary:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}
body.dark .btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border-color: rgba(239,68,68,0.25);
}
body.dark .btn-danger:hover {
  background: rgba(239,68,68,0.20);
}

/* Topbar: always visible above content */
.topbar { overflow: visible; }

/* Onboarding step banner: subtle in dark mode */
body.dark .onb-steps-bar,
body.dark .onboarding-bar,
body.dark .ob-banner,
body.dark #onbStepBanner {
  background: var(--panel) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* Page content: consistent top padding */
.content { padding-bottom: 40px; }

/* ============================================================
   ★ TRADESYNCER GLASS DESIGN SYSTEM v2
   Pixel-matched to target screenshots + Tradecopia inspo.
   This is the authoritative layer — appended last so it wins.
   ============================================================ */

/* ---- New tokens: radii, focus, glass, mono ---- */
:root {
  --r-xs:4px; --r-sm:6px; --r-md:9px; --r-icon:10px; --r-lg:12px; --r-glass:14px; --r-pill:999px;
  --btn-radius:9px; --input-radius:8px;
  --focus-ring:0 0 0 3px rgba(21,106,255,.12);
  --focus-ring-strong:0 0 0 3px rgba(21,106,255,.30);
  --glass-surface:rgba(255,255,255,0.86);
  --glass-border:rgba(15,23,42,0.08);
  --glass-shadow:0 24px 64px -16px rgba(16,22,38,0.28), 0 0 0 1px rgba(15,23,42,0.06);
  --glass-sheen:radial-gradient(120% 80% at 85% 110%, rgba(21,106,255,0.10), transparent 60%);
  --glass-surface-flat:#FFFFFF;
  --overlay-backdrop:rgba(16,22,38,0.32);
  --sidebar-w:64px;
  --font-mono:'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
body.dark {
  --focus-ring:0 0 0 3px rgba(59,130,246,.22);
  --focus-ring-strong:0 0 0 3px rgba(59,130,246,.40);
  --glass-surface:rgba(23,24,31,0.92);
  --glass-border:rgba(255,255,255,0.08);
  --glass-shadow:0 30px 80px -20px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.06);
  --glass-sheen:radial-gradient(120% 80% at 85% 110%, rgba(21,106,255,0.16), transparent 60%);
  --glass-surface-flat:#1B1C22;
  --overlay-backdrop:rgba(8,9,13,0.66);
}

/* ---- App shell: 64px slim rail ---- */
.app { grid-template-columns: var(--sidebar-w) 1fr !important; }

/* ---- Logo tile: white glyph on a blue rounded-square ---- */
.sidebar-header { padding: 16px 0 14px; justify-content: center; gap: 0; }
.logo-tile {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: linear-gradient(135deg, #156AFF 0%, #0457FF 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(21,106,255,0.32);
}
.logo-tile .logo-svg { width: 21px; height: 21px; }
.logo-tile .logo-svg path { fill: #fff !important; stroke: #fff !important; }

/* ---- Slim nav item: fixed 40px rounded square ---- */
.nav-item {
  width: 40px !important; height: 40px; padding: 0 !important;
  margin: 3px auto !important; border-radius: var(--r-icon) !important;
  gap: 0; justify-content: center;
}
.nav-icon { width: 20px; height: 20px; }
.nav-item.ai-coach { border: 1px solid rgba(21,106,255,0.18); }

/* ---- Sidebar bottom: stacked, collapse pinned at very bottom ---- */
.sidebar-bottom {
  margin-top: auto; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 8px 0 12px;
  border-top: 1px solid var(--border-soft); flex-shrink: 0;
}
.sidebar-collapse, .topbar-collapse {
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer; color: var(--muted);
  border-radius: var(--r-icon); transition: background .15s, color .15s;
  font-family: inherit; padding: 0;
}
.sidebar-collapse { width: 40px; height: 40px; }
.sidebar-collapse svg, .topbar-collapse svg { width: 20px; height: 20px; }
.sidebar-collapse:hover, .topbar-collapse:hover { background: var(--border-soft); color: var(--blue); }
body.dark .sidebar-collapse:hover, body.dark .topbar-collapse:hover { background: rgba(255,255,255,0.06); color: var(--blue); }

/* ---- Topbar left: leading collapse icon + bold title ---- */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-collapse { width: 36px; height: 36px; }
.page-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }

/* ---- Collapsed sidebar state ---- */
body.nav-collapsed .app { grid-template-columns: 0 1fr !important; }
body.nav-collapsed .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
.sidebar { transition: transform .2s ease; }

/* ---- Topbar icon buttons: 36 / r10 / 18px icon + ACTIVE state ---- */
.icon-btn {
  width: 36px !important; height: 36px !important;
  border-radius: var(--r-icon) !important; border: 1px solid var(--border);
  background: var(--white); color: var(--muted); position: relative;
  transition: all .15s;
}
.icon-btn svg { width: 18px !important; height: 18px !important; }
.icon-btn:hover { background: var(--blue-softer); color: var(--blue); border-color: var(--blue-soft); }
.icon-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.icon-btn.active svg { color: #fff; }
body.dark .icon-btn { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
body.dark .icon-btn:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.15); color: #fff; }
body.dark .icon-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.notif-dot { width: 7px; height: 7px; top: 6px; right: 6px; border: 2px solid var(--white); }

/* ---- Topbar avatar: 36px blue rounded-square ---- */
.topbar-avatar {
  width: 36px !important; height: 36px !important;
  border-radius: var(--r-icon) !important; background: var(--blue) !important;
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  transition: background .15s, opacity .15s;
}
.topbar-avatar:hover { background: var(--blue-bright) !important; opacity: 1; }

/* ============================================================
   GLASS SURFACES — avatar dropdown + modals
   ============================================================ */
.avatar-dropdown {
  background: var(--glass-surface) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--r-glass) !important;
  box-shadow: var(--glass-shadow) !important;
  overflow: hidden; position: absolute;
}
.avatar-dropdown::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: var(--glass-sheen);
}
.avatar-dropdown > * { position: relative; z-index: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .avatar-dropdown { background: var(--glass-surface-flat) !important; }
}

/* Glass modal scrim — translucent + blurred (not flat black) */
.modal-backdrop {
  background: var(--overlay-backdrop) !important;
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
}
/* Glass modal surface */
.modal {
  position: relative;
  background: var(--glass-surface) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
  overflow: hidden;
}
.modal::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: var(--glass-sheen);
}
.modal > * { position: relative; z-index: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .modal { background: var(--glass-surface-flat) !important; }
}
.modal-header { border-bottom: 1px solid var(--glass-border) !important; }
.modal-footer { border-top: 1px solid var(--glass-border) !important; }
body.dark .modal-close:hover { background: var(--surface-hover); color: var(--ink); }

/* ============================================================
   TABLES — flat surface, uppercase muted headers, blue hover
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 11px !important; font-weight: 600 !important;
  text-transform: uppercase !important; letter-spacing: 0.06em !important;
  color: var(--muted) !important; background: transparent !important;
  border-bottom: 1px solid var(--border) !important; white-space: nowrap;
  vertical-align: middle;
}
thead th:first-child { padding-left: 20px; }
thead th:last-child { padding-right: 20px; }
thead th.num, thead th.actions, th[align="right"] { text-align: right; }
tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
  color: var(--text); vertical-align: middle; font-variant-numeric: tabular-nums;
}
tbody td:first-child { padding-left: 20px; }
tbody td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(21,106,255,0.04); }
body.dark thead th { border-bottom-color: rgba(255,255,255,0.07) !important; }
body.dark tbody td { border-bottom-color: rgba(255,255,255,0.06); }
body.dark tbody tr:hover { background: rgba(21,106,255,0.07); }
.cell-strong { color: var(--ink); font-weight: 700; }
.cell-meta { color: var(--muted); font-size: 12px; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-dash { color: var(--subtle); text-align: center; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--muted); }
.table-footer b { color: var(--ink); font-weight: 700; }
body.dark .table-footer { border-color: rgba(255,255,255,0.06); }

/* --- Table cell components --- */
.rating-cell { display: inline-flex; align-items: center; gap: 6px; }
.rating-stars { color: #F7D117; letter-spacing: 1px; font-size: 13px; }
.rating-stars .star-empty { color: #D0D3DA; }
body.dark .rating-stars .star-empty { color: #3A3A3E; }
.rating-num { font-size: 13px; font-weight: 700; color: var(--ink); }

.broker-stack { display: inline-flex; align-items: center; }
.broker-stack .bi { width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border); object-fit: cover; }
.broker-stack .bi + .bi, .broker-stack .bi-more { margin-left: -8px; }
.broker-stack .bi-more { width: 28px; height: 28px; border-radius: 50%; background: #EEF0F4; color: var(--muted); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--panel); }
body.dark .broker-stack .bi { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px rgba(255,255,255,0.06); }
body.dark .broker-stack .bi-more { background: #3A3A52; color: #C4C5CB; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,0.22); display: inline-block; }
.status-dot.paused { background: var(--amber); box-shadow: 0 0 0 3px rgba(251,191,36,0.22); }
.status-cell { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--green); }
.status-cell.paused { color: var(--amber); }

.cell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.btn-link-cell { color: var(--blue); font-size: 13px; font-weight: 600; background: none; border: none; cursor: pointer; font-family: inherit; }
.btn-link-cell:hover { text-decoration: underline; }
.btn-outline-cell { background: transparent; border: 1px solid var(--blue); color: var(--blue); border-radius: 8px; padding: 5px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-outline-cell:hover { background: rgba(21,106,255,0.06); }
body.dark .btn-outline-cell:hover { background: rgba(21,106,255,0.10); }
.btn-flatten { background: #64191F; color: #fff; border: none; border-radius: 8px; padding: 5px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-flatten:hover { background: #7A1E26; }
.cell-kebab { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; }
.cell-kebab:hover { background: var(--surface-hover); color: var(--ink); }
.conn-delete-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; background: var(--red); color: #fff; border: none; border-radius: 8px; cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s; }
.conn-delete-btn:hover { background: #DC2626; }
body.dark .conn-delete-btn { background: transparent; color: var(--red); }
body.dark .conn-delete-btn:hover { background: var(--red-soft); }

/* ============================================================
   BUTTONS — weight 600, radius 9, full states
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--btn-radius) !important; font-size: 14px; font-weight: 600 !important;
  line-height: 1; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .05s;
  text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-pill { border-radius: 999px !important; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.btn-primary:hover { background: var(--blue-bright); border-color: var(--blue-bright); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.btn-primary:active { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring-strong); }
.btn-outline { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-softer); }
.btn-outline.btn-accent { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline.btn-accent:hover { background: var(--blue-softer); }
body.dark .btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
body.dark .btn-outline:hover { background: var(--surface-hover); border-color: var(--blue); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.onb-footer .btn-ghost, .banner-dark .btn-ghost { color: rgba(255,255,255,.65); }
.onb-footer .btn-ghost:hover, .banner-dark .btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
body.dark .btn-ghost { background: transparent; color: var(--muted); }
body.dark .btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }
body.dark .btn-danger { background: #DC2626; border-color: #DC2626; color: #fff; }
body.dark .btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-danger-soft { background: rgba(239,68,68,.12); color: var(--red); border-color: rgba(239,68,68,.25); }
.btn-danger-soft:hover { background: rgba(239,68,68,.20); }

/* ============================================================
   CONTROLS — toggle, tabs, segmented, inputs, select, checkbox, slider
   ============================================================ */
.toggle { position: relative; width: 36px; height: 20px; background: var(--border); border-radius: 20px; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: var(--shadow-sm); }
.toggle.on { background: var(--blue); }
.toggle.on::after { transform: translateX(16px); }
body.dark .toggle { background: var(--surface-hover); }
body.dark .toggle::after { background: var(--muted); }
body.dark .toggle.on { background: var(--blue); }
body.dark .toggle.on::after { background: #fff; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 12px 20px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border: none; background: transparent; position: relative; font-family: inherit; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--blue); border-radius: 2px; }

.filter-tabs { display: inline-flex; background: var(--surface-sunken); border-radius: 8px; padding: 3px; gap: 2px; border: 1px solid transparent; }
body.dark .filter-tabs { border-color: var(--border); }
.filter-tab { padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; border: none; background: transparent; transition: all .15s; font-family: inherit; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { background: var(--panel); color: var(--blue); box-shadow: var(--shadow-sm); }

.form-input, select.form-input, input.form-input, textarea.form-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--input-radius);
  font-size: 14px; font-family: inherit; color: var(--text); background: var(--input-bg, var(--white)); width: 100%;
}
select.form-input {
  padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23767D8C' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form-input:focus, select.form-input:focus, textarea.form-input:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus-ring); }
.form-input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.form-input.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

input[type="range"].font-scale { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px; background: linear-gradient(var(--blue), var(--blue)) no-repeat var(--border); background-size: var(--fill, 50%) 100%; cursor: pointer; }
input[type="range"].font-scale::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .1s; }
input[type="range"].font-scale::-webkit-slider-thumb:hover { transform: scale(1.1); }
body.dark input[type="range"].font-scale { background-color: var(--border); }

/* ============================================================
   BADGES — promo pill, status tag/pill, info banner
   ============================================================ */
.promo-pill {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 14px; min-width: 84px; border-radius: 999px;
  line-height: 1; text-align: center; white-space: nowrap;
  background: linear-gradient(90deg, #716CF9 0%, #D84EA9 100%);
  box-shadow: 0 3px 10px -2px rgba(123,76,255,0.45); color: #fff; user-select: none;
}
.promo-pill .promo-value { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; }
.promo-pill .promo-label { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; color: rgba(255,255,255,0.88); }
.promo-pill.is-special { background: linear-gradient(90deg, #FA7315 0%, #E23623 100%); box-shadow: 0 3px 10px -2px rgba(240,80,30,0.45); }
.promo-pill:hover { filter: brightness(1.06); }
.foryou-card .promo-pill, .offer-card .promo-pill { border-radius: 9px; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag-green { background: var(--green-soft); color: #065F46; }
.tag-red { background: var(--red-soft); color: #991B1B; }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-amber { background: var(--amber-soft); color: #92400E; }
body.dark .tag-green { color: var(--tag-green-fg); }
body.dark .tag-red { color: var(--tag-red-fg); }
body.dark .tag-blue { color: var(--tag-blue-fg); }
body.dark .tag-amber { color: var(--tag-amber-fg); }
body.dark .tag-purple { background: rgba(168,85,247,0.14); color: var(--tag-purple-fg); }

.info-banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.45; border: 1px solid transparent; }
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.info-banner .info-dismiss { margin-left: auto; color: currentColor; opacity: .6; cursor: pointer; border: 0; background: transparent; padding: 2px; border-radius: 6px; }
.info-banner .info-dismiss:hover { opacity: 1; background: rgba(127,127,127,0.12); }
.info-banner.info-blue { background: var(--blue-soft); border-color: rgba(21,106,255,0.20); color: #0457FF; }
.info-banner.info-blue svg { color: var(--blue); }
.info-banner.info-amber { background: linear-gradient(135deg, #FEF3C7, rgba(254,243,199,0.55)); border-color: rgba(245,158,11,0.30); color: #92400E; }
.info-banner.info-amber svg { color: #F59E0B; }
body.dark .info-banner.info-blue { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.30); color: #93C5FD; }
body.dark .info-banner.info-blue svg { color: #60A5FA; }
body.dark .info-banner.info-amber { background: linear-gradient(135deg, rgba(251,191,36,0.14), rgba(251,191,36,0.07)); border-color: rgba(251,191,36,0.35); color: #FCD34D; }
body.dark .info-banner.info-amber svg { color: #FBBF24; }

/* ============================================================
   ONBOARDING STEP BANNER — compact, subtle blue, segmented bar
   ============================================================ */
.onb-step { display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden; padding: 18px 20px; border-radius: 14px; margin-bottom: 20px; background: linear-gradient(135deg, #F2F6FF 0%, #E9F1FF 100%); border: 1px solid rgba(21,106,255,0.18); box-shadow: 0 2px 8px rgba(12,20,117,0.06); }
.onb-step__num { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #156AFF, #0457FF); color: #fff; font: 800 15px/1 var(--font-mono); box-shadow: 0 4px 12px rgba(21,106,255,0.30); }
.onb-step__body { flex: 1; min-width: 0; }
.onb-step__title { font-size: 15px; font-weight: 700; color: #1A2640; }
.onb-step__sub { font-size: 12.5px; color: #767D8C; margin-top: 2px; }
.onb-step__bar { display: flex; gap: 4px; max-width: 260px; margin-top: 10px; }
.onb-step__bar span { flex: 1; height: 4px; border-radius: 2px; background: #E6E8EC; transition: background .3s; }
.onb-step__bar span.done, .onb-step__bar span.active { background: #156AFF; }
.onb-step__count { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #156AFF; margin-top: 8px; }
.onb-step__actions { flex-shrink: 0; }
body.dark .onb-step { background: linear-gradient(135deg, #15171D 0%, #171A22 100%); border-color: rgba(59,130,246,0.22); box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(59,130,246,0.10); }
body.dark .onb-step::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 120% 80% at 50% -40%, rgba(21,106,255,0.16), transparent 46%); }
body.dark .onb-step__title { color: #F1F5F9; }
body.dark .onb-step__sub { color: #8B92A3; }
body.dark .onb-step__count { color: #A5B4FC; }
body.dark .onb-step__bar span { background: rgba(255,255,255,0.12); }
body.dark .onb-step__bar span.done { background: #34D399; }
body.dark .onb-step__bar span.active { background: #3B82F6; }
.onb-step > * { position: relative; z-index: 1; }

/* ============================================================
   EMPTY STATE — neutral + blue variants
   ============================================================ */
.empty-state { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 320px; }
.empty-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; background: #F2F6FF; color: #156AFF; }
.empty-icon svg { width: 28px; height: 28px; }
.empty-icon.is-neutral { background: #F4F5F7; color: #767D8C; border: 1px solid #E6E8EC; }
.empty-title { font-size: 16px; font-weight: 700; color: #1A2640; margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: #767D8C; max-width: 380px; margin: 0 auto 16px; }
body.dark .empty-icon { background: rgba(59,130,246,0.08); color: #3B82F6; }
body.dark .empty-icon.is-neutral { background: #1F2128; color: #8B92A3; border-color: #272930; }
body.dark .empty-title { color: #F1F5F9; }
body.dark .empty-desc { color: #8B92A3; }

/* ============================================================
   DISCORD COMMUNITY BANNER — full, with illustration
   ============================================================ */
.discord-banner { position: relative; overflow: hidden; border-radius: 14px; padding: 20px 22px; min-height: 128px; background: linear-gradient(135deg, #5865F2 0%, #7C3AED 100%); color: #fff; box-shadow: 0 10px 30px -12px rgba(88,101,242,0.55); }
body.dark .discord-banner { background: linear-gradient(135deg, #4A4DE0 0%, #6D28D9 100%); box-shadow: 0 14px 36px -14px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08); }
.discord-banner__pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: #fff; color: #5865F2; font-size: 13px; font-weight: 700; border: none; cursor: pointer; font-family: inherit; box-shadow: 0 4px 12px rgba(0,0,0,0.18); transition: transform .15s, background .15s; position: relative; z-index: 2; }
.discord-banner__pill svg { width: 18px; height: 18px; }
.discord-banner__pill:hover { background: #F1F2FF; transform: scale(1.02); }
.discord-banner__copy { font-size: 12.5px; color: rgba(255,255,255,0.85); margin-top: 12px; max-width: 62%; position: relative; z-index: 2; line-height: 1.5; }
/* decorative illustration substitute — glow blobs + floating orbs */
.discord-banner::after { content: ''; position: absolute; right: -30px; bottom: -56px; width: 220px; height: 220px; pointer-events: none; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.22), transparent 60%), radial-gradient(circle at 70% 70%, rgba(124,58,237,0.55), transparent 65%); border-radius: 50%; }
.discord-orbs { position: absolute; right: 14px; bottom: 12px; width: 150px; height: 96px; pointer-events: none; z-index: 1; opacity: .95; }

/* Help panel community uses the new banner cleanly */
.hsp-discord-banner { background: none !important; padding: 0 !important; min-height: 0 !important; }

/* ============================================================
   GLOBAL POLISH — mono numerics, consistent radii on cards
   ============================================================ */
.stat-value, .kpi-value, .balance-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono, .account-id, .price-value { font-family: var(--font-mono); }

/* ============================================================
   ONBOARDING / "CHOOSE YOUR PLAN" BANNER — theme-aware retint
   to match the target step banner. Scoped to skip admin banners
   that carry their own inline background.
   ============================================================ */
body:not(.dark) .onboarding-banner:not([style*="background"]) {
  background: linear-gradient(135deg, #F2F6FF 0%, #E9F1FF 100%);
  color: var(--ink);
  border: 1px solid rgba(21,106,255,0.18);
  box-shadow: 0 2px 8px rgba(12,20,117,0.06);
}
body:not(.dark) .onboarding-banner:not([style*="background"])::before,
body:not(.dark) .onboarding-banner:not([style*="background"])::after { display: none; }
body:not(.dark) .onboarding-banner:not([style*="background"]) .onboarding-title { color: var(--ink); }
body:not(.dark) .onboarding-banner:not([style*="background"]) .onboarding-sub { color: var(--muted); }
body:not(.dark) .onboarding-banner:not([style*="background"]) .onboarding-eyebrow {
  background: var(--blue-soft); border-color: transparent; color: var(--blue);
}
body:not(.dark) .onboarding-banner:not([style*="background"]) .step-progress { background: #E6E8EC; }
/* Ghost "Skip" button readable on the light banner */
body:not(.dark) .onboarding-banner:not([style*="background"]) .btn-ghost { color: var(--muted); }
body:not(.dark) .onboarding-banner:not([style*="background"]) .btn-ghost:hover { background: rgba(21,106,255,0.06); color: var(--blue); }

/* Dark mode: calmer near-black step banner with faint blue sheen (match target) */
body.dark .onboarding-banner:not([style*="background"]) {
  background: linear-gradient(135deg, #15171D 0%, #171A22 100%);
  border: 1px solid rgba(59,130,246,0.22);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(59,130,246,0.10);
}

/* ----- The persistent compact step strip (.onb-footer) -----
   Target shows a subtle LIGHT-BLUE card in light mode (not dark slate). */
body:not(.dark) .onb-footer {
  background: linear-gradient(135deg, #F2F6FF 0%, #E9F1FF 100%);
  box-shadow: 0 2px 8px rgba(12,20,117,0.06), 0 0 0 1px rgba(21,106,255,0.14);
}
body:not(.dark) .onb-footer-title { color: var(--ink); }
body:not(.dark) .onb-footer-step { color: var(--blue); }
body:not(.dark) .onb-footer-desc { color: var(--muted); }
body:not(.dark) .onb-footer-progress .dot { background: #E6E8EC; }
body:not(.dark) .onb-footer-progress .dot.active { background: var(--blue); }
body:not(.dark) .onb-footer-progress .dot.done { background: var(--green); }
body:not(.dark) .onb-footer-close { color: var(--subtle); }
body:not(.dark) .onb-footer-close:hover { background: rgba(21,106,255,0.08); color: var(--blue); }
body:not(.dark) .onb-footer-actions .btn-ghost { color: var(--muted) !important; }
body:not(.dark) .onb-footer-actions .btn-ghost:hover { background: rgba(21,106,255,0.06) !important; color: var(--blue) !important; }
/* Dark mode: align the strip to the calmer near-black target tone */
body.dark .onb-footer {
  background: linear-gradient(135deg, #15171D 0%, #171A22 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(59,130,246,0.12);
}
