/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 * Form colors for explicit dark themes. Light and print styles remain unchanged.
 */
@media screen {
    :is([data-theme="dark"], .theme-dark, .dark-theme) {
        --df-surface: #18291f;
        --df-control: #20372a;
        --df-ink: #f3eee3;
        --df-muted: #c3c7bc;
        --df-line: #819980;
        --df-focus: #dfc58b;
        --df-error: #ffb9ad;
        --df-success: #b9e9c2;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(form, fieldset, .form-group, .card, .hd-panel):has(input:not([type="hidden"]), select, textarea),
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(div, section):has(> input:not([type="hidden"]), > select, > textarea) {
        --hd-ink: var(--df-ink);
        --hd-muted: var(--df-muted);
        --hd-text-muted: var(--df-muted);
        color: var(--df-ink) !important;
        background-color: var(--df-surface) !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input:where(:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"])), select, textarea, .custom-file-label, .input-group-text, .note-editable, .note-toolbar, .note-statusbar) {
        color-scheme: dark;
        color: var(--df-ink) !important;
        background-color: var(--df-control) !important;
        border-color: var(--df-line) !important;
        caret-color: var(--df-ink);
        min-width: 0;
        max-width: 100%;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) select {
        appearance: auto !important;
        background-image: none !important;
        background-repeat: no-repeat !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(option, optgroup) {
        color: var(--df-ink) !important;
        background-color: var(--df-control) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input, textarea)::placeholder {
        color: var(--df-muted) !important;
        opacity: 1;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(label, legend, .form-label, .control-label) {
        color: var(--df-ink) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(form, fieldset, .form-group) :is(.form-text, .text-muted) {
        color: var(--df-muted) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :where(form, .input-group) :is(button, input[type="submit"], input[type="button"], .btn, .hd-btn) {
        color: var(--df-ink) !important;
        background-color: #304738 !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) form :is(button[type="submit"], input[type="submit"], .btn-primary, .btn-success, .hd-btn--primary) {
        color: #18291f !important;
        background-color: var(--df-focus) !important;
        border-color: var(--df-focus) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) form :is(button, input, a):is(.btn-danger, .hd-btn--danger) {
        color: #ffd1c8 !important;
        background-color: #59352e !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) form a:not(.btn):not(.hd-btn) { color: var(--df-focus) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) form .text-danger { color: var(--df-error) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) form .text-success { color: var(--df-success) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .card:has(input:not([type="hidden"]), select, textarea) :is(.card-header, .card-footer) {
        color: var(--df-ink) !important;
        background-color: #304738 !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(form, .card:has(input:not([type="hidden"]), select, textarea)) :is(h1, h2, h3, h4, h5, h6, .card-title) {
        color: var(--df-ink) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input, select, textarea, [contenteditable="true"], .select2-selection):focus-visible,
    :is([data-theme="dark"], .theme-dark, .dark-theme) form :is(button, a, summary):focus-visible {
        outline: 3px solid var(--df-focus) !important;
        outline-offset: 2px;
        border-color: var(--df-focus) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input, select, textarea):is(:disabled, [readonly]) {
        color: var(--df-muted) !important;
        background-color: #29372e !important;
        border-color: #758975 !important;
        opacity: 1;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input, select, textarea):is(.is-invalid, .input-validation-error, [aria-invalid="true"]) {
        border-color: var(--df-error) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.invalid-feedback, .field-validation-error, .validation-summary-errors, .error-message) {
        color: var(--df-error) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(input, select, textarea).is-valid {
        border-color: var(--df-success) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .valid-feedback { color: var(--df-success) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) input:is([type="checkbox"], [type="radio"], [type="range"]) {
        color-scheme: dark;
        accent-color: var(--df-focus);
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .custom-control-label::before {
        background-color: var(--df-control) !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .custom-control-input:checked ~ .custom-control-label::before {
        background-color: #8f7136 !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .custom-control-input:focus-visible ~ .custom-control-label::before {
        outline: 3px solid var(--df-focus) !important;
        outline-offset: 2px;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .custom-control-input:disabled ~ .custom-control-label { color: var(--df-muted) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) input[type="color"] {
        color-scheme: dark;
        background-color: var(--df-control) !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) input::file-selector-button,
    :is([data-theme="dark"], .theme-dark, .dark-theme) .custom-file-label::after {
        color: var(--df-ink) !important;
        background-color: #304738 !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) input:-webkit-autofill {
        -webkit-text-fill-color: var(--df-ink) !important;
        caret-color: var(--df-ink);
        box-shadow: 0 0 0 1000px var(--df-control) inset !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-menu, .select2-dropdown, .select2-selection, .select2-search__field, .select2-results, .ui-autocomplete, .note-editor) {
        color: var(--df-ink) !important;
        background-color: var(--df-control) !important;
        border-color: var(--df-line) !important;
        color-scheme: dark;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-menu, .select2-dropdown, .ui-autocomplete) { max-width: calc(100vw - 24px); }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .select2-container { max-width: 100%; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-item, .select2-selection__rendered, .select2-selection__placeholder, .select2-results__option, .ui-menu-item-wrapper) {
        color: var(--df-ink) !important;
        background-color: transparent !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-item, .select2-results__option, .ui-menu-item-wrapper) {
        white-space: normal;
        overflow-wrap: break-word;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-item:hover, .dropdown-item:focus, .select2-results__option--highlighted, .ui-state-active) {
        color: var(--df-ink) !important;
        background-color: #39543f !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-item.active, .select2-results__option[aria-selected="true"]) {
        color: #18291f !important;
        background-color: var(--df-focus) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.select2-selection__choice, .select2-selection__choice__remove) {
        color: var(--df-ink) !important;
        background-color: #304738 !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .select2-selection__choice {
        max-width: 100%;
        box-sizing: border-box;
        white-space: normal;
        overflow-wrap: break-word;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .select2-selection__arrow b { border-top-color: var(--df-muted) !important; }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .select2-container--open .select2-selection__arrow b {
        border-top-color: transparent !important;
        border-bottom-color: var(--df-muted) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) :is(.dropdown-item.disabled, .select2-results__option[aria-disabled="true"], .select2-selection__clear, .note-placeholder) {
        color: var(--df-muted) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .note-editor .note-btn {
        color: var(--df-ink) !important;
        background-color: #304738 !important;
        border-color: var(--df-line) !important;
    }
    :is([data-theme="dark"], .theme-dark, .dark-theme) .dropdown-divider { border-color: var(--df-line) !important; }
}
