@charset "utf-8";

/* =========================================================
 FILE :: /public/assets/css/core/dark-mode.css
 MODULE :: UI
 DOMAIN :: UI
 LAYER :: Presentation Asset
 PURPOSE :: Apply governed semantic appearance tokens across the BusinessOS shell
 OWNER :: UI Domain Authority
 VERSION :: 2.0.1
 ========================================================= */

html,
body {
    background-color: var(--bos-page-background);
    color: var(--bos-text-primary);
}

body,
body * {
    border-color: var(--bos-border);
}

a {
    color: var(--bos-link);
}

a:hover {
    color: var(--bos-link-hover);
}

:is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--bos-focus);
    outline-offset: 2px;
}

:is(.card, .modal-content, .offcanvas, .dropdown-menu, .list-group-item, .portal-card, .status-widget, .service-orders-container) {
    background-color: var(--bos-surface-card);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

:is(.form-control, .form-select, .input-group-text) {
    background-color: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

:is(.form-control, .form-select)::placeholder {
    color: var(--bos-text-muted);
    opacity: 1;
}

.table {
    --bs-table-bg: var(--bos-surface-card);
    --bs-table-color: var(--bos-text-primary);
    --bs-table-border-color: var(--bos-divider);
    --bs-table-hover-bg: var(--bos-surface-row-hover);
    --bs-table-hover-color: var(--bos-text-primary);
}

.table > thead,
.table-light {
    --bs-table-bg: var(--bos-surface-table-header);
    --bs-table-color: var(--bos-text-primary);
}

[data-theme="dark"] img,
[data-theme="dark"] svg,
[data-theme="dark"] i {
    filter: none;
}

.details-popup {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
}

/* Shared BusinessOS module surfaces. The root selector deliberately wins over
   legacy module literals while those modules migrate fully to semantic tokens. */
[data-theme="dark"] :is(
    .bos-hero,
    .bos-panel,
    .bos-card,
    .accounting-panel,
    .accounting-summary-tile,
    .accounting-filter-bar,
    .swiftledger-command-bar,
    .swiftledger-kpi-card,
    .swiftledger-widget,
    .swiftledger-palette-panel,
    .swiftledger-slide-over-panel,
    .swiftledger-screen-toolbar,
    .swiftledger-detail-card,
    .qbo-hero,
    .qbo-card,
    .qbo-metrics article,
    .qbo-section-nav
) {
    background: var(--bos-surface-card);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
    box-shadow: var(--bos-shadow);
}

[data-theme="dark"] :is(
    .accounting-header h1,
    .accounting-panel h2,
    .accounting-summary-tile strong,
    .swiftledger-kpi-card strong,
    .swiftledger-widget strong,
    .swiftledger-slide-over-panel h2,
    .swiftledger-detail-card h2,
    .qbo-hero h1,
    .qbo-card h2,
    .qbo-card h3,
    .qbo-metrics strong,
    .qbo-summary-list dd
) {
    color: var(--bos-text-primary);
}

[data-theme="dark"] :is(
    .accounting-header p,
    .accounting-panel-header p,
    .accounting-summary-tile span,
    .billing-inline-note,
    .billing-pipeline-search span,
    .swiftledger-workflow-card li,
    .qbo-hero p,
    .qbo-card-heading > span,
    .qbo-metrics span,
    .qbo-summary-list dt,
    .qbo-empty p,
    .qbo-empty-cell,
    .qbo-file-field small,
    .qbo-filter-bar span,
    .qbo-table td small
) {
    color: var(--bos-text-muted);
}

[data-theme="dark"] :is(
    .accounting-page-nav a,
    .accounting-link-button,
    .accounting-icon-button,
    .billing-customer-suggestion,
    .swiftledger-nav-group a,
    .swiftledger-action-grid a,
    .swiftledger-feed-item,
    .swiftledger-workflow-card a,
    .swiftledger-command-hints a,
    .swiftledger-palette-list a,
    .qbo-button,
    .qbo-badges span,
    .qbo-status-chip
) {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

[data-theme="dark"] :is(
    .accounting-page-nav a:hover,
    .accounting-page-nav a[aria-current="page"],
    .billing-customer-suggestion:hover,
    .swiftledger-nav-group a:hover,
    .swiftledger-nav-group a[aria-current="page"],
    .swiftledger-action-grid a:hover,
    .swiftledger-feed-item:hover,
    .swiftledger-palette-list a:hover,
    .qbo-section-nav a:hover,
    .qbo-section-nav a[aria-current="page"]
) {
    background: var(--bos-surface-row-hover);
    color: var(--bos-link-hover);
    border-color: var(--bos-focus);
}

[data-theme="dark"] :is(
    .accounting-form input,
    .accounting-form select,
    .accounting-filter-bar input,
    .billing-pipeline-search input,
    .swiftledger-screen-toolbar input,
    .swiftledger-screen-toolbar select,
    .qbo-file-field input,
    .qbo-filter-bar input,
    .qbo-filter-bar select
) {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

[data-theme="dark"] :is(
    .accounting-table th,
    .qbo-table th
) {
    background: var(--bos-surface-table-header);
    color: var(--bos-text-secondary);
    border-color: var(--bos-divider);
}

[data-theme="dark"] :is(
    .accounting-table td,
    .qbo-table td,
    .qbo-table-wrap,
    .accounting-table-wrap
) {
    color: var(--bos-text-primary);
    border-color: var(--bos-divider);
}

[data-theme="dark"] :is(
    .qbo-summary-list div,
    .qbo-empty,
    .qbo-file-field,
    .qbo-data-table tr.is-subtotal td,
    .qbo-data-table tr.is-heading td,
    .qbo-data-table tr.is-header td,
    .billing-selected-customer,
    .swiftledger-slide-steps span,
    .swiftledger-detail-card dl div
) {
    background: var(--bos-surface-subtle);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

[data-theme="dark"] .qbo-button-primary,
[data-theme="dark"] .accounting-primary-button {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

[data-theme="dark"] :is(.qbo-status.is-error, .qbo-alert.is-error, .qbo-error-state, .qbo-status-chip.is-failed) {
    background: var(--bos-error-surface);
    color: var(--bos-error);
}

[data-theme="dark"] :is(.qbo-status:not(:empty), .qbo-status-chip.is-completed) {
    background: var(--bos-success-surface);
    color: var(--bos-success);
}

[data-theme="dark"] :is(.qbo-loading, .qbo-status-chip.is-previewed, .qbo-status-chip.is-processing, .qbo-status-chip.is-validating) {
    background: var(--bos-warning-surface);
    color: var(--bos-warning);
}

[data-theme="dark"] .app-navbar .businessos-experience-switcher :is(.form-label, .form-control, .form-select) {
    color: var(--bos-text-primary);
}

[data-theme="dark"] :is(.ux-guidance-intro, .ux-guidance-drawer, .ux-guidance-tooltip, .ux-guided-workflow) {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

/* Workspace and Platform command centers share the governed root theme. */
[data-theme="dark"] :is(.workspace-dashboard, .msp-ops-center) {
    background: var(--bos-page-background);
    color: var(--bos-text-primary);
}

[data-theme="dark"] :is(
    .workspace-command-deck,
    .workspace-kpi-card,
    .workspace-widget,
    .workspace-product-owner,
    .workspace-dashboard-hidden,
    .workspace-focus-panel,
    .msp-side,
    .msp-main,
    .msp-section
) {
    background: var(--bos-surface-card);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
    box-shadow: var(--bos-shadow);
}

[data-theme="dark"] :is(
    .workspace-dashboard-actions button,
    .workspace-kpi-tools button,
    .workspace-widget-controls button,
    .workspace-kpi-toggle,
    .workspace-context-strip span,
    .workspace-launch-tiles a,
    .workspace-compact-actions a,
    .workspace-secondary-links a,
    .msp-quick-actions a,
    .msp-side-section a
) {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

[data-theme="dark"] :is(
    .workspace-command-title,
    .workspace-kpi-card a,
    .workspace-kpi-card strong,
    .workspace-product-header h2,
    .workspace-focus-panel h2,
    .workspace-focus-panel summary
) {
    color: var(--bos-text-primary);
}

[data-theme="dark"] :is(
    .workspace-command-kicker,
    .workspace-command-subtitle,
    .workspace-kpi-card span,
    .workspace-kpi-card em,
    .workspace-widget-header,
    .workspace-product-header span,
    .workspace-product-header p,
    .workspace-context-strip strong
) {
    color: var(--bos-text-muted);
}

[data-theme="dark"] .workspace-status-chip {
    background: var(--bos-success-surface);
    color: var(--bos-success);
    border-color: var(--bos-success);
}

[data-theme="dark"] .ecc {
    --ecc-border: var(--bos-border);
    --ecc-ink: var(--bos-text-primary);
    --ecc-muted: var(--bos-text-muted);
    --ecc-bg: var(--bos-page-background);
    --ecc-panel: var(--bos-surface-card);
}

[data-theme="dark"] :is(
    .ecc-alert,
    .ecc-ai-list a,
    .ecc-timeline a,
    .ecc-widget a,
    .ecc-panel header a,
    .ecc-widget header a,
    .ecc-org,
    .ecc-command-actions a
) {
    background: var(--bos-surface-elevated);
    color: var(--bos-text-primary);
    border-color: var(--bos-border);
}

[data-theme="dark"] :is(.ecc-panel header, .ecc-widget header) {
    border-color: var(--bos-divider);
}
