/* Tema claro (padrão) e escuro — pref_theme true = light, false = dark */
:root {
    --home-primary: #1A6A3E;
    --home-primary-light: #70C094;
    --home-primary-hover: #5cad82;
    --home-text: #111827;
    --home-text-secondary: #64748b;
    --home-white: #ffffff;
    --home-bg-section: #f4f7fb;
    --home-bg-card: #f9fafb;
    --home-border: #e5e7eb;
    --home-shadow-card: 0 18px 40px rgba(0, 0, 0, .06);
    --home-shadow-hover: 0 10px 25px rgba(0, 0, 0, .06);
    --home-shadow-primary: 0 12px 25px rgba(112, 192, 148, .35);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bt-table-loading-bg: #1a2a26;
    --bt-table-loading-color: #e8f0ee;
    --bt-table-border-color: #2a4a42;
    --home-primary: #5dcaa5;
    --home-primary-light: #3dba90;
    --home-primary-hover: #70C094;
    --home-text: #e8f0ee;
    --home-text-secondary: #9bbdb4;
    --home-white: #162420;
    --home-bg-section: #101a17;
    --home-bg-card: #1a2a26;
    --home-border: #2a4a42;
    --home-shadow-card: 0 18px 40px rgba(0, 0, 0, .35);
    --home-shadow-hover: 0 10px 25px rgba(0, 0, 0, .4);
    --home-shadow-primary: 0 12px 25px rgba(29, 158, 117, .25);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: #0d1513;
    color: var(--home-text);
}

html[data-theme="dark"] #wrapper #content-wrapper,
html[data-theme="dark"] #content-wrapper {
    background-color: #0d1513 !important;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] #accordionSidebar {
    background-color: #111c19 !important;
    border-right-color: #1e3330 !important;
}

html[data-theme="dark"] #accordionSidebar a {
    color: #9bbdb4 !important;
}

html[data-theme="dark"] .si-label {
    color: #9bbdb4;
}

html[data-theme="dark"] .si-label.bold {
    color: #e8f0ee;
}

html[data-theme="dark"] .sb-item.active {
    background: #1a3a32;
    border-left-color: #1d9e75;
}

html[data-theme="dark"] .sidebar .nav-item .nav-link:hover,
html[data-theme="dark"] a.sb-item:hover {
    background-color: rgba(29, 158, 117, .16) !important;
}

html[data-theme="dark"] .sb-lbl {
    color: #6a9e94;
}

