/* Dark theme. Loaded only by _Layout, after site.css, so PDF and print views never see it.
   The tenant's Background Color doesn't paint the page here; it only colors the header line. */
html[data-bs-theme="dark"] {
    --bs-body-bg: #15181c;
    --bs-body-color: #e6e8eb;
    --bs-tertiary-bg: #22272d;
    --bs-secondary-bg: #2b3138;
    --app-border-color: rgba(255, 255, 255, 0.2);
    --app-border-muted: rgba(255, 255, 255, 0.12);
    --app-control-bg: rgba(255, 255, 255, 0.07);
    --app-control-bg-focus: rgba(255, 255, 255, 0.11);
    --app-control-bg-disabled: rgba(255, 255, 255, 0.03);
    --app-link-color: #e6e8eb;
    --app-muted-color: #a6adb5;
    --app-surface: rgba(255, 255, 255, 0.04);
    --app-surface-strong: rgba(255, 255, 255, 0.07);
    --app-surface-hover: rgba(255, 255, 255, 0.09);
    --app-text-color: #e6e8eb;
}

html[data-bs-theme="dark"] body {
    --app-theme-bg: #15181c !important;
}

html[data-bs-theme="dark"] .app-header {
    border-bottom: 3px solid var(--app-tenant-color, #e5e8eb);
}

/* Tenant logos are made for a light page, so they keep a light backing. */
html[data-bs-theme="dark"] img[src^="/Home/GetLogo"] {
    background-color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}

/* Signatures are black ink, and a narrative is a document that prints on white, so both stay
   as they will look on paper. */
html[data-bs-theme="dark"] img[src^="data:image/svg+xml"],
html[data-bs-theme="dark"] .app-signature-pad canvas {
    background-color: #fff;
}
html[data-bs-theme="dark"] .ql-container .ql-editor {
    background-color: #fff;
    color: #171717;
}

/* Report pages (marketing.css). */
html[data-bs-theme="dark"] .marketing-tabs { border-bottom-color: var(--app-border-color); }
html[data-bs-theme="dark"] .marketing-tabs .nav-link,
html[data-bs-theme="dark"] .customer-marketing-tabs .nav-link { color: rgba(255, 255, 255, 0.72); }
html[data-bs-theme="dark"] .marketing-tabs .nav-link:hover,
html[data-bs-theme="dark"] .marketing-tabs .nav-link:focus,
html[data-bs-theme="dark"] .customer-marketing-tabs .nav-link:hover { background-color: rgba(255, 255, 255, 0.07) !important; color: #fff; }
html[data-bs-theme="dark"] .marketing-tabs .nav-link.active,
html[data-bs-theme="dark"] .customer-marketing-tabs .nav-link.active { background-color: rgba(255, 255, 255, 0.14) !important; border-color: rgba(255, 255, 255, 0.24) rgba(255, 255, 255, 0.24) transparent !important; color: #fff !important; }
html[data-bs-theme="dark"] .marketing-admin-tabs .nav-link.active,
html[data-bs-theme="dark"] .marketing-admin-tabs .nav-link.active:hover { border-bottom-color: rgba(255, 255, 255, 0.4); }
html[data-bs-theme="dark"] .marketing-edit-context,
html[data-bs-theme="dark"] .marketing-plan-contact { color: var(--app-muted-color); }
html[data-bs-theme="dark"] .marketing-at-risk-text { color: #f5a8a2; }
html[data-bs-theme="dark"] .marketing-crop-detail-title-accent { color: #fff; }

/* Bootstrap's table status colors stay pale in its own dark theme. */
html[data-bs-theme="dark"] .table-warning { --bs-table-color: #f0dfa8; --bs-table-bg: #4d3d10; --bs-table-border-color: rgba(255, 255, 255, 0.14); }
html[data-bs-theme="dark"] .table-danger { --bs-table-color: #f5c6c2; --bs-table-bg: #5c2522; --bs-table-border-color: rgba(255, 255, 255, 0.14); }
html[data-bs-theme="dark"] .table-success { --bs-table-color: #bfe6c9; --bs-table-bg: #1e4a2c; --bs-table-border-color: rgba(255, 255, 255, 0.14); }
html[data-bs-theme="dark"] .table-info { --bs-table-color: #bcdcf5; --bs-table-bg: #1d3f58; --bs-table-border-color: rgba(255, 255, 255, 0.14); }

/* DataTables' page-length box. */
html[data-bs-theme="dark"] div.dt-container select.dt-input,
html[data-bs-theme="dark"] div.dt-container input.dt-input { background-color: #22272d; border-color: var(--app-border-color); color: var(--app-text-color); }

html[data-bs-theme="dark"] .analytics-box {
    background: var(--app-surface);
    border-color: var(--app-border-color);
}

/* Status colors keep their meaning on a dark page. */
html[data-bs-theme="dark"] .bg-warning { background-color: #4d3d10 !important; }
html[data-bs-theme="dark"] .bg-danger { background-color: #5c2522 !important; }
html[data-bs-theme="dark"] .bg-success { background-color: #1e4a2c !important; }
html[data-bs-theme="dark"] .bg-info { background-color: #1d3f58 !important; }
html[data-bs-theme="dark"] .password-policy-panel { background: #1d3f58; }
html[data-bs-theme="dark"] .bg-light { background-color: rgba(255, 255, 255, 0.07) !important; }
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .u-bg-white { background-color: #1d2126 !important; }
html[data-bs-theme="dark"] .bg-dark { background-color: #2f363e !important; }
html[data-bs-theme="dark"] .u-bg-report-muted { background-color: #2b3138; }
html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-black { color: var(--app-text-color) !important; }
html[data-bs-theme="dark"] .u-color-brand { color: #a9cbae; }
html[data-bs-theme="dark"] .u-loan-compliant { background-color: #1e4a2c; color: #bfe6c9; }
html[data-bs-theme="dark"] .u-loan-noncompliant { background-color: #5c2522; color: #f5c6c2; }

html[data-bs-theme="dark"] .customer-status-pill-success,
html[data-bs-theme="dark"] .geninfo-autosave-status[data-state="saved"] { color: #8fdca9; }
html[data-bs-theme="dark"] .customer-status-pill-warning { color: #f0c674; }
html[data-bs-theme="dark"] .customer-status-pill-info { color: #9cc7ec; }
html[data-bs-theme="dark"] .customer-status-pill-danger,
html[data-bs-theme="dark"] .geninfo-autosave-status[data-state="error"] { color: #f5a8a2; }
html[data-bs-theme="dark"] .narrative-autosave-anchor .geninfo-autosave-status { background-color: #22272d; }
html[data-bs-theme="dark"] .narrative-autosave-anchor .geninfo-autosave-status[data-state="saved"] { background-color: #1e4a2c; }
html[data-bs-theme="dark"] .narrative-autosave-anchor .geninfo-autosave-status[data-state="error"] { background-color: #5c2522; }

/* Text that site.css fixes to black. */
html[data-bs-theme="dark"] .analytics-box,
html[data-bs-theme="dark"] .applicationNavActive a,
html[data-bs-theme="dark"] .CustomerApplicationActive a,
html[data-bs-theme="dark"] .sidebar-wrapper a,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-menu-tabs .nav-link,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-menu-tabs .nav-link.active,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-brand > a,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-menu .header-menu span,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-menu ul li a,
html[data-bs-theme="dark"] .sidebar-wrapper .sidebar-menu ul li a i { color: var(--app-text-color); }
html[data-bs-theme="dark"] .Analytics-Number { color: #8ab4f8; }

/* Tabs and action buttons. */
html[data-bs-theme="dark"] .customer-dashboard-tabs,
html[data-bs-theme="dark"] .app-workflow-nav,
html[data-bs-theme="dark"] .app-schedule-nav { border-bottom-color: var(--app-border-color); }
html[data-bs-theme="dark"] .customer-dashboard-tabs .nav-link,
html[data-bs-theme="dark"] .view-mode-switcher .nav-link { color: rgba(255, 255, 255, 0.72); }
html[data-bs-theme="dark"] .customer-dashboard-tabs .nav-link:hover,
html[data-bs-theme="dark"] .customer-dashboard-tabs .nav-link:focus,
html[data-bs-theme="dark"] .view-mode-switcher .nav-link:hover,
html[data-bs-theme="dark"] .view-mode-switcher .nav-link:focus { background-color: rgba(255, 255, 255, 0.07) !important; color: #fff; }
html[data-bs-theme="dark"] .customer-dashboard-tabs .nav-link.active,
html[data-bs-theme="dark"] .view-mode-switcher .nav-link.active { background-color: rgba(255, 255, 255, 0.14) !important; border-color: rgba(255, 255, 255, 0.24) rgba(255, 255, 255, 0.24) transparent !important; color: #fff !important; }
html[data-bs-theme="dark"] .customer-workspace-action-count,
html[data-bs-theme="dark"] .balance-sheet-tab-metric { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.18); }
html[data-bs-theme="dark"] .customer-workspace-action-primary,
html[data-bs-theme="dark"] .customer-workspace-action-active .customer-workspace-action-count,
html[data-bs-theme="dark"] .balance-sheet-side-switcher .nav-link.active .balance-sheet-tab-metric { background: rgba(255, 255, 255, 0.14); }
html[data-bs-theme="dark"] .customer-workspace-action-active { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); border-left-color: rgba(255, 255, 255, 0.4); }
html[data-bs-theme="dark"] #nav-tab.nav-pills .nav-link { background-color: #1d2126; color: #a6adb5; }
html[data-bs-theme="dark"] #nav-tab.nav-pills .nav-link.active { background-color: #22272d; color: #fff; }

/* Other fixed light panels. */
html[data-bs-theme="dark"] .bold-readonly { background-color: #2b3138; color: var(--app-text-color); }
html[data-bs-theme="dark"] .mcf-table-wrapper thead th { background: #2b3138; }
html[data-bs-theme="dark"] .accordion { background-color: #22272d; color: var(--app-text-color); }
html[data-bs-theme="dark"] .accordion:hover { background-color: #2b3138; }
html[data-bs-theme="dark"] .ua-legend { background: #1d2126; border-bottom-color: var(--app-border-color); }
html[data-bs-theme="dark"] .column-details th { background-color: #2b3138; }
html[data-bs-theme="dark"] .column-details td,
html[data-bs-theme="dark"] #tableList { border-color: var(--app-border-color); }
html[data-bs-theme="dark"] .card .table-borderless tr { border-bottom-color: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] .multi-steps > li.is-active:after,
html[data-bs-theme="dark"] .multi-steps > li.is-active ~ li:after { background-color: #3a4048; }
html[data-bs-theme="dark"] .multi-steps > li.is-active ~ li:before { background-color: #3a4048; border-color: #3a4048; }

/* Form controls. */
html[data-bs-theme="dark"] input[type=checkbox] { background-color: #3a4048; }
html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus { border-color: rgba(255, 255, 255, 0.4); box-shadow: 0 0 0 0.16rem rgba(255, 255, 255, 0.1); }

/* Vendor widgets with fixed light colors. */
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
html[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-bs-theme="dark"] .select2-dropdown { background-color: #22272d; border-color: var(--app-border-color); color: var(--app-text-color); }
html[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--app-text-color); }
html[data-bs-theme="dark"] .select2-results__option { color: var(--app-text-color); }
html[data-bs-theme="dark"] .datepicker-dropdown,
html[data-bs-theme="dark"] .datepicker table { background-color: #22272d; color: var(--app-text-color); }
html[data-bs-theme="dark"] .ql-toolbar .ql-stroke { stroke: #c9ced4; }
html[data-bs-theme="dark"] .ql-toolbar .ql-fill { fill: #c9ced4; }
html[data-bs-theme="dark"] .ql-toolbar .ql-picker { color: #c9ced4; }
html[data-bs-theme="dark"] .ql-toolbar .ql-picker-options { background-color: #22272d; }
html[data-bs-theme="dark"] .ql-toolbar.ql-snow,
html[data-bs-theme="dark"] .ql-container.ql-snow { border-color: var(--app-border-color); }
