/* Shared field treatment, including modal forms, DataTables and Select2. */
html body input.form-control, html body select.form-control, html body textarea.form-control,
html body input:not([type]), html body input[type=text], html body input[type=email],
html body input[type=password], html body input[type=tel], html body input[type=number],
html body input[type=search], html body input[type=date], html body input[type=datetime-local],
html body input[type=url], html body input[type=file], html body select, html body textarea,
html body .select2-container .select2-selection--single,
html body .select2-container .select2-selection--multiple,
html body .select2-dropdown, html body .dropdown-menu {
    background-color:#000!important; color:#fff!important; border-color:#454545!important; color-scheme:dark;
}
html body input::placeholder, html body textarea::placeholder { color:#aaa!important; opacity:1; }
html body select option, html body select optgroup { background:#000; color:#fff; }
html body .select2-container .select2-selection__rendered,
html body .select2-container .select2-search__field,
html body .select2-results__option, html body .dropdown-menu .dropdown-item { color:#fff!important; }
html body .select2-results__option--highlighted[aria-selected],
html body .dropdown-menu .dropdown-item:hover, html body .dropdown-menu .dropdown-item:focus { background:#333!important; }
html body .select2-results__option[aria-selected=true],
html body .select2-container .select2-selection__choice { background:#222!important; color:#fff!important; }
html body input:disabled, html body select:disabled, html body textarea:disabled { background-color:#191919!important; color:#aaa!important; }
html body input[type=file]::file-selector-button { background:#222; color:#fff; border:1px solid #555; border-radius:4px; }
html body input:-webkit-autofill { -webkit-text-fill-color:#fff!important; box-shadow:0 0 0 1000px #000 inset!important; }
html body .ws-form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
html body .ws-form select, html body .ws-form textarea,
html body .ws-form .select2-container .select2-selection--single { background-color:#000!important; color:#fff!important; }
/* Align modal actions consistently, including forms that use a portlet footer. */
html body .modal .modal-footer { justify-content:center !important; text-align:center; }
html body .modal .kt-form__actions { text-align:center; }
html body .modal .form-group > label { display:block; margin-bottom:.4rem; }
html body .modal .modal-body label:not(.custom-file-label):not(.ws-check) { color:#212121 !important; }
html body .modal .modal-body .modal-field-label { display:block; margin-bottom:.4rem; font-weight:600; }

/* Keep DataTables within their container and allow long values to wrap. */
html body table.dataTable { width:100% !important; }
html body table.dataTable:not(#clientsTable) { table-layout:fixed; }
html body table.dataTable th, html body table.dataTable td {
    text-align:center!important;
    white-space:normal !important;
    overflow-wrap:anywhere;
}
html body table.dataTable .text-left,
html body table.dataTable .text-right,
html body table.dataTable .text-start,
html body table.dataTable .text-end {text-align:center!important;}
html body table.dataTable td > .d-flex {justify-content:center;}
/* Company client tables deliberately scroll to keep the expanded headers on one line. */
html body table.dataTable[data-scroll-x="true"] th {white-space:nowrap!important;overflow-wrap:normal;}
.dataTables_wrapper:has(table[data-scroll-x="true"]) {min-width:0;max-width:100%;}
.dataTables_wrapper:has(table[data-scroll-x="true"]) .dataTables_scrollBody {overflow-x:auto!important;}
html body table.dataTable[data-scroll-x="true"] {min-width:1500px;}
html body table.dataTable td .btn, html body table.dataTable td .badge {
    max-width:100%;
    white-space:normal;
}
.table-responsive:has(table.dataTable) { overflow:visible; }
.dataTables_wrapper > .row { margin-inline:0; }
.dataTables_wrapper > .row > [class*="col-"] { padding-inline:0; }
@media (max-width:991.98px) {
    html body table.dataTable.data-table-stacked,
    .data-table-stacked tbody, .data-table-stacked tbody tr {
        display:block;
    }
    .data-table-stacked thead {
        position:absolute;
        width:1px;
        height:1px;
        overflow:hidden;
        clip-path:inset(50%);
    }
    .data-table-stacked tbody tr { margin-bottom:.75rem; }
    .data-table-stacked tbody td {
        display:flex;
        align-items:baseline;
        justify-content:space-between;
        flex-wrap:wrap;
        gap:.35rem .75rem;
        width:100% !important;
        min-width:0 !important;
        max-width:none !important;
        box-sizing:border-box;
    }
    .data-table-stacked tbody td[data-column-label]::before {
        content:attr(data-column-label);
        font-weight:600;
    }
}
/* Popup forms retain their original light fields, including portaled Select2 menus. */
html body .modal .modal-content,
html body .modal .modal-body,
html body .modal .modal-footer {
    background:#fff!important;
    color:#212121!important;
    color-scheme:light;
}
/* Workspace panels and portlets can be reused inside a dialog without inheriting the page's dark surface. */
html body .modal .ws-panel,
html body .modal .ws-form,
html body .modal .kt-portlet,
html body .modal .kt-portlet__body,
html body .modal .kt-container {
    background:#fff!important;
    color:#212121!important;
}
html body .modal .ws-panel:not(.ws-note),
html body .modal .kt-portlet { border-color:#dee2e6; }
html body .modal .ws-form label,
html body .modal .ws-note p,
html body .modal .modal-body h1,
html body .modal .modal-body h2,
html body .modal .modal-body h3,
html body .modal .modal-body h4,
html body .modal .modal-body h5,
html body .modal .modal-body h6 { color:#212121!important; }
html body .modal .ws-muted,
html body .modal .text-muted { color:#666!important; }
html body .modal .ws-form .ws-check {
    background:#f8f9fa;
    border-color:#ced4da;
    color:#212121!important;
}
html body .modal input.form-control, html body .modal select.form-control, html body .modal textarea.form-control,
html body .modal input:not([type]), html body .modal input[type=text], html body .modal input[type=email],
html body .modal input[type=password], html body .modal input[type=tel], html body .modal input[type=number],
html body .modal input[type=search], html body .modal input[type=date], html body .modal input[type=datetime-local],
html body .modal input[type=url], html body .modal input[type=file], html body .modal select, html body .modal textarea,
html body .modal .ws-form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
html body .modal .ws-form select, html body .modal .ws-form textarea,
html body .modal .select2-container .select2-selection--single,
html body .modal .select2-container .select2-selection--multiple,
html body .modal .dropdown-menu, html body.modal-open .select2-dropdown,
html body.modal-open .select2-dropdown .select2-search__field {
    background-color:#fff!important; color:#212121!important; border-color:#ced4da!important; color-scheme:light;
}
html body .modal input::placeholder, html body .modal textarea::placeholder { color:#777!important; }
html body .modal select option, html body .modal select optgroup { background:#fff; color:#212121; }
html body .modal .select2-container .select2-selection__rendered,
html body .modal .dropdown-menu .dropdown-item,
html body.modal-open .select2-dropdown .select2-results__option { color:#212121!important; }
html body.modal-open .select2-dropdown .select2-results__option[aria-selected=true],
html body .modal .select2-container .select2-selection__choice { background:#eee!important; color:#212121!important; }
html body.modal-open .select2-dropdown .select2-results__option--highlighted[aria-selected],
html body .modal .dropdown-menu .dropdown-item:hover, html body .modal .dropdown-menu .dropdown-item:focus { background:#e9ecef!important; color:#212121!important; }
html body .modal input:disabled, html body .modal select:disabled, html body .modal textarea:disabled { background-color:#eee!important; color:#666!important; }
html body .modal input[type=file]::file-selector-button { background:#eee; color:#212121; border-color:#ced4da; }
/* Keep modal fields white while hovered, clicked or focused. Page-level dark field rules such as
   ".kt-portlet__body .form-control:focus" (specificity 0,3,0) otherwise turn fields inside a modal black
   on focus, because the modal markup sits inside a portlet body. These selectors out-rank them. */
html body .modal input.form-control:hover, html body .modal input.form-control:focus, html body .modal input.form-control:active,
html body .modal select.form-control:hover, html body .modal select.form-control:focus, html body .modal select.form-control:active,
html body .modal textarea.form-control:hover, html body .modal textarea.form-control:focus, html body .modal textarea.form-control:active,
html body .modal input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not(:disabled):hover,
html body .modal input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not(:disabled):focus,
html body .modal select:not(:disabled):hover, html body .modal select:not(:disabled):focus,
html body .modal textarea:not(:disabled):hover, html body .modal textarea:not(:disabled):focus,
html body .modal input[type=file]:hover, html body .modal input[type=file]:focus,
html body .modal .select2-container--focus .select2-selection--single, html body .modal .select2-container--open .select2-selection--single,
html body .modal .select2-container--focus .select2-selection--multiple, html body .modal .select2-container--open .select2-selection--multiple {
    background-color:#fff!important; color:#212121!important; color-scheme:light;
}
html body .modal input.form-control:focus, html body .modal select.form-control:focus, html body .modal textarea.form-control:focus,
html body .modal input:not([type=checkbox]):not([type=radio]):not([type=hidden]):focus, html body .modal select:focus, html body .modal textarea:focus,
html body .modal .select2-container--focus .select2-selection, html body .modal .select2-container--open .select2-selection {
    border-color:#bfa957!important; box-shadow:0 0 0 2px rgba(191,169,87,.25)!important; outline:0;
}
html body .modal .select2-container--focus .select2-selection__rendered, html body .modal .select2-container--open .select2-selection__rendered { color:#212121!important; }
html body .modal input:-webkit-autofill { -webkit-text-fill-color:#212121!important; box-shadow:0 0 0 1000px #fff inset!important; }
@media print {
    html body input.form-control, html body select.form-control, html body textarea.form-control { background:#fff!important; color:#000!important; color-scheme:light; }
}

/* ============================================================
   Login page: light fields
   ============================================================ */
html body .login-container input.form-control,
html body .login-container input[type=email],
html body .login-container input[type=password],
html body .login-container input[type=text],
html body .login-container input:not([type]),
html body .login-container select,
html body .login-container textarea {
    background-color:#fff!important;
    color:#212121!important;
    border-color:#e5e7eb!important;
    color-scheme:light;
}
html body .login-container input::placeholder { color:#9ca3af!important; opacity:1; }
html body .login-container input:-webkit-autofill {
    -webkit-text-fill-color:#212121!important;
    box-shadow:0 0 0 1000px #fff inset!important;
}

/* ============================================================
   Intake form: light fields
   ============================================================ */
html body .intake-wrap input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]),
html body .intake-wrap select,
html body .intake-wrap textarea,
html body .intake-wrap .form-control {
    background-color:#fff!important;
    color:#2b2210!important;
    border-color:#d9cfa9!important;
    color-scheme:light;
}
html body .intake-wrap input::placeholder,
html body .intake-wrap textarea::placeholder { color:#9a8b5c!important; opacity:1; }
html body .intake-wrap select option { background:#fff; color:#2b2210; }
html body .intake-wrap input:-webkit-autofill {
    -webkit-text-fill-color:#2b2210!important;
    box-shadow:0 0 0 1000px #fff inset!important;
}
html body .intake-wrap .select2-container .select2-selection--single,
html body .intake-wrap .select2-container .select2-selection--multiple {
    background-color:#fff!important;
    color:#2b2210!important;
    border-color:#d9cfa9!important;
}
html body .intake-wrap .select2-container .select2-selection__rendered { color:#2b2210!important; }

/* ============================================================
   Review Application form: light fields
   ============================================================ */
html body .rf-wrap input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]),
html body .rf-wrap select,
html body .rf-wrap textarea,
html body .rf-wrap .form-control {
    background-color:#fff!important;
    color:#2b2210!important;
    border-color:#d9cfa9!important;
    color-scheme:light;
}
html body .rf-wrap input::placeholder,
html body .rf-wrap textarea::placeholder { color:#9a8b5c!important; opacity:1; }
html body .rf-wrap select option { background:#fff; color:#2b2210; }
html body .rf-wrap input:-webkit-autofill {
    -webkit-text-fill-color:#2b2210!important;
    box-shadow:0 0 0 1000px #fff inset!important;
}
html body .rf-wrap .select2-container .select2-selection--single,
html body .rf-wrap .select2-container .select2-selection--multiple {
    background-color:#fff!important;
    color:#2b2210!important;
    border-color:#d9cfa9!important;
}
html body .rf-wrap .select2-container .select2-selection__rendered { color:#2b2210!important; }
html body .rf-wrap input:disabled,
html body .rf-wrap select:disabled,
html body .rf-wrap textarea:disabled { background-color:#f7f2e7!important; color:#6b6248!important; }

/* Readable client links and dark-theme helper text; light modal fields retain their own palette. */
html body .client-profile-link { color:#e5ca77; font-weight:600; text-decoration:none; }
/* No underlines on links inside the data tables of the left-menu pages (client names, View Customer, etc.). */
html body .kt-content table a, html body .kt-content table a:hover, html body .kt-content table a:focus, html body a.client-profile-link:hover, html body a.client-profile-link:focus { text-decoration:none; }
html body .client-profile-link:hover, html body .client-profile-link:focus { color:#fff0b4; }
html body .kt-portlet .form-text, html body .kt-portlet .form-control-plaintext { color:#c8c8c8; }
html body .modal .form-text, html body .modal .form-control-plaintext { color:#343a40!important; }
html body #kt_header_mobile { background:#131410; }
html body #kt_header_mobile .kt-header-mobile__toolbar-toggler span,
html body #kt_header_mobile .kt-header-mobile__toolbar-toggler span::before,
html body #kt_header_mobile .kt-header-mobile__toolbar-toggler span::after { background:#e5ca77!important; }
html body #kt_header_mobile .kt-header__topbar-icon { color:#fff; }
html body table button[aria-label="Actions"] { color:#e5ca77; }
