/* AHAD appearance tokens. Brand artwork and financial semantics stay intact. */
.theme-picker { min-width: 170px; }
.theme-picker select { width:100%; min-height:36px; border:1px solid var(--bs-border-color,#c9d8d1); border-radius:8px; padding:5px 10px; background:var(--bs-body-bg,#fff); color:var(--bs-body-color,#243f36); font:inherit; }
.login-right > .theme-picker { width:100%; margin-block:12px 18px; }
html[data-bs-theme="dark"] {
    --theme-canvas:#15191d; --theme-surface:#20262c; --theme-raised:#2a3138;
    --theme-text:#d8dde2; --theme-muted:#abb4be; --theme-border:#38424b; --theme-brand-text:#a3c6b2;
    --bg-light:var(--theme-canvas);
    --bs-body-bg:var(--theme-canvas); --bs-body-bg-rgb:21,25,29;
    --bs-body-color:var(--theme-text); --bs-body-color-rgb:216,221,226;
    --bs-secondary-color:var(--theme-muted); --bs-secondary-bg:var(--theme-raised);
    --bs-tertiary-bg:var(--theme-surface); --bs-border-color:var(--theme-border);
    --bs-emphasis-color:#e1e6eb; --bs-emphasis-color-rgb:225,230,235;
    --bs-primary-text-emphasis:#a3c6b2; --bs-primary-bg-subtle:#26362e; --bs-primary-border-subtle:#496352;
    --bs-info-text-emphasis:#a7becf; --bs-info-bg-subtle:#273139; --bs-info-border-subtle:#475c6b;
    --bs-success-text-emphasis:#a2c7b0; --bs-success-bg-subtle:#27352e; --bs-success-border-subtle:#496352;
    --bs-warning-text-emphasis:#d8bd89; --bs-warning-bg-subtle:#393225; --bs-warning-border-subtle:#716047;
    --bs-danger-text-emphasis:#e4a2a7; --bs-danger-bg-subtle:#3b292c; --bs-danger-border-subtle:#755156;
    --bs-link-color:#a3c6b2; --bs-link-color-rgb:163,198,178;
    --bs-link-hover-color:#c4d8cd; --bs-link-hover-color-rgb:196,216,205;
    --primary-bg-subtle:#28362e; --primary-bg-hover:#303c35; --primary-border-soft:#46554d;
    --card-shadow:0 4px 20px rgba(0,0,0,.25);
    color-scheme:dark;
}
html[data-bs-theme="dark"] body { background:var(--theme-canvas); color:var(--theme-text); }
html[data-bs-theme="dark"] :is(.card,.card-custom,.modal-content,.dropdown-menu,.offcanvas,.popover,#topbar,.notif-dropdown,.account-dropdown) { background-color:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border); }
html[data-bs-theme="dark"] :is(.table,.rows-table,.dataTable) { --bs-table-bg:var(--theme-surface); --bs-table-color:var(--theme-text); --bs-table-striped-bg:var(--theme-raised); --bs-table-striped-color:var(--theme-text); --bs-table-hover-bg:#2a3138; --bs-table-hover-color:var(--theme-text); --bs-table-border-color:var(--theme-border); color:var(--theme-text); }
html[data-bs-theme="dark"] :is(.form-control,.form-select,.input-group-text,textarea,input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),select) { background-color:var(--theme-surface); color:var(--theme-text); border-color:var(--theme-border); }
html[data-bs-theme="dark"] :is(input,textarea)::placeholder { color:#abb4be; opacity:1; }
html[data-bs-theme="dark"] :is(input,textarea,select):disabled { background-color:#292f35; color:#a4adb6; }
html[data-bs-theme="dark"] :is(.text-muted,.text-secondary,.form-text,.dropdown-header,.breadcrumb-item) { color:var(--theme-muted)!important; }
html[data-bs-theme="dark"] .text-primary { color:var(--theme-brand-text)!important; }
html[data-bs-theme="dark"] .text-success { color:#a2c7b0!important; }
html[data-bs-theme="dark"] .text-danger { color:#e4a2a7!important; }
html[data-bs-theme="dark"] .text-warning { color:#d8bd89!important; }
html[data-bs-theme="dark"] .text-info { color:#a7becf!important; }
html[data-bs-theme="dark"] :is(.bg-white,.bg-light) { background-color:var(--theme-surface)!important; }
html[data-bs-theme="dark"] .dropdown-item { color:var(--theme-text); }
html[data-bs-theme="dark"] .dropdown-item:is(:hover,:focus) { background-color:var(--theme-raised); }
html[data-bs-theme="dark"] :is(.btn-outline-primary,.btn-outline-success) { --bs-btn-color:#a3c6b2; --bs-btn-border-color:#587563; --bs-btn-hover-bg:#347362; --bs-btn-hover-border-color:#587563; --bs-btn-hover-color:#fff; }
html[data-bs-theme="dark"] :is(.select2-container--bootstrap-5 .select2-selection,.select2-dropdown,.select2-search__field) { background-color:var(--theme-surface)!important; color:var(--theme-text)!important; border-color:var(--theme-border)!important; }
html[data-bs-theme="dark"] :is(.select2-selection__rendered,.select2-selection__choice,.select2-results__option) { color:var(--theme-text)!important; }
html[data-bs-theme="dark"] .select2-selection__choice { background-color:var(--theme-raised)!important; border-color:var(--theme-border)!important; }
html[data-bs-theme="dark"] .select2-results__option--highlighted { background-color:#347362!important; color:#fff!important; }
html[data-bs-theme="dark"] .select2-results__option[aria-disabled=true] { color:#a4adb6!important; background-color:#292f35!important; }
html[data-bs-theme="dark"] .btn-close { filter:invert(1) grayscale(1) brightness(2); }
html[data-bs-theme="dark"] :focus-visible { outline:2px solid #a3c6b2; outline-offset:3px; }
@media print {
    html[data-bs-theme] { color-scheme:light!important; --bs-body-bg:#fff; --bs-body-color:#222; --bs-border-color:#ddd; --bg-light:#fff; }
    .theme-picker { display:none!important; }
    html[data-bs-theme] body { background:#fff!important; color:#222!important; }
}

html[data-bs-theme="dark"] .text-dark { color:var(--theme-text)!important; }
html[data-bs-theme="dark"] .btn-light { --bs-btn-bg:var(--theme-raised); --bs-btn-color:var(--theme-text); --bs-btn-border-color:var(--theme-border); --bs-btn-hover-bg:#353e37; --bs-btn-hover-color:#fff; }
html[data-bs-theme="dark"] :is(.notif-popup-icon-wrap,.notif-icon) { background:var(--theme-raised)!important; }
button.user-dropdown { font:inherit; color:inherit; text-align:start; }

html[data-bs-theme="dark"] .form-label { color:var(--theme-text); }

/* Quiet structural surfaces; semantic status feedback retains its own colors. */
html[data-bs-theme="dark"] #sidebar { background:var(--theme-surface); }
html[data-bs-theme="dark"] :is(.dash-hero,.translation-hero,.login-left,.donor-story) { background:linear-gradient(135deg,#26362d,#2e4135); }
html[data-bs-theme="dark"] :is(.stat-icon,.stat-card .stat-icon,.type-header,.card-header-custom,.approval-show-page .project-header) { background:var(--theme-raised)!important; color:var(--theme-text)!important; }
html[data-bs-theme="dark"] :is(.type-header h6,.value-chip,.pay-section-title,.act-section-title,.topbar-title,.stat-label,.translation-source strong) { color:var(--theme-text)!important; }
html[data-bs-theme="dark"] :is(.table-custom thead th,.rows-table th,.table thead th) { background:var(--theme-raised)!important; color:#bdc5cd!important; border-color:var(--theme-border)!important; }
html[data-bs-theme="dark"] :is(.table-custom td,.rows-table td,.table td) { border-color:var(--theme-border); }
html[data-bs-theme="dark"] .stat-card { border-color:var(--theme-border); box-shadow:0 2px 10px rgba(0,0,0,.12); }
html[data-bs-theme="dark"] .form-control:focus, html[data-bs-theme="dark"] .form-select:focus { border-color:#769985; box-shadow:0 0 0 3px rgba(118,153,133,.15); }
@media(prefers-reduced-motion:reduce) { .form-control,.form-select,.user-dropdown { transition:none; } }

html[data-bs-theme="dark"] .alert-danger { background-color:var(--bs-danger-bg-subtle)!important; color:var(--bs-danger-text-emphasis)!important; border-color:var(--bs-danger-border-subtle)!important; }
html[data-bs-theme="dark"] .alert-warning { background-color:var(--bs-warning-bg-subtle)!important; color:var(--bs-warning-text-emphasis)!important; border-color:var(--bs-warning-border-subtle)!important; }
html[data-bs-theme="dark"] .alert-success { background-color:var(--bs-success-bg-subtle)!important; color:var(--bs-success-text-emphasis)!important; border-color:var(--bs-success-border-subtle)!important; }
html[data-bs-theme="dark"] .alert-info { background-color:var(--bs-info-bg-subtle)!important; color:var(--bs-info-text-emphasis)!important; border-color:var(--bs-info-border-subtle)!important; }
html[data-bs-theme="dark"] :is(.badge,.badge-status).bg-warning, html[data-bs-theme="dark"] .badge-status[style*="#fef9c3"] { background-color:var(--bs-warning-bg-subtle)!important; color:var(--bs-warning-text-emphasis)!important; }
html[data-bs-theme="dark"] :is(.badge,.badge-status).bg-danger { background-color:var(--bs-danger-bg-subtle)!important; color:var(--bs-danger-text-emphasis)!important; }
html[data-bs-theme="dark"] :is(.badge,.badge-status).bg-success { background-color:var(--bs-success-bg-subtle)!important; color:var(--bs-success-text-emphasis)!important; }
html[data-bs-theme="dark"] :is(.badge,.badge-status).bg-info { background-color:var(--bs-info-bg-subtle)!important; color:var(--bs-info-text-emphasis)!important; }

html[data-bs-theme="dark"] .sidebar-brand { background:var(--theme-surface); border-color:var(--theme-border); }
html[data-bs-theme="dark"] .sidebar-menu a { color:#bdc5cd; }
html[data-bs-theme="dark"] .sidebar-menu a:is(.active,:hover) { background:var(--theme-raised); color:var(--theme-text); border-color:#65737e; }
html[data-bs-theme="dark"] .sidebar-group-toggle { color:var(--theme-muted); }
html[data-bs-theme="dark"] .sidebar-menu a .nav-icon { color:inherit; }

#sidebar .badge.sidebar-attention-badge { background:#e3bd71; color:#292315!important; font-weight:800; font-size:11px; line-height:1.25; min-width:22px; padding:3px 6px; font-variant-numeric:tabular-nums; }
html[data-bs-theme="dark"] #sidebar .badge.sidebar-attention-badge { background:#d8bd89!important; color:#292315!important; border:1px solid #a58c5c; }

/* Compact appearance control for authentication and donor surfaces. */
.appearance-segments { display:inline-flex; flex:0 0 auto; direction:ltr; gap:2px; padding:3px; border:1px solid var(--bs-border-color,#dbe7e2); border-radius:10px; background:var(--bs-body-bg,#fff); }
.appearance-option { display:inline-flex; align-items:center; justify-content:center; width:34px; height:32px; padding:0; border:0; border-radius:7px; background:transparent; color:#617269; cursor:pointer; }
.appearance-option:hover { background:#edf4ef; }
.appearance-option[aria-pressed="true"] { background:#e0ece5; color:#24543f; box-shadow:inset 0 0 0 1px #b7cec1; }
.appearance-option:focus-visible { outline:2px solid #347362; outline-offset:2px; }
.auth-appearance-toolbar { position:absolute; inset-inline:22px; top:18px; display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.auth-appearance-toolbar .language-switcher { position:static; }
.login-right:has(.auth-appearance-toolbar) { padding-block-start:76px; }
.donor-appearance-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:24px; }
.donor-appearance-toolbar .login-languages { margin:0; }
.account-dropdown > .appearance-segments { margin:12px 16px; }
html[data-bs-theme="dark"] .appearance-segments { background:var(--theme-surface); border-color:var(--theme-border); }
html[data-bs-theme="dark"] .appearance-option { color:var(--theme-muted); }
html[data-bs-theme="dark"] .appearance-option:hover { background:var(--theme-raised); }
html[data-bs-theme="dark"] .appearance-option[aria-pressed="true"] { background:#303c35; color:#c4d8cd; box-shadow:inset 0 0 0 1px #587563; }
@media print { .appearance-segments { display:none; } }

/* Finance lists: Bootstrap contextual rows own table variables at the row level. */
.payment-source-badge--project { background:#e0f2fe; color:#1e3a5f; }
.payment-source-badge--sacrifice { background:#fef3c7; color:#92400e; }
html[data-bs-theme="dark"] .financial-records-table > tbody > tr {
    --bs-table-color:var(--theme-text); --bs-table-bg:var(--theme-surface);
    --bs-table-hover-color:var(--theme-text); --bs-table-hover-bg:#2a3138;
    --bs-table-active-color:var(--theme-text); --bs-table-active-bg:#303943;
    --bs-table-striped-color:var(--theme-text); --bs-table-striped-bg:#252c33;
    --bs-table-border-color:var(--theme-border);
}
html[data-bs-theme="dark"] .financial-records-table > tbody > tr.workflow-review-row {
    --bs-table-bg:var(--workflow-review-bg); --bs-table-color:var(--workflow-review-text);
    --bs-table-hover-bg:#42344f; --bs-table-hover-color:#e1c9f4;
    --bs-table-striped-bg:#3a3048; --bs-table-striped-color:var(--workflow-review-text);
    --bs-table-active-bg:#42344f; --bs-table-active-color:#e1c9f4;
    --bs-table-border-color:var(--workflow-review-border);
}
html[data-bs-theme="dark"] .financial-records-table > tbody > tr > * {
    background-color:var(--bs-table-bg); color:var(--bs-table-color);
    border-color:var(--bs-table-border-color);
}
html[data-bs-theme="dark"] .financial-records-table > tbody > tr:hover > * {
    color:var(--bs-table-hover-color); background-color:var(--bs-table-hover-bg);
}
html[data-bs-theme="dark"] .payment-source-badge--project { background:#283744; color:#bad2e6; }
html[data-bs-theme="dark"] .payment-source-badge--sacrifice { background:#3b3324; color:#dec795; }

/* Workflow status palette: shared meanings, independent from brand/priority utilities. */
:root {
    --bs-workflow-new:#626262; --workflow-new-bg:#efefef; --workflow-new-text:#484848; --workflow-new-border:#cfcfcf;
    --bs-workflow-progress:#2563a6; --workflow-progress-bg:#e9f2ff; --workflow-progress-text:#1e5088; --workflow-progress-border:#bfd5f0;
    --bs-workflow-review:#76539b; --workflow-review-bg:#f1eafa; --workflow-review-text:#68428a; --workflow-review-border:#d8c7e9;
    --bs-workflow-revision:#b65b16; --workflow-revision-bg:#fff0df; --workflow-revision-text:#91450d; --workflow-revision-border:#efccaa;
    --bs-workflow-delivery:#23758b; --workflow-delivery-bg:#e5f4f8; --workflow-delivery-text:#175e70; --workflow-delivery-border:#b7dce5;
}
html[data-bs-theme="dark"] {
    --bs-workflow-new:#626262; --workflow-new-bg:#343434; --workflow-new-text:#d5d5d5; --workflow-new-border:#5c5c5c;
    --bs-workflow-progress:#2c5b87; --workflow-progress-bg:#24364d; --workflow-progress-text:#a8c9ee; --workflow-progress-border:#416186;
    --bs-workflow-review:#614780; --workflow-review-bg:#352c43; --workflow-review-text:#d1b8eb; --workflow-review-border:#66507e;
    --bs-workflow-revision:#8f4d1d; --workflow-revision-bg:#403025; --workflow-revision-text:#edbd91; --workflow-revision-border:#806043;
    --bs-workflow-delivery:#226779; --workflow-delivery-bg:#243a40; --workflow-delivery-text:#a1d4de; --workflow-delivery-border:#436873;
}
.bg-workflow-new, .bg-workflow-new-subtle { background-color:var(--workflow-new-bg)!important; color:var(--workflow-new-text)!important; }
.text-workflow-new { color:var(--workflow-new-text)!important; }
.border-workflow-new { border-color:var(--workflow-new-border)!important; }
.bg-workflow-progress, .bg-workflow-progress-subtle { background-color:var(--workflow-progress-bg)!important; color:var(--workflow-progress-text)!important; }
.text-workflow-progress { color:var(--workflow-progress-text)!important; }
.border-workflow-progress { border-color:var(--workflow-progress-border)!important; }
.bg-workflow-review, .bg-workflow-review-subtle { background-color:var(--workflow-review-bg)!important; color:var(--workflow-review-text)!important; }
.text-workflow-review { color:var(--workflow-review-text)!important; }
.border-workflow-review { border-color:var(--workflow-review-border)!important; }
.bg-workflow-revision, .bg-workflow-revision-subtle { background-color:var(--workflow-revision-bg)!important; color:var(--workflow-revision-text)!important; }
.text-workflow-revision { color:var(--workflow-revision-text)!important; }
.border-workflow-revision { border-color:var(--workflow-revision-border)!important; }
.bg-workflow-delivery, .bg-workflow-delivery-subtle { background-color:var(--workflow-delivery-bg)!important; color:var(--workflow-delivery-text)!important; }
.text-workflow-delivery { color:var(--workflow-delivery-text)!important; }
.border-workflow-delivery { border-color:var(--workflow-delivery-border)!important; }

.financial-records-table > tbody > tr.workflow-review-row {
    --bs-table-bg:var(--workflow-review-bg); --bs-table-color:var(--workflow-review-text);
    --bs-table-hover-bg:var(--workflow-review-bg); --bs-table-hover-color:var(--workflow-review-text);
    --bs-table-border-color:var(--workflow-review-border);
}

/* Shared notification presentation: dynamic bell items and the full inbox. */
:root {
    --notif-title:#243d35; --notif-message:#596571; --notif-time:#606c77;
    --notif-unread:#edf5f1; --notif-hover:#e3eee8; --notif-border:#dce6e1;
    --notif-info:#347362; --notif-success:#327548; --notif-warning:#946008;
    --notif-danger:#b73a45; --notif-review:#76539b; --notif-assignment:#2563a6;
    --notif-update:#23758b; --notif-icon-bg:#edf2ef;
}
html[data-bs-theme="dark"] {
    --notif-title:#d8dde2; --notif-message:#c1c9d1; --notif-time:#abb4be;
    --notif-unread:#27332f; --notif-hover:#303e38; --notif-border:#3c4944;
    --notif-info:#a3c6b2; --notif-success:#a2c7b0; --notif-warning:#e4c185;
    --notif-danger:#e4a2a7; --notif-review:#d1b8eb; --notif-assignment:#a8c9ee;
    --notif-update:#a1d4de; --notif-icon-bg:#2a3138;
}
:is(.notif-dropdown,.notification-record) .notif-title { color:var(--notif-title); }
:is(.notif-dropdown,.notification-record) .notif-message { color:var(--notif-message); }
:is(.notif-dropdown,.notification-record) .notif-time { color:var(--notif-time); }
.notif-item, .notification-record { border-color:var(--notif-border)!important; }
.notif-item.unread, .notification-record.unread { background:var(--notif-unread); }
.notif-item:hover, .notif-item.unread:hover { background:var(--notif-hover); }
.notif-icon[data-notification-type] { background:var(--notif-icon-bg); color:var(--notif-info); }
.notif-icon:is([data-notification-type="success"],[data-notification-type="task_completed"],[data-notification-type="closed"]) { color:var(--notif-success); }
.notif-icon:is([data-notification-type="warning"],[data-notification-type="new_request"]) { color:var(--notif-warning); }
.notif-icon[data-notification-type="danger"] { color:var(--notif-danger); }
.notif-icon:is([data-notification-type="circular"],[data-notification-type="execution_review"]) { color:var(--notif-review); }
.notif-icon[data-notification-type="assignment"] { color:var(--notif-assignment); }
.notif-icon[data-notification-type="task_update"] { color:var(--notif-update); }
html[data-bs-theme="dark"] .notif-popup-card { background:var(--theme-surface)!important; color:var(--theme-text); }
html[data-bs-theme="dark"] .notif-popup-title { color:var(--notif-title)!important; }
html[data-bs-theme="dark"] .notif-popup-msg { color:var(--notif-message)!important; }

/* Rating gold is independent of brand and warning palettes; preserve Light colors. */
html[data-bs-theme="dark"] { --rating-filled:#fbbf24; --rating-empty:#6f7d8a; }
html[data-bs-theme="dark"] .rating-star { color:var(--rating-empty)!important; }
html[data-bs-theme="dark"] .rating-star.is-filled,
html[data-bs-theme="dark"] .rating-star-icon,
html[data-bs-theme="dark"] .num.rating-score { color:var(--rating-filled)!important; }

/* Canonical AHAD brand states for receipt controls. */
html[data-bs-theme="dark"] .btn-primary { --bs-btn-focus-shadow-rgb:163,198,178; }
html[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color:var(--theme-muted); --bs-btn-border-color:var(--theme-border); --bs-btn-hover-color:var(--theme-text); --bs-btn-hover-bg:var(--theme-raised); --bs-btn-hover-border-color:var(--theme-muted); --bs-btn-active-color:var(--theme-text); --bs-btn-active-bg:var(--theme-raised); --bs-btn-active-border-color:var(--theme-muted); --bs-btn-focus-shadow-rgb:171,180,190; --bs-btn-disabled-color:var(--theme-muted); --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:var(--theme-border); }
html[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color:var(--bs-danger-text-emphasis); --bs-btn-border-color:var(--bs-danger-text-emphasis); --bs-btn-hover-color:#fff; --bs-btn-hover-bg:var(--danger); --bs-btn-hover-border-color:var(--bs-danger-text-emphasis); --bs-btn-active-color:#fff; --bs-btn-active-bg:var(--danger); --bs-btn-active-border-color:var(--bs-danger-text-emphasis); --bs-btn-focus-shadow-rgb:228,162,167; --bs-btn-disabled-color:var(--bs-danger-text-emphasis); --bs-btn-disabled-bg:transparent; --bs-btn-disabled-border-color:var(--bs-danger-border-subtle); }
html[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color:var(--theme-brand-text); --bs-btn-border-color:#587563; --bs-btn-hover-bg:var(--primary); --bs-btn-hover-border-color:#587563; --bs-btn-hover-color:#fff; --bs-btn-active-bg:var(--primary-dark); --bs-btn-active-border-color:#587563; --bs-btn-active-color:#fff; --bs-btn-focus-shadow-rgb:163,198,178; --bs-btn-disabled-color:var(--theme-brand-text); --bs-btn-disabled-border-color:#587563; }
html[data-bs-theme="dark"] .pagination { --bs-pagination-color:var(--theme-brand-text); --bs-pagination-bg:var(--theme-surface); --bs-pagination-border-color:var(--theme-border); --bs-pagination-hover-color:#d8ebdf; --bs-pagination-hover-bg:var(--theme-raised); --bs-pagination-hover-border-color:var(--theme-border); --bs-pagination-focus-color:#d8ebdf; --bs-pagination-focus-bg:var(--theme-raised); --bs-pagination-focus-box-shadow:0 0 0 .25rem rgba(163,198,178,.25); --bs-pagination-disabled-color:var(--theme-muted); --bs-pagination-disabled-bg:var(--theme-surface); --bs-pagination-disabled-border-color:var(--theme-border); }
html[data-bs-theme="dark"] .select2-container--bootstrap-5:is(.select2-container--focus,.select2-container--open) .select2-selection { border-color:#587563!important; box-shadow:0 0 0 .2rem rgba(163,198,178,.2)!important; }
html[data-bs-theme="dark"] .select2-selection__placeholder { color:var(--theme-muted)!important; }
