/* Shared web components. Legacy selectors keep existing page layouts intact. */
.coach-theme-ui .desktop-nav { max-width: none; }
body.coach-theme-ui.program-workspace-body .topbar:has(.desktop-menu[open]) { position: relative; }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) { --slatecopy: var(--hp-muted); --text-muted: var(--hp-muted); --surface-soft: var(--hp-raised); --border: var(--hp-border); }

html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content {
  --navy: var(--hp-text); --navy-deep: var(--hp-text); --slate: var(--hp-muted);
  --green: var(--hp-success-text); --mint: var(--hp-success-bg); --teal: var(--hp-accent);
  --surface: var(--hp-surface); --surface-soft: var(--hp-raised); --ink: var(--hp-text);
  --muted: var(--hp-muted); --border: var(--hp-border); --danger: var(--hp-destructive-text);
  color: var(--hp-text);
}

html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(
  .ai-verification-panel,
  .analytics-attention-item,
  .analytics-comparison-card,
  .analytics-feature-card,
  .analytics-member-dialog,
  .analytics-member-page,
  .analytics-member-row,
  .analytics-toolbar-field,
  .application-acknowledgement-field,
  .application-answer-card,
  .application-answer-section,
  .application-choice-field,
  .application-closed-card,
  .application-contract-dialog,
  .application-deadline-panel,
  .application-hero,
  .application-invite-panel,
  .application-optional-field,
  .application-payment-panel,
  .application-progress-panel,
  .application-question-field,
  .application-summary-tile,
  .catalog-hero,
  .catalog-list-panel,
  .catalog-row,
  .checkin-archive-item,
  .checkin-chart-summary,
  .checkin-coach-editor,
  .checkin-coach-editor-field,
  .checkin-feedback-empty,
  .checkin-feedback-item,
  .checkin-metric-card,
  .checkin-metric-summary,
  .checkin-recurring-panel,
  .checkin-recurring-summary,
  .checkin-review-group,
  .checkin-rhythm-panel,
  .checkin-trend-card,
  .coach-management-hero,
  .coach-management-list,
  .coach-management-panel,
  .coach-management-row,
  .coach-management-summary,
  .decision-book-card,
  .decision-book-list,
  .decision-book-panel,
  .enrollment-create-panel,
  .enrollment-history-panel,
  .enrollment-management-hero,
  .enrollment-management-summary,
  .form-manager-add-question,
  .form-manager-advanced-field,
  .form-manager-advanced-panel,
  .form-manager-definition-group,
  .form-manager-empty,
  .form-manager-field,
  .form-manager-option-empty,
  .form-manager-section-field,
  .form-manager-summary,
  .form-video-overview-card,
  .form-video-overview-panel,
  .guide-article-card,
  .guide-card,
  .guide-category-panel,
  .guide-detail-card,
  .guide-editor,
  .guide-hero,
  .guide-management-panel,
  .initial-metric-field,
  .medication-library-empty,
  .medication-library-hero,
  .medication-library-list,
  .medication-library-row,
  .medication-library-tools-summary,
  .medication-matrix-panel,
  .metric-history-item,
  .metric-history-summary,
  .notification-card,
  .notification-group,
  .notification-panel,
  .panel,
  .panel-muted,
  .payment-settings-hero,
  .payment-settings-panel,
  .payment-settings-preview-row,
  .receipt-file-action-card,
  .receipt-file-card,
  .receipt-review-meta-item,
  .slot-row-card,
  .slot-stat-card,
  .summary-tile,
  .survey-builder-card,
  .survey-builder-hero,
  .survey-form-card,
  .survey-hero,
  .survey-panel,
  .survey-prompt-dialog,
  .survey-question,
  .survey-results-card,
  .survey-results-hero,
  .survey-send-card,
  .survey-send-hero,
  .survey-send-page,
  .survey-summary-question,
  .template-day-card,
  .template-exercise-note,
  .template-exercise-row,
  .template-item-row,
  .template-module,
  .template-note-details,
  .wp-checkout-hero,
  .wp-checkout-panel,
  .wp-hero,
  .wp-link-card,
  .wp-panel,
  .wp-result-card,
  .wp-toggle-card
) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }

