/* Shared theme for the login, workspace, dialogs and transient UI. */
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f3f6f8; --panel: #fff; --field: #f8fafc; --text: #152638;
  --muted: #53677c; --line: #d9e2eb; --brand: #0e7490; --brand-hover: #155e75;
  --soft: #e7f5f7; --ring: #9bcdd5; --surface-raised: #f6f9fb; --surface-inset: #f8fafc;
  --info: #0369a1; --warn: #925a0c; --danger: #be123c;
}
:root[data-theme=dark] { color-scheme: dark; }
.theme-toggle-btn { display: inline-grid; flex: 0 0 38px; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--muted); }
.theme-toggle-btn:hover { color: var(--brand); border-color: var(--brand); }
[data-theme-toggle] svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-theme-toggle] .theme-sun { display: none; }
[data-theme=dark] [data-theme-toggle] .theme-sun { display: block; }
[data-theme=dark] [data-theme-toggle] .theme-moon { display: none; }
/* Semantic section accents remain readable against white surfaces. */
[data-theme=light] .workspace-section { --section-accent: #0e7490; }
[data-theme=light] #workspace-traceability { --section-accent: #5547b3; }
[data-theme=light] #workspace-backups { --section-accent: #26754d; }
[data-theme=light] #workspace-maintenance { --section-accent: #8b590f; }
[data-theme=light] #workspace-utilities { --section-accent: #4e52a1; }
[data-theme=light] #workspace-alerts { --section-accent: #9c4d2e; }
[data-theme=light] #dashboard :is(h1,h2,h3,h4,h5,strong,b) { color: var(--text); }
[data-theme=light] #dashboard :is(.eyebrow,.dr-overline) { color: var(--section-accent,var(--brand)); }
[data-theme=light] #dashboard :is(.notice,.repo-sub,.repo-trace small,.details,.details li,.details small,.util-hint,.util-stat span,.util-stat small,.ops-kpi-card small,.stat-body .kpi-title,.dr-tool-card p,.dr-runbook small,.dr-runbook ol,.bk-meta small,.bk-provider p,.top-main small,.top-line > span,.availability-cert small,.availability-name small,.availability-head span,.timeline-detail,.timeline-time,.timeline-head p) { color: var(--muted); }
[data-theme=light] #dashboard :is(.card,.ops-card,.data-panel,.glass-panel,.repository,.ops-kpi-card,.util-panel,.util-stat,.channel-card,.alert-pref-box,.operational-timeline) { border-color: var(--line); box-shadow: 0 4px 18px #15304706; }
[data-theme=light] #dashboard :is(.rail,.ws-topbar .user-chip,.ws-topbar .refresh-btn,.btn-menu-mobile,.section-emblem) { background: var(--panel); border-color: var(--line); box-shadow: none; }
[data-theme=light] #dashboard .sidebar-brand { border-color: var(--line); }
[data-theme=light] #dashboard .sidebar-brand h2 { color: var(--brand); -webkit-text-fill-color: var(--brand); }
[data-theme=light] #dashboard .sidebar-brand .brand-product { color: var(--text); -webkit-text-fill-color: var(--text); }
[data-theme=light] #dashboard :is(.brand-subtitle,.nav-group-label,.rail-footer,.rail-footer small,.ws-topbar .topbar-heading .eyebrow) { color: var(--muted); }
[data-theme=light] #dashboard .rail-nav .nav-tab { color: #4e6479; }
[data-theme=light] #dashboard .rail-nav .nav-tab:hover { background: #f0f5f8; color: var(--text); }
[data-theme=light] #dashboard .rail-nav .nav-tab.active { background: #e7f5f7; color: #0c6379; border-color: #b8dce2; }
[data-theme=light] #dashboard .rail-nav .tab-alerts #alerts-count { background: #e4edf3; color: #405a70; }
[data-theme=light] #dashboard .rail-nav .tab-alerts.has-alerts #alerts-count { background: #be123c; color: #fff; }
[data-theme=light] #dashboard .ws-topbar .user-avatar { background: #d6eef0; color: #14586a; }
[data-theme=light] #dashboard .role-badge { background: #e7f5f7; border-color: #a8d5df; color: #0e647c; }
[data-theme=light] #dashboard #workspace-overview > .intro h2 em { color: #0e7490; }
[data-theme=light] #dashboard :is(.kpi-icon,.stat-icon,.grp-ico,.dr-tool-icon,.panel-glyph,.modal-icon,.top-rank,.repo-trace > span,.alert-active-icon) { background: #e7f5f7; border-color: #c2dfe5; color: #0e7490; box-shadow: none; }
[data-theme=light] #dashboard :is(.progress,.top-bar,.capacity-item i) { background: #e1e9f0; }
[data-theme=light] #dashboard :is(.chart,.availability-item,.merged-service-list .availability-item,.top-row,.details,.deploy-group,.dr-toolkit,.dr-runbook,.dr-tool-card,.cal,.bk-card,.bk-tile,.util-command-deck,.util-action,.util-logs-disclosure,.util-config-disclosure,.util-list,.maintenance-session-grid) { background: var(--surface-inset); border-color: var(--line); box-shadow: none; }
[data-theme=light] #dashboard .repo-grid > .repository { background: var(--panel); }
[data-theme=light] #dashboard :is(.repo-trace b,.details code,.chart-row span,.kpi-detail,.kpi-label,.kpi-trend) { color: #466178; }
[data-theme=light] #dashboard :is(.grp-chip,.top-badge,.count-badge,.top-range) { background: #eaf3f6; color: #3a6275; border-color: #c9dfe7; }
[data-theme=light] #dashboard .resources-card .capacity-in-resources { background: #edf7f8; }
[data-theme=light] #dashboard .resources-card .capacity-in-resources::before { background: #edf7f8; color: #0e647c; }
[data-theme=light] #dashboard :is(.service-host,.bk-provider,.maintenance-coverage,.alert-command-center) { background: #eef7f9; border-color: #c6dfe5; }
[data-theme=light] #dashboard :is(.btn.secondary,.pager-btn,.bk-dl,.cal-head button) { background: #f1f5f9; color: #294359; border-color: #c7d5e1; text-shadow: none; box-shadow: none; }
[data-theme=light] #dashboard .btn.secondary:hover:not(:disabled) { background: #e3edf4; border-color: #8ba8bc; color: #153e52; }
[data-theme=light] #dashboard .btn.ghost { color: #53677c; }
[data-theme=light] #dashboard :is(.search-field,.gsel-btn,.util-input) { background: var(--field); color: var(--text); border-color: #c7d5e1; }
[data-theme=light] #dashboard :is(input,select,textarea) { color: var(--text); border-color: #c7d5e1; background-color: var(--field); }
[data-theme=light] #dashboard input::placeholder { color: #6b7e90; opacity: 1; }
[data-theme=light] #dashboard .search-field input { background: transparent; }
[data-theme=light] #dashboard :is(.seg,.timeline-filters,.env-pill-selector) { background: #edf3f7; border-color: var(--line); }
[data-theme=light] #dashboard :is(.seg,.timeline-filters) button { color: #52677c; }
[data-theme=light] #dashboard :is(.seg,.timeline-filters) button[aria-pressed=true] { background: #d4edf1; color: #07576c; border-color: #a8d0d9; }
[data-theme=light] #dashboard .btn-env-pill { color: #52677c; }
[data-theme=light] #dashboard .btn-env-pill.active { background: #0e7490; color: #fff; }
[data-theme=light] #dashboard .ops-table th { background: #edf3f7; color: #4b647a; }
[data-theme=light] #dashboard .ops-table td { border-color: var(--line); color: var(--text); }
[data-theme=light] #dashboard .ops-table tbody tr:hover { background: #f0f7fa; }
[data-theme=light] #dashboard .ops-table .empty-cell { color: var(--muted); }
[data-theme=light] #dashboard :is(.table-sub,.row-sub,.timeline-footer,.pager) { color: var(--muted); }
[data-theme=light] #dashboard :is(.timeline-node,.timeline-icon,.timeline-ico) { background: #e6f3f6; border-color: #bbdbe3; color: #0e7490; }
[data-theme=light] #dashboard :is(.alert-center-head p,.alerts-all-clear small,.alert-active-item small,.channel-copy small,.channel-recipient,.channel-status,.util-command-head small,.util-logs-disclosure summary small,.util-config-disclosure summary small,.maintenance-coverage small) { color: #536d80; }
[data-theme=light] #dashboard :is(.alerts-all-clear,.dr-readiness,.util-live-state) { background: #eaf7ef; border-color: #b4d9c2; color: #246746; }
[data-theme=light] #dashboard :is(.alert-active-item,.connected-pool-card,.util-row,.util-env-group,.maint-actions-card) { background: #f5f8fb; border-color: var(--line); color: var(--text); }
[data-theme=light] #dashboard .alert-active-item.warning { background: #fffbeb; border-color: #e5c98a; }
[data-theme=light] #dashboard .alert-active-item.critical { background: #fff1f2; border-color: #e4adb9; }
[data-theme=light] #dashboard :is(.pill.ok,.risk-low,.redis-badge.ok,.maintenance-status-badge.idle,.top-success) { color: #206344; background-color: #e7f5ec; border-color: #add5bd; }
[data-theme=light] #dashboard :is(.pill.pending,.risk-warning,.maintenance-status-badge.countdown,.manual-tag) { color: #855409; background-color: #fff7e1; border-color: #dfc38b; }
[data-theme=light] #dashboard :is(.pill.off,.pill.err,.risk-danger,.redis-badge.degraded,.maintenance-status-badge.active,.top-fail) { color: #a42344; background-color: #fff0f2; border-color: #e4adbc; }
[data-theme=light] #dashboard :is(.auto-tag,.auto-tag-flow,.session-product) { color: #08647b !important; background: #e5f4f7 !important; border-color: #add5df !important; }
[data-theme=light] #dashboard .manual-tag { color: #855409 !important; }
[data-theme=light] #dashboard .promotion-warning { color: #855409 !important; background: #fff7e1; border-color: #dfc38b; }
[data-theme=light] #dashboard .control-link { color: #036a8a; }
[data-theme=light] #dashboard .btn.transport-btn { color: #fff; }
[data-theme=light] #dashboard .repository.is-deploying { background: #f0faf6; border-color: #afd7c4; }
[data-theme=light] #dashboard .cal :is(button,span) { color: #52677c; }
[data-theme=light] #dashboard .cal button[aria-pressed=true] { color: #fff; background: #0e7490; }
[data-theme=light] #dashboard .cal .cal-today { color: #0e7490; }
/* Transient components are appended to body, outside the dashboard. */
[data-theme=light] :is(.modal-card,.profile-modal-card,.gsel-menu,.setup-toast,.profile-menu) { background: #fff; color: var(--text); border-color: #c7d5e1; box-shadow: 0 24px 70px #15304726; }
[data-theme=light] .profile-menu { background: #fff !important; }
[data-theme=light] .modal { background: rgba(22,40,59,.4); }
[data-theme=light] :is(.modal,.profile-menu,.setup-toast,.gsel-menu) :is(h2,h3,strong,b) { color: var(--text); }
[data-theme=light] :is(.modal,.profile-menu,.setup-toast,.gsel-menu) :is(p,small,.modal-body,.toast-copy span,.profile-details span) { color: var(--muted); }
[data-theme=light] :is(.modal-footer,.profile-modal-card .modal-footer,.profile-details > div,.profile-identity,.profile-security) { background: #f4f8fb; border-color: var(--line); }
[data-theme=light] :is(.profile-action,.gsel-menu button) { color: #2e4a60; }
[data-theme=light] :is(.profile-action:hover,.gsel-menu button:hover) { background: #e7f3f7; color: #0e647c; }
[data-theme=light] :is(.profile-menu-kicker,.modal .eyebrow) { color: #0e7490; }
[data-theme=light] :is(.profile-menu .btn-logout,.modal .btn.danger) { color: #a42344; }
[data-theme=light] .profile-details b { color: var(--text); }
[data-theme=light] .modal :is(input:not([type=checkbox]),textarea,select) { background: #fff; color: var(--text); border-color: #c7d5e1; }
[data-theme=light] .modal .btn.secondary { background: #eaf1f6; color: #294359; border-color: #c7d5e1; box-shadow: none; }
[data-theme=light] .modal .btn.ghost { color: #53677c; }
[data-theme=light] :is(.modal-icon,.toast-icon) { background: #e7f3f7; color: #0e7490; box-shadow: none; }
[data-theme=light] :is(.toast-close,.modal-close) { color: #53677c; }
[data-theme=light] .setup-toast.error .toast-icon { background: #fff0f2; color: #a42344; }
[data-theme=light] .setup-toast.success .toast-icon { background: #e7f5ec; color: #206344; }
[data-theme=light] #dashboard .util-log { background: #101c2a; color: #d6e5f1; }
[data-theme=light] #dashboard .util-log span { color: inherit; }
@media (max-width:700px) {
  .ws-topbar { grid-template-columns: 40px minmax(0,1fr) 82px 44px; }
  .ws-topbar .user { width: 82px; gap: 6px; }
  .theme-toggle-btn { width: 38px; height: 38px; flex-basis: 38px; }
  [data-theme=light] body.profile-menu-open .app-shell::after { background: #15304766; }
}
@media (max-width:380px) {
  .ws-topbar { grid-template-columns: 36px minmax(0,1fr) 74px 42px; }
  .ws-topbar .user { width: 74px; }
  .theme-toggle-btn,.ws-topbar .refresh-btn { width: 34px; min-width: 34px; height: 36px; flex-basis: 34px; }
}
/* Contrast corrections for legacy component rules that use fixed dark colors. */
[data-theme=light] #dashboard .ops-table tbody tr { background: var(--panel); }
[data-theme=light] #dashboard .ops-table tbody tr:hover { background: #f0f7fa; }
[data-theme=light] #dashboard :is(.ops-table code,.ops-table .util-sub,.network-key,.capacity-item > span,.deploy-group-head small,.timeline-copy small,.timeline-event time,.timeline-footer span,.util-action small,.util-check,.alert-pref-options label,.alert-pref-options label span) { color: var(--muted); }
[data-theme=light] #dashboard .ops-table code { color: #0e7490; }
[data-theme=light] #dashboard .deploy-group-head h4 em { color: #08647b; background: #d9eff3; }
[data-theme=light] #dashboard .timeline-filters button { background: #f5f8fb; }
[data-theme=light] #dashboard .timeline-filters button[aria-pressed=true] { background: #d4edf1; }
[data-theme=light] #dashboard :is(.channel-recipient,.util-seg) { background: #edf3f7; border-color: var(--line); }
[data-theme=light] #dashboard .util-seg button { color: var(--muted); }
[data-theme=light] #dashboard .util-seg button.active { background: #0e7490; color: #fff; }
[data-theme=light] #dashboard :is(.alert-count-orb,.util-disclosure-state,.maintenance-coverage-kicker) { background: #e0f1f5; border-color: #b5d8e1; color: #0e647c; box-shadow: none; }
[data-theme=light] #dashboard .alert-live-label { color: #246746; background: #e4f5eb; border-color: #b4d9c2; }
[data-theme=light] #dashboard .alerts-all-clear > span { color: #246746; background: #d8eee0; box-shadow: none; }
[data-theme=light] #dashboard .maintenance-product { color: #255973; background: #e1f0f5; border-color: #b5d5e1; }
[data-theme=light] #dashboard .maintenance-product-pos { color: #574291; background: #eee9f8; border-color: #cfc2e8; }
[data-theme=light] #dashboard .maintenance-flow { color: var(--muted); }
[data-theme=light] #dashboard .btn.maint-action-primary { color: #fff !important; background: #0e7490 !important; text-shadow: none; box-shadow: none !important; }
[data-theme=light] #dashboard .live-readout { color: #246746 !important; background: #e5f5ec; border-color: #b4d9c2; }
[data-theme=light] #dashboard .live-readout.offline { color: #a42344 !important; background: #fff0f2; border-color: #e4adbc; }
[data-theme=light] #dashboard .refresh-btn { color: #52677c; }
[data-theme=light] #dashboard .refresh-btn.is-done { color: #246746; }
[data-theme=light] #dashboard .refresh-btn.is-degraded { color: #a42344; }
[data-theme=light] #dashboard .sidebar-brand .ai-badge { color: #0e647c !important; background: #e7f3f7 !important; border-color: #bddce4 !important; box-shadow: none !important; }
[data-theme=light] #dashboard .sidebar-brand .ai-badge svg { color: #0e647c !important; }
[data-theme=light] .modal :is(label,.alert-toggle span,.workflow-step.done,.workflow-step.active,.profile-security b,.profile-security small) { color: var(--text); }
[data-theme=light] .modal .alert-hint { color: var(--muted) !important; }
[data-theme=light] .modal .profile-live { color: #246746 !important; }
[data-theme=light] .modal .profile-verified { color: #246746; background: #e4f5eb; border-color: #b4d9c2; }
[data-theme=light] .modal .profile-security .btn { background: #e3f1f5; color: #0e647c; border-color: #bad9e2; }
