/* Theme switcher and shared dark palette. */
.theme-toggle{font:700 19px/1 var(--font-main);position:relative;overflow:hidden}
.theme-toggle span{position:absolute;transition:transform .25s ease,opacity .25s ease}
.theme-toggle-moon{opacity:1;transform:translateY(0)}
.theme-toggle-sun{opacity:0;transform:translateY(24px)}
html[data-theme="dark"] .theme-toggle-moon{opacity:0;transform:translateY(-24px)}
html[data-theme="dark"] .theme-toggle-sun{opacity:1;transform:translateY(0)}

html[data-theme="dark"]{
    color-scheme:dark;
    --color-dark:#f4f4fb;
    --color-text:#e5e6f0;
    --color-text-light:#a9adbf;
    --color-bg:#151621;
    --color-bg-light:#0f1019;
    --color-border:#303246;
    --shadow-sm:0 1px 3px rgba(0,0,0,.28);
    --shadow-md:0 8px 28px rgba(0,0,0,.3)
}
html[data-theme="dark"] body,
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .site-footer{background:var(--color-bg);color:var(--color-text)}
html[data-theme="dark"] .site-header{border-color:var(--color-border);box-shadow:0 4px 20px rgba(0,0,0,.2)}
html[data-theme="dark"] .icon-link:hover,
html[data-theme="dark"] .input-group input:focus,
html[data-theme="dark"] .form-group input:focus{background:#202231}
html[data-theme="dark"] .main-nav{background:var(--color-bg)}

/* Public page */
html[data-theme="dark"] :is(.hero-section,.features-section,.how-section,.examples-section,.problem-section,.results-section,.compare-section,.pricing-page,.faq-section,.contact-section){background-color:var(--color-bg)!important;color:var(--color-text)}
html[data-theme="dark"] :is(.feature-card,.how-step,.example-card,.problem-item,.result-card,.compare-col,.pricing-card,.faq-item,.hero-stat){background:#202230!important;border-color:#34364a!important;color:var(--color-text)!important;box-shadow:0 12px 34px rgba(0,0,0,.22)}
html[data-theme="dark"] :is(.hero-title,.section-header h2,.feature-card h3,.how-step h3,.result-value,.compare-col h3,.pricing-card-title,.pricing-card-price,.faq-question){color:var(--color-dark)!important}
html[data-theme="dark"] :is(.hero-subtitle,.section-header p,.feature-card p,.how-step p,.result-label,.results-source,.pricing-card-period,.pricing-feature,.faq-answer){color:var(--color-text-light)!important}
html[data-theme="dark"] .pricing-card-popular{border-color:var(--color-primary)!important}

/* Personal area, feeds and templates */
html[data-theme="dark"] :is(.profile-form-wrapper,.sidebar-card,.dashboard-card,.stat-card,.quick-action,.current-tariff-card,.available-tariff-card,.tariff-history,.template-card,.templates-empty,.feed-card,.feeds-empty){background:#202230!important;border-color:#34364a!important;color:var(--color-text)!important}
html[data-theme="dark"] :is(.dashboard-title,.dashboard-card-title,.stat-value,.quick-action h3,.tariffs-title,.available-tariff-name,.template-name,.feed-name,.h1_title,.site-content h2,.site-content h3,.site-content strong){color:var(--color-dark)!important}
html[data-theme="dark"] :is(input,select,textarea){background:#171823!important;border-color:#3a3c50!important;color:var(--color-text)!important}
html[data-theme="dark"] :is(table td,table th){border-color:#34364a!important}
html[data-theme="dark"] table tr:nth-child(even) td,
html[data-theme="dark"] table tr:first-child td,
html[data-theme="dark"] table td:first-child{background:#1b1c29!important}
html[data-theme="dark"] :is(.feed-quality>div,.feed-quality>ul){background:#202230;border-color:#3a3c50;box-shadow:0 12px 30px rgba(0,0,0,.35)}

/* Constructor */
html[data-theme="dark"] :is(.constructor-stage,.constructor-panel){background:#202230;border-color:#34364a;color:var(--color-text)}
html[data-theme="dark"] .constructor-layer{background:#181925}
html[data-theme="dark"] :is(.constructor-group,.constructor-layer input[type=number],.constructor-layer select,.constructor-input,.constructor-condition-row input){border-color:#3a3c50}
html[data-theme="dark"] :is(.constructor-topbar p,.constructor-hint,.constructor-group>p,.constructor-layer label,.constructor-group ul){color:var(--color-text-light)}
html[data-theme="dark"] .constructor-check{color:var(--color-dark)!important}
html[data-theme="dark"] .constructor-stage canvas{box-shadow:0 12px 36px rgba(0,0,0,.42)}

/* Administration */
html[data-theme="dark"] .admin-shell{background:#10111a;color:var(--color-text)}
html[data-theme="dark"] :is(.admin-identity,.admin-tabs,.admin-stats article,.admin-card){background:#202230;border-color:#34364a;color:var(--color-text);box-shadow:0 8px 26px rgba(0,0,0,.2)}
html[data-theme="dark"] :is(.admin-heading h1,.admin-identity strong,.admin-card h2,.admin-user-title h2,.admin-data-list dd){color:var(--color-dark)}
html[data-theme="dark"] :is(.admin-heading p,.admin-identity,.admin-tabs a,.admin-card>p,.admin-card th,.admin-data-list dt){color:var(--color-text-light)}
html[data-theme="dark"] :is(.admin-card td,.admin-card th,.admin-data-list>div){border-color:#34364a}
html[data-theme="dark"] .admin-card button.secondary{background:#303246;color:var(--color-text)}
html[data-theme="dark"] :is(.admin-user-form>label,.admin-form-options label){color:var(--color-text-light)}
html[data-theme="dark"] .admin-icon-link{background:#302b4d;color:#a99cff}
html[data-theme="dark"] .admin-card button.admin-icon-btn--danger{background:#392329;color:#ff9ca5}

/* Personal dashboard tariff surfaces load their page CSS after the shared theme. */
html[data-theme="dark"] :is(.tariff-banner,.current-tariff-card.tariff-active,.current-tariff-card.tariff-expired,.tariff-banner.tariff-limit-critical,.tariff-banner.tariff-limit-warning){background:#202230!important;border-color:#7567e8!important;color:#e5e6f0!important}
html[data-theme="dark"] :is(.tariff-banner-name,.tariff-banner-stat-value,.tariff-card-name,.tariff-card-price,.tariff-stat-value,.tariff-date-item strong){color:#f4f4fb!important}
html[data-theme="dark"] :is(.tariff-banner-label,.tariff-banner-price,.tariff-banner-stat-label,.tariff-progress-header,.tariff-card-price small){color:#a9adbf!important}
html[data-theme="dark"] :is(.tariff-progress-bar,.tariff-dates-row,.sku-progress-bar){background:#171823!important}
html[data-theme="dark"] :is(.tariff-banner-progress,.tariff-stats-row){border-color:#3a3c50!important}
html[data-theme="dark"] .available-tariff-card.tariff-current{background:#28233f!important}
html[data-theme="dark"] :is(.limit-warning-banner,.limit-warning-critical){background:#2c2027!important;border-color:#bd4b5b!important;color:#f4f4fb!important}
html[data-theme="dark"] :is(.limit-warning-content h3,.limit-warning-critical h3){color:#ff929c!important}
html[data-theme="dark"] .limit-warning-content p{color:#d6d8e4!important}
html[data-theme="dark"] .limit-warning-content strong{color:#fff!important}
html[data-theme="dark"] .limit-warning-actions .btn-outline{background:#202230!important;border-color:#515469!important;color:#e5e6f0!important}
html[data-theme="dark"] :is(.admin-users-list,.admin-user-row){border-color:#34364a}
html[data-theme="dark"] .admin-user-avatar{background:#302b4d;color:#b4a9ff}
html[data-theme="dark"] .admin-user-main a{color:#b4a9ff}
html[data-theme="dark"] .admin-user-action{background:#252737!important;border-color:#3d4054!important;color:#d7d9e5!important}
html[data-theme="dark"] .admin-user-action--login{background:#17362f!important;border-color:#286151!important;color:#8ee1c9!important}

@media (max-width:860px){html[data-theme="dark"] .main-nav{background:var(--color-bg)}}

/* Kept as direct selectors for embedded and older WebViews. */
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .how-step,
html[data-theme="dark"] .example-card,
html[data-theme="dark"] .problem-item,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .compare-col,
html[data-theme="dark"] .pricing-card,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .hero-stat{background:#202230!important;border-color:#34364a!important;color:#e5e6f0!important}
html[data-theme="dark"] .feature-card h3,
html[data-theme="dark"] .how-step h3,
html[data-theme="dark"] .pricing-card-title,
html[data-theme="dark"] .pricing-card-price,
html[data-theme="dark"] .faq-question{color:#f4f4fb!important}
html[data-theme="dark"] .feature-card p,
html[data-theme="dark"] .how-step p,
html[data-theme="dark"] .pricing-card-period,
html[data-theme="dark"] .pricing-feature,
html[data-theme="dark"] .faq-answer{color:#a9adbf!important}
