:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #10151b;
  --surface: #1b232d;
  --surface-2: #222d39;
  --surface-3: #2c3947;
  --ink: #f3f6f9;
  --ink-soft: #d5dfe9;
  --muted: #a7b7c8;
  --line: #344252;
  --line-strong: #516276;
  --accent: #82adff;
  --accent-strong: #a9c6ff;
  --accent-soft: #263d65;
  --accent-faint: #1e304d;
  --success: #78d7b8;
  --success-soft: #193d38;
  --danger: #ff9a94;
  --danger-soft: #472c32;
  --nav: #111922;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .phone-shell,
:root[data-theme="dark"] .views,
:root[data-theme="dark"] .view {
  color: var(--ink);
  background: var(--page);
}

:root[data-theme="dark"] .phone-shell:not(.is-landing):not(.is-auth):not(.is-registering) .topbar,
:root[data-theme="dark"] .phone-shell:not(.is-landing):not(.is-auth):not(.is-registering) .views,
:root[data-theme="dark"] .topbar {
  border-color: var(--line);
  background: #171f29;
}

:root[data-theme="dark"] .phone-shell:not(.is-landing):not(.is-auth):not(.is-registering) .views {
  background: var(--page);
}

:root[data-theme="dark"] .bottom-nav {
  border-color: var(--line);
  color: var(--ink);
  background: var(--nav);
}
:root[data-theme="dark"] .bottom-nav > button { color: var(--muted); }
:root[data-theme="dark"] .bottom-nav > button:hover { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
:root[data-theme="dark"] .bottom-nav > button.is-active { border-color: #496aa2; color: #eaf2ff; background: var(--accent-soft); }
:root[data-theme="dark"] .desktop-nav-brand,
:root[data-theme="dark"] .desktop-nav-user { border-color: var(--line); }
:root[data-theme="dark"] .desktop-nav-user > .nav-logout { border-color: var(--line); color: var(--muted); background: var(--surface-2); }
:root[data-theme="dark"] .desktop-nav-progress { border-color: var(--line); color: var(--ink); background: var(--surface); }
:root[data-theme="dark"] .desktop-nav-label { color: var(--muted); }

:root[data-theme="dark"] :is(.section-head h2, .hero-strip h1, .settings-panel > header h3,
  .mobile-home-feed-head h2, .messages-head h2, .levels-head h2) { color: var(--ink); }

:root[data-theme="dark"] :is(.settings-workspace, .settings-panels, .settings-panel,
  .settings-tabs, .settings-tabs button, .settings-action > button, .service-links a,
  .service-links button, .profile-settings-button, .notifications-head .icon-button) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
}

:root[data-theme="dark"] .settings-tabs { background: var(--surface-2); }
:root[data-theme="dark"] .settings-tabs button { color: var(--muted); background: transparent; }
:root[data-theme="dark"] .settings-tabs button:hover { color: var(--ink); background: var(--surface-3); }
:root[data-theme="dark"] .settings-tabs button.is-active {
  border-color: var(--accent);
  color: #eff5ff;
  background: #315583;
  box-shadow: inset 3px 0 0 var(--accent);
}
:root[data-theme="dark"] :is(.preference-row, .settings-action, .account-actions) { border-color: var(--line); }
:root[data-theme="dark"] :is(.preference-row strong, .settings-action strong) { color: var(--ink); }
:root[data-theme="dark"] :is(.preference-row small, .settings-action small) { color: var(--muted); }
:root[data-theme="dark"] .preference-row input[role="switch"] { border-color: var(--line-strong); background: var(--surface-3); }
:root[data-theme="dark"] .preference-row input[role="switch"]::after { background: #dce8f4; }
:root[data-theme="dark"] .preference-row input[role="switch"]:checked { border-color: #6d9ced; background: #547fc9; }

:root[data-theme="dark"] :is(.mobile-home-person, .mobile-home-swipe-surface,
  .mobile-home-project, .response-card, .match-card, .profile-awards-section,
  .mission-card, .business-material, .reward-card, .level-card,
  .interest-category, .region-catalog-option) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

:root[data-theme="dark"] :is(.collaboration-brief, .collaboration-brief section + section,
  .match-context, .card-footer, .adjacent-recommendation, .deck-state) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
:root[data-theme="dark"] .collaboration-brief section + section,
:root[data-theme="dark"] .card-footer { background: var(--surface-2); }
:root[data-theme="dark"] :is(.brief-offer h3, .brief-need h3) { color: var(--ink); }
:root[data-theme="dark"] :is(.brief-offer p, .brief-need p, .privacy-note) { color: var(--ink-soft); }
:root[data-theme="dark"] .match-reasons span { border-color: var(--line-strong); color: var(--accent-strong); background: var(--accent-faint); }
:root[data-theme="dark"] .match-signal { border-color: #7a9dd7; color: var(--accent-strong); background: var(--surface-2); }
:root[data-theme="dark"] .match-signal strong { color: var(--accent-strong); }
:root[data-theme="dark"] .match-signal span { color: var(--muted); }
:root[data-theme="dark"] .round-action.skip { border-color: var(--line); color: var(--ink-soft); background: var(--surface-2); }

:root[data-theme="dark"] :is(.mobile-home-person-main, .mobile-home-card-actions,
  .mobile-home-project > button, .response-person, .response-actions,
  .mission-card > footer) { color: var(--ink); background: transparent; }
:root[data-theme="dark"] .mobile-home-person:not(.has-portrait) .mobile-home-person-main { background: var(--surface-2); }
:root[data-theme="dark"] .mobile-home-person-copy > strong { color: var(--ink); }
:root[data-theme="dark"] .has-portrait .mobile-home-person-copy > strong { color: #fff; }
:root[data-theme="dark"] .person-request-row { border-color: var(--line); }
:root[data-theme="dark"] .person-request-row > small { color: var(--accent-strong); }
:root[data-theme="dark"] .mobile-home-person .person-request-row > .person-request-text { color: var(--ink-soft); }
:root[data-theme="dark"] .mobile-home-card-actions button:first-child { color: var(--muted); background: var(--surface-2); }
:root[data-theme="dark"] .mobile-home-card-actions button + button { border-color: var(--line); color: var(--accent-strong); }
:root[data-theme="dark"] .mobile-home-empty { color: var(--muted); }

:root[data-theme="dark"] :is(.interest-catalog-search, .region-catalog-shortcuts > button,
  .mobile-discovery-search, .mobile-filter-button, .mobile-feed-search,
  .search-field, .region-field select, .segment-control, .responses-tabs,
  .responses-tabs button, .thread-search, .chat-create-tabs button) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: none;
}
:root[data-theme="dark"] :is(.interest-catalog-search, .region-catalog-shortcuts > button,
  .region-catalog-option, .interest-category):hover { border-color: var(--accent); }
:root[data-theme="dark"] :is(.interest-catalog-search input, .region-catalog-shortcuts strong,
  .region-catalog-option span, .interest-category-copy strong) { color: var(--ink); }
:root[data-theme="dark"] :is(.region-catalog-shortcuts small, .interest-category-copy small) { color: var(--muted); }
:root[data-theme="dark"] .interest-category-icon { color: var(--accent-strong); background: var(--accent-soft); }
:root[data-theme="dark"] .interest-category.tone-coral .interest-category-icon { color: #f0a499; background: #493039; }
:root[data-theme="dark"] .interest-category.tone-green .interest-category-icon { color: #83d9bd; background: #20443d; }
:root[data-theme="dark"] .interest-category.tone-violet .interest-category-icon { color: #c8b1f0; background: #3b3455; }
:root[data-theme="dark"] .responses-tabs button.is-active { color: var(--ink); background: #315583; }
:root[data-theme="dark"] :is(.response-person small, .response-person em, .response-status) { color: var(--muted); }
:root[data-theme="dark"] .response-actions button { border-color: var(--line); color: var(--ink); background: var(--surface-2); }

:root[data-theme="dark"] .messages-layout,
:root[data-theme="dark"] :is(.thread-column, .messages-head, .chat-head, .message-form,
  .chat-panel, .thread-list, .message-stack, .chat-pinned-messages) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
:root[data-theme="dark"] .message-stack { background: var(--page); }
:root[data-theme="dark"] .thread-item { border-color: var(--line); color: var(--ink); background: transparent; }
:root[data-theme="dark"] .thread-item:hover,
:root[data-theme="dark"] .thread-item.is-active { background: var(--surface-3); }
:root[data-theme="dark"] :is(.chat-tools button, .message-form .attach-button,
  .message-actions button, .chat-pinned-messages button) { border-color: var(--line); color: var(--ink-soft); background: var(--surface-2); }
:root[data-theme="dark"] :is(.bubble.them, .message-edit-form textarea, .message-edit-form button) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
}

@media (min-width: 900px) {
  :root[data-theme="dark"] .phone-shell .views { background-color: var(--page); background-image: none; }
  :root[data-theme="dark"] .match-card:not([hidden]) { border-color: var(--line); background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.16); }
}

:root[data-theme="dark"] .profile-view .profile-hero {
  border-color: #38547a;
  color: var(--ink);
  background: linear-gradient(125deg, #202f46, #253e61 60%, #355d7d);
  box-shadow: 0 14px 32px rgba(0,0,0,.2);
}
:root[data-theme="dark"] :is(.profile-view .profile-title h3, .profile-details-head h3,
  .profile-view .profile-awards-head h3) { color: var(--ink); }
:root[data-theme="dark"] :is(.profile-view .profile-title p, .profile-hero-actions > span,
  .profile-view .profile-snapshot span, .profile-view .profile-story p) { color: var(--ink-soft); }
:root[data-theme="dark"] .profile-eyebrow { color: #b4d0ff; }
:root[data-theme="dark"] :is(.profile-active-pill, .profile-identity-meta span,
  .profile-view .profile-card .profile-photo, .profile-view .profile-snapshot > div,
  .profile-view .profile-story, .profile-view .profile-portfolio, .profile-view .profile-interests,
  .profile-view .profile-awards-head > strong, .profile-awards-more > summary,
  .profile-view .award-card, .profile-view .award-card.is-locked) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
}
:root[data-theme="dark"] .profile-active-pill { color: #92dec6; background: #213f3d; }
:root[data-theme="dark"] .profile-identity-meta span { color: #bed7f6; background: #294362; }
:root[data-theme="dark"] :is(.profile-view .profile-snapshot strong,
  .profile-view .profile-story > span, .profile-view .profile-interests > span,
  .profile-awards-more > summary, .profile-view .profile-awards-head > strong) { color: var(--accent-strong); }
:root[data-theme="dark"] .profile-view .profile-story-need > span { color: #85d9bc; }
:root[data-theme="dark"] .profile-view .profile-portfolio > span,
:root[data-theme="dark"] .profile-view .profile-portfolio a,
:root[data-theme="dark"] .portfolio-link { color: var(--accent-strong); }
:root[data-theme="dark"] .profile-view .profile-tags span { border-color: var(--line); color: #c4d8f5; background: var(--surface-2); }

:root[data-theme="dark"] :is(.dialog-shell, .group-dialog-shell, .participant-dialog-shell,
  .tool-dialog-shell, .missions-dialog-shell, .image-viewer, .notification-letter,
  .product-tour) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
:root[data-theme="dark"] :is(.dialog-shell h2, .group-dialog-shell h2,
  .participant-dialog-shell h2, .tool-dialog-shell h2, .missions-dialog-shell h2) { color: var(--ink); }
:root[data-theme="dark"] :is(.dialog-copy, .dialog-copy p, .group-dialog-shell header p,
  .tool-dialog-shell > div > p) { color: var(--ink-soft); }
:root[data-theme="dark"] :is(.dialog-close, .image-viewer-toolbar button,
  .group-dialog-shell button:not(.primary-button)) { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
:root[data-theme="dark"] :is(.image-viewer-toolbar, .image-viewer-stage) { border-color: var(--line); color: var(--ink); background: var(--page); }
:root[data-theme="dark"] .notification-letter { background: linear-gradient(145deg, #1c2939, #263e59); }

:root[data-theme="dark"] #support-widget {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 65px rgba(0,0,0,.35);
}
:root[data-theme="dark"] #support-widget header { border-color: var(--line); background: var(--surface-2); }
:root[data-theme="dark"] #support-widget header strong { color: var(--ink); }
:root[data-theme="dark"] #support-widget header span { color: var(--muted); }
:root[data-theme="dark"] #support-widget header a { color: var(--accent-strong); }
:root[data-theme="dark"] #support-widget :is(header button, .support-empty, .support-message,
  .support-message.is-user, .support-chat-form, textarea, .support-guest-form textarea,
  .support-guest-form input[type=email]) {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-2);
}

:root[data-theme="dark"] .view :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
:root[data-theme="dark"] dialog :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-2);
}
:root[data-theme="dark"] :is(input, textarea)::placeholder { color: #95a8bc; }

@media (max-width: 899px) {
  :root[data-theme="dark"] .home-guide { border-color: #3a567a; color: var(--ink); background: linear-gradient(120deg, #1d314e, #315983); }
  :root[data-theme="dark"] .home-track-slide { background: linear-gradient(120deg, #282949, #494887); }
  :root[data-theme="dark"] .home-invite-slide { background: linear-gradient(120deg, #17372f, #276451); }
  :root[data-theme="dark"] .home-audit-slide { background: linear-gradient(120deg, #3d2d2d, #78524a); }
  :root[data-theme="dark"] :is(.home-guide-eyebrow, .home-guide #home-guide-title,
    .home-guide .home-banner-title, .home-track-slide .home-banner-title,
    .home-invite-slide .home-banner-title, .home-audit-slide .home-banner-title) { color: #f5f8ff; }
  :root[data-theme="dark"] :is(.home-guide-copy, .home-track-slide .home-guide-copy,
    .home-invite-slide .home-guide-copy, .home-audit-slide .home-guide-copy) { color: #d8e5f4; }
  :root[data-theme="dark"] .home-audit-visual { border-color: #806e6b; color: #f6e8df; background: rgba(39,34,38,.88); }
  :root[data-theme="dark"] .home-audit-visual i { background: #695b5b; }
  :root[data-theme="dark"] .home-carousel-controls button { border-color: var(--line); color: var(--ink); background: rgba(31,44,59,.88); }
  :root[data-theme="dark"] .home-carousel-controls > span { color: var(--ink-soft); background: rgba(31,44,59,.88); }
}
