/* Semantic bridge for marketing and the dashboard shell only. */
.ui-scheme-control {
    display: inline-flex;
    align-items: center;
    gap: var(--pm-space-2);
    margin: 0;
    color: inherit;
    font-size: var(--pm-text-sm);
    white-space: nowrap;
}

.ui-footer-preferences,
.ui-footer-language {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--pm-space-2);
}

.ui-footer-preferences {
    gap: var(--pm-space-3) var(--pm-space-6);
    color: var(--pm-text-secondary);
    font-size: var(--pm-text-sm);
}

.ui-footer-language__heading,
.ui-footer-language__choices,
.ui-scheme-control__heading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--pm-space-2);
}

.ui-footer-preferences i {
    color: var(--pm-primary-400);
}

.ui-footer-language__option {
    color: inherit;
    padding: var(--pm-space-1) var(--pm-space-2);
    border-radius: var(--pm-radius-md);
    text-decoration: none;
}

.ui-footer-language__option:hover,
.ui-footer-language__option.is-current {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    text-decoration: none;
}

.ui-footer-language__option.is-current {
    font-weight: 700;
}

.ui-footer-language__option:focus-visible,
.ui-scheme-control select:focus-visible {
    outline: 3px solid var(--pm-primary-400);
    outline-offset: 2px;
}

.footer-premium .ui-footer-preferences {
    color: var(--pm-gray-300);
}

.footer-premium .ui-footer-language__option:hover,
.footer-premium .ui-footer-language__option.is-current {
    background: rgba(255, 255, 255, 0.12);
    color: var(--pm-white);
}

.footer-premium .ui-scheme-control select {
    background: var(--pm-gray-800);
    color: var(--pm-white);
    border-color: var(--pm-gray-600);
}

.ui-scheme-control select {
    min-height: 44px;
    max-width: 6.8rem;
    padding-inline: var(--pm-space-2);
    border: 1px solid var(--pm-border-medium);
    border-radius: var(--pm-radius-md);
    background: var(--pm-bg-primary);
    color: var(--pm-text-primary);
}

.ui-scheme-control select:focus-visible {
    outline: 3px solid var(--pm-primary-400);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .ui-footer-preferences {
        width: 100%;
        flex-wrap: nowrap;
        gap: var(--pm-space-3);
    }

    .ui-footer-language,
    .ui-scheme-control {
        flex-direction: column;
        flex-wrap: nowrap;
    }
}

html[data-ui-scheme="dark"] {
    color-scheme: dark;
    --pm-bg-primary: var(--pm-gray-900);
    --pm-bg-secondary: var(--pm-gray-800);
    --pm-bg-tertiary: var(--pm-gray-700);
    --pm-text-primary: var(--pm-gray-50);
    --pm-text-secondary: var(--pm-gray-200);
    --pm-text-muted: var(--pm-gray-300);
    --pm-border-light: var(--pm-gray-700);
    --pm-border-medium: var(--pm-gray-600);
    --pm-surface-0: var(--pm-gray-900);
    --pm-success-bg: rgba(16, 185, 129, 0.15);
    --pm-success-text: var(--pm-success-200, #a7f3d0);
    --pm-warning-bg: rgba(245, 158, 11, 0.12);
    --pm-warning-text: var(--pm-warning-100);
    --pm-danger-bg: rgba(244, 63, 94, 0.12);
    --pm-danger-text: var(--pm-danger-200);
    --pm-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
    --pm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --color-bg-primary: var(--pm-bg-primary);
    --color-bg-secondary: var(--pm-bg-secondary);
    --color-bg-tertiary: var(--pm-bg-tertiary);
    --color-text-primary: var(--pm-text-primary);
    --color-text-secondary: var(--pm-text-secondary);
    --color-text-muted: var(--pm-text-muted);
    --color-border-light: var(--pm-border-light);
    --color-border: var(--pm-border-medium);
    --pm-surface-elevated: var(--pm-gray-800);
    --pm-surface-muted: var(--pm-gray-700);
    --pm-surface-marketing-band: linear-gradient(180deg, var(--pm-gray-900) 0%, var(--pm-gray-800) 72%);
    --pm-pricing-section-bg: linear-gradient(180deg, var(--pm-gray-900) 0%, var(--pm-gray-800) 100%);
    --pm-pricing-col-free: var(--pm-gray-800);
    --pm-pricing-col-pro: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(167, 139, 250, 0.12));
    --pm-pricing-col-pro-muted: rgba(124, 58, 237, 0.15);
    --pm-table-group-header-bg: var(--pm-gray-700);
}