html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(
  #id_recipients label,
  .application-actions,
  .application-deadline-manual-form,
  .application-deadline-quick-actions,
  .application-delete-form,
  .application-form,
  .application-invite-note,
  .application-program-form,
  .catalog-list-head,
  .catalog-toolbar,
  .checkin-archive-item-body,
  .checkin-disabled-form,
  .checkin-photo-note,
  .checkin-report-form,
  .coach-management-panel-head,
  .decision-book-filters,
  .enrollment-panel-head,
  .form-manager-checks label,
  .form-manager-compact-details,
  .form-manager-custom-question-form,
  .form-manager-section-actions,
  .form-video-actions,
  .guide-editor-head,
  .guide-reading-meta,
  .guide-toolbar,
  .medication-library-list-head,
  .medication-library-row-body,
  .medication-library-tools-body,
  .metric-history-item-body,
  .metric-history-note,
  .notification-toolbar,
  .payment-settings-note,
  .payment-settings-panel-head,
  .receipt-review-note,
  .slot-create-form,
  .slot-edit-details,
  .survey-form,
  .survey-recipient-controls,
  .survey-send-form,
  .survey-summary-head,
  .template-catalog-result,
  .template-catalog-results,
  .template-day-body,
  .template-day-summary,
  .template-module-foot,
  .template-module-head,
  .wp-checkout-panel-head,
  .wp-panel-head
) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }

html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(
  .analytics-dialog-stat,
  .analytics-dialog-tag,
  .analytics-member-stat,
  .analytics-page-index,
  .application-answer-count,
  .application-answer-index,
  .application-closed-icon,
  .application-deadline-icon,
  .application-delete-dialog-icon,
  .application-invite-icon,
  .application-payment-icon,
  .application-visual-group-index,
  .catalog-metric,
  .catalog-status,
  .checkin-archive-empty-icon,
  .checkin-coach-editor-guidance-icon,
  .checkin-micro-stat,
  .checkin-review-metric,
  .coach-management-avatar,
  .coach-progress-report-metric,
  .decision-book-stat,
  .decision-book-tag,
  .form-manager-add-question-icon,
  .form-manager-choice-index,
  .form-manager-package-mark,
  .guide-article-type,
  .guide-category-count,
  .guide-hero-stat,
  .medication-library-stat,
  .medication-matrix-day-pill,
  .medication-matrix-toggle-icon,
  .metric-history-empty-icon,
  .metric-history-score,
  .metric-history-stat,
  .notification-count,
  .payment-settings-preview-icon,
  .receipt-file-icon,
  .receipt-history-count,
  .receipt-history-icon,
  .slot-date-badge,
  .survey-prompt-icon,
  .survey-result-stat,
  .survey-section-icon,
  .survey-selected-count,
  .survey-send-icon,
  .survey-stat,
  .survey-status,
  .survey-version-pill,
  .template-macro,
  .template-order,
  .wp-empty-icon,
  .wp-hero-chip,
  .wp-panel-count,
  .wp-result-mark,
  .wp-status
) { background: var(--hp-neutral-bg); border-color: var(--hp-border); color: var(--hp-neutral-text); box-shadow: none; }


