/* DARK MODE - Direct selectors */
[data-theme="dark"] {
    --bg-body: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-header: #1a2744;
    --bg-navbar: #0d1b3e;
    --bg-input: #1a2744;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #2a2a4a;
    --sidebar-bg-start: #0f3460;
    --sidebar-bg-end: #1a3a5c;
}

[data-theme="dark"] body,
[data-theme="dark"] .main-content {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0f3460 0%, #1a3a5c 100%) !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .card-body {
    background-color: #16213e !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card-header {
    background-color: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .navbar,
[data-theme="dark"] .top-navbar,
[data-theme="dark"] nav {
    background-color: #0d1b3e !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] table {
    color: #ffffff !important;
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] table thead th {
    background-color: #1a2744 !important;
    color: #a0b0c0 !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] table td,
[data-theme="dark"] table th {
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: #1a2744 !important;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: #1e3a5f !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: #1a2744 !important;
    color: #ffffff !important;
    border-color: #3a3a5a !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #a0a0b0 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
    background-color: #1e3050 !important;
    color: #ffffff !important;
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 0.2rem rgba(76,175,80,0.25) !important;
}

[data-theme="dark"] .modal-content {
    background-color: #16213e !important;
    color: #ffffff !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .modal-header {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .modal-footer {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .dropdown-menu {
    background-color: #1a2744 !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .dropdown-item {
    color: #ffffff !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #1e3a5f !important;
}

[data-theme="dark"] .breadcrumb {
    background-color: transparent !important;
}

[data-theme="dark"] .breadcrumb-item a {
    color: #4CAF50 !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #d0d0d0 !important;
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: #d0d0d0 !important;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #16213e !important;
    color: #4CAF50 !important;
    border-color: #2a2a4a #2a2a4a #16213e !important;
}

[data-theme="dark"] .nav-tabs {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .list-group-item {
    background-color: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .alert-info {
    background-color: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #90caf9 !important;
}

[data-theme="dark"] .alert-success {
    background-color: #1b3a1b !important;
    border-color: #2e5e2e !important;
    color: #a5d6a7 !important;
}

[data-theme="dark"] .alert-warning {
    background-color: #3e3a1a !important;
    border-color: #5e5a2a !important;
    color: #fff59d !important;
}

[data-theme="dark"] .alert-danger {
    background-color: #3a1a1a !important;
    border-color: #5e2a2a !important;
    color: #ef9a9a !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: #ffffff !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] label,
[data-theme="dark"] li {
    color: #ffffff;
}

[data-theme="dark"] .text-muted {
    color: #a0a0b0 !important;
}

[data-theme="dark"] .text-dark {
    color: #ffffff !important;
}

[data-theme="dark"] .bg-light {
    background-color: #1a2744 !important;
}

[data-theme="dark"] .bg-white {
    background-color: #16213e !important;
}

[data-theme="dark"] .border {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .shadow,
[data-theme="dark"] .shadow-sm {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #d0d0d0 !important;
    border-color: #4a4a6a !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] .input-group-text {
    background-color: #1a2744 !important;
    border-color: #3a3a5a !important;
    color: #d0d0d0 !important;
}

[data-theme="dark"] .stat-card {
    background-color: #16213e !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .stat-card h2,
[data-theme="dark"] .stat-card .stat-number {
    color: #ffffff !important;
}

[data-theme="dark"] .tab-content {
    background-color: #16213e !important;
}

[data-theme="dark"] .tab-pane {
    color: #ffffff !important;
}

[data-theme="dark"] hr {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] a:not(.btn):not(.nav-link):not(.sidebar a) {
    color: #66bb6a;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) !important;
}

[data-theme="dark"] .page-link {
    background-color: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}

[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1a1a2e;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 4px;
}

/* Transition for smooth switching */
body, .main-content, .card, .card-body, .card-header,
.navbar, nav, .sidebar, .table, table, .form-control,
.modal-content, .dropdown-menu, .nav-tabs .nav-link,
.list-group-item, .alert, .btn, input, textarea, select,
.tab-content, .tab-pane, .stat-card, .breadcrumb, hr {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Print always light */
@media print {
    [data-theme="dark"] body,
    [data-theme="dark"] .main-content,
    [data-theme="dark"] .card,
    [data-theme="dark"] .card-body {
        background-color: #fff !important;
        color: #333 !important;
    }
}

/* Fix table rows with white background */
[data-theme="dark"] .table tbody tr,
[data-theme="dark"] table tbody tr,
[data-theme="dark"] tr {
    background-color: #16213e !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table tbody tr:nth-child(even),
[data-theme="dark"] table tbody tr:nth-child(even) {
    background-color: #1a2744 !important;
}

[data-theme="dark"] .table tbody tr:hover,
[data-theme="dark"] table tbody tr:hover {
    background-color: #1e3a5f !important;
}

/* Fix any inline white backgrounds */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background-color:white"],
[data-theme="dark"] [style*="background-color: white"] {
    background-color: #16213e !important;
}

/* Fix footer */
[data-theme="dark"] .footer,
[data-theme="dark"] footer {
    background-color: #0d1b3e !important;
    color: #a0a0b0 !important;
    border-color: #2a2a4a !important;
}

/* Fix search/filter areas */
[data-theme="dark"] .search-area,
[data-theme="dark"] .filter-area {
    background-color: #16213e !important;
}

/* Fix stat cards text */
[data-theme="dark"] .stat-card span,
[data-theme="dark"] .stat-card p,
[data-theme="dark"] .stat-card div {
    color: #ffffff !important;
}

/* Fix TD cells specifically */
[data-theme="dark"] td,
[data-theme="dark"] .table td,
[data-theme="dark"] table td,
[data-theme="dark"] tbody td {
    background-color: inherit !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table > tbody > tr > td,
[data-theme="dark"] .table > tbody > tr > th {
    background-color: transparent !important;
    color: #ffffff !important;
    border-color: #2a2a4a !important;
}

/* Fix stat cards - numbers and labels */
[data-theme="dark"] .stat-value {
    color: #4CAF50 !important;
    font-weight: bold;
}

[data-theme="dark"] .stat-label {
    color: #a0b0c0 !important;
}

/* Fix stat card icons - darken their light backgrounds */
[data-theme="dark"] .stat-icon {
    opacity: 0.85;
}

[data-theme="dark"] .icon-green {
    background-color: #1b5e20 !important;
    color: #66bb6a !important;
}

[data-theme="dark"] .icon-blue {
    background-color: #1a237e !important;
    color: #64b5f6 !important;
}

[data-theme="dark"] .icon-orange {
    background-color: #e65100 !important;
    color: #ffb74d !important;
}

[data-theme="dark"] .icon-purple {
    background-color: #4a148c !important;
    color: #ce93d8 !important;
}

/* Fix all icons/fas in dark mode */
[data-theme="dark"] .stat-icon i,
[data-theme="dark"] .stat-icon .fas,
[data-theme="dark"] .stat-icon .far,
[data-theme="dark"] .stat-icon svg {
    color: inherit !important;
}

/* Fix patient names and all table text */
[data-theme="dark"] td a,
[data-theme="dark"] .table td a,
[data-theme="dark"] table td a {
    color: #66bb6a !important;
    font-weight: 500;
}

[data-theme="dark"] td span,
[data-theme="dark"] td div,
[data-theme="dark"] td p,
[data-theme="dark"] .table td span,
[data-theme="dark"] .table td div {
    color: #ffffff !important;
}

/* Fix client profile header green gradient */
[data-theme="dark"] .client-header,
[data-theme="dark"] [style*="E8F5E9"],
[data-theme="dark"] [style*="C8E6C9"] {
    background: linear-gradient(135deg, #0f3460 0%, #1a3a5c 100%) !important;
    color: #ffffff !important;
}

/* Fix all light green backgrounds */
[data-theme="dark"] .badge-ativo {
    background: #1b5e20 !important;
    color: #66bb6a !important;
}

[data-theme="dark"] .badge-rascunho {
    background: #e65100 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .doc-icon.pdf {
    background: #3a1a1a !important;
}

[data-theme="dark"] .doc-icon.img {
    background: #1a237e !important;
}

[data-theme="dark"] .doc-icon.doc {
    background: #1a1a3e !important;
}

[data-theme="dark"] .lgpd-badge {
    background: #1b5e20 !important;
    color: #66bb6a !important;
}

/* Fix profile values and all text in profile tabs */
[data-theme="dark"] .tab-pane td,
[data-theme="dark"] .tab-pane span,
[data-theme="dark"] .tab-pane p,
[data-theme="dark"] .tab-pane div,
[data-theme="dark"] .tab-pane li,
[data-theme="dark"] .tab-pane label,
[data-theme="dark"] .profile-value,
[data-theme="dark"] .info-value,
[data-theme="dark"] .data-value {
    color: #ffffff !important;
}

[data-theme="dark"] .tab-pane th,
[data-theme="dark"] .tab-pane strong,
[data-theme="dark"] .profile-label,
[data-theme="dark"] .info-label,
[data-theme="dark"] .data-label {
    color: #a0b0c0 !important;
}

[data-theme="dark"] .text-success {
    color: #66bb6a !important;
}

[data-theme="dark"] .text-warning {
    color: #ffb74d !important;
}

[data-theme="dark"] .text-danger {
    color: #ef5350 !important;
}

/* Fix document list cards and category headers */
[data-theme="dark"] .accordion-item,
[data-theme="dark"] .accordion-header,
[data-theme="dark"] .accordion-button,
[data-theme="dark"] .accordion-body,
[data-theme="dark"] .doc-card,
[data-theme="dark"] .document-card,
[data-theme="dark"] .doc-item,
[data-theme="dark"] .list-group-item {
    background-color: #16213e !important;
    color: #ffffff !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #1b5e20 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1) !important;
}

/* Fix any remaining light green/white card backgrounds */
[data-theme="dark"] .card[style*="border-left"],
[data-theme="dark"] div[style*="background:#f"],
[data-theme="dark"] div[style*="background: #f"],
[data-theme="dark"] div[style*="background:#E"],
[data-theme="dark"] div[style*="background: #E"],
[data-theme="dark"] div[style*="background:#C"],
[data-theme="dark"] div[style*="background: #C"] {
    background-color: #16213e !important;
    color: #ffffff !important;
}

/* Category header green */
[data-theme="dark"] .category-header,
[data-theme="dark"] [style*="background:#E8F5E9"],
[data-theme="dark"] [style*="background: #E8F5E9"],
[data-theme="dark"] [style*="background:#C8E6C9"],
[data-theme="dark"] [style*="background: #C8E6C9"],
[data-theme="dark"] [style*="background:#f0f8f0"],
[data-theme="dark"] [style*="background:#e8f5e9"] {
    background-color: #1b5e20 !important;
    color: #ffffff !important;
}

/* NUCLEAR FIX - Override ALL light backgrounds in dark mode */
[data-theme="dark"] * {
    border-color: #2a2a4a !important;
}

[data-theme="dark"] *:not(.btn):not(.badge):not(.btn-success):not(.btn-warning):not(.btn-danger):not(.btn-info):not(.btn-primary):not(.sidebar *):not(.nav-link):not(.lgpd-badge):not(i) {
    color: inherit;
}

[data-theme="dark"] body * {
    --bs-body-bg: #1a1a2e;
    --bs-body-color: #ffffff;
    --bs-card-bg: #16213e;
    --bs-table-bg: #16213e;
    --bs-table-striped-bg: #1a2744;
}

/* Force ALL inline style backgrounds to dark */
html[data-theme="dark"] [style*="background"] {
    background: #16213e !important;
    background-color: #16213e !important;
    color: #ffffff !important;
}

html[data-theme="dark"] [style*="linear-gradient"] {
    background: linear-gradient(135deg, #0f3460 0%, #1a3a5c 100%) !important;
    color: #ffffff !important;
}

/* Keep green buttons green */
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-success[style] {
    background: #4CAF50 !important;
    background-color: #4CAF50 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .btn-warning,
html[data-theme="dark"] .btn-warning[style] {
    background: #FF9800 !important;
    background-color: #FF9800 !important;
}

html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-danger[style] {
    background: #f44336 !important;
    background-color: #f44336 !important;
}

/* Keep sidebar green gradient */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar[style] {
    background: linear-gradient(180deg, #0f3460 0%, #1a3a5c 100%) !important;
}

/* Fix diagnosis/analysis section headers - green bars */
[data-theme="dark"] .diagnosis-section h4,
[data-theme="dark"] .analysis-section h5,
[data-theme="dark"] .section-header,
[data-theme="dark"] .card-header[style],
[data-theme="dark"] .accordion-button {
    background: #2E7D32 !important;
    color: #ffffff !important;
    border-color: #1b5e20 !important;
}

[data-theme="dark"] .diagnosis-section,
[data-theme="dark"] .analysis-section,
[data-theme="dark"] .exam-analysis-result {
    background: #16213e !important;
    color: #ffffff !important;
    border-color: #2a2a4a !important;
}

[data-theme="dark"] .diagnosis-content,
[data-theme="dark"] .diagnosis-content p,
[data-theme="dark"] .diagnosis-content li,
[data-theme="dark"] .diagnosis-content strong,
[data-theme="dark"] .diagnosis-content td,
[data-theme="dark"] .diagnosis-content th {
    color: #ffffff !important;
}

[data-theme="dark"] .diagnosis-content .table {
    background: #16213e !important;
}

/* Fix icons to dark gray */
[data-theme="dark"] .diagnosis-section i,
[data-theme="dark"] .analysis-section i {
    color: #333333 !important;
}

/* Fix disclaimer/warning boxes */
[data-theme="dark"] .alert,
[data-theme="dark"] .alert-warning,
[data-theme="dark"] .alert-info,
[data-theme="dark"] .disclaimer,
[data-theme="dark"] .diagnosis-disclaimer,
[data-theme="dark"] [class*="disclaimer"],
[data-theme="dark"] [class*="alert"] {
    background: #1a2744 !important;
    border-color: #e6a817 !important;
    color: #ffffff !important;
}

/* Fix inbox/messages empty state and panels */
[data-theme="dark"] .inbox-list,
[data-theme="dark"] .message-list,
[data-theme="dark"] .inbox-panel,
[data-theme="dark"] .message-panel,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .inbox-empty,
[data-theme="dark"] .no-messages {
    background: #16213e !important;
    color: #a0b0c0 !important;
}

/* Force ALL remaining white/light panels */
[data-theme="dark"] div[style*="border-radius"] {
    background-color: #16213e !important;
}

/* Fix theme toggle button background */
[data-theme="dark"] .btn-theme-toggle,
[data-theme="dark"] #themeToggle {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}


/* ============================================================
   COMPREHENSIVE DARK MODE FIXES - ALL TEMPLATES
   Added 2026-03-22
   ============================================================ */

/* === PROTOCOL DETAIL PAGE === */
[data-theme="dark"] .protocol-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a2744 100%) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .protocol-header h3,
[data-theme="dark"] .protocol-header span,
[data-theme="dark"] .protocol-header div {
    color: #ffffff !important;
}
[data-theme="dark"] .meta-item {
    color: #b0b0b0 !important;
}
[data-theme="dark"] .meta-item i {
    color: #66bb6a !important;
}
[data-theme="dark"] .content-block {
    background: #1a2744 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .content-block h6 {
    color: #66bb6a !important;
}
[data-theme="dark"] .content-block p,
[data-theme="dark"] .content-block li,
[data-theme="dark"] .content-block ul {
    color: #d0d0d0 !important;
}
[data-theme="dark"] .content-block[style*="FFF5F5"] {
    background: #3a1a1a !important;
}
[data-theme="dark"] .protein-target-box {
    background: linear-gradient(135deg, #3e2a0a 0%, #4a3010 100%) !important;
    border-color: #FF9800 !important;
}
[data-theme="dark"] .protein-target-box .protein-value {
    color: #ffb74d !important;
}
[data-theme="dark"] .protein-target-box .protein-label {
    color: #ffcc80 !important;
}
[data-theme="dark"] .expiration-box {
    background: linear-gradient(135deg, #3a1a1a 0%, #4a2020 100%) !important;
    border-color: #f44336 !important;
}
[data-theme="dark"] .expiration-box .expiration-date {
    color: #ef5350 !important;
}
[data-theme="dark"] .expiration-box .expiration-label {
    color: #ef9a9a !important;
}
[data-theme="dark"] .week-card {
    border-color: #2a2a4a !important;
    background: #16213e !important;
}
[data-theme="dark"] .week-card-header {
    background: #1a2744 !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .week-card-body {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .week-section h6 {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .week-section li {
    color: #d0d0d0 !important;
}

/* === BADGE OVERRIDES (all templates) === */
[data-theme="dark"] .badge-ativo {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .badge-rascunho {
    background: #3e2a0a !important;
    color: #ffb74d !important;
}
[data-theme="dark"] .badge-concluido {
    background: #1a2744 !important;
    color: #64b5f6 !important;
}
[data-theme="dark"] .badge-pendente {
    background: #3e2a0a !important;
    color: #ffb74d !important;
}
[data-theme="dark"] .badge-analisado {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .badge-revisado {
    background: #1a2744 !important;
    color: #64b5f6 !important;
}
[data-theme="dark"] .badge-sem-analise {
    background: #2a2a4a !important;
    color: #a0a0b0 !important;
}
[data-theme="dark"] .badge-status {
    border: 1px solid #2a2a4a !important;
}

/* === CLIENT DETAIL PAGE === */
[data-theme="dark"] .client-header-card {
    background: linear-gradient(135deg, #0f3460 0%, #1a2744 100%) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .client-header-card h3,
[data-theme="dark"] .client-header-card h4,
[data-theme="dark"] .client-header-card span,
[data-theme="dark"] .client-header-card div,
[data-theme="dark"] .client-header-card a,
[data-theme="dark"] .client-header-card p,
[data-theme="dark"] .client-header-card i {
    color: #ffffff !important;
}
[data-theme="dark"] .client-meta {
    color: #b0b0b0 !important;
}
[data-theme="dark"] .client-meta i {
    color: #66bb6a !important;
}
[data-theme="dark"] .info-grid .info-item {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .info-grid .info-label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .info-grid .info-value {
    color: #ffffff !important;
}
[data-theme="dark"] .doc-item {
    background: #16213e !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .doc-item div {
    color: #ffffff !important;
}
[data-theme="dark"] .protocol-card {
    background: #16213e !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .protocol-card h5,
[data-theme="dark"] .protocol-card h6 {
    color: #ffffff !important;
}
[data-theme="dark"] .protocol-card div {
    color: #b0b0b0 !important;
}
[data-theme="dark"] .profile-summary .ps-item {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .profile-summary .ps-label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .profile-summary .ps-value {
    color: #ffffff !important;
}
[data-theme="dark"] .delete-section {
    background: #3a1a1a !important;
    border-color: #5e2a2a !important;
}
[data-theme="dark"] .delete-section h6 {
    color: #ef5350 !important;
}
[data-theme="dark"] .delete-section p {
    color: #b0b0b0 !important;
}

/* Notes area in client detail */
[data-theme="dark"] div[style*="background:#f9f9f9"] {
    background: #1a2744 !important;
    color: #ffffff !important;
}
[data-theme="dark"] div[style*="color:#333"] {
    color: #ffffff !important;
}

/* === REPORT PAGES (client_report + exam_report) === */
[data-theme="dark"] .report-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a2744 100%) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .report-header h3,
[data-theme="dark"] .report-header p,
[data-theme="dark"] .report-header span,
[data-theme="dark"] .report-header div,
[data-theme="dark"] .report-header i {
    color: #ffffff !important;
}
[data-theme="dark"] .report-header-bar {
    background: linear-gradient(135deg, #0f3460 0%, #1a2744 100%) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .report-section h5 {
    color: #66bb6a !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .info-row {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .info-row .label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .info-row .value {
    color: #ffffff !important;
}
[data-theme="dark"] .profile-grid {
    color: #ffffff !important;
}
[data-theme="dark"] .doc-list-item {
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .section-analyzed {
    background: #16213e !important;
    border-color: #4CAF50 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .section-analyzed h5 {
    color: #66bb6a !important;
}
[data-theme="dark"] .section-pending {
    background: #16213e !important;
    border-color: #FF9800 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .section-pending h6 {
    color: #ffb74d !important;
}
[data-theme="dark"] .obs-block {
    background: #1a2744 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .obs-block .obs-label {
    color: #a0b0c0 !important;
}

/* Exam table */
[data-theme="dark"] .exam-table th {
    background: #1a2744 !important;
    color: #66bb6a !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .exam-table td {
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .exam-table tr:hover {
    background: #1e3a5f !important;
}
[data-theme="dark"] .exam-category {
    background: #1a2744 !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .exam-value {
    color: #ffffff !important;
}
[data-theme="dark"] .doc-link {
    background: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #d0d0d0 !important;
}
[data-theme="dark"] .doc-link:hover {
    border-color: #4CAF50 !important;
    color: #66bb6a !important;
    background: #16213e !important;
}

/* File type badges */
[data-theme="dark"] span[style*="background:#f0f0f0"] {
    background: #2a2a4a !important;
    color: #d0d0d0 !important;
}

/* === EXAM ANALYSIS PAGES === */
[data-theme="dark"] .analysis-header {
    background: linear-gradient(135deg, #0f3460 0%, #1a2744 100%) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .analysis-header h4 {
    color: #ffffff !important;
}
[data-theme="dark"] .ai-result-card {
    border-color: #2E7D32 !important;
    background: #16213e !important;
}
[data-theme="dark"] .ai-result-card .card-header {
    background: #1b3a1b !important;
    color: #66bb6a !important;
    border-color: #2E7D32 !important;
}
[data-theme="dark"] .ai-result-card .card-body {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .ai-result-card .analysis-section h5 {
    color: #66bb6a !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .observations-card {
    background: #16213e !important;
    color: #ffffff !important;
}

/* Card header with inline green background */
[data-theme="dark"] .card-header[style*="background:#E8F5E9"],
[data-theme="dark"] .card-header[style*="background: #E8F5E9"] {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .card-header[style*="background:#FFF3E0"],
[data-theme="dark"] .card-header[style*="background: #FFF3E0"] {
    background: #3e2a0a !important;
    color: #ffb74d !important;
}

/* Exam dashboard */
[data-theme="dark"] .action-bar {
    background: #16213e !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .stats-mini .stat-num {
    color: #66bb6a !important;
}
[data-theme="dark"] .stats-mini .stat-label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .loading-card {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .loading-card h5 {
    color: #ffffff !important;
}

/* === FICHA PAGE === */
[data-theme="dark"] .ficha-container {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .ficha-header {
    border-color: #4CAF50 !important;
}
[data-theme="dark"] .ficha-header h2 {
    color: #ffffff !important;
}
[data-theme="dark"] .ficha-section-title {
    color: #66bb6a !important;
    border-color: #2a5a2a !important;
}
[data-theme="dark"] .ficha-field {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .ficha-label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .ficha-value {
    color: #ffffff !important;
}
[data-theme="dark"] .ficha-exam-card {
    border-color: #2a2a4a !important;
    background: #1a2744 !important;
}
[data-theme="dark"] .ficha-obs {
    color: #b0b0b0 !important;
}
[data-theme="dark"] .ficha-date {
    color: #a0b0c0 !important;
}

/* === INBOX / MESSAGES PAGE === */
[data-theme="dark"] .inbox-container {
    background: #16213e !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-sidebar {
    background: #1a1a2e !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-sidebar-header {
    background: #16213e !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-sidebar-header h5 {
    color: #ffffff !important;
}
[data-theme="dark"] .inbox-filter select {
    background: #1a2744 !important;
    color: #ffffff !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-messages-list {
    background: #1a1a2e !important;
}
[data-theme="dark"] .inbox-message-item {
    border-color: #2a2a4a !important;
    color: #ffffff !important;
    background: #1a1a2e !important;
}
[data-theme="dark"] .inbox-message-item:hover {
    background: #1a2744 !important;
}
[data-theme="dark"] .inbox-message-item.active {
    background: #1e3a5f !important;
    border-left-color: #4CAF50 !important;
}
[data-theme="dark"] .inbox-message-item.unread {
    background: #16213e !important;
}
[data-theme="dark"] .inbox-msg-sender {
    color: #ffffff !important;
}
[data-theme="dark"] .inbox-msg-date {
    color: #a0a0b0 !important;
}
[data-theme="dark"] .inbox-msg-subject {
    color: #d0d0d0 !important;
}
[data-theme="dark"] .inbox-msg-preview {
    color: #808090 !important;
}
[data-theme="dark"] .inbox-detail {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .inbox-detail-header {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-detail-header h4 {
    color: #ffffff !important;
}
[data-theme="dark"] .inbox-detail-meta {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .inbox-detail-meta span {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .inbox-detail-body {
    color: #d0d0d0 !important;
}
[data-theme="dark"] .inbox-detail-actions {
    background: #1a2744 !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .inbox-detail-empty {
    color: #606070 !important;
}
[data-theme="dark"] .inbox-detail-empty i {
    color: #404050 !important;
}
[data-theme="dark"] .direction-inbound {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .direction-outbound {
    background: #1a2744 !important;
    color: #64b5f6 !important;
}
[data-theme="dark"] .unread-badge {
    background: #e53935 !important;
    color: #fff !important;
}

/* === DOCUMENT UPLOAD PAGE === */
[data-theme="dark"] .upload-zone {
    border-color: #2a5a2a !important;
    background: linear-gradient(135deg, #1a2744 0%, #1b3a1b 100%) !important;
}
[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.dragover {
    border-color: #4CAF50 !important;
    background: linear-gradient(135deg, #1b3a1b 0%, #1a2744 100%) !important;
}
[data-theme="dark"] .upload-zone .upload-icon {
    color: #4CAF50 !important;
}
[data-theme="dark"] .upload-zone h4 {
    color: #66bb6a !important;
}
[data-theme="dark"] .upload-area {
    border-color: #2a5a2a !important;
    background: #1a2744 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .upload-area:hover,
[data-theme="dark"] .upload-area.dragover {
    border-color: #4CAF50 !important;
    background: #1b3a1b !important;
}
[data-theme="dark"] .upload-area i {
    color: #4CAF50 !important;
}
[data-theme="dark"] .file-preview {
    background: #1a2744 !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .file-preview div {
    color: #ffffff !important;
}

/* Autocomplete dropdown */
[data-theme="dark"] .autocomplete-dropdown,
[data-theme="dark"] div[class*="autocomplete-dropdown"],
[data-theme="dark"] [id*="Dropdown"] {
    background: #16213e !important;
    border-color: #2a2a4a !important;
    color: #ffffff !important;
}
[data-theme="dark"] .autocomplete-dropdown div,
[data-theme="dark"] .autocomplete-dropdown span {
    color: #ffffff !important;
}
[data-theme="dark"] .autocomplete-dropdown div:hover {
    background: #1e3a5f !important;
}

/* === DOCUMENT LIST PAGE === */
[data-theme="dark"] .doc-group-header {
    background: #1a2744 !important;
    color: #66bb6a !important;
}

/* === DASHBOARD PAGE === */
[data-theme="dark"] .stat-card {
    background: #16213e !important;
    color: #ffffff !important;
}
[data-theme="dark"] .stat-card .stat-value {
    color: #ffffff !important;
}
[data-theme="dark"] .stat-card .stat-label {
    color: #a0b0c0 !important;
}
[data-theme="dark"] .icon-green {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .icon-blue {
    background: #1a2744 !important;
    color: #64b5f6 !important;
}
[data-theme="dark"] .icon-orange {
    background: #3e2a0a !important;
    color: #ffb74d !important;
}
[data-theme="dark"] .icon-purple {
    background: #2a1a3e !important;
    color: #ce93d8 !important;
}
[data-theme="dark"] .quick-search-box {
    background: #16213e !important;
    color: #ffffff !important;
}

/* === CLIENT FORM PAGE === */
[data-theme="dark"] .form-label {
    color: #d0d0d0 !important;
}

/* === CLIENT PROFILE PAGE (accordion) === */
[data-theme="dark"] .accordion-item[style*="border:1px solid #eee"],
[data-theme="dark"] .accordion-item[style*="border: 1px solid #eee"] {
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .accordion-button {
    background: #1a2744 !important;
    color: #ffffff !important;
}
[data-theme="dark"] .accordion-button:not(.collapsed) {
    background: #1b3a1b !important;
    color: #66bb6a !important;
}
[data-theme="dark"] .accordion-body {
    background: #16213e !important;
    color: #ffffff !important;
}

/* === UPLOAD MANAGER PAGES === */
[data-theme="dark"] .modal-header[style*="var(--green-bg)"] {
    background: #1a2744 !important;
    border-color: #2a2a4a !important;
}
[data-theme="dark"] .modal-header[style*="var(--green-bg)"] h5 {
    color: #66bb6a !important;
}

/* Review page background blocks */
[data-theme="dark"] div[style*="background:#f8f9fa"] {
    background: #1a2744 !important;
    color: #ffffff !important;
}

/* === PAGE HEADER === */
[data-theme="dark"] .page-header {
    color: #ffffff !important;
}
[data-theme="dark"] .page-header h2,
[data-theme="dark"] .page-header h3 {
    color: #ffffff !important;
}

/* === MISC INLINE STYLE OVERRIDES === */
/* Color #555 text */
[data-theme="dark"] [style*="color:#555"],
[data-theme="dark"] [style*="color: #555"],
[data-theme="dark"] div[style*="color:#555"],
[data-theme="dark"] p[style*="color:#555"],
[data-theme="dark"] span[style*="color:#555"] {
    color: #b0b0b0 !important;
}

/* Color #333 text */
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color: #333"],
[data-theme="dark"] h5[style*="color:#333"],
[data-theme="dark"] h4[style*="color:#333"],
[data-theme="dark"] div[style*="color:#333"] {
    color: #ffffff !important;
}

/* Color #666 text */
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color: #666"],
[data-theme="dark"] div[style*="color:#666"] {
    color: #b0b0b0 !important;
}

/* Color #888 text */
[data-theme="dark"] [style*="color:#888"],
[data-theme="dark"] [style*="color: #888"],
[data-theme="dark"] div[style*="color:#888"] {
    color: #a0a0b0 !important;
}

/* Color #999 text */
[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color: #999"],
[data-theme="dark"] div[style*="color:#999"],
[data-theme="dark"] span[style*="color:#999"] {
    color: #808090 !important;
}

/* Color #777 text */
[data-theme="dark"] [style*="color:#777"],
[data-theme="dark"] [style*="color: #777"] {
    color: #a0a0b0 !important;
}

/* Color #444 text */
[data-theme="dark"] [style*="color:#444"],
[data-theme="dark"] [style*="color: #444"] {
    color: #d0d0d0 !important;
}

/* Color #aaa text */
[data-theme="dark"] [style*="color:#aaa"],
[data-theme="dark"] [style*="color: #aaa"] {
    color: #707080 !important;
}

/* Color #ddd icons */
[data-theme="dark"] [style*="color:#ddd"],
[data-theme="dark"] [style*="color: #ddd"],
[data-theme="dark"] i[style*="color:#ddd"] {
    color: #404050 !important;
}

/* Color #ccc */
[data-theme="dark"] [style*="color:#ccc"],
[data-theme="dark"] [style*="color: #ccc"] {
    color: #505060 !important;
}

/* C8E6C9 colored icons (empty state icons) */
[data-theme="dark"] i[style*="color:#C8E6C9"],
[data-theme="dark"] i[style*="color: #C8E6C9"] {
    color: #2a5a2a !important;
}

/* 81C784 colored icons */
[data-theme="dark"] i[style*="color:#81C784"],
[data-theme="dark"] i[style*="color: #81C784"] {
    color: #66bb6a !important;
}

/* Background #f9f9f9 */
[data-theme="dark"] [style*="background:#f9f9f9"],
[data-theme="dark"] [style*="background: #f9f9f9"] {
    background: #1a2744 !important;
    color: #ffffff !important;
}

/* Background #f0f0f0 */
[data-theme="dark"] [style*="background:#f0f0f0"],
[data-theme="dark"] [style*="background: #f0f0f0"],
[data-theme="dark"] span[style*="background:#f0f0f0"] {
    background: #2a2a4a !important;
    color: #d0d0d0 !important;
}

/* Background #FFF3E0 (warning orange blocks) */
[data-theme="dark"] [style*="background:#FFF3E0"],
[data-theme="dark"] [style*="background: #FFF3E0"],
[data-theme="dark"] div[style*="background:#FFF3E0"] {
    background: #3e2a0a !important;
    color: #ffb74d !important;
}

/* Background #FFF5F5 (danger blocks) */
[data-theme="dark"] [style*="background:#FFF5F5"],
[data-theme="dark"] [style*="background: #FFF5F5"] {
    background: #3a1a1a !important;
    color: #ef9a9a !important;
}

/* Background var(--green-bg) */
[data-theme="dark"] [style*="background:var(--green-bg)"],
[data-theme="dark"] [style*="background: var(--green-bg)"],
[data-theme="dark"] div[style*="background:var(--green-bg)"] {
    background: #1a2744 !important;
}

/* Background #F1F8E9 */
[data-theme="dark"] [style*="background:#F1F8E9"],
[data-theme="dark"] [style*="background: #F1F8E9"] {
    background: #1a2744 !important;
}

/* border-left colored cards */
[data-theme="dark"] .card[style*="border-left:4px solid #4CAF50"],
[data-theme="dark"] div[style*="border-left:4px solid #4CAF50"],
[data-theme="dark"] div[style*="border-left:3px solid var(--green-primary)"] {
    background: #16213e !important;
}

/* Border #eee */
[data-theme="dark"] [style*="border:1px solid #eee"],
[data-theme="dark"] [style*="border: 1px solid #eee"] {
    border-color: #2a2a4a !important;
}

/* Background #fff inline */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] div[style*="background:#fff"] {
    background: #16213e !important;
}

/* === DOC ICON BACKGROUNDS === */
[data-theme="dark"] .doc-icon.pdf {
    background: #3a1a1a !important;
    color: #ef5350 !important;
}
[data-theme="dark"] .doc-icon.img {
    background: #1a2744 !important;
    color: #64b5f6 !important;
}
[data-theme="dark"] .doc-icon.doc {
    background: #1a1a3e !important;
    color: #7986cb !important;
}
[data-theme="dark"] .doc-icon.other {
    background: #2a2a4a !important;
    color: #a0a0b0 !important;
}
[data-theme="dark"] .file-preview .file-icon.pdf {
    background: #3a1a1a !important;
    color: #ef5350 !important;
}

/* === CHANGE PASSWORD PAGE === */
[data-theme="dark"] .card-header[style*="background:#4CAF50"] {
    background: #2E7D32 !important;
}

/* === WEIGHT PAGES === */
[data-theme="dark"] i[style*="color:#ccc"] {
    color: #505060 !important;
}

/* === PRINT HEADER (hidden normally, keep light for print) === */
@media print {
    [data-theme="dark"] .report-header,
    [data-theme="dark"] .protocol-header,
    [data-theme="dark"] .analysis-header,
    [data-theme="dark"] .client-header-card {
        background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%) !important;
        color: #333 !important;
    }
    [data-theme="dark"] .content-block {
        background: #f9f9f9 !important;
        color: #555 !important;
    }
    [data-theme="dark"] .inbox-container,
    [data-theme="dark"] .inbox-sidebar,
    [data-theme="dark"] .inbox-detail {
        background: #fff !important;
        color: #333 !important;
    }
}

/* === STAT NUMBER (exam reports inline) === */
[data-theme="dark"] .stat-number {
    color: #66bb6a !important;
}
[data-theme="dark"] .stat-card.green .stat-number {
    color: #66bb6a !important;
}
[data-theme="dark"] .stat-card.yellow .stat-number {
    color: #ffb74d !important;
}
[data-theme="dark"] .stat-card.blue .stat-number {
    color: #64b5f6 !important;
}

/* Empty field placeholder */
[data-theme="dark"] .empty-field {
    color: #505060 !important;
}

/* === FINAL NUCLEAR OVERRIDE for linear-gradient inline styles === */
/* Override the previous nuclear rule to be more specific about sidebar */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar[style] {
    background: linear-gradient(180deg, #0f3460 0%, #1a3a5c 100%) !important;
}

/* Ensure btn-info keeps its style */
html[data-theme="dark"] .btn-info {
    background: #0288d1 !important;
    background-color: #0288d1 !important;
    color: #ffffff !important;
}

/* Ensure btn-outline-green keeps its style */
html[data-theme="dark"] .btn-outline-green {
    color: #66bb6a !important;
    border-color: #66bb6a !important;
}
html[data-theme="dark"] .btn-outline-green:hover {
    background: #1b3a1b !important;
    color: #ffffff !important;
}

/* Btn-green */
html[data-theme="dark"] .btn-green {
    background: #4CAF50 !important;
    color: #ffffff !important;
}
