html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eef5;
  --muted: #a3afbd;
  --line: #2d3b4a;
  --bg: #0d141c;
  --panel: #16212c;
  --nav: #090f16;
  --nav-soft: #223141;
  --primary: #58c9ba;
  --primary-dark: #79ddd0;
  --blue: #83adff;
  --amber: #f2b85e;
  --red: #ff858d;
  --critical: #f2a0b5;
  --green: #65cda8;
  --shadow: 0 12px 34px rgba(0,0,0,.24);
}

.theme-ready body,
.theme-ready .panel,
.theme-ready .metric,
.theme-ready .filter-bar,
.theme-ready input,
.theme-ready select,
.theme-ready textarea,
.theme-ready .button,
.theme-ready .upload-picker { transition: background-color .2s ease,border-color .2s ease,color .2s ease,box-shadow .2s ease; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 39px;
  height: 39px;
  padding: 0;
  border: 1px solid #d9dfea;
  border-radius: 12px;
  background: #fff;
  color: #4a5570;
  box-shadow: 0 6px 18px rgba(33,42,70,.08);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle:hover { border-color: #adb5ef; color: #4652d4; transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 3px solid #6874ee; outline-offset: 3px; }
.theme-toggle-floating { position: fixed; top: 18px; right: 18px; z-index: 50; }

html[data-theme="dark"] body:not(.auth-body) {
  --mp-ink: #e9eef8;
  --mp-muted: #a1aec0;
  --mp-border: #2c394b;
  --mp-surface: #16212c;
  --mp-bg: #0d141c;
  --mp-violet: #929bff;
  --mp-violet-dark: #aab1ff;
  --mp-teal: #56cbb7;
  --mp-coral: #ff8291;
  --mp-amber: #f1b45f;
  background: var(--bg);
  color: var(--ink);
}

html[data-theme="dark"] body:not(.auth-body) .sidebar {
  background: linear-gradient(175deg,#090f17 0%,#111c2c 100%);
  border-right-color: rgba(255,255,255,.08);
  box-shadow: 16px 0 42px rgba(0,0,0,.24);
}
html[data-theme="dark"] body:not(.auth-body) .sidebar-user { background: rgba(255,255,255,.065); }
html[data-theme="dark"] body:not(.auth-body) .panel,
html[data-theme="dark"] body:not(.auth-body) .filter-bar,
html[data-theme="dark"] body:not(.auth-body) .metric { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
html[data-theme="dark"] body:not(.auth-body) .metric { background: linear-gradient(145deg,#182531 65%,#1c263d); }
html[data-theme="dark"] body:not(.auth-body) .metric::after { background: rgba(145,155,255,.08); }
html[data-theme="dark"] body:not(.auth-body) .metric small,
html[data-theme="dark"] body:not(.auth-body) label,
html[data-theme="dark"] body:not(.auth-body) .profile-view-grid dt { color: #a8b4c4; }
html[data-theme="dark"] body:not(.auth-body) input,
html[data-theme="dark"] body:not(.auth-body) select,
html[data-theme="dark"] body:not(.auth-body) textarea {
  background: #101a24;
  border-color: #344456;
  color: var(--ink);
}
html[data-theme="dark"] body:not(.auth-body) input::placeholder,
html[data-theme="dark"] body:not(.auth-body) textarea::placeholder { color: #718092; }
html[data-theme="dark"] body:not(.auth-body) input:disabled,
html[data-theme="dark"] body:not(.auth-body) select:disabled,
html[data-theme="dark"] body:not(.auth-body) textarea:disabled { background: #202a35; color: #8491a0; }
html[data-theme="dark"] body:not(.auth-body) .button.secondary,
html[data-theme="dark"] body:not(.auth-body) .mobile-head button { background: #1a2632; border-color: #3a495b; color: #d7e0ea; }
html[data-theme="dark"] body:not(.auth-body) .button.ghost { color: #abb7c7; }
html[data-theme="dark"] body:not(.auth-body) fieldset { border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) legend { color: #bdc8d5; }

html[data-theme="dark"] body:not(.auth-body) th,
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table thead th { background: #1b2734; color: #aeb9c9; border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) td,
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tbody th { border-color: #283644; }
html[data-theme="dark"] body:not(.auth-body) tbody tr:hover,
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tbody tr:hover td,
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tbody tr:hover th,
html[data-theme="dark"] body:not(.auth-body) .table-wrap tbody tr:focus-within { background: #1a2835; }
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tbody th { background: var(--panel); }
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tbody tr.row-attention th,
html[data-theme="dark"] body:not(.auth-body) .row-attention { background: #2b261e; }
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tfoot th,
html[data-theme="dark"] body:not(.auth-body) .dashboard-data-table tfoot td { background: #202d42; color: #d8e1f6; border-top-color: #40516a; }
html[data-theme="dark"] body:not(.auth-body) .research-type-matrix th:last-child,
html[data-theme="dark"] body:not(.auth-body) .research-type-matrix .matrix-total { background: #1c2938; box-shadow: -1px 0 0 #354556; }
html[data-theme="dark"] body:not(.auth-body) .research-type-matrix thead th:last-child,
html[data-theme="dark"] body:not(.auth-body) .research-type-matrix tfoot .matrix-total { background: #243149; }
html[data-theme="dark"] body:not(.auth-body) .matrix-count { background: #283354; color: #c3c8ff; }
html[data-theme="dark"] body:not(.auth-body) .matrix-count:hover { background: #34416a; }

html[data-theme="dark"] body:not(.auth-body) :is(.analytics-stat-grid > div,.analytics-month,.analytics-events a,.presence-grid article,.timezone-preview,.meeting-report-signals > span,.output-fields,.branding-card,.term-block > .panel-head) {
  background: #192632;
  border-color: var(--line);
}
html[data-theme="dark"] body:not(.auth-body) :is(.analytics-stat-grid strong,.analytics-month > strong,.analytics-month b) { color: var(--ink); }
html[data-theme="dark"] body:not(.auth-body) .analytics-events a:hover { background: #202e3e; }
html[data-theme="dark"] body:not(.auth-body) .analytics-track,
html[data-theme="dark"] body:not(.auth-body) .bar-row > div,
html[data-theme="dark"] body:not(.auth-body) .progress,
html[data-theme="dark"] body:not(.auth-body) .big-progress > i,
html[data-theme="dark"] body:not(.auth-body) .table-progress > i { background: #2a3745; }
html[data-theme="dark"] body:not(.auth-body) .analytics-outcome-mix span { background: #233149; color: #c4cee0; }
html[data-theme="dark"] body:not(.auth-body) .analytics-outcome-mix strong { color: #b8beff; }
html[data-theme="dark"] body:not(.auth-body) .donut::after { background: var(--panel); }

html[data-theme="dark"] body:not(.auth-body) :is(.compact-list > a,.item-card,.task-list > div,.portfolio-list > a,.profile-details > div,.profile-journey-static,.profile-subsection,.profile-cv-row,.notification) { border-color: #293746; }
html[data-theme="dark"] body:not(.auth-body) :is(.compact-list > a:hover,.item-card:hover) { background: #1c2936; }
html[data-theme="dark"] body:not(.auth-body) .type-icon { background: #283354; color: #b5bcff; }
html[data-theme="dark"] body:not(.auth-body) .update-card { background: #131e28; border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) .update-fields { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) :is(.support-check,.announcement-banner .feedback-box) { background: #302818; border-color: #5b4b27; }
html[data-theme="dark"] body:not(.auth-body) :is(.feedback-box,.support-box,.privacy-note) { background: #192b2d; }
html[data-theme="dark"] body:not(.auth-body) .summary-grid p,
html[data-theme="dark"] body:not(.auth-body) .item-description { color: #c5cfda; }

html[data-theme="dark"] body:not(.auth-body) :is(.conversation-list > a.active,.conversation-list > a:hover,.recent-conversations > a.active,.recent-conversations > a:hover,.member-search-results > .member-result:hover,.member-search-results > .member-result.active) { background: #233047; }
html[data-theme="dark"] body:not(.auth-body) .message > div { background: #202c38; }
html[data-theme="dark"] body:not(.auth-body) .message.mine > div { background: #273252; color: #e2e5ff; }
html[data-theme="dark"] body:not(.auth-body) .notification.unread { background: #222d49; }
html[data-theme="dark"] body:not(.auth-body) .notification p { color: #b9c4d1; }

html[data-theme="dark"] body:not(.auth-body) .meeting-student:hover,
html[data-theme="dark"] body:not(.auth-body) .meeting-student.active { background: #1c3435; border-color: #37605e; }
html[data-theme="dark"] body:not(.auth-body) .meeting-student-group-heading span { background: #253241; }
html[data-theme="dark"] body:not(.auth-body) .meeting-student b { background: #49321e; color: #f4bb73; }
html[data-theme="dark"] body:not(.auth-body) :is(.meeting-recorded-state,.attendance-view) { background: #18302e; border-color: #315650; }
html[data-theme="dark"] body:not(.auth-body) .attendance-record { background: #14232b; border-color: #31514f; }
html[data-theme="dark"] body:not(.auth-body) .requirement-edit form { background: #172a2b; }

html[data-theme="dark"] body:not(.auth-body) .action-menu[open] summary { background: #293354; border-color: #515d91; }
html[data-theme="dark"] body:not(.auth-body) .action-menu-panel { background: #17232e; border-color: #354354; box-shadow: 0 16px 38px rgba(0,0,0,.35); }
html[data-theme="dark"] body:not(.auth-body) .action-menu-panel a { color: #d4dce7; }
html[data-theme="dark"] body:not(.auth-body) .action-menu-panel a:hover { background: #263250; color: #c5caff; }
html[data-theme="dark"] body:not(.auth-body) .notification-filters button { background: #17232e; border-color: #364456; color: #b4c0cf; }
html[data-theme="dark"] body:not(.auth-body) .notification-filters button[aria-pressed="true"],
html[data-theme="dark"] body:not(.auth-body) :is(.log-pager a:hover,.log-pager .current,.lab-pager .active) { background: #293354; border-color: #5965a4; color: #c7ccff; }
html[data-theme="dark"] body:not(.auth-body) :is(.log-pager a,.log-pager .current,.log-section-nav a) { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) .log-section-nav span { background: #23323d; }

html[data-theme="dark"] body:not(.auth-body) .profile-main-panel .profile-media { background: linear-gradient(120deg,#192d2e,#1d2638); border-color: #324348; }
html[data-theme="dark"] body:not(.auth-body) .profile-photo-preview img,
html[data-theme="dark"] body:not(.auth-body) .profile-photo-fallback { background: #24343b; color: #8bddd2; }
html[data-theme="dark"] body:not(.auth-body) .branding-strip { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
html[data-theme="dark"] body:not(.auth-body) .branding-strip-primary { border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) .branding-strip-primary strong { color: var(--ink); }
html[data-theme="dark"] body:not(.auth-body) .branding-strip-primary small,
html[data-theme="dark"] body:not(.auth-body) .branding-strip-partner { color: var(--muted); }
html[data-theme="dark"] body:not(.auth-body) .branding-scope-nav a { background: var(--panel); border-color: var(--line); color: #cbd5df; }
html[data-theme="dark"] body:not(.auth-body) .branding-scope-nav a.active { background: #397f81; border-color: #4b9b98; color: #fff; }
html[data-theme="dark"] body:not(.auth-body) .branding-card-image { background: #f5f7f8; border-color: #374653; }

html[data-theme="dark"] body:not(.auth-body) .announcement-banner { background: linear-gradient(135deg,#302a1e,#19232d); border-color: #66542c; }
html[data-theme="dark"] body:not(.auth-body) .close-notice { background: #282419; border-color: #6c5a32; color: #f2c66f; }
html[data-theme="dark"] body:not(.auth-body) .back-to-top { background: #1a2632; border-color: #3b4a5d; color: #afb6ff; box-shadow: 0 10px 30px rgba(0,0,0,.3); }

html[data-theme="dark"] .badge.success,
html[data-theme="dark"] body:not(.auth-body) .badge.success { background: #183a32; color: #7edbb9; }
html[data-theme="dark"] .badge.warning,
html[data-theme="dark"] body:not(.auth-body) .badge.warning { background: #46351e; color: #f3c274; }
html[data-theme="dark"] .badge.danger,
html[data-theme="dark"] .badge.critical,
html[data-theme="dark"] body:not(.auth-body) .badge.danger,
html[data-theme="dark"] body:not(.auth-body) .badge.critical { background: #45252e; color: #ff9eaa; }
html[data-theme="dark"] .badge.neutral,
html[data-theme="dark"] body:not(.auth-body) .badge.neutral { background: #29343f; color: #b7c1cd; }
html[data-theme="dark"] .alert.success { background: #18362e; color: #95dfc1; border-color: #315d50; }
html[data-theme="dark"] .alert.error,
html[data-theme="dark"] .alert.danger { background: #3b2329; color: #ffadb5; border-color: #6b3b43; }
html[data-theme="dark"] .alert.info { background: #1f3047; color: #a8c7ff; border-color: #38577c; }
html[data-theme="dark"] .alert.warning { background: #3b311d; color: #f1c678; border-color: #6a572d; }

html[data-theme="dark"] .upload-picker { background: #131e28; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.6); }
html[data-theme="dark"] .upload-picker-close { background: #26323d; color: #d3dbe3; }
html[data-theme="dark"] .upload-picker-tabs { border-color: var(--line); }
html[data-theme="dark"] .upload-picker-tabs button { color: #9eabb9; }
html[data-theme="dark"] .upload-picker-tabs button[aria-selected="true"] { color: #72d8ca; border-color: #55c7b8; }
html[data-theme="dark"] .upload-dropzone { background: #17232d; border-color: #3a4a58; }
html[data-theme="dark"] .upload-dropzone.dragging { background: #193531; border-color: #55c7b8; }
html[data-theme="dark"] .upload-drop-icon { background: #1c3b37; color: #75dbce; }
html[data-theme="dark"] .upload-dropzone p,
html[data-theme="dark"] .upload-dropzone small,
html[data-theme="dark"] .upload-field-summary,
html[data-theme="dark"] .upload-picker-foot p { color: #9eabb9; }
html[data-theme="dark"] .upload-library-card { background: #192631; border-color: #334250; color: var(--ink); }
html[data-theme="dark"] .upload-library-preview { background: linear-gradient(145deg,#26343f,#1d2a35); color: #a8b4bf; }
html[data-theme="dark"] .upload-picker-foot { background: #101922; border-color: var(--line); }

html[data-theme="dark"] .auth-body {
  background: radial-gradient(circle at 18% 16%,rgba(119,129,255,.14),transparent 31%),radial-gradient(circle at 86% 82%,rgba(56,183,162,.1),transparent 28%),#090f16;
  color: var(--ink);
}
html[data-theme="dark"] .auth-card { background: #151f29; border-color: #2d3a48; box-shadow: 0 28px 80px rgba(0,0,0,.45); }
html[data-theme="dark"] .auth-body.has-auth-background .auth-card { background: rgba(17,27,36,.94); box-shadow: 0 28px 80px rgba(0,0,0,.5); }
html[data-theme="dark"] .auth-card h1 { color: #edf2f8; }
html[data-theme="dark"] .auth-card label { color: #b4c0cc; }
html[data-theme="dark"] .auth-card input { background: #0e1821; border-color: #354454; color: #edf2f8; }
html[data-theme="dark"] .auth-card input::placeholder { color: #748293; }
html[data-theme="dark"] .auth-help-link { color: #73d8ca; }
html[data-theme="dark"] .auth-divider { color: #8e9cab; }
html[data-theme="dark"] .auth-divider::before,
html[data-theme="dark"] .auth-divider::after { background: #33404c; }
html[data-theme="dark"] .auth-provider span { background: #28343e; color: #aeb9c4; }

html[data-theme="dark"] .theme-toggle { background: #1b2732; border-color: #3b4959; color: #f3c56d; box-shadow: 0 8px 22px rgba(0,0,0,.28); }
html[data-theme="dark"] .theme-toggle:hover { background: #22313e; border-color: #6f78d0; color: #ffd981; }

html[data-theme="dark"] .system-reset-panel { border-color:#62343c; box-shadow:0 12px 34px rgba(0,0,0,.22); }
html[data-theme="dark"] .system-reset-panel .panel-head .badge { background:#4b262e; color:#ffadb5; }
html[data-theme="dark"] .reset-impact-grid > div { background:#241b21; border-color:#503039; }
html[data-theme="dark"] .reset-impact-grid strong { color:#ff9ca6; }
html[data-theme="dark"] .reset-impact-grid small { color:#c6a9ae; }

html[data-theme="dark"] body:not(.auth-body) :is(.mp-filter-card,.mp-metrics article,.mp-card,.mp-button.secondary) { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] body:not(.auth-body) .mp-metrics article.violet { background: linear-gradient(145deg,#18232e 58%,#242947); }
html[data-theme="dark"] body:not(.auth-body) :is(.mp-filter-chips button,.mp-filter-button) { background: #192631; border-color: var(--line); color: #bac4d1; }
html[data-theme="dark"] body:not(.auth-body) .mp-filter-chips button.active { background: #293354; border-color: #5964a5; color: #d0d4ff; }
html[data-theme="dark"] body:not(.auth-body) :is(.mp-icon,.mp-person,.mp-date) { background: #293354; color: #c3c9ff; }
html[data-theme="dark"] body:not(.auth-body) .mp-donut > div { background: var(--panel); box-shadow: inset 0 0 0 1px #33414e; }
html[data-theme="dark"] body:not(.auth-body) :is(.mp-trend-pill,.mp-risk,.mp-deadline-list em) { background: #29343f; color: #bac4d0; }
html[data-theme="dark"] body:not(.auth-body) :is(.mp-attention-list > a,.mp-deadline-list > a) { border-color: #293746; }
html[data-theme="dark"] body:not(.auth-body) .mp-task-row > a { background: #192631; border-color: #2f3d4b; }
html[data-theme="dark"] body:not(.auth-body) .mp-mini-progress { background: #2b3844; }
html[data-theme="dark"] body:not(.auth-body) .concept-bar { background: #242a48; border-color: #39416b; color: #bac3d3; }

@media(max-width:900px) {
  .theme-toggle-floating { top: 14px; right: 70px; }
}

@media(prefers-reduced-motion:reduce) {
  .theme-ready body,.theme-ready .panel,.theme-ready .metric,.theme-ready .filter-bar,.theme-ready input,.theme-ready select,.theme-ready textarea,.theme-ready .button,.theme-ready .upload-picker { transition: none !important; }
}