html[data-theme="dark"] .icon_life { background-color: #1a2f44; }
html[data-theme="dark"] .icon_sv { background-color: #3a1a28; }
html[data-theme="dark"] .icon_o { background-color: #16352c; }
html[data-theme="dark"] .icon_sosst { background-color: #3a2e14; }

html[data-theme="dark"] .ph-title,
html[data-theme="dark"] .ph-sub-tt,
html[data-theme="dark"] .v_cards,
html[data-theme="dark"] .pc-title,
html[data-theme="dark"] .prev-title-text,
html[data-theme="dark"] .fi-v,
html[data-theme="dark"] .ex-l,
html[data-theme="dark"] .cpt-value,
html[data-theme="dark"] .dist-count,
html[data-theme="dark"] .pk-v {
    color: #e8f0ee;
}

html[data-theme="dark"] .ph-sub,
html[data-theme="dark"] .prev-title-sub,
html[data-theme="dark"] .pc-desc,
html[data-theme="dark"] .pr-label,
html[data-theme="dark"] .fi-l,
html[data-theme="dark"] .fi-s,
html[data-theme="dark"] .ex-sl,
html[data-theme="dark"] .cpt-label,
html[data-theme="dark"] .cpt-sub,
html[data-theme="dark"] .bar-lbl,
html[data-theme="dark"] .pk-l,
html[data-theme="dark"] .dist-title {
    color: #8bbdb4;
}

html[data-theme="dark"] .prev-section,
html[data-theme="dark"] .prev-card,
html[data-theme="dark"] .pc-result,
html[data-theme="dark"] .fi,
html[data-theme="dark"] .ex,
html[data-theme="dark"] .cp-total,
html[data-theme="dark"] .cp-dist,
html[data-theme="dark"] .home-dash,
html[data-theme="dark"] .cad-dash,
html[data-theme="dark"] .rel-dash,
html[data-theme="dark"] .saude-dash,
html[data-theme="dark"] .cfg-page {
    background: var(--home-bg-section);
}

html[data-theme="dark"] .prev-card,
html[data-theme="dark"] .pc-result {
    border-color: var(--home-border);
    background: var(--home-bg-card);
}

html[data-theme="dark"] .prev-card.highlight {
    background: #0e3d32;
}

html[data-theme="dark"] .prev-kpi,
html[data-theme="dark"] .home-dash-card-icon {
    background: #1a3a32;
}

html[data-theme="dark"] .bar-bg,
html[data-theme="dark"] .dist-bar-bg {
    background: #1a2a26;
}

html[data-theme="dark"] .cp-func { background: #1a2f44; border-color: #2a4a6a; }
html[data-theme="dark"] .cp-empresa { background: #16352c; border-color: #1d9e75; }
html[data-theme="dark"] .copay-badge { background: #16352c; color: #9FE1CB; }
html[data-theme="dark"] .ctb { background: #16352c; color: #9FE1CB; }
html[data-theme="dark"] .limit-rule,
html[data-theme="dark"] .copay-limit-badge { background: #3a2e14; color: #efc27a; }
html[data-theme="dark"] .rbox { background: #3a1a1a; }
html[data-theme="dark"] .icon-credit { background: #1a2f44; }
html[data-theme="dark"] .icon-down { background: #3a2e14; }
html[data-theme="dark"] .icon-corp { background: #16352c; }

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .jumbotron {
    background-color: #162420 !important;
    color: var(--home-text);
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .modal-body {
    background-color: #162420;
    border-color: var(--home-border);
    color: var(--home-text);
}

html[data-theme="dark"] .dropdown-item {
    color: #d5e8e2;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: #1a3a32;
    color: #fff;
}

html[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--home-border);
}

html[data-theme="dark"] .collapse-inner {
    background: #162420 !important;
}

html[data-theme="dark"] .collapse-item {
    color: #c5ddd6 !important;
}

html[data-theme="dark"] .collapse-item:hover {
    background-color: #1a3a32 !important;
    color: #fff !important;
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-body,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] label,
html[data-theme="dark"] .form-label {
    color: var(--home-text);
}

html[data-theme="dark"] .text-muted {
    color: var(--home-text-secondary) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="file"] {
    background-color: #1a2a26;
    color: var(--home-text);
    border-color: var(--home-border);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    background-color: #1a2a26;
    color: var(--home-text);
    border-color: #1d9e75;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly] {
    background-color: #13201c;
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .close {
    color: #e8f0ee;
    text-shadow: none;
}

html[data-theme="dark"] .table,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .bootstrap-table .table {
    color: var(--home-text);
    border-color: var(--home-border);
}

html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .home-bootstrap-table thead th,
html[data-theme="dark"] .cad-bootstrap-table thead th,
html[data-theme="dark"] .home-bootstrap-table tbody td,
html[data-theme="dark"] .cad-bootstrap-table tbody td {
    border-bottom-color: #243a34 !important;
    border-left-color: #1e3330 !important;
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .table-hover tbody tr:hover,
html[data-theme="dark"] .table-hover tbody tr:hover td,
html[data-theme="dark"] .cad-bootstrap-table tbody tr:hover td,
html[data-theme="dark"] .home-bootstrap-table tbody tr:hover td {
    background-color: rgba(29, 158, 117, .12) !important;
    color: var(--home-text);
}

html[data-theme="dark"] .cad-bootstrap-table tbody tr.selected td,
html[data-theme="dark"] .bootstrap-table .fixed-table-container .table tbody tr.selected td {
    background-color: #1a3a32 !important;
    color: #e8f0ee !important;
}

html[data-theme="dark"] .fixed-table-container,
html[data-theme="dark"] .fixed-table-body,
html[data-theme="dark"] .fixed-table-header,
html[data-theme="dark"] .fixed-table-toolbar,
html[data-theme="dark"] .fixed-table-pagination,
html[data-theme="dark"] .bootstrap-table .table,
html[data-theme="dark"] .fixed-table-border {
    background-color: transparent;
    border-color: transparent !important;
}

html[data-theme="dark"] .cad-dash-table .fixed-table-body::-webkit-scrollbar-track {
    background: #1a2a26;
}

html[data-theme="dark"] .page-link,
html[data-theme="dark"] .pagination .page-link {
    background: #162420;
    border-color: var(--home-border);
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .page-item.disabled .page-link {
    background: #13201c;
    border-color: var(--home-border);
    color: #5a7a72;
}

html[data-theme="dark"] .nav-tabs {
    border-bottom-color: var(--home-border);
}

html[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .nav-tabs .nav-link.active {
    background: #162420;
    border-color: var(--home-border) var(--home-border) #162420;
    color: var(--home-primary);
}

html[data-theme="dark"] .hr,
html[data-theme="dark"] hr {
    border-top-color: var(--home-border);
}

html[data-theme="dark"] .sidebar-divider {
    border-top-color: #1e3330;
}

html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-secondary {
    background-color: #1a2a26;
    border-color: var(--home-border);
    color: var(--home-text);
}

html[data-theme="dark"] .cad-btn-excel {
    background: #162420;
    color: #3dba90;
}

html[data-theme="dark"] .cad-mass-status-box.demissao,
html[data-theme="dark"] .cad-mass-status-box.afastamento,
html[data-theme="dark"] .cad-mass-status-box.aposentadoria {
    background: var(--home-bg-card);
}

html[data-theme="dark"] .bootstrap-select > .dropdown-toggle,
html[data-theme="dark"] .bootstrap-select .dropdown-menu,
html[data-theme="dark"] .dropdown-menu.show {
    background: #162420 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .bootstrap-select .dropdown-item,
html[data-theme="dark"] .dropdown-item.selected,
html[data-theme="dark"] .bootstrap-select .dropdown-menu li a {
    color: #d5e8e2;
}

html[data-theme="dark"] .bootstrap-select .dropdown-menu li a:hover,
html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .dropdown-item:active {
    background-color: #1a3a32 !important;
    color: #fff;
}

html[data-theme="dark"] .filter-option-inner-inner {
    color: var(--home-text);
}

html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-theme="dark"] .select2-dropdown,
html[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #1a2a26 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .select2-container--default .select2-results__option {
    color: var(--home-text);
}

html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
html[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #1a3a32;
    color: #fff;
}

html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--home-text) !important;
}

html[data-theme="dark"] .swal2-popup {
    background: #162420;
    color: var(--home-text);
}

html[data-theme="dark"] .swal2-title,
html[data-theme="dark"] .swal2-html-container,
html[data-theme="dark"] .swal2-content {
    color: var(--home-text) !important;
}

html[data-theme="dark"] .swal2-input,
html[data-theme="dark"] .swal2-textarea {
    background: #1a2a26 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .home-dash-card,
html[data-theme="dark"] .home-dash-table,
html[data-theme="dark"] .cad-dash-table,
html[data-theme="dark"] .titular-info-card,
html[data-theme="dark"] .home-modal-body {
    background: var(--home-white);
    border-color: var(--home-border);
}

html[data-theme="dark"] .home-input:not(select),
html[data-theme="dark"] .home-modal input.form-control:not([type="hidden"]):not([readonly]),
html[data-theme="dark"] .home-modal textarea.form-control {
    background-color: #1a2a26 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .home-modal .btn.home-btn-cancelar {
    background: #162420 !important;
    color: var(--home-text-secondary) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .dash-adv-trigger,
html[data-theme="dark"] .dash-adv-card,
html[data-theme="dark"] .dash-adv-tile,
html[data-theme="dark"] .dash-adv-select,
html[data-theme="dark"] .dash-adv-body {
    background: #162420 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .dash-adv-body {
    background: #101a17 !important;
}

html[data-theme="dark"] .dash-adv-card-title,
html[data-theme="dark"] .dash-adv-tile {
    color: var(--home-text) !important;
}

html[data-theme="dark"] .dash-adv-card-hint,
html[data-theme="dark"] .dash-adv-tile-txt small {
    color: var(--home-text-secondary) !important;
}

html[data-theme="dark"] .dash-adv-tile.is-on {
    background: #1a3a32 !important;
    border-color: #1d9e75 !important;
}

html[data-theme="dark"] .dash-adv-card-ico {
    background: #1a3a32;
    color: #5dcaa5;
}

html[data-theme="dark"] .dash-adv-tile-ico {
    background: #1a2a26;
}

html[data-theme="dark"] .dash-filter-badge {
    box-shadow: 0 0 0 2px #162420;
}

html[data-theme="dark"] .progress {
    background-color: #1a2a26;
}

html[data-theme="dark"] .lista_empresas:hover,
html[data-theme="dark"] .selected {
    background-color: #0d3f34af !important;
}

html[data-theme="dark"] .main {
    color: var(--home-text);
}

html[data-theme="dark"] .header {
    background: #162420;
    border-bottom-color: var(--home-border);
}

/* Inline styles comuns nas views */
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#f5faf8"],
html[data-theme="dark"] [style*="background: #f5faf8"],
html[data-theme="dark"] [style*="background:#f4f7fb"],
html[data-theme="dark"] [style*="background: #f4f7fb"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#eef7f4"],
html[data-theme="dark"] [style*="background: #eef7f4"] {
    background-color: #162420 !important;
}

html[data-theme="dark"] [style*="color:#0a2e26"],
html[data-theme="dark"] [style*="color: #0a2e26"],
html[data-theme="dark"] [style*="color:#111827"],
html[data-theme="dark"] [style*="color: #111827"],
html[data-theme="dark"] [style*="color:black"],
html[data-theme="dark"] [style*="color: black"] {
    color: #e8f0ee !important;
}

html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"] {
    color: #9bbdb4 !important;
}

html[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #111c19;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #2a4a42;
    border-radius: 8px;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #1d9e75;
}

html[data-theme="dark"] .rel-empresa-menu,
html[data-theme="dark"] .rel-filtro-select,
html[data-theme="dark"] .saude-btn-excel,
html[data-theme="dark"] .dash-adv-pill,
html[data-theme="dark"] .dash-adv-footer,
html[data-theme="dark"] .dash-adv-btn.ghost,
html[data-theme="dark"] .dash-adv-btn.muted {
    background: #162420 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}

html[data-theme="dark"] .rel-filtro-select {
    color: var(--home-text);
}

html[data-theme="dark"] .dash-adv-btn.ghost:hover {
    background: #1a3a32 !important;
}

html[data-theme="dark"] .dropdown-header {
    background-color: #1a3a32;
    color: #9FE1CB;
    border-color: var(--home-border);
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, .03);
}

html[data-theme="dark"] .bootstrap-table .no-records-found {
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .bootstrap-table .fixed-table-loading,
html[data-theme="dark"] .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading {
    background: var(--bt-table-loading-bg) !important;
    color: var(--bt-table-loading-color) !important;
}

html[data-theme="dark"] .bootstrap-table .fixed-table-loading .loading-text {
    color: var(--bt-table-loading-color) !important;
}

html[data-theme="dark"] .bootstrap-table .fixed-table-loading .animation-dot,
html[data-theme="dark"] .bootstrap-table .fixed-table-loading .animation-wrap::after,
html[data-theme="dark"] .bootstrap-table .fixed-table-loading .animation-wrap::before {
    background: var(--home-primary-light) !important;
}

html[data-theme="dark"] .bootstrap-table.fullscreen {
    background: var(--home-bg-section) !important;
}

html[data-theme="dark"] tr.rel-detail-row > td,
html[data-theme="dark"] .rel-subtable-wrap {
    background: #13221e !important;
}

html[data-theme="dark"] .rel-subtable {
    background: var(--home-bg-card) !important;
    border-color: var(--home-border) !important;
    color: var(--home-text);
}

html[data-theme="dark"] .rel-subtable thead th {
    background: #1e332e !important;
    color: var(--home-text-secondary) !important;
    border-bottom-color: var(--home-border) !important;
}

html[data-theme="dark"] .rel-subtable td,
html[data-theme="dark"] .rel-subtable th {
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
    background-color: transparent !important;
}

html[data-theme="dark"] .rel-subtable tbody tr:hover td {
    background-color: rgba(29, 158, 117, .12) !important;
}

html[data-theme="dark"] .rel-empty {
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .rel-dep-badge,
html[data-theme="dark"] .rel-tipo-badge {
    background: #16352c;
    color: #9FE1CB;
}

html[data-theme="dark"] .rel-tipo-badge.pf {
    background: #1a2f44;
    color: #9bb7e8;
}

html[data-theme="dark"] .rel-expand-btn {
    background: #16352c;
    color: #9FE1CB;
    border-color: #2a4a42;
}

html[data-theme="dark"] .rel-expand-btn:hover,
html[data-theme="dark"] .rel-expand-btn.open {
    background: #1A6A3E;
    color: #fff;
    border-color: #1A6A3E;
}

html[data-theme="dark"] .pagination-info,
html[data-theme="dark"] .page-list {
    color: var(--home-text-secondary);
}

html[data-theme="dark"] .cad-pf-filters-grid .form-control,
html[data-theme="dark"] .cad-pf-filters-grid select {
    background: #1a2a26 !important;
    color: var(--home-text) !important;
    border-color: var(--home-border) !important;
}
