:root,[data-tms-theme="emerald-gold"]{
--tms-bg:#06110d;--tms-surface:rgba(12,37,28,.9);--tms-surface-strong:#0d2a20;--tms-border:rgba(214,175,88,.3);--tms-gold:#d6af58;--tms-gold-strong:#f0c96f;--tms-accent:#d6af58;--tms-brand-glass:linear-gradient(145deg,rgba(22,138,105,.76),rgba(6,61,48,.8));--tms-page-glow:rgba(22,138,105,.17);
}
[data-tms-theme="sapphire-night"]{
--tms-bg:#050b16;--tms-surface:rgba(10,27,51,.9);--tms-surface-strong:#0b2342;--tms-border:rgba(156,200,239,.3);--tms-gold:#9cc8ef;--tms-gold-strong:#c6e2fa;--tms-accent:#9cc8ef;--tms-brand-glass:linear-gradient(145deg,rgba(34,100,162,.76),rgba(7,30,61,.8));--tms-page-glow:rgba(34,100,162,.17);
}
[data-tms-theme="graphite-copper"]{
--tms-bg:#0b0d0e;--tms-surface:rgba(34,36,37,.9);--tms-surface-strong:#252829;--tms-border:rgba(200,139,97,.3);--tms-gold:#c88b61;--tms-gold-strong:#e0ae86;--tms-accent:#c88b61;--tms-brand-glass:linear-gradient(145deg,rgba(88,74,65,.76),rgba(26,28,29,.8));--tms-page-glow:rgba(88,74,65,.17);
}
[data-tms-theme="royal-violet"]{
--tms-bg:#090612;--tms-surface:rgba(34,18,62,.9);--tms-surface-strong:#291444;--tms-border:rgba(220,193,123,.3);--tms-gold:#dcc17b;--tms-gold-strong:#f3dda1;--tms-accent:#dcc17b;--tms-brand-glass:linear-gradient(145deg,rgba(91,48,142,.76),rgba(24,10,45,.8));--tms-page-glow:rgba(91,48,142,.17);
}
[data-tms-theme="midnight-teal"]{
--tms-bg:#071316;--tms-surface:rgba(13,41,45,.9);--tms-surface-strong:#10343a;--tms-border:rgba(125,207,197,.3);--tms-gold:#7dcfc5;--tms-gold-strong:#b4eee5;--tms-accent:#7dcfc5;--tms-brand-glass:linear-gradient(145deg,rgba(31,114,108,.76),rgba(12,48,54,.8));--tms-page-glow:rgba(31,114,108,.17);
}
[data-tms-theme="obsidian-silver"]{
--tms-bg:#0d1014;--tms-surface:rgba(28,34,41,.9);--tms-surface-strong:#262d35;--tms-border:rgba(192,203,213,.3);--tms-gold:#c0cbd5;--tms-gold-strong:#e9eef3;--tms-accent:#c0cbd5;--tms-brand-glass:linear-gradient(145deg,rgba(80,91,102,.76),rgba(23,29,36,.8));--tms-page-glow:rgba(80,91,102,.17);
}
[data-tms-theme="olive-sand"]{
--tms-bg:#10130c;--tms-surface:rgba(36,44,28,.9);--tms-surface-strong:#303c26;--tms-border:rgba(201,191,139,.3);--tms-gold:#c9bf8b;--tms-gold-strong:#e8deb1;--tms-accent:#c9bf8b;--tms-brand-glass:linear-gradient(145deg,rgba(89,103,72,.76),rgba(36,45,28,.8));--tms-page-glow:rgba(89,103,72,.17);
}
[data-tms-theme="mocha-cream"]{
--tms-bg:#15100e;--tms-surface:rgba(44,33,30,.9);--tms-surface-strong:#3b2c26;--tms-border:rgba(212,189,158,.3);--tms-gold:#d4bd9e;--tms-gold-strong:#f0e1c8;--tms-accent:#d4bd9e;--tms-brand-glass:linear-gradient(145deg,rgba(106,79,64,.76),rgba(45,33,28,.8));--tms-page-glow:rgba(106,79,64,.17);
}
[data-tms-theme="indigo-ice"]{
--tms-bg:#0b1020;--tms-surface:rgba(26,35,65,.9);--tms-surface-strong:#243057;--tms-border:rgba(173,195,250,.3);--tms-gold:#adc3fa;--tms-gold-strong:#dbe7ff;--tms-accent:#adc3fa;--tms-brand-glass:linear-gradient(145deg,rgba(60,77,146,.76),rgba(24,36,64,.8));--tms-page-glow:rgba(60,77,146,.17);
}
[data-tms-theme="charcoal-amber"]{
--tms-bg:#12120f;--tms-surface:rgba(38,38,32,.9);--tms-surface-strong:#333229;--tms-border:rgba(224,180,101,.3);--tms-gold:#e0b465;--tms-gold-strong:#f6d398;--tms-accent:#e0b465;--tms-brand-glass:linear-gradient(145deg,rgba(103,96,67,.76),rgba(40,39,32,.8));--tms-page-glow:rgba(103,96,67,.17);
}
/* User-selectable dark themes. Semantic profit/loss/warning colors stay fixed. */
[data-tms-theme]{
    /*
     * Legacy aliases keep older modules on the same palette as the modern
     * design tokens. They intentionally describe presentation only; semantic
     * profit, loss, warning and trade-state colors remain module-owned.
     */
    --page:var(--tms-bg);--surface:var(--tms-surface);--surface-raised:var(--tms-surface-strong);
    --field:var(--tms-input-bg);--text:var(--tms-text);--muted:var(--tms-muted);
    --line:var(--tms-border);--line-soft:var(--tms-border-soft);
    --gold:var(--tms-gold);--gold-hover:var(--tms-gold-strong);--gold-soft:var(--tms-accent-medium);
    --primary:var(--tms-surface-strong);--primary-hover:var(--tms-accent-medium);
    --nav-bg:var(--tms-navigation-bg);--account-border:var(--tms-border);
    --account-glass:var(--tms-surface-glass);
}
[data-tms-theme]{
    --tms-surface-glass:color-mix(in srgb,var(--tms-surface) 86%,transparent);
    --tms-surface-soft:color-mix(in srgb,var(--tms-surface-strong) 62%,transparent);
    --tms-surface-subtle:color-mix(in srgb,var(--tms-surface-strong) 34%,transparent);
    --tms-input-bg:color-mix(in srgb,var(--tms-bg) 72%,var(--tms-surface-strong));
    --tms-navigation-bg:color-mix(in srgb,var(--tms-bg) 95%,transparent);
    --tms-accent-soft:color-mix(in srgb,var(--tms-accent) 10%,transparent);
    --tms-accent-medium:color-mix(in srgb,var(--tms-accent) 28%,transparent);
    --tms-border-soft:color-mix(in srgb,var(--tms-border) 64%,transparent);
    --tms-text:#eef3f0;--tms-muted:#8e9b95;
}
html{background:var(--tms-bg)}
body{background-color:var(--tms-bg)!important;background-image:radial-gradient(circle at 50% -18%,var(--tms-page-glow),transparent 42%)!important}
.tme-topbar,.market-session-strip,.economic-news-strip{background-color:color-mix(in srgb,var(--tms-bg) 91%,transparent)!important}
.tme-topbar-brand>span,.auth-mark,.tms-loader-logo{background:var(--tms-brand-glass)!important;border-color:color-mix(in srgb,var(--tms-accent) 68%,transparent)!important;color:#f0c96f!important;box-shadow:inset 0 1px rgba(255,255,255,.13),0 12px 30px rgba(0,0,0,.32)!important;backdrop-filter:blur(18px) saturate(125%)}
.admin-page .tme-topbar-brand>span{background:var(--tms-brand-glass)!important;border-color:#ef405f!important;color:#f0c96f!important}
/* Brand lettering is invariant; theme accents still apply to other UI. */
.auth-brand>span,.legal-logo,.admin-access-identity strong,.brand-mark{color:#f0c96f!important}
.auth-card,.module-card,.settings-card,.settings-panel,.profile-card,.profile-hero-card,.management-panel,.summary-panel,.portfolio-ledger-panel,.account-card,.dashboard-card,.analytics-card,.journal-panel,.scenario-card{background-color:var(--tms-surface)!important;border-color:var(--tms-border)}

/*
 * Complete theme bridge
 * ---------------------
 * Older modules originally owned emerald-colored backgrounds. These grouped
 * overrides connect every structural surface to the active theme without
 * touching semantic success, loss, warning or trade-state colors.
 */
.account-management-page,.auth-page,.profile-page,.onboarding-page,.manual-trade-page,
.economic-calendar-page,.mt5-import-page,.admin-access-page{
    background-color:var(--tms-bg)!important;
    background-image:radial-gradient(circle at 50% -18%,var(--tms-page-glow),transparent 42%)!important;
    color:var(--tms-text)!important;
}
.tme-topbar,.account-sidebar,.admin-sidebar,.market-session-strip,.economic-news-strip{
    background:var(--tms-navigation-bg)!important;
    border-color:var(--tms-border)!important;
}
.admin-summary-card,.admin-panel,.admin-service-card,.admin-quick-grid>a,.admin-health-list article,.pattern-row,
.admin-definition-grid>div,.database-action-card,.database-history-panel,
.auth-card,.registration-step,.profile-card,.profile-hero-card,.identity-card dl>div,
.profile-summary-card dl>div,.verification-card,.onboarding-card,.admin-access-card,.admin-access-identity,
    .input-panel,.engine-wizard-summary,.engine-wizard-summary-list article,.result-glass,#results .panel,#results .metrics-grid article,#results .scenario-card,
.engine-mode-grid button,.engine-choice-grid label span,.engine-choice-grid span,.pattern-visual-grid button,
.account-snapshot-grid article,.scenario-metric-grid article,
.take-trade-review-grid>div,.take-trade-review-grid>label,.take-trade-review-grid>button,
.split-allocation-summary>div,.split-allocation-card,.before-trade-capture,
.dashboard-filters,.summary-values div,.financial-strip article,.dashboard-shortcuts a,.chart-panel,.account-pl,
.account-detail-metrics article,.account-history-metrics article,.account-table-view,.portfolio-mobile-card,
.overall-analysis-metrics article,.engine-draft-card dl div,.account-view-toggle,
.merge-accounts-panel,.creation-wizard .wizard-step,.record-actions[open]>form,
.economic-sort,.economic-event-group,.economic-detail-grid article,
.help-search,.help-card,.final-review-card,.engine-draft-card,.performance-grid div,.journal-tabs a,
.settings-toggles label,.visibility-grid section,.pattern-setting-row,.settings-clock-grid>section,.settings-mobile-nav a,
.mt5-dropzone,.mt5-import-dropzone,.mt5-wizard-steps li,.mt5-account-lock>span,
.manual-trade-card,.manual-section,.manual-submit-row,.wizard-summary>div,
.engine-trade-card,.engine-trade-metrics>div,.final-review-metrics>div,
.glass-card:where(:not(.modal-content)),.metric-grid article,.trade-result-panel,.overall-journal-analysis,
.trade-media-hero,.trade-media-facts span,
.trade-notes-panel,.trade-charts-panel,.trade-note-card,.trade-chart-card,.trade-chart-preview,.trade-chart-preview>span,.trade-chart-dialog,
.tms-state,.tms-help-popover,.avatar-crop-stage,.profile-session-item,
.notification-panel,.tme-system-panel,.market-strip-item,
.admin-error-item,.copy-toast,.manual-time-badge,.account-empty,.mobile-card-toggle,.tms-action-tooltip,
.context-help::after,.admin-development-toggle,.admin-zero-state,.login-language-toggle{
    background:var(--tms-surface-glass)!important;
    border-color:var(--tms-border)!important;
}
.admin-form-grid input,.admin-backlog-form input,.admin-backlog-form select,.admin-backlog-form textarea,
.pattern-row input,.auth-field .form-control,.country-code-select,
.onboarding-form .form-control,.onboarding-form .form-select,
.profile-password-card .auth-field .form-control,.profile-personal-card .auth-field .form-control,
.verification-code-form .form-control,.profile-inline-verification .form-control,
.record-actions input,.record-actions select,.account-sort-control select,
.economic-sort .form-select,.mini-input,.journal-action-form input,.journal-action-form select,
.journal-action-form textarea,.filter-row select,.filter-row input,.development-form input,
.development-form select,.development-form textarea,.development-grid input,.development-grid select,
.development-grid textarea,.form-control,.form-select{
    background-color:var(--tms-input-bg)!important;
    border-color:var(--tms-border-soft)!important;
    color:var(--tms-text)!important;
}
.form-control:focus,.form-select:focus{
    border-color:var(--tms-accent)!important;
    box-shadow:0 0 0 .2rem var(--tms-accent-soft)!important;
}
.form-control.is-invalid,.form-select.is-invalid,.was-validated .form-control:invalid,.was-validated .form-select:invalid{
    border-color:#dc3545!important;
}
.form-control.is-valid,.form-select.is-valid,.was-validated .form-control:valid,.was-validated .form-select:valid{
    border-color:#31d297!important;
}
.aggregate-risk-control,.no-pattern-control,.admin-file-drop,.database-card-status,
.profile-file-control,.profile-mobile-nav a,.economic-group-empty{
    background:var(--tms-accent-soft)!important;
    border-color:var(--tms-border)!important;
}
.btn-warning,.btn-calculate,.registration-primary{
    border-color:var(--tms-accent)!important;
    background:linear-gradient(135deg,var(--tms-gold-strong),var(--tms-accent))!important;
    color:var(--tms-bg)!important;
}
.btn-outline-warning,.btn-outline-gold{
    border-color:var(--tms-accent)!important;
    background:var(--tms-accent-soft)!important;
    color:var(--tms-gold-strong)!important;
}
.economic-sort button,.economic-event-group>header span,.economic-event-group>header>b,
.economic-detail-grid span,.economic-calendar-page .modal-header small,.economic-empty i{
    color:var(--tms-gold-strong)!important;
}
.economic-sort button,.economic-event-group>header>b{
    border-color:var(--tms-border)!important;
    background:var(--tms-accent-soft)!important;
}
.manual-trade-page .trades-mode-toggle,.manual-section-heading i,
.mt5-wizard-steps b,.trade-note-card>header>i{
    border-color:var(--tms-border)!important;
    background:var(--tms-accent-soft)!important;
    color:var(--tms-gold-strong)!important;
}
.manual-form-heading,.manual-section,.manual-submit-row,.trade-note-card>header,.trade-note-card>footer,
.economic-card-timing,.final-review-actions,.journal-card-actions,.engine-trade-actions{
    border-color:var(--tms-border-soft)!important;
}
.manual-field .form-control,.manual-field .form-select,
.manual-wizard-step .form-control,.manual-wizard-step .form-select{
    background:var(--tms-input-bg)!important;
    border-color:var(--tms-border-soft)!important;
    color:var(--tms-text)!important;
}
.manual-submit{
    background:linear-gradient(135deg,var(--tms-gold-strong),var(--tms-accent))!important;
    color:var(--tms-bg)!important;
}
.engine-action{
    background:var(--tms-surface-soft)!important;
    border-color:var(--tms-border)!important;
    color:var(--tms-text)!important;
}
.engine-action.activate,.engine-action.protect,.engine-action.profit{border-color:#348a67!important;color:#64dda8!important}
.engine-action.loss,.engine-action.danger{border-color:#9a414c!important;color:#ff7a83!important}
.engine-trade-card{background:var(--tms-surface-glass)!important}
.engine-trade-card.is-at-risk{border-color:#d8b84f!important}
.engine-trade-card.is-protected{border-color:#3fcf91!important}
.engine-trade-card.is-inactive{border-color:#68736f!important}
.final-review-card.is-profit{border-color:#3fcf91!important}
.final-review-card.is-loss{border-color:#9f3947!important}
.final-review-card.is-neutral{border-color:#68736f!important}
.economic-event-card{background:var(--tms-surface-glass)!important;border-color:color-mix(in srgb,var(--impact) 48%,transparent)!important}
.economic-event-card.is-warning{border-color:#f2d15e!important}
.economic-event-card.is-critical{border-color:#ff536c!important;background:color-mix(in srgb,var(--tms-surface-strong) 82%,#711021 18%)!important}
.economic-event-card:hover,.economic-event-card:focus-visible{
    background:color-mix(in srgb,var(--tms-surface-strong) 92%,var(--tms-accent) 8%)!important;
}
.btn-outline-light{
    background:var(--tms-surface-soft)!important;
    border-color:var(--tms-border)!important;
    color:var(--tms-text)!important;
}
.btn-outline-light:hover,.btn-outline-light:focus-visible{
    background:var(--tms-accent-soft)!important;
    border-color:var(--tms-accent)!important;
    color:var(--tms-gold-strong)!important;
}
.tms-action-tooltip,.context-help::after{
    color:var(--tms-text)!important;
}
.settings-heading,.settings-card>header i,.settings-card h3,
.manual-section-heading span,.wizard-progress span,.mt5-account-lock strong,
.mt5-wizard-steps li.active,.economic-empty i{
    color:var(--tms-gold-strong)!important;
}
.wizard-progress i{
    background:linear-gradient(90deg,var(--tms-accent),var(--tms-gold-strong))!important;
}
.tme-module-links a:hover,.tme-module-links a.active,
.tme-profile-link:hover,.tme-profile-link.active,
.tme-settings-link:hover,.tme-settings-link.active,
.tme-admin-link:hover,.tme-admin-link.active,
.tme-user-actions button:hover,.tme-system-menu>summary:hover,
.tme-system-menu[open]>summary,.tme-system-menu.active>summary,
.tme-notifications>summary:hover,.tme-notifications[open]>summary,
.account-side-nav a:hover,.account-side-nav a.active,
.settings-mobile-nav a.active{
    background:var(--tms-accent-soft)!important;
    border-color:color-mix(in srgb,var(--tms-accent) 52%,transparent)!important;
    color:var(--tms-gold-strong)!important;
}
.admin-page .tme-admin-link.active{
    background:rgba(217,47,79,.12)!important;
    border-color:rgba(229,56,86,.58)!important;
    color:#ff637e!important;
}
.sidebar-tree-group,.sidebar-tree-children,.account-view-toggle,
.theme-choice,.portfolio-mobile-carousel .carousel-control-prev i,
.portfolio-mobile-carousel .carousel-control-next i{
    background:var(--tms-surface-subtle)!important;
    border-color:var(--tms-border-soft)!important;
}
.sidebar-collapse-control,.risk-reward-stepper button,.brand-stack small{
    background:var(--tms-input-bg)!important;
    border-color:var(--tms-border)!important;
    color:var(--tms-gold-strong)!important;
}
.theme-choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;margin-top:1rem}
.theme-choice{display:grid;gap:.45rem;padding:1rem;border:2px solid var(--tms-border);border-radius:18px;background:rgba(0,0,0,.16);cursor:pointer;transition:border-color .18s ease,transform .18s ease}
.theme-choice:has(input:checked){border-color:var(--tms-gold);box-shadow:0 0 0 3px color-mix(in srgb,var(--tms-gold) 13%,transparent)}
.theme-choice:hover{transform:translateY(-2px)}.theme-choice input{position:absolute;opacity:0}.theme-choice strong{color:#eef3f0;font-size:.85rem}.theme-choice small{color:#8e9b95;font-size:.68rem;line-height:1.5}
.theme-choice-preview{display:grid;height:72px;padding:.65rem;border-radius:13px;grid-template-columns:32% 1fr;grid-template-rows:1fr 1fr;gap:.38rem;background:#06110d}.theme-choice-preview i{grid-row:1/3;border-radius:9px;background:#14634c}.theme-choice-preview b,.theme-choice-preview em{border-radius:7px;background:#15392e}.theme-choice-preview em{background:#d6af58}.theme-choice-sapphire-night .theme-choice-preview em{background:#9cc8ef}.theme-choice-graphite-copper .theme-choice-preview em{background:#c88b61}.theme-choice-crimson-noir .theme-choice-preview em{background:#e34868}.theme-choice-royal-violet .theme-choice-preview em{background:#dcc17b}.theme-save-status{margin:.8rem 0 0;color:#88968f;font-size:.7rem}
@media(max-width:767.98px){.theme-choice-grid{grid-template-columns:1fr}.theme-choice{grid-template-columns:90px 1fr;align-items:center}.theme-choice-preview{grid-row:1/3}.theme-choice small{grid-column:2}}
.theme-choice-emerald-gold .theme-choice-preview{background:#06110d}.theme-choice-emerald-gold .theme-choice-preview i{background:#168a69}.theme-choice-emerald-gold .theme-choice-preview b{background:#0d2a20}.theme-choice-emerald-gold .theme-choice-preview em{background:#d6af58}
.theme-choice-sapphire-night .theme-choice-preview{background:#050b16}.theme-choice-sapphire-night .theme-choice-preview i{background:#2264a2}.theme-choice-sapphire-night .theme-choice-preview b{background:#0b2342}.theme-choice-sapphire-night .theme-choice-preview em{background:#9cc8ef}
.theme-choice-graphite-copper .theme-choice-preview{background:#0b0d0e}.theme-choice-graphite-copper .theme-choice-preview i{background:#584a41}.theme-choice-graphite-copper .theme-choice-preview b{background:#252829}.theme-choice-graphite-copper .theme-choice-preview em{background:#c88b61}
.theme-choice-royal-violet .theme-choice-preview{background:#090612}.theme-choice-royal-violet .theme-choice-preview i{background:#5b308e}.theme-choice-royal-violet .theme-choice-preview b{background:#291444}.theme-choice-royal-violet .theme-choice-preview em{background:#dcc17b}
.theme-choice-midnight-teal .theme-choice-preview{background:#071316}.theme-choice-midnight-teal .theme-choice-preview i{background:#1f726c}.theme-choice-midnight-teal .theme-choice-preview b{background:#10343a}.theme-choice-midnight-teal .theme-choice-preview em{background:#7dcfc5}
.theme-choice-obsidian-silver .theme-choice-preview{background:#0d1014}.theme-choice-obsidian-silver .theme-choice-preview i{background:#505b66}.theme-choice-obsidian-silver .theme-choice-preview b{background:#262d35}.theme-choice-obsidian-silver .theme-choice-preview em{background:#c0cbd5}
.theme-choice-olive-sand .theme-choice-preview{background:#10130c}.theme-choice-olive-sand .theme-choice-preview i{background:#596748}.theme-choice-olive-sand .theme-choice-preview b{background:#303c26}.theme-choice-olive-sand .theme-choice-preview em{background:#c9bf8b}
.theme-choice-mocha-cream .theme-choice-preview{background:#15100e}.theme-choice-mocha-cream .theme-choice-preview i{background:#6a4f40}.theme-choice-mocha-cream .theme-choice-preview b{background:#3b2c26}.theme-choice-mocha-cream .theme-choice-preview em{background:#d4bd9e}
.theme-choice-indigo-ice .theme-choice-preview{background:#0b1020}.theme-choice-indigo-ice .theme-choice-preview i{background:#3c4d92}.theme-choice-indigo-ice .theme-choice-preview b{background:#243057}.theme-choice-indigo-ice .theme-choice-preview em{background:#adc3fa}
.theme-choice-charcoal-amber .theme-choice-preview{background:#12120f}.theme-choice-charcoal-amber .theme-choice-preview i{background:#676043}.theme-choice-charcoal-amber .theme-choice-preview b{background:#333229}.theme-choice-charcoal-amber .theme-choice-preview em{background:#e0b465}
