/* Shared dark palette, loaded after all legacy component styles. */
html[data-theme="dark"],body[data-theme="dark"]{
 color-scheme:dark;
 --bg:#111316;--surface:#1b1e23;--surface-2:#242830;--text:#f2f4f7;
 --muted:#b0b7c3;--line:#3b424d;--nav:#101215;
 --primary:#ff985c;--primary-2:#ffb17d;--primary-soft:#39291f;
 --green:#80ddb2;--green-soft:#18382b;--amber:#f5cd7b;--amber-soft:#3c311b;
 --red:#ff9da4;--red-soft:#40252b;--violet:#c4b4ff;--violet-soft:#302943;
 --shadow:0 12px 30px #0003;--shadow-soft:0 6px 18px #0002;
 background:var(--bg);color:var(--text);
}
html[data-theme="dark"] body{background:var(--bg);color:var(--text)}
body[data-theme="dark"] :is(.panel,.overview-panel,.overview-kpi,.page-header-card,.stat,.order-item,.current-row,.entity-row,.controls-panel,.service-card,.analytics-simple-kpi,.analytics-service-row){background:var(--surface)!important;border-color:var(--line)!important;color:var(--text)}
body[data-theme="dark"] :is(.analytics-card,.analytics-metric-card,.analytics-metric-card.orange,.analytics-metric-card.green,.analytics-focus-card,.analytics-row,.saas-card,.auth-card,.modal-inner,dialog,.theme-card,.plan-option,.orders-calendar-card,.np-install-banner){background:var(--surface);border-color:var(--line);color:var(--text);box-shadow:var(--shadow-soft)}
body[data-theme="dark"] :is(.order-date,.order-price,.detail-box,.mini-stat,.soft-chip,.local-pill,.hero-card,.choice-row,.form-section,.order-picker-section,.order-picker-chevron,.subscription-card,.subscription-meta>div,.saas-step,.saas-plan,.prototype-box,.analytics-focus-meta div,.analytics-row-meta div,.legend-row){background:var(--surface-2);border-color:var(--line);color:var(--text)}
body[data-theme="dark"] :is(.analytics-insights-strip>div,.analytics-client-stat,.analytics-future-summary>div,.analytics-selected-day>div,.analytics-selected-month>div,.analytics-cancel-grid>div,.profit-donut-detail-grid>div,.profit-donut-legend-row){background:var(--surface-2);border-color:var(--line);color:var(--text);box-shadow:none}
body[data-theme="dark"] :is(.profit-donut-center,.profit-donut-empty,.empty){background:var(--surface);border-color:var(--line);color:var(--muted)}
body[data-theme="dark"] :is(.insight-item,.profit-donut-detail,.analytics-service-details){background:var(--primary-soft);border-color:#77513a;color:var(--text)}
body[data-theme="dark"] :is(.analytics-context-note,.analytics-chart-switch,.analytics-period-tabs,.analytics-future-tabs,.orders-tabs,.orders-search,.mini-calendar,.install-card){background:var(--surface-2);border-color:var(--line);color:var(--muted)}
body[data-theme="dark"] :is(.analytics-topbar h1,.analytics-logo,.analytics-metric-title,.analytics-metric-value,.analytics-card-title,.analytics-summary-money strong,.analytics-money-legend-row,.analytics-money-legend-row b,.analytics-money-legend-row strong,.analytics-service-copy b,.analytics-service-values strong,.hero-card strong,.order-service,.order-mini-time,.client-picker-title,.form-section legend,.profit-donut-detail-head b,.profit-donut-detail-grid strong,.profit-donut-center strong,.profit-donut-label b,.profit-donut-legend-row strong){color:var(--text)}
body[data-theme="dark"] :is(.analytics-insights-strip strong,.analytics-client-stat strong,.analytics-future-summary strong,.analytics-selected-day strong,.analytics-selected-month strong,.analytics-cancel-grid strong){color:var(--text)}
body[data-theme="dark"] :is(label,.order-workers,.order-info-line,.overview-tip,.week-count,.analytics-selected-month-title){color:var(--muted)}
body[data-theme="dark"] :is(.panel p,.stat-label,.muted,small){color:var(--muted)!important}
body[data-theme="dark"] :is(.analytics-metric-change small,.analytics-card-period,.analytics-insights-strip span,.analytics-client-stat span,.analytics-client-stat small,.analytics-selected-day span,.analytics-selected-month span,.analytics-cancel-grid span,.analytics-future-summary span,.analytics-service-copy small,.analytics-service-values span,.profit-donut-detail-grid span,.profit-donut-center span,.analytics-help-note,.analytics-profit-note,.analytics-zero-state,.analytics-summary-money span,.analytics-month-value,.analytics-weekday-count,.analytics-more-link){color:var(--muted)}
body[data-theme="dark"] :is(.order-mini-row,.detail-line,.worker-job,.overview-tip){border-color:var(--line)!important}
body[data-theme="dark"] :is(.detail-divider,.analytics-mini-bar,.analytics-bar,.analytics-service-progress,.analytics-weekday-track,.analytics-month-track,.worker-chart-track,.signed-service-track){background:var(--line)}
body[data-theme="dark"] :is(.donut-track,.profit-donut-track){stroke:var(--line)}
body[data-theme="dark"] .profit-line-chart .line-grid{stroke:var(--line)}
body[data-theme="dark"] .profit-line-chart :is(.line-label,.line-xlabel){fill:var(--muted)}
body[data-theme="dark"] .profit-line-chart .line-bubble{fill:var(--surface-2);stroke:var(--line)}
body[data-theme="dark"] .profit-line-chart .line-bubble-text{fill:var(--text)}
body[data-theme="dark"] .profit-line-chart .line-dot{stroke:var(--surface)}
body[data-theme="dark"] .money-donut .donut-total{fill:var(--text)}
body[data-theme="dark"] .money-donut .donut-sub{fill:var(--muted)}
body[data-theme="dark"] :is(button.secondary,.button.secondary,.service-icon-btn.edit,.orders-chips button,.orders-calendar-action,.orders-calendar-selected-note button,.worker-chart-periods button,.analytics-calendar-btn,.analytics-info-btn,.settings-top-btn){background:var(--surface-2);border-color:var(--line);color:var(--text);box-shadow:none}
body[data-theme="dark"] :is(.orders-tabs button,.analytics-period-tabs button,.analytics-chart-switch button,.analytics-future-tabs button){background:transparent;color:var(--muted);box-shadow:none}
body[data-theme="dark"] :is(.orders-tabs button.active,.analytics-period-tabs button.active,.worker-chart-periods button.active,.orders-week-day.selected){background:var(--primary);border-color:var(--primary);color:#21160e;box-shadow:none}
body[data-theme="dark"] :is(.orders-chips button.active,.analytics-chart-switch button.active,.analytics-future-tabs button.active,.analytics-client-stat.active,.profit-donut-legend-row.is-selected,.week-day.selected,.week-day.active){background:var(--primary-soft);border-color:var(--primary);color:var(--primary);box-shadow:none}
body[data-theme="dark"] :is(.analytics-month,.analytics-weekday){color:var(--muted)}
body[data-theme="dark"] :is(.analytics-month.active b,.analytics-month.active .analytics-month-value,.analytics-weekday.active b,.analytics-weekday.active .analytics-weekday-count){color:var(--primary)}
body[data-theme="dark"] :is(.analytics-month.active .analytics-month-track,.analytics-weekday.active .analytics-weekday-track){background:var(--primary-soft);box-shadow:inset 0 0 0 1px #77513a}
body[data-theme="dark"] :is(.analytics-metric-icon,.analytics-service-icon,.analytics-rank,.overview-tip-icon,.count-pill,.saas-step-num,.saas-kicker){background:var(--primary-soft);color:var(--primary)}
body[data-theme="dark"] .analytics-metric-icon.white{background:var(--surface-2)}
body[data-theme="dark"] :is(input,select,textarea){background:var(--bg);color:var(--text);border-color:var(--line);color-scheme:dark}
body[data-theme="dark"] input::placeholder,body[data-theme="dark"] textarea::placeholder{color:#959eac;opacity:1}
body[data-theme="dark"] :is(input,select,textarea):focus{border-color:var(--primary);box-shadow:0 0 0 3px #ff985c26;outline:none}
body[data-theme="dark"] .orders-search input{background:transparent}
body[data-theme="dark"] :is(.week-day,.orders-week-day,.orders-calendar-cell){background:var(--surface-2);color:var(--text);border-color:var(--line)}
body[data-theme="dark"] .orders-week-day.selected{background:var(--primary);color:#21160e;border-color:var(--primary)}
body[data-theme="dark"] .orders-week-day.selected :is(.orders-week-name,.orders-week-count){color:#3c281b}
body[data-theme="dark"] .orders-week-day.selected .orders-week-dot{background:#3c281b}
body[data-theme="dark"] .orders-calendar-cell.selected{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary)}
body[data-theme="dark"] .orders-calendar-cell.outside{background:var(--bg)}
body[data-theme="dark"] .orders-week-day.today:not(.selected){background:var(--primary-soft);border-color:var(--primary)}
body[data-theme="dark"] .cal-day{background:var(--surface-2)!important;color:var(--text)!important;border-color:var(--line)!important}
body[data-theme="dark"] .cal-day.today{background:var(--primary)!important;color:#21160e!important;border-color:var(--primary)!important}
body[data-theme="dark"] :is(.status-progress,.order-status-mobile,.orders-calendar-event,.orders-calendar-event.progress){background:var(--primary-soft);color:var(--primary)}
body[data-theme="dark"] .order-mini-status.status-progress{background:var(--primary-soft)!important;color:var(--primary)!important}
body[data-theme="dark"] :is(.status-planned,.order-mobile-row[data-status="Запланирован"] .order-status-mobile){background:var(--amber-soft);color:var(--amber)}
body[data-theme="dark"] .order-mini-status.status-planned{background:var(--amber-soft)!important;color:var(--amber)!important}
body[data-theme="dark"] :is(.status-done,.worker-choice.paid,.orders-calendar-event.done,.order-mobile-row[data-status="Завершён"] .order-status-mobile,.sync-badge){background:var(--green-soft);color:var(--green)}
body[data-theme="dark"] .order-mini-status.status-done{background:var(--green-soft)!important;color:var(--green)!important}
body[data-theme="dark"] :is(.status-cancelled,.orders-calendar-event.cancelled,.np-error,.auth-error){background:var(--red-soft);color:var(--red);border-color:#86515a}
body[data-theme="dark"] :is(.debt,.worker-job .unpaid-amount,.worker-job .unpaid-label,.signed-service.loss strong){color:var(--red)}
body[data-theme="dark"] :is(.debt.zero,.analytics-metric-change.neutral){color:var(--muted)}
body[data-theme="dark"] .analytics-metric-change.positive{color:var(--green)}
body[data-theme="dark"] .service-icon-btn.delete{background:transparent;color:var(--red);border-color:#86515a}
body[data-theme="dark"] .service-icon-btn.delete:hover{background:var(--red-soft)}
body[data-theme="dark"] :is(.signed-service,.profit-donut-legend-row:hover){border-color:var(--line)}
body[data-theme="dark"] .signed-service[aria-pressed="true"]{border-color:var(--primary)}
body[data-theme="dark"] :is(.np-auth-links a,.np-consent a,.np-account-line a,main a:not(.button):not(.top-icon-btn):not(.overview-link)){color:var(--primary)}
body[data-theme="dark"] .mobile-dock{background:#1b1e23f5!important;border-color:var(--line)!important}
body[data-theme="dark"] .mobile-dock :is(a,button){color:var(--muted)!important}
body[data-theme="dark"] .mobile-dock :is(a,button).active{background:var(--surface-2)!important;color:var(--text)!important}
body[data-theme="dark"] .mobile-dock :is(a,button).active .dock-icon{background:var(--primary-soft);color:var(--primary);box-shadow:none}
body[data-theme="dark"] dialog::backdrop{background:#06080bc7}
body[data-theme="dark"] :is(.np-install-actions button:not(.secondary),.np-install-settings button,.plan-option .button,.np-submit){background:var(--primary);color:#21160e}
body[data-theme="dark"] .np-install-close{background:transparent;color:var(--muted);box-shadow:none}

body[data-theme="dark"] .np-subscription-pay{background:var(--primary);color:#21160e}