/* Native elements, shared utility classes, and controls. */
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(h1, h2, h3, h4, .screen-title, .text-navy, .field-label, th, strong) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.screen-copy, .text-slatecopy, .field-help, .field-hint, .helptext, .form-help, .catalog-meta, .catalog-description, .template-module-copy, .template-empty, .guide-article-summary, .guide-description, .guide-reading-meta, .coach-management-copy, .payment-settings-copy, .payment-settings-panel-copy, .application-answer-label, .application-answer-index, .application-answer-count, .analytics-page-meta, .analytics-muted, .survey-subtitle, .enrollment-management-copy) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.text-red-700, .errorlist, .field-error-text, .form-error, .form-manager-option-editor-alert, [data-state="error"]) { color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.catalog-hero h1, .catalog-name, .template-day-title, .template-module-title, .guide-title, .coach-management-title, .payment-settings-title, .survey-title, .analytics-value) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.table-wrap, .table-wrapper, .table-scroll, table, td, th, hr, .checkbox-row, .form-control) { border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(thead, th, .checkbox-row) { background: var(--hp-raised); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .template-stepper, .template-amount-control) { background-color: var(--hp-raised); border-color: var(--hp-control-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(input, textarea)::placeholder { color: var(--hp-muted); opacity: 1; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--hp-accent-fill); color: var(--hp-accent-fill); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(input, select, textarea):focus-visible { border-color: var(--hp-focus); outline: 3px solid var(--hp-focus); outline-offset: 3px; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.btn-secondary, .icon-button, .template-icon-button, .template-stepper-button, .template-drag-handle, .analytics-detail-button, .slot-filter, .analytics-filter a, .metric-history-periods a, .guide-stage-tabs a, .form-manager-filter, .form-manager-type-tab) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.btn-primary, .btn-trust, .survey-send-action button[type="submit"], .application-delete-submit) { background: var(--hp-accent-fill); border-color: var(--hp-accent-fill); color: var(--hp-on-accent); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.btn-primary, .btn-trust, .survey-send-action button[type="submit"]):hover { background: var(--hp-accent-fill-hover); border-color: var(--hp-accent-fill-hover); color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.btn-secondary, .icon-button, .template-icon-button, .template-stepper-button, .catalog-row):hover { background: var(--hp-hover-surface); border-color: var(--hp-hover-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-white, .bg-sand, [class~="bg-white/80"], [class~="bg-white/90"], [class~="bg-sand/30"], [class~="bg-sand/40"], [class~="bg-sand/60"]) { background-color: var(--hp-surface); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .bg-navy { background: var(--hp-accent-fill); color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-mint, .catalog-status, .slot-status-open, .wp-status-paid, .analytics-activity-badge.is-active, .checkin-report-state.is-reviewed, .checkin-history-delta-negative, .coach-progress-status.is-good, .checkin-coach-editor-feedback[data-state="success"], .survey-config-badge.ok, .wp-config-badges .ok) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.catalog-status.is-passive, .slot-status-closed, .analytics-activity-badge.is-inactive, .coach-progress-status.is-muted, .checkin-history-delta-neutral) { background: var(--hp-neutral-bg); color: var(--hp-neutral-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-gold, .catalog-metric.is-warning, .catalog-status.is-warning, .slot-status-full, .medication-library-stat-warning, .wp-readiness, .analytics-attention-item, .analytics-trend.is-neutral, .checkin-report-state.is-submitted, .checkin-report-state.is-pending_previous, .checkin-trend-warning, .coach-progress-status.is-watch, .ai-verification-panel.is-review) { background: var(--hp-warning-bg); color: var(--hp-warning-text); border-color: var(--hp-warning-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-orange, [class~="bg-orange/10"], .wp-status-failed, .checkin-report-state.is-missed, .coach-progress-status.is-risk, .checkin-history-delta-positive, .analytics-trend.is-down, .application-delete-warning, .application-delete-confirmation) { background: var(--hp-danger-bg); color: var(--hp-danger-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.analytics-trend.is-up, .ai-verification-panel:not(.is-review), .form-manager-section-toggle:has(input:checked), .survey-toggle:has(input:checked)) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.form-manager-danger, .survey-danger, .application-delete-trigger, .template-icon-button.is-danger, .template-danger) { background: var(--hp-danger-bg); border-color: var(--hp-destructive-text); color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.catalog-macro, .catalog-meta, .guide-article-meta, .template-item-meta, .template-stepper-label, .template-stepper-input, .template-day-count, .template-macro-pill, .survey-status, .survey-meta span, .survey-summary-meta span) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(a.is-active, button.is-active, a[aria-current="page"], button[aria-selected="true"], button[aria-pressed="true"], .form-manager-package-choice:has(input:checked), [id="id_recipients"] label:has(input:checked), .analytics-filter a.is-active, .slot-filter.is-active, .application-step-tab.is-active) { background: var(--hp-accent-fill); border-color: var(--hp-selected-outline); color: var(--hp-on-accent); box-shadow: inset 0 0 0 1px var(--hp-selected-outline); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.slot-filter.is-active strong, .application-step-tab.is-active span, .form-manager-package-choice:has(input:checked) span) { color: var(--hp-on-accent); background: transparent; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.catalog-icon, .catalog-card-icon, .application-payment-icon, .application-invite-icon, .application-deadline-icon, .form-manager-add-question-icon, .form-manager-package-mark, .medication-row-leading, .payment-settings-preview-icon, .survey-send-icon, .survey-section-icon) { background: var(--hp-accent-soft); color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.slot-progress, .analytics-funnel-bar, .analytics-feature-bar, .metric-history-chart-track) { background: var(--hp-neutral-bg); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.slot-progress span, .analytics-funnel-bar span, .analytics-feature-bar span, .analytics-day-bar, .coach-progress-bar-fill, .survey-toggle:has(input:checked) .survey-toggle-track) { background: var(--hp-accent-fill); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.metric-history-axis, .metric-history-grid, .analytics-grid) { stroke: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.metric-history-axis-label, .metric-history-axis-title) { fill: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.application-delete-dialog, .analytics-member-dialog) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.application-delete-dialog, .analytics-member-dialog)::backdrop { background: rgba(0, 0, 0, .65); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.application-delete-dialog-close, .application-delete-dialog-icon, .analytics-dialog-close) { background: var(--hp-raised); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.application-delete-dialog-title, .application-delete-dialog h2, .analytics-member-dialog h2) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is([style*="background:#fff"], [style*="background: #fff"]) { background-color: var(--hp-surface) !important; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is([style*="color:var(--slate)"], [style*="color: var(--slate)"]) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(a, button, summary, [tabindex]):focus-visible { outline: 3px solid var(--hp-focus); outline-offset: 3px; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(label, .checkbox-row):has(input:focus-visible) { outline: 3px solid var(--hp-focus); outline-offset: 3px; }


/* Composite components with their own nested surfaces. */
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.guide-section, .guide-step-panel, .guide-reading-card, .guide-empty-state, .guide-management-list, .template-item-card, .template-program-row, .template-day-editor, .decision-book-list-item, .decision-book-transcript) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.guide-management-stats, .guide-admin-order, .guide-admin-order span, .guide-key-points, .guide-editor-note, .guide-next-prev a, .template-catalog-option, .template-stepper button, .coach-management-summary span, .enrollment-management-summary span) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-muted); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.guide-admin-badges span, .guide-stage-tab, .guide-category-nav a, .guide-stage-number, .guide-lock-icon, .catalog-macro, .form-manager-type-tabs, .template-macro-pill, .decision-book-status, .coach-management-avatar) { background: var(--hp-neutral-bg); border-color: var(--hp-border); color: var(--hp-neutral-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-management-badges span, .payment-settings-source, .guide-complete-icon, .decision-book-status.is-reviewed) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-management-badges .is-closed, .wp-config-badges span) { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.wp-config-badges .ok) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.payment-settings-preview-row span, .guide-admin-order, .guide-admin-badges, .template-day-count) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.wp-readiness li, .wp-readiness strong, .wp-readiness p) { color: var(--hp-warning-text); }

