:root {
    color-scheme: light;
    --background: #f4f7f6;
    --surface: #ffffff;
    --surface-secondary: #edf3f1;
    --surface-elevated: #ffffff;
    --border: #e1e8e5;
    --text-primary: #17211e;
    --text-secondary: #64736f;
    --text-disabled: #8b9995;
    --accent: rgb(var(--color-theme-1));
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --background: #071713;
    --surface: #102823;
    --surface-secondary: #0d211c;
    --surface-elevated: #15332c;
    --border: rgb(255 255 255 / 8%);
    --text-primary: #f1f5f4;
    --text-secondary: #a9b9b5;
    --text-disabled: #71827e;
    --color-darkmode-50: 169 185 181;
    --color-darkmode-100: 142 161 156;
    --color-darkmode-200: 113 130 126;
    --color-darkmode-300: 81 103 97;
    --color-darkmode-400: 48 77 69;
    --color-darkmode-500: 21 51 44;
    --color-darkmode-600: 16 40 35;
    --color-darkmode-700: 13 33 28;
    --color-darkmode-800: 7 23 19;
    --color-darkmode-900: 5 17 14;
}

:root[data-theme="dark"] .budget-shell {
    --budget-ink: var(--text-primary) !important;
    --budget-muted: var(--text-secondary) !important;
    --budget-line: var(--border) !important;
    --budget-surface: var(--surface) !important;
    background-color: var(--background) !important;
}

:root[data-theme="dark"] .budget-shell .widget-box {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 22px 48px rgb(0 0 0 / 18%) !important;
}

:root[data-theme="dark"] .budget-shell :is(
    .executive-stat,
    .executive-progress-card,
    .mobile-accordion-toggle
) {
    background: var(--surface-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
}

.rubick > .flex > .bg-slate-100,
.rubick > .flex > [class*="dark:bg-darkmode-700"] {
    background-color: var(--background) !important;
}

:root[data-theme="dark"] .rubick::before {
    background-image: linear-gradient(to bottom, #071713, #0d211c) !important;
}

:root[data-theme="dark"] :is(.bg-white, .box, .modal-content, .dropdown-content) {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary);
}

:root[data-theme="dark"] .rubick :is(.card, .panel, [class$="-card"], [class*="-card "], [class*="__card"], [class$="-panel"], [class*="-panel "], [class*="__panel"]) {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary);
}

:root[data-theme="dark"] :is(.bg-slate-50, .bg-gray-50, .bg-slate-100, .bg-gray-100) {
    background-color: var(--surface-secondary) !important;
}

:root[data-theme="dark"] :is(.bg-slate-200, .bg-gray-200) {
    background-color: var(--surface-elevated) !important;
}

:root[data-theme="dark"] :is(.bg-slate-300, .bg-gray-300) {
    background-color: #1a3a32 !important;
}

:root[data-theme="dark"] :is(.border-slate-100, .border-slate-200, .border-slate-300, .border-gray-100, .border-gray-200, .border-gray-300) {
    border-color: var(--border) !important;
}

:root[data-theme="dark"] :is(.text-slate-900, .text-slate-800, .text-slate-700, .text-gray-900, .text-gray-800, .text-gray-700) {
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(.text-slate-600, .text-slate-500, .text-slate-400, .text-gray-600, .text-gray-500, .text-gray-400) {
    color: var(--text-secondary) !important;
}

:root[data-theme="dark"] :is(.text-slate-300, .text-gray-300) {
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
:root[data-theme="dark"] :is(.form-control, .form-select) {
    background-color: var(--surface-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(input, textarea)::placeholder {
    color: var(--text-disabled) !important;
}

:root[data-theme="dark"] table {
    color: var(--text-primary);
}

:root[data-theme="dark"] :is(thead, tfoot) {
    background-color: var(--surface-secondary);
}

:root[data-theme="dark"] :is(th, td) {
    border-color: var(--border) !important;
}

:root[data-theme="dark"] tbody tr:hover {
    background-color: var(--surface-elevated);
}

:root[data-theme="dark"] :is(.pagination, [role="dialog"], [data-tw-backdrop] > div) {
    color: var(--text-primary);
}

:root[data-theme="dark"] :is(.modal, .drawer, .offcanvas, [role="dialog"]) :is(.bg-white, .box, .card, .panel) {
    background-color: var(--surface-elevated) !important;
}

:root[data-theme="dark"] :is(.search-box, .filter-panel, .table-responsive) {
    background-color: var(--surface-secondary) !important;
    border-color: var(--border) !important;
}

:root[data-theme="dark"] :is(
    .cadastro-columns-button,
    .cadastro-columns-panel,
    .cadastro-bulk-dialog,
    .cadastro-feedback-dialog,
    #tb-comp-columns-panel,
    #catalog-model-table .cell-actions,
    .technical-viewer-card,
    .technical-engine-picker,
    .technical-viewer-fallback,
    .engineering-document-viewer,
    .bcf-issue,
    .project-form-aside__card,
    .project-form-card,
    .project-file-preview,
    .ep-secondary,
    .ep-field-shell,
    .ep-document,
    .mo-matrix-shell,
    .mo-matrix-header-shell,
    .mo-matrix-label,
    .qqp-currency-input,
    .qqp-column-filter,
    .comp-selector-dropdown,
    .dados-mo-role-search,
    .dados-mo-currency-input,
    .orc-scroll-navigation__button,
    .audit-completion-modal__panel,
    .audit-completion-modal__button,
    .hh-composition-dialog,
    .orc-save-toast__details,
    .orc-floating-actions__menu
) {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(.mo-editor-card, .bdi-card, .mo-summary-card, .ep-upload) {
    background: var(--surface-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(.patrimonio-ui, .ep-info dd, .ep-description, .bcf-issue h3, .bcf-issue > p, .mo-label-title, .mo-label-desc) {
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(.patrimonio-ui label, .bcf-issue__meta, .ep-document__meta, .mo-toolbar-field__label, .mo-sub) {
    color: var(--text-secondary) !important;
}

.rubick :is(.btn-primary, .item-action--primary) {
    background-color: rgb(var(--color-theme-1)) !important;
    border-color: rgb(var(--color-theme-1)) !important;
}

.rubick :is(a, button).text-primary,
.rubick :is(.btn-outline-primary, .item-action--secondary) {
    border-color: rgb(var(--color-theme-1) / 45%) !important;
    color: rgb(var(--color-theme-1)) !important;
}

:root[data-theme="dark"] :is(.select2-dropdown, .select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple) {
    background-color: var(--surface-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] .tezk-company-logo,
:root[data-theme="dark"] .tezk-mobile-company-logo {
    background-color: var(--surface) !important;
    border: 1px solid var(--border);
}

@media print {
    :root {
        color-scheme: light;
        --background: #ffffff;
        --surface: #ffffff;
        --surface-secondary: #ffffff;
        --text-primary: #000000;
        --text-secondary: #334155;
    }
}
