/* Legacy consulting surfaces follow the same application theme tokens as the shared UI. */
body[data-theme="dark"] .consulting-screen,
body[data-theme="dark"] .consulting-modals {
    --ink: var(--text);
    --muted: #9fb0bc;
    --line: rgba(255, 255, 255, .14);
    --soft: var(--surface-strong);
    --teal: var(--primary-strong);
    --teal-dark: color-mix(in srgb, var(--primary) 65%, white 35%);
    --amber: var(--accent);
    --danger: #e35d6a;
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen,
body[data-theme="dark"] .consulting-screen.catalog-screen,
body[data-theme="dark"] .consulting-screen .workspace-panel {
    background: var(--bg);
}

body[data-theme="dark"] .consulting-screen :is(
    .metric-strip, .metric-strip > div, .metric-strip button, .filter-grid,
    .table-shell, .report-summary, .report-summary > div, .catalog-overview,
    .catalog-screen .filter-grid, .catalog-screen .filter-grid > label,
    .catalog-screen .workspace-panel, .catalog-screen .consulting-tabs,
    .catalog-screen .section-title, .catalog-screen .table-shell,
    .project-card, .form-section, .execution-line, .editor-subsection,
    .project-register-modes, .group-register-modes, .project-estimate
) {
    background: var(--surface);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(
    .consulting-header, .catalog-screen .consulting-header, .section-title,
    .execution-column, .execution-line > header, .form-section > header,
    .selected-line > header, .editor-subsection > header, .project-facts,
    .project-classification, .milestone-timeline, .stage-head, .session-row,
    .customer-results-head, .payment-balance, .definition-head,
    .catalog-screen .result-total, .result-total, .operations-screen .result-total,
    .finance-grid > div, .project-estimate th, .audience-divider th,
    .project-register-modes strong, .group-register-modes strong
) {
    background: color-mix(in srgb, var(--surface) 78%, var(--primary) 22%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(
    .catalog-screen .filter-grid > label > span, .catalog-overview th,
    .catalog-screen .table-shell th, .project-register th, .finance-register th,
    .organization-kinds-modal th, .payment-methods-modal th
),
body[data-theme="dark"] .consulting-modals :is(
    .definition-head, .stage-head, .team-head, .organization-kinds-modal th,
    .payment-methods-modal th, .project-estimate th
) {
    background: color-mix(in srgb, var(--surface) 65%, var(--primary) 35%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(
    .catalog-screen .table-shell tbody tr:nth-child(even) td,
    .project-register tbody tr:nth-child(even) td,
    .finance-register tbody tr:nth-child(even) td
) {
    background: color-mix(in srgb, var(--surface) 92%, var(--text) 8%);
}

body[data-theme="dark"] .consulting-screen :is(
    .catalog-screen .table-shell tbody tr:hover td,
    .project-register tbody tr:hover td,
    .finance-register tbody tr:hover td,
    .operations-screen .metric-strip button:hover
) {
    background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
}

body[data-theme="dark"] .consulting-screen :is(
    .filter-grid input, .filter-grid select, .catalog-screen .filter-grid input,
    .catalog-screen .filter-grid select, .cohort-link-toolbar select,
    .project-register-modes button, .group-register-modes button
),
body[data-theme="dark"] .consulting-modals :is(
    input, select, textarea, .definition-row input, .definition-row select,
    .member-search, .team-toolbar input
) {
    background: var(--surface-strong);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(input, textarea)::placeholder,
body[data-theme="dark"] .consulting-modals :is(input, textarea)::placeholder {
    color: var(--muted);
    opacity: 1;
}

body[data-theme="dark"] .consulting-screen :is(
    .secondary-action, .icon-button, .icon-actions button, .line-actions button,
    .project-register-modes button, .group-register-modes button
),
body[data-theme="dark"] .consulting-modals :is(
    .secondary-action, .icon-button, .icon-actions button, .line-actions button,
    .editor-subsection header button, .member-list button
) {
    background: var(--surface-strong);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(
    .primary-action, .project-register-modes button.active,
    .group-register-modes button.active
),
body[data-theme="dark"] .consulting-modals .primary-action {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #fff;
}

body[data-theme="dark"] .consulting-screen :is(
    .metric-strip span, .filter-grid span, .section-title span,
    .table-shell small, .catalog-screen .filter-grid > label > span,
    .operations-screen .metric-strip span
) {
    color: var(--muted);
}

body[data-theme="dark"] .consulting-screen :is(
    .catalog-screen .filter-grid > label > span, .catalog-overview th,
    .catalog-screen .table-shell th, .project-register th, .finance-register th
) {
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(
    .finance-summary > div:nth-child(3), .finance-summary > div:nth-child(4),
    .catalog-screen .result-total, .operations-screen .metric-strip > div > span
),
body[data-theme="dark"] .consulting-modals :is(
    .payment-balance, .selected-customer, .selection-card.selected,
    .team-row.selected, .employee-selection label.selected, .customer-result:hover
) {
    background: color-mix(in srgb, var(--surface) 83%, var(--primary) 17%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen .status,
body[data-theme="dark"] .consulting-modals .status {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen :is(.money, .table-link, .record-link),
body[data-theme="dark"] .consulting-modals :is(.money, .table-link, a[href]) {
    color: var(--teal-dark);
}

body[data-theme="dark"] .consulting-modals :is(
    .modal-panel, .modal-header, .modal-actions, .editor-modal,
    .editor-modal .modal-header, .editor-modal .modal-actions,
    .customer-toolbar label, .customer-result, .service-catalog > input,
    .catalog-toggle button, .catalog-list > button, .form-section,
    .execution-line, .editor-subsection, .employee-selection label,
    .execution-team-table, .team-row, .project-classification,
    .member-list button, .member-search, .project-estimate,
    .organization-kinds-modal .table-shell, .payment-methods-modal .table-shell
) {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .service-catalog, .customer-results-head, .form-section > header,
    .selected-line > header, .project-facts, .milestone-timeline,
    .execution-line > header, .editor-subsection > header,
    .editor-modal .editor-subsection > header, .definition-head,
    .stage-head, .team-toolbar, .team-head, .payment-balance,
    .session-row, .team-toolbar output, .finance-grid > div
) {
    background: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-modals :is(
    .field-grid label, .line-price-grid label, .finance-grid label,
    .editor-modal .field-grid.four > label, .definition-row,
    .editor-modal .definition-row, .option-editor, .team-row:hover,
    .multi-choice-grid label, .linked-organization, .project-card,
    .execution-column, .stage-row, .project-files span
) {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .editor-modal input:not([type="checkbox"]):not([type="color"]),
    .editor-modal select, .editor-modal textarea,
    .field-grid input:not([type="checkbox"]):not([type="color"]),
    .field-grid select, .field-grid textarea,
    .definition-row input, .definition-row select,
    .team-toolbar input, .finance-section textarea
) {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .organization-kinds-modal tbody tr:nth-child(even),
    .payment-methods-modal tbody tr:nth-child(even),
    .editor-modal .definition-row:nth-child(even), .multi-choice-grid label.selected
) {
    background: color-mix(in srgb, var(--surface) 90%, var(--text) 10%);
}

body[data-theme="dark"] .consulting-modals :is(
    .form-message.error, .page-message.error, .delete-confirmation,
    .editor-validation, .range-note
) {
    background: color-mix(in srgb, var(--surface) 82%, var(--danger) 18%);
    color: var(--danger);
}

body[data-theme="dark"] .consulting-modals :is(
    .status.waiting, .status.review, .status.customer, .status.done,
    .status.live, .status.muted
) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .consulting-modals :is(
    .team-row strong, .team-row span, .project-facts strong,
    .line-price-grid strong, .field-grid label > span
) {
    color: var(--text);
}

body[data-theme="dark"] .consulting-modals .editor-modal .field-grid.four > label > span {
    color: var(--muted);
}

body[data-theme="dark"] .cohort-page {
    --cohort-ink: var(--text);
    --cohort-muted: var(--muted);
    --cohort-line: var(--line);
    --cohort-head: color-mix(in srgb, var(--surface) 65%, var(--primary) 35%);
    --cohort-soft: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
    background: var(--bg);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page :is(
    .cohort-summary, .cohort-register, .faculty-section, .link-existing,
    .empty-state, .table-scroll, .detail-table, .project-files span,
    .project-files a, .project-milestones span, .payment-ledger span,
    .result-count, .faculty-totals span, .secondary-action
) {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page :is(
    .faculty-deadlines, .faculty-deadlines span, .filter-result,
    .service-row td, .session-note
) {
    background: var(--cohort-soft) !important;
    color: var(--text);
}

body[data-theme="dark"] .cohort-page :is(
    .filter-grid input, .filter-grid select
) {
    background: var(--surface-strong);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page tbody tr:nth-child(even) > td {
    background: color-mix(in srgb, var(--surface) 91%, var(--text) 9%);
}

body[data-theme="dark"] .cohort-page tbody tr:hover > td {
    background: color-mix(in srgb, var(--surface) 84%, var(--primary) 16%);
}

body[data-theme="dark"] .cohort-page .project-detail-row > td {
    background: var(--surface-strong) !important;
}

body[data-theme="dark"] .cohort-page :is(
    .record-link, .money, .project-files a, .detail-table td a
) {
    color: color-mix(in srgb, var(--primary) 65%, white 35%);
}

body[data-theme="dark"] .cohort-page :is(
    .outstanding, .milestone, .detail-facts, .project-notes,
    .faculty-deadlines span, .status
) {
    color: var(--muted);
}

body[data-theme="dark"] .cohort-page .status,
body[data-theme="dark"] .cohort-page .action-message {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page .action-message.error {
    background: color-mix(in srgb, var(--surface) 82%, var(--danger) 18%);
    color: var(--danger);
}

body[data-theme="dark"] .customer-consulting {
    color: var(--text);
}

body[data-theme="dark"] .customer-consulting :is(
    .summary, .filters, .project-table, .details-button, .line-list section
) {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] .customer-consulting :is(
    .project-table th, .line-list section > header,
    .stages p, .expanded td
) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .customer-consulting :is(
    .summary b, .filters input, .filters select
) {
    color: var(--text);
}

body[data-theme="dark"] .customer-consulting :is(
    .summary span, .filters span, .project-table small, .empty
) {
    color: var(--muted);
}

body[data-theme="dark"] .customer-consulting .files a {
    color: color-mix(in srgb, var(--primary) 65%, white 35%);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .consulting-header,
body[data-theme="dark"] .consulting-screen.catalog-screen .section-title,
body[data-theme="dark"] .consulting-screen.catalog-screen .result-total {
    background: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen.catalog-screen :is(
    .consulting-tabs, .filter-grid, .filter-grid > label,
    .table-shell, .catalog-overview
) {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .workspace-panel {
    background: var(--bg);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-screen.catalog-screen :is(
    .catalog-overview th, .filter-grid > label > span, .table-shell th
) {
    background: color-mix(in srgb, var(--surface) 65%, var(--primary) 35%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .consulting-tabs a {
    color: var(--muted);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .consulting-tabs a.active {
    background: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
    color: var(--text);
}

body[data-theme="dark"] .consulting-screen.catalog-screen :is(
    .filter-grid input, .filter-grid select
) {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .table-shell tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface) 92%, var(--text) 8%);
}

body[data-theme="dark"] .consulting-screen.catalog-screen .table-shell tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
}

body[data-theme="dark"] .consulting-modals .editor-modal :is(
    .field-grid.four, .field-grid.four > label, .definition-row,
    .definition-row:nth-child(even), .package-totals, .price-reset
) {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals .editor-modal :is(
    .field-grid.four input:not([type="checkbox"]):not([type="color"]),
    .field-grid.four select, .field-grid.four textarea,
    .definition-row input, .definition-row select
) {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .definition-row, .definition-row:nth-child(even),
    .option-editor, .member-picker, .service-catalog,
    .stage-row, .session-row, .attachment-row,
    .project-facts, .milestone-timeline, .selected-line > header
) {
    color: var(--text);
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .table-shell, .project-estimate, .team-row.selected,
    .employee-selection label.selected, .selection-card.selected,
    .multi-choice-grid label.selected
) {
    border-color: var(--line);
}

body[data-theme="dark"] .consulting-modals :is(
    .project-facts, .milestone-timeline, .selected-line > header,
    .stage-head, .session-row, .definition-head, .attachment-row
) {
    background: var(--surface-strong);
}

body[data-theme="dark"] .consulting-screen :is(
    .status.waiting, .status.review, .status.customer,
    .status.done, .status.live, .status.muted
) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page :is(
    .cohort-header, .section-heading
) {
    background: var(--cohort-soft);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page th,
body[data-theme="dark"] .cohort-page .filter-grid label span {
    background: var(--cohort-head);
    color: var(--text);
}

body[data-theme="dark"] .cohort-page .primary-action {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #fff;
}

body[data-theme="dark"] .customer-consulting :is(
    .eyebrow, .status, .summary b
) {
    color: var(--text);
}

body[data-theme="dark"] .customer-consulting .status {
    background: var(--surface-strong);
}

body[data-theme="dark"] :is(
    .customer-summary-table .summary-volume, .report-paid-cell,
    .report-debt-cell, .report-result-cell
) {
    color: var(--text);
}

body[data-theme="dark"] .payment-status:is(.is-paid, .is-partial, .is-unpaid) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .invoice-review-notice, .reconciliation-warning,
    .queue-held-header, .queue-held-list > article,
    .queue-exception-board, .queue-journey-list article.is-exception
) {
    background: color-mix(in srgb, var(--surface) 86%, var(--accent) 14%);
    color: var(--text);
}

body[data-theme="dark"] .production-job-entry > .production-job-row,
body[data-theme="dark"] .generated-code-field:disabled {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-live-indicator, .queue-current-number, .queue-prefix,
    .queue-pickup-toggle, .queue-pickup-selection,
    .queue-pickup-detail, .queue-origin-banner,
    .queue-invoice-link, .queue-terminal-links a
) {
    background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-waiting-list > button, .queue-setup-list > button,
    .queue-customer-results button
) {
    background: var(--surface);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-waiting-list > button:hover, .queue-setup-list > button:hover,
    .queue-invoice-link:hover
) {
    background: color-mix(in srgb, var(--surface) 84%, var(--primary) 16%);
}

body[data-theme="dark"] :is(
    .queue-display-layout, .queue-kiosk, .queue-ticket-page
) {
    background: var(--bg);
    color: var(--text);
}

body[data-theme="dark"] .queue-public-display {
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-display-board-tabs, .queue-display-sidebar h2,
    .queue-stage-panel > header, .queue-stage-panel > footer
) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-display-board-tabs button, .queue-now-serving article,
    .queue-display-sidebar > section, .queue-stage-panel,
    .queue-stage-items > article, .queue-journey-grid > article,
    .queue-journey-list > article, .queue-kiosk-services button,
    .queue-kiosk-appointment, .queue-kiosk-secondary,
    .queue-kiosk-result, .queue-kiosk-unavailable,
    .queue-ticket-preview-heading
) {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

body[data-theme="dark"] :is(
    .queue-display-board-tabs button strong,
    .queue-display-sidebar section > .queue-display-page,
    .queue-stage-items > article.is-waiting,
    .queue-stage-items > article.is-review,
    .queue-stage-items > article.is-packing,
    .queue-stage-items > article.is-ready,
    .queue-stage-items > article.is-partial,
    .queue-stage-items > article.is-exception,
    .queue-journey-grid article.is-ready,
    .queue-journey-grid article.is-partial
) {
    background: var(--surface-strong);
    color: var(--text);
}

body[data-theme="dark"] .queue-display-board-tabs button.is-active {
    background: var(--primary-strong);
    color: #fff;
}

body[data-theme="dark"] .queue-kiosk-services button:is(:hover, .is-selected) {
    background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
}

body[data-theme="dark"] :is(
    .queue-kiosk-services small, .queue-now-serving > span,
    .queue-display-board-tabs button strong
) {
    color: var(--muted);
}

body[data-theme="dark"] :is(
    .notice-toast, .notice-preferences, .notice-sound-toggle
) {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}