html[data-ui-scheme="dark"] body:not(.auth-page):not(.profile-public) {
    background: var(--pm-bg-primary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] .static-page-main,
html[data-ui-scheme="dark"] .features-section,
html[data-ui-scheme="dark"] .pricing-section,
html[data-ui-scheme="dark"] .how-it-works-section {
    background-color: var(--pm-bg-primary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] .feature-card,
html[data-ui-scheme="dark"] .pricing-card,
html[data-ui-scheme="dark"] .stat-card,
html[data-ui-scheme="dark"] .quick-actions,
html[data-ui-scheme="dark"] .static-page-main .card,
html[data-ui-scheme="dark"] .static-page-main .card-header,
html[data-ui-scheme="dark"] .sidebar,
html[data-ui-scheme="dark"] body.dashboard .navbar {
    background-color: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] .pricing-section,
html[data-ui-scheme="dark"] .how-it-works-section,
html[data-ui-scheme="dark"] .social-proof-section,
html[data-ui-scheme="dark"] .static-page-main .bg-white {
    background: var(--pm-bg-primary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] .section-title,
html[data-ui-scheme="dark"] .feature-card h3,
html[data-ui-scheme="dark"] .pricing-title,
html[data-ui-scheme="dark"] .pricing-amount,
html[data-ui-scheme="dark"] .action-title,
html[data-ui-scheme="dark"] .tip-title,
html[data-ui-scheme="dark"] .static-page-main .text-dark {
    color: var(--pm-text-primary) !important;
}

html[data-ui-scheme="dark"] .section-description,
html[data-ui-scheme="dark"] .feature-card p,
html[data-ui-scheme="dark"] .pricing-subtitle,
html[data-ui-scheme="dark"] .pricing-currency,
html[data-ui-scheme="dark"] .action-description,
html[data-ui-scheme="dark"] .static-page-main .text-muted {
    color: var(--pm-text-secondary) !important;
}

html[data-ui-scheme="dark"] .static-page-main .table,
html[data-ui-scheme="dark"] .static-page-main .list-group-item,
html[data-ui-scheme="dark"] .action-btn,
html[data-ui-scheme="dark"] .tips-card {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] .static-page-main .table td,
html[data-ui-scheme="dark"] .static-page-main .table th {
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] .sidebar .nav-link,
html[data-ui-scheme="dark"] .sidebar .nav-section-title,
html[data-ui-scheme="dark"] .sidebar-user-name,
html[data-ui-scheme="dark"] .navbar-breadcrumb,
html[data-ui-scheme="dark"] .stat-title,
html[data-ui-scheme="dark"] .stat-value {
    color: var(--pm-text-primary);
}

/* Dashboard shell and touched task surfaces use shell tokens, not profile theme colors. */
html[data-ui-scheme="dark"] body.dashboard .dashboard-wrapper,
html[data-ui-scheme="dark"] body.dashboard .main-content,
html[data-ui-scheme="dark"] body.dashboard .page-content {
    background: var(--pm-bg-primary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .dashboard-footer,
html[data-ui-scheme="dark"] body.dashboard .sidebar,
html[data-ui-scheme="dark"] body.dashboard .navbar,
html[data-ui-scheme="dark"] body.dashboard .modal-content {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu-panel {
    background: var(--pm-bg-secondary);
    border-color: var(--pm-border-light);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__link {
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__link:hover {
    background: var(--pm-bg-tertiary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__link.is-route-active {
    background: var(--pm-bg-tertiary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__link--danger,
html[data-ui-scheme="dark"] body.dashboard .user-menu__link--danger:hover {
    color: var(--pm-danger-text);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__link--danger:hover {
    background: var(--pm-danger-bg);
}

html[data-ui-scheme="dark"] body.dashboard .user-menu__divider {
    background: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.dashboard .sidebar-brand,
html[data-ui-scheme="dark"] body.dashboard .sidebar-footer,
html[data-ui-scheme="dark"] body.dashboard .navbar,
html[data-ui-scheme="dark"] body.dashboard .dashboard-footer {
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.dashboard .sidebar-user:hover,
html[data-ui-scheme="dark"] body.dashboard .sidebar-user[aria-expanded="true"],
html[data-ui-scheme="dark"] body.dashboard .navbar-toggle:hover {
    background: var(--pm-bg-tertiary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .navbar-icon-btn,
html[data-ui-scheme="dark"] body.dashboard .navbar-toggle,
html[data-ui-scheme="dark"] body.dashboard .sidebar-user-email,
html[data-ui-scheme="dark"] body.dashboard .sidebar-user-menu-label,
html[data-ui-scheme="dark"] body.dashboard .sidebar-user-chevron,
html[data-ui-scheme="dark"] body.dashboard .breadcrumb-item {
    color: var(--pm-text-secondary);
}

html[data-ui-scheme="dark"] body.dashboard .sidebar-user[aria-expanded="true"] .sidebar-user-menu-label,
html[data-ui-scheme="dark"] body.dashboard .sidebar-user[aria-expanded="true"] .sidebar-user-chevron {
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .nav-link:hover,
html[data-ui-scheme="dark"] body.dashboard .period-link:hover {
    background: var(--pm-bg-tertiary);
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.dashboard .period-link,
html[data-ui-scheme="dark"] body.dashboard .period-locked,
html[data-ui-scheme="dark"] body.dashboard .analytics-page .data-table,
html[data-ui-scheme="dark"] body.dashboard .analytics-page .data-table th,
html[data-ui-scheme="dark"] body.dashboard .analytics-page .data-table td {
    background: var(--pm-bg-tertiary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-medium);
}

html[data-ui-scheme="dark"] .static-page-main .accordion .card,
html[data-ui-scheme="dark"] .static-page-main .accordion .card-header,
html[data-ui-scheme="dark"] .static-page-main .accordion .card-body,
html[data-ui-scheme="dark"] .static-page-main .accordion .btn-link,
html[data-ui-scheme="dark"] .static-plans-faq .card,
html[data-ui-scheme="dark"] .static-plans-faq .card-header,
html[data-ui-scheme="dark"] .static-plans-faq .card-body,
html[data-ui-scheme="dark"] .static-plans-faq .pm-accordion-toggle,
html[data-ui-scheme="dark"] .static-page-main .table,
html[data-ui-scheme="dark"] .static-page-main .table-striped tbody tr,
html[data-ui-scheme="dark"] .static-page-main .form-control {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

/* Pricing comparison cells carry legacy inline light styles. */
html[data-ui-scheme="dark"] .static-page-main .table th,
html[data-ui-scheme="dark"] .static-page-main .table td {
    background: var(--pm-bg-secondary) !important;
    color: var(--pm-text-primary) !important;
    border-color: var(--pm-border-light) !important;
}

html[data-ui-scheme="dark"] .static-page-main .table tr:nth-child(even) td {
    background: var(--pm-bg-tertiary) !important;
}

html[data-ui-scheme="dark"] body.dashboard .completion-card,
html[data-ui-scheme="dark"] body.dashboard .tips-card,
html[data-ui-scheme="dark"] body.dashboard .quick-actions,
html[data-ui-scheme="dark"] body.dashboard .theme-card,
html[data-ui-scheme="dark"] body.dashboard .settings-card,
html[data-ui-scheme="dark"] body.dashboard .help-card {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.dashboard .dashboard-next-step,
html[data-ui-scheme="dark"] body.dashboard .stat-label,
html[data-ui-scheme="dark"] body.dashboard .stat-footer {
    color: var(--pm-text-secondary);
}

html[data-ui-scheme="dark"] body.dashboard .alert-banner--block,
html[data-ui-scheme="dark"] body.dashboard .alert-banner--warning {
    border-color: var(--pm-border-medium);
}

html[data-ui-scheme="dark"] body.dashboard .shortcuts-modal,
html[data-ui-scheme="dark"] body.dashboard .shortcuts-modal__panel {
    background: var(--pm-bg-secondary);
    color: var(--pm-text-primary);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.dashboard .upgrade-page-panel {
    background: var(--pm-bg-secondary);
    border-color: var(--pm-border-light);
    color: var(--pm-text-primary);
}