/* Shared dialogs and tools live outside the page content and remain themed on every staff screen. */
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog, .app-feedback-dialog-card, .coach-chat-dock, .coach-chat-panel, .coach-chat-header, .coach-chat-composer, .coach-decision-dialog, .decision-modal, .searchable-select-menu, .searchable-select-options, .survey-prompt-dialog) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-title, .app-feedback-dialog-heading-copy, .coach-chat-title, .coach-decision-modal-title, .searchable-select-option) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-message, .app-feedback-dialog-detail, .app-feedback-dialog-prompt-label, .coach-chat-subtitle, .coach-chat-empty, .coach-chat-bubble time) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-input, .coach-chat-bubble, .coach-chat-thread, .coach-chat-textarea, .app-feedback-dialog-button-secondary, .app-feedback-dialog-close) { background: var(--hp-raised); border-color: var(--hp-control-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-button-primary, .coach-chat-send) { background: var(--hp-accent-fill); border-color: var(--hp-accent-fill); color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .coach-chat-bubble.is-own { background: var(--hp-success-bg); border-color: var(--hp-success-border); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-bubble-name, .app-feedback-dialog-eyebrow) { color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog, .survey-prompt-dialog)::backdrop { background: rgba(0, 0, 0, .65); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.searchable-select-option:hover, .searchable-select-option[aria-selected="true"]) { background: var(--hp-accent-soft); color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-button, .app-feedback-dialog-input, .app-feedback-dialog-close, .coach-chat-send):focus-visible { outline: 3px solid var(--hp-focus); outline-offset: 3px; }

html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-dock, .coach-chat-dock-panel, .coach-decision-dialog, .app-feedback-dialog, .client-dates-dialog, .searchable-select-menu) { --navy: var(--hp-text); --slate: var(--hp-muted); --text: var(--hp-text); --line: var(--hp-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-dock-panel, .coach-chat-dock-body, .coach-decision-dialog, .client-dates-dialog) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-dock-header, .coach-chat-header-button, .coach-chat-composer-button, .coach-chat-attachment-tools, .coach-chat-template-row button, .coach-decision-dialog-head, .coach-decision-header-button, .coach-decision-compact-stop, .coach-decision-context, .coach-decision-recorder, .coach-decision-feedback, .client-dates-preview, .client-dates-calendar, .client-dates-actions, .app-feedback-dialog-actions) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-bubble-body, .coach-chat-thread-title, .coach-decision-dialog h2, .client-dates-dialog h2) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.coach-chat-composer-button.is-send, .coach-decision-compact-stop) { background: var(--hp-accent-fill); color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.client-dates-warning, .coach-decision-header-visual) { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.client-dates-error, .template-form-errors, .coach-chat-dock-error, .app-feedback-dialog[data-tone="error"] .app-feedback-dialog-icon) { background: var(--hp-danger-bg); color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .app-feedback-dialog[data-tone="error"] .app-feedback-dialog-button-primary { background: var(--hp-danger-bg); border-color: var(--hp-destructive-text); color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.app-feedback-dialog-icon, .coach-chat-avatar) { background: var(--hp-accent-soft); color: var(--hp-accent); }

/* Selected control text and legacy utility surfaces. */

html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is([class*="bg-white/"], .survey-send-action, .application-step-tab, .application-package-card, .application-choice-field .form-field > div label, .application-choice-field .form-field > ul label, .analytics-toolbar-clear) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is([class*="text-white/"], .text-white) { color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.slot-filter strong, .survey-summary-meta span, .application-step-tab span:first-child, .application-visual-group-index) { background: var(--hp-neutral-bg); color: var(--hp-neutral-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(a[aria-current="page"], a.is-active, button[aria-selected="true"], .application-step-tab.is-active, .application-choice-field label:has(input:checked)) { background: var(--hp-accent-fill); border-color: var(--hp-selected-outline); color: var(--hp-on-accent); box-shadow: inset 0 0 0 1px var(--hp-selected-outline); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(a[aria-current="page"], a.is-active, button[aria-selected="true"], .application-step-tab.is-active) :is(span, small, strong) { color: var(--hp-on-accent); background: transparent; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .application-choice-field label:has(input:checked) :is(span, strong) { color: var(--hp-on-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.survey-send-action-copy span, .survey-send-action-copy strong) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.template-icon-button-danger, .template-form-errors) { background: var(--hp-danger-bg); color: var(--hp-destructive-text); border-color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.analytics-funnel-bar span, .analytics-feature-bar span, .analytics-day-bar, .coach-progress-bar-fill) { background: var(--hp-accent); }

/* Coach views of nutrition, supplement and workout history. */
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-day-summary-note, .nutrition-history-detail, .nutrition-history-insight, .nutrition-history-meal, .nutrition-history-note, .nutrition-history-panel, .nutrition-history-week, .nutrition-history-week-card, .student-workout-attention-row, .student-workout-movement-body, .student-workout-panel, .student-workout-session-body, .supplement-history-day-body, .supplement-history-detail, .supplement-history-insight, .supplement-history-panel, .supplement-history-plan-item, .supplement-history-product) { background: var(--hp-surface); color: var(--hp-text); border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-filters, .nutrition-history-periods, .student-workout-movement-search, .student-workout-movement-toggle, .student-workout-periods, .student-workout-rhythm-track, .supplement-history-periods, .supplement-history-rhythm-track) { background: var(--hp-raised); color: var(--hp-text); border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-chevron, .nutrition-history-day-status, .nutrition-history-extra-badge, .nutrition-history-filter, .nutrition-history-insight-icon, .nutrition-history-plan-macro, .nutrition-history-stat, .student-workout-movement-metric, .student-workout-movement-point, .student-workout-set, .student-workout-stat, .supplement-history-filter, .supplement-history-insight-label, .supplement-history-product-status, .supplement-history-stat) { background: var(--hp-neutral-bg); color: var(--hp-neutral-text); border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-primary-link, .supplement-history-primary-link, a[aria-current="true"]) { background: var(--hp-accent-fill); color: var(--hp-on-accent); border-color: var(--hp-selected-outline); box-shadow: inset 0 0 0 1px var(--hp-selected-outline); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-day-status.good, .supplement-history-product-status) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.nutrition-history-day-status.attention, .nutrition-history-insight.attention, .nutrition-history-meal--extra, .supplement-history-insight.is-attention, .supplement-history-product-status.is-skipped) { background: var(--hp-warning-bg); color: var(--hp-warning-text); }

/* Follow-up reviews, progress charts and auxiliary client navigation. */
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.action-card, .checklist-row, .checkin-edit-access, .checkin-coach-editor-guidance, [data-cheat-meal-panel], .student-workout-coach-link, .nutrition-history-coach-link, .coach-progress-signal) { background: var(--hp-raised); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-metric small, .coach-progress-chart-value span) { color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-bar-track) { background: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-line, .coach-progress-dot) { stroke: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-line.is-waist, .coach-progress-dot.is-waist) { stroke: var(--hp-chart-comparison); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .coach-progress-dot { fill: var(--hp-surface); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-status.is-good) { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-status.is-watch) { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-status.is-risk) { background: var(--hp-danger-bg); color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .coach-progress-status.is-muted { background: var(--hp-neutral-bg); color: var(--hp-neutral-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .coach-progress-bar-fill.is-watch { background: var(--hp-warning-indicator); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .coach-progress-bar-fill.is-risk { background: var(--hp-danger-indicator); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .coach-progress-bar-fill.is-muted { background: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is([class*="bg-mint/"], [class*="bg-sand/"]) { background: var(--hp-raised); border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .guide-editor label { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.client-dates-check small, .client-dates-preview small, .client-dates-hint, [data-client-dates-form] .field-help) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.coach-progress-table small, .coach-progress-report-date time) { color: var(--hp-muted); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .text-orange { color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.survey-response-card, .survey-response-hero, .survey-response-question) { background: var(--hp-surface); border-color: var(--hp-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.survey-choice, .survey-scale label, .survey-hero-meta span, .survey-question-count, .survey-question-requirement) { background: var(--hp-raised); border-color: var(--hp-control-border); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.survey-choice:has(input:checked), .survey-scale label:has(input:checked)) { background: var(--hp-accent-fill); border-color: var(--hp-selected-outline); color: var(--hp-on-accent); box-shadow: inset 0 0 0 1px var(--hp-selected-outline); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.survey-hero-icon, .survey-question-number, .survey-response .eyebrow) { background: var(--hp-accent-soft); color: var(--hp-accent); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content .survey-preview-notice { background: var(--hp-info-bg); border-color: var(--hp-border); color: var(--hp-info-text); }

/* Validation and transient feedback use the same semantic palette. */
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-red-50, .bg-red-100) { background: var(--hp-danger-bg); border-color: var(--hp-destructive-text); color: var(--hp-destructive-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-amber-50, .bg-yellow-50) { background: var(--hp-warning-bg); border-color: var(--hp-warning-border); color: var(--hp-warning-text); }
html[data-color-theme="dark"] :is(.coach-theme-extended, .student-theme-ui) #main-content :is(.bg-green-50, .bg-emerald-50) { background: var(--hp-success-bg); border-color: var(--hp-success-border); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message { background: var(--hp-surface); border-color: var(--hp-border); border-left-color: var(--hp-accent); color: var(--hp-text); box-shadow: none; }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.flash-dismiss-button, .feedback-toast-icon) { background: var(--hp-raised); color: var(--hp-accent); border-color: var(--hp-border); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) :is(.feedback-toast-copy strong, .feedback-toast-copy > span) { color: var(--hp-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-success { border-left-color: var(--hp-success-indicator); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-success .feedback-toast-icon { background: var(--hp-success-bg); color: var(--hp-success-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-warning { border-left-color: var(--hp-warning-indicator); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-warning .feedback-toast-icon { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-error { border-left-color: var(--hp-danger-indicator); }
html[data-color-theme="dark"] :is(.coach-theme-ui, .student-theme-ui) .flash-message-error .feedback-toast-icon { background: var(--hp-danger-bg); color: var(--hp-destructive-text); }
