/* Shared dark finish for the dashboard, validation, research, and sign-in. */
body.theme-dashboard,
body.theme-validation,
body.theme-research,
body.theme-login {
  --night: #0c1719;
  --rail: #0b1b1f;
  --surface: #142427;
  --surface-raised: #1b3032;
  --surface-soft: #17292b;
  --line: #2c4542;
  --text: #e9f2eb;
  --muted: #a4bbb0;
  --quiet: #809b90;
  --lime: #d0eb8a;
  --green: #87cfac;
  color: var(--text);
  background: radial-gradient(circle at 85% -12%, #16342e 0, transparent 36%), var(--night);
  color-scheme: dark;
  text-rendering: optimizeLegibility;
}

body[class^="theme-"] ::selection { background: #bfe57966; color: #f8fff4; }
body[class^="theme-"] button,
body[class^="theme-"] a,
body[class^="theme-"] input,
body[class^="theme-"] select { transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
body[class^="theme-"] :focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

/* Overview and My Trades */
.theme-dashboard .sidebar { background: var(--rail); border-right: 1px solid #27423c; }
.theme-dashboard .brand-mark { background: var(--lime); color: #143125; }
.theme-dashboard .brand small,
.theme-dashboard .sidebar-bottom small { color: #96b4a5; }
.theme-dashboard .nav-link { color: #b2c8bd; }
.theme-dashboard .nav-link:hover { background: #203936; color: #fff; }
.theme-dashboard .nav-link.active { background: #d1eb90; color: #173327; box-shadow: 0 6px 18px #0003; }
.theme-dashboard .sidebar-bottom { border-color: #29443f; color: #d4e5d8; }
.theme-dashboard .logout-form button { border-color: #35544a; color: #bdd3c6; }
.theme-dashboard .topbar { background: #101e21; border-color: var(--line); }
.theme-dashboard .crumb { color: #9cb6aa; }
.theme-dashboard .crumb b { color: var(--text); }
.theme-dashboard .top-status { color: var(--muted); }
.theme-dashboard .source-badge { background: #1e4036; color: #ade0af; }
.theme-dashboard .source-badge.demo { background: #40331e; color: #e5c185; }
.theme-dashboard .eyebrow { color: #9cd8ae; }
.theme-dashboard .hero { background: radial-gradient(circle at 85% 20%, #245548 0, transparent 43%), linear-gradient(125deg,#12302f,#11252b 68%); border: 1px solid #3d6859; box-shadow: 0 22px 55px #020d0c66; }
.theme-dashboard .hero-content>p:not(.eyebrow) { color: #c5d9ce; }
.theme-dashboard .hero h1 em { color: var(--lime); }
.theme-dashboard .run-button,
.theme-dashboard .primary-button { background: var(--lime); color: #173326; box-shadow: 0 9px 22px #0003; }
.theme-dashboard .run-button:hover,
.theme-dashboard .primary-button:hover { background: #e1f7a5; }
.theme-dashboard .engine-progress,
.theme-dashboard .trial-universe,
.theme-dashboard .empty-state,
.theme-dashboard .result-card,
.theme-dashboard .saved-card,
.theme-dashboard .phone-card,
.theme-dashboard .level-box { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: 0 10px 28px #0411123b; }
.theme-dashboard .phone-card { background: linear-gradient(115deg,#1d3934,#142629 75%); }
.theme-dashboard .result-card.expanded { border-color: #6aa888; }
.theme-dashboard .result-head:hover { background: #203735; }
.theme-dashboard .result-body,
.theme-dashboard .detail-checks,
.theme-dashboard .saved-card details,
.theme-dashboard .trade-form,
.theme-dashboard .trade-more,
.theme-dashboard .detail-actions { border-color: var(--line); }
.theme-dashboard .detail-panel,
.theme-dashboard .detail-actions { background: #102023; color: var(--text); }
.theme-dashboard .detail-chart { background: #152529; border-color: var(--line); }
.theme-dashboard .empty-state { border-style: dashed; }
.theme-dashboard .empty-state h3,
.theme-dashboard .page-intro h1,
.theme-dashboard .section-header h2,
.theme-dashboard .saved-card h3,
.theme-dashboard .phone-title-row h2,
.theme-dashboard .detail-panel h2,
.theme-dashboard .detail-checks h3 { color: var(--text); }
.theme-dashboard .empty-state p,
.theme-dashboard .result-stamp,
.theme-dashboard .summary-chip,
.theme-dashboard .score-note,
.theme-dashboard .page-intro>p:last-child,
.theme-dashboard .saved-card p,
.theme-dashboard .saved-card .meta,
.theme-dashboard .detail-muted,
.theme-dashboard .detail-subtitle,
.theme-dashboard .phone-copy>p,
.theme-dashboard .phone-note,
.theme-dashboard .engine-progress p,
.theme-dashboard .trial-universe p { color: var(--muted); }
.theme-dashboard .summary-chip strong,
.theme-dashboard .saved-card .meta b,
.theme-dashboard .level-box strong,
.theme-dashboard .ticker-name strong { color: var(--text); }
.theme-dashboard .check-item,
.theme-dashboard .trade-form label,
.theme-dashboard .level-box small { color: #b7d0c0; }
.theme-dashboard .progress-track { background: #2b423c; }
.theme-dashboard .progress-fill { background: #9cdaa7; }
.theme-dashboard .view-button,
.theme-dashboard .secondary-button,
.theme-dashboard .outline-button,
.theme-dashboard .icon-button { background: #203a34; color: #d7eed7; border-color: #426a55; }
.theme-dashboard .view-button:hover,
.theme-dashboard .secondary-button:hover,
.theme-dashboard .outline-button:hover,
.theme-dashboard .icon-button:hover { background: #2b4b3e; color: #fff; }
.theme-dashboard .trade-form input,
.theme-dashboard .trade-form select,
.theme-dashboard .topic-row code { background: #102024; color: var(--text); border-color: #3b5850; }
.theme-dashboard .message { background: #193d32; color: #c7efd1; border-color: #397452; }
.theme-dashboard .message.error { background: #3a2525; color: #f2b6aa; border-color: #94534b; }
.theme-dashboard .pill { background: #214235; color: #bce6c3; }
.theme-dashboard .pill.review { background: #493820; color: #f0ca86; }
.theme-dashboard .pill.closed { background: #293636; color: #acc1b7; }
.theme-dashboard .phone-status,
.theme-dashboard .count-pill { background: #284938; color: #c6e9bd; }

/* TradingAgents validation */
.theme-validation .rail { background: var(--rail); border-right: 1px solid #27423c; }
.theme-validation .brand-mark { background: var(--lime); color: #143125; }
.theme-validation .rail nav a { color: #b3cbbd; }
.theme-validation .rail nav a.active,
.theme-validation .rail nav a:hover { background: #254a3c; color: #f1faed; }
.theme-validation .rail-note { color: #9eb9aa; }
.theme-validation .top { background: #101e21; border-color: var(--line); color: #9db8ab; }
.theme-validation .top span:last-child { color: #a8dcb4; }
.theme-validation .intro { background: radial-gradient(circle at 88% 25%,#2b6650 0,transparent 38%),linear-gradient(120deg,#153d36,#11262b); border: 1px solid #3d6859; box-shadow: 0 18px 42px #03121066; }
.theme-validation .intro p:last-child { color: #cbe1d0; }
.theme-validation .intro .eyebrow,
.theme-validation .eyebrow { color: #a6ddb4; }
.theme-validation .panel { background: var(--surface); border-color: var(--line); box-shadow: 0 12px 30px #03101240; }
.theme-validation .panel h2,
.theme-validation .detail-header h2,
.theme-validation .confirm-card h3,
.theme-validation .saved-research h3,
.theme-validation .report-bar h3,
.theme-validation .checks h3 { color: var(--text); }
.theme-validation .panel-help,
.theme-validation .empty,
.theme-validation .empty-detail p,
.theme-validation .detail-header p,
.theme-validation .row-meta,
.theme-validation .footer-note,
.theme-validation .muted,
.theme-validation .provider-label { color: var(--muted); }
.theme-validation .setup-row-wrap,
.theme-validation .setup-row,
.theme-validation .search-result,
.theme-validation .confirm-card,
.theme-validation .saved-report-button,
.theme-validation .hidden-item { background: var(--surface-soft); border-color: var(--line); color: var(--text); }
.theme-validation .setup-row-wrap.active,
.theme-validation .setup-row-wrap:hover,
.theme-validation .search-result:hover,
.theme-validation .search-result.active,
.theme-validation .saved-report-button:hover { background: #203a35; border-color: #6caa82; }
.theme-validation .row-top small,
.theme-validation .row-levels,
.theme-validation .saved-report-button span,
.theme-validation .search-result span { color: #afc8b9; }
.theme-validation .row-top span,
.theme-validation .search-result strong,
.theme-validation .saved-report-button strong { color: #f0f8ee; }
.theme-validation .chart { background: #152529; border-color: var(--line); }
.theme-validation .comparison th,
.theme-validation .comparison td { border-color: var(--line); }
.theme-validation .comparison th { color: #a3bcaf; }
.theme-validation .comparison td { color: #e4eee7; }
.theme-validation .comparison td:first-child { color: #b6cec0; }
.theme-validation .report { background: #102023; border-color: var(--line); }
.theme-validation .report summary { color: #cfebd1; }
.theme-validation .report pre { color: #c2d7cb; }
.theme-validation .checks,
.theme-validation .saved-research,
.theme-validation .hidden-section,
.theme-validation .report-bar { border-color: var(--line); }
.theme-validation .check-row { color: #d1e4d8; }
.theme-validation .badge,
.theme-validation .count,
.theme-validation .rating { background: #284d3b; color: #caebc5; }
.theme-validation .badge.demo { background: #4b3d23; color: #eed398; }
.theme-validation .primary { background: var(--lime); color: #18372b; box-shadow: 0 7px 20px #0003; }
.theme-validation .primary:hover { background: #e1f7a5; }
.theme-validation .search-controls input { background: #102024; border-color: #3b5850; color: var(--text); }
.theme-validation .ticker-search label { color: #bdd2c3; }
.theme-validation .search-controls input::placeholder { color: #89a498; }
.theme-validation .search-controls input:focus { border-color: #9ace9d; box-shadow: 0 0 0 3px #9ace9d22; }
.theme-validation .notice,
.theme-validation .plan-ready { background: #1a3c31; color: #c8ecd1; border-color: #3d7454; }
.theme-validation .notice.error { background: #412a29; color: #f3c3b5; border-color: #925b51; }
.theme-validation .plan-warning { background: #433621; color: #f2d298; border-color: #866941; }
.theme-validation .remove-button,
.theme-validation .restore-button,
.theme-validation .saved-remove-button { background: #203732; color: #d0e3d5; border-color: #466256; }
.theme-validation .remove-button:hover,
.theme-validation .saved-remove-button:hover { background: #4b302d; color: #f5c9bd; border-color: #935d54; }
.theme-validation .logout-form button { border-color: #35544a; color: #bdd3c6; }

/* Research, already dark, brought into the same palette. */
.theme-research .topbar { background: #101e21; border-color: var(--line); }
.theme-research .topbar h1,
.theme-research h2,
.theme-research .metric strong { color: var(--text); }
.theme-research .eyebrow { color: #a5d8af; }
.theme-research .card { background: var(--surface); border-color: var(--line); box-shadow: 0 12px 30px #030d0e44; }
.theme-research .hero { background: radial-gradient(circle at 82% 4%,#245347 0,transparent 40%),#142d2d; border-color: #426d58; }
.theme-research .button,
.theme-research .logout-form button,
.theme-research .tab { background: #203734; color: #d8e9df; border-color: #416158; }
.theme-research .button:hover,
.theme-research .logout-form button:hover,
.theme-research .tab:hover { background: #2b4b41; }
.theme-research .button.primary,
.theme-research .tab.active { background: var(--lime); color: #18372b; border-color: var(--lime); }
.theme-research .button.primary:hover { background: #e1f7a5; }
.theme-research th { background: #1c3433; color: #a9c5b7; }
.theme-research td,
.theme-research .phase-rule { border-color: var(--line); }
.theme-research tbody tr:hover,
.theme-research tbody tr.selected,
.theme-research .phase-table tbody tr.selected { background: #224037; }
.theme-research .phase-stats div,
.theme-research .phase-evidence,
.theme-research .level-box,
.theme-research .metric { background: var(--surface-soft); border-color: var(--line); }
.theme-research .chart { background: #152529; border-color: var(--line); }
.theme-research .backtest-form input,
.theme-research .trade-form input { background: #102024; border-color: #3b5850; color: var(--text); }
.theme-research .small,
.theme-research .muted,
.theme-research .footnote,
.theme-research .metric span,
.theme-research .metric small,
.theme-research .notes p,
.theme-research footer { color: var(--muted); }

/* Sign-in follows the same dark surfaces without losing its clear hierarchy. */
.theme-login .story { background: radial-gradient(circle at 74% 6%,#275947 0,transparent 40%),linear-gradient(145deg,#102b2c,#0b1a20 76%); }
.theme-login .form-side { background: radial-gradient(circle at 100% 0,#18322b 0,transparent 34%),#101e21; }
.theme-login .login-card { padding: 28px 0; }
.theme-login .login-card h2 { color: var(--text); }
.theme-login .form-intro,
.theme-login .help { color: var(--muted); }
.theme-login .help { border-color: var(--line); }
.theme-login .form-foot { color: var(--quiet); }
.theme-login .lock-mark { background: #254737; color: var(--lime); }
.theme-login .form-side .eyebrow { color: #a2d7aa; }
.theme-login .login-card label { color: #d3e5d7; }
.theme-login .login-card input:not([type=hidden]) { background: #17292b; border-color: #3b5650; color: var(--text); }
.theme-login .login-card input:focus { border-color: #b0d987; box-shadow: 0 0 0 3px #a4d48725; }
.theme-login .password-field button { color: #bde3b1; }
.theme-login .submit { background: var(--lime); color: #173326; }
.theme-login .submit:hover { background: #e1f7a5; }
.theme-login .error { background: #412a29; color: #f3c3b5; border-color: #925b51; }
.theme-login .signal-card { background: #d5f2d509; border-color: #87b49b55; }

@media (max-width: 570px) {
  .theme-validation .main,
  .theme-validation .content { width: 100%; min-width: 0; max-width: 100%; }
  .theme-validation .top span:last-child { display: none; }
  .theme-validation .intro,
  .theme-validation .panel { min-width: 0; }
}
