/* Dark theme surfaces that stay light because later stylesheets hard-code white. */

html[data-theme="dark"] {
    --sb-bg-top: #07265e;
    --sb-bg-mid: #105298;
    --sb-bg-bottom: #166fb8;
}

html[data-theme="dark"] .sidebar {
    background:
        radial-gradient(120% 70% at 110% 0%, rgba(56, 189, 248, .1), transparent 55%),
        radial-gradient(90% 55% at -20% 100%, rgba(14, 165, 233, .14), transparent 50%),
        linear-gradient(180deg, var(--sb-bg-top) 0%, var(--sb-bg-mid) 48%, var(--sb-bg-bottom) 100%);
    box-shadow: -4px 0 24px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .sidebar::before {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(125, 211, 252, .08), transparent 55%),
        radial-gradient(ellipse at 75% 70%, rgba(14, 165, 233, .1), transparent 60%);
}

html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .wad-clear-filters-btn {
    background: #162033;
    color: #e8eef6;
    border-color: #2a3b52;
}

html[data-theme="dark"] .btn-outline:hover {
    background: #1c2c44;
    color: #fff;
}

html[data-theme="dark"] .empty-state {
    background: #121b2c;
    border-color: #3a4d66;
    color: #a8b6c8;
}

html[data-theme="dark"] .empty-state:hover {
    background: #182436;
    border-color: #64b5f6;
    color: #e8eef6;
}

html[data-theme="dark"] .empty-title {
    color: #e8eef6;
}

html[data-theme="dark"] .account-header__code,
html[data-theme="dark"] .account-header__value {
    color: #dbeafe;
}

html[data-theme="dark"] .rpt-chart-host {
    background: #162033;
    border-color: #2a3b52;
}

html[data-theme="dark"] .rpt-table tfoot td {
    background: #3a2e14;
    color: #fde68a;
}

/* Reports menu: pastel headers were sitting on dark cards. */
html[data-theme="dark"] .rl-head {
    background:
        radial-gradient(circle at 12% -30%, rgba(255, 255, 255, .16), transparent 45%),
        linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #fff;
}

html[data-theme="dark"] .rl-tone-violet { --rl-tint: #241b36; }
html[data-theme="dark"] .rl-tone-blue { --rl-tint: #15283d; }
html[data-theme="dark"] .rl-tone-amber { --rl-tint: #332413; }
html[data-theme="dark"] .rl-tone-green { --rl-tint: #13281f; }
html[data-theme="dark"] .rl-tone-rose { --rl-tint: #341820; }

html[data-theme="dark"] .rl-section__icon,
html[data-theme="dark"] .rl-section__count {
    background: color-mix(in srgb, var(--rl-accent) 18%, #0b1220);
    color: var(--rl-accent);
}

html[data-theme="dark"] .rl-item__icon {
    background: #243044;
    color: #cbd5e1;
}

html[data-theme="dark"] .rl-item:hover .rl-item__icon {
    background: #1c2c44;
    color: var(--rl-accent);
}

/* Invoice, document, and payment lists. */
html[data-theme="dark"] #webInvoiceList.wad-list-page,
html[data-theme="dark"] #webAccountingDocumentList.wad-list-page,
html[data-theme="dark"] #webPaymentList.wad-list-page {
    --wad-list-bg: transparent;
    --wad-card-border: #2a3b52;
    background: transparent;
    color: #e8eef6;
}

html[data-theme="dark"] #webInvoiceList .wad-list-header,
html[data-theme="dark"] #webAccountingDocumentList .wad-list-header,
html[data-theme="dark"] #webPaymentList .wad-list-header,
html[data-theme="dark"] #webInvoiceList .wad-list-toolbar,
html[data-theme="dark"] #webAccountingDocumentList .wad-list-toolbar,
html[data-theme="dark"] #webPaymentList .wad-list-toolbar,
html[data-theme="dark"] #webInvoiceList .accounting-document-list-table-wrap,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table-wrap,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table-wrap,
html[data-theme="dark"] #webInvoiceList .wad-list-search-input,
html[data-theme="dark"] #webAccountingDocumentList .wad-list-search-input,
html[data-theme="dark"] #webPaymentList .wad-list-search-input,
html[data-theme="dark"] #webInvoiceList .wad-pretty-select__trigger,
html[data-theme="dark"] #webAccountingDocumentList .wad-pretty-select__trigger,
html[data-theme="dark"] #webPaymentList .wad-pretty-select__trigger,
html[data-theme="dark"] #webInvoiceList .wad-pretty-select__menu,
html[data-theme="dark"] #webAccountingDocumentList .wad-pretty-select__menu,
html[data-theme="dark"] #webPaymentList .wad-pretty-select__menu,
html[data-theme="dark"] #webInvoiceList .wad-clear-filters-btn,
html[data-theme="dark"] #webAccountingDocumentList .wad-clear-filters-btn,
html[data-theme="dark"] #webPaymentList .wad-clear-filters-btn {
    background: #162033;
    color: #e8eef6;
    border-color: #2a3b52;
}

html[data-theme="dark"] #webInvoiceList .wad-pretty-select__trigger:hover,
html[data-theme="dark"] #webAccountingDocumentList .wad-pretty-select__trigger:hover,
html[data-theme="dark"] #webPaymentList .wad-pretty-select__trigger:hover {
    background: #1c2c44;
    border-color: #3a4d66;
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table thead th,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table thead th,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table thead th {
    background: #1c2c44;
    color: #dbe7f5;
    border-bottom-color: #2a3b52;
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table td,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table td,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table td,
html[data-theme="dark"] #webInvoiceList .accounting-document-list-table th,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table th,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table th {
    color: #e8eef6;
    border-bottom-color: #2a3b52;
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table tbody tr:hover td,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table tbody tr:hover td,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table tbody tr:hover td,
html[data-theme="dark"] .accounting-document-list-table tbody tr.is-selected > td {
    background: #1a3050;
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table tbody .wad-list-actions,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table tbody .wad-list-actions,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table tbody .wad-list-actions {
    background: #162033;
    box-shadow: 1px 0 0 #2a3b52, 10px 0 16px -12px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table thead .wad-list-actions,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table thead .wad-list-actions,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table thead .wad-list-actions {
    background: #1c2c44;
    box-shadow: 1px 0 0 #2a3b52, 10px 0 16px -12px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] #webInvoiceList .accounting-document-list-table tbody tr:hover > .wad-list-actions,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table tbody tr:hover > .wad-list-actions,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table tbody tr:hover > .wad-list-actions,
html[data-theme="dark"] #webInvoiceList .accounting-document-list-table tbody tr.is-selected > .wad-list-actions,
html[data-theme="dark"] #webAccountingDocumentList .accounting-document-list-table tbody tr.is-selected > .wad-list-actions,
html[data-theme="dark"] #webPaymentList .accounting-document-list-table tbody tr.is-selected > .wad-list-actions {
    background: #1a3050;
}

html[data-theme="dark"] .wad-pretty-select__option {
    color: #e8eef6;
}

html[data-theme="dark"] .wad-pretty-select__option:hover,
html[data-theme="dark"] .wad-pretty-select__option:focus-visible,
html[data-theme="dark"] .wad-pretty-select__option.is-selected {
    background: #1a3050;
    color: #dbeafe;
}

html[data-theme="dark"] .wad-list-search-icon,
html[data-theme="dark"] .wad-pretty-select__caret,
html[data-theme="dark"] #webInvoiceList .wad-list-filter span,
html[data-theme="dark"] #webAccountingDocumentList .wad-list-filter span,
html[data-theme="dark"] #webPaymentList .wad-list-filter span {
    color: #a8b6c8;
}

html[data-theme="dark"] .wad-year-trigger,
html[data-theme="dark"] .accounting-document-date-field .modal-date-input,
html[data-theme="dark"] .page-number-input,
html[data-theme="dark"] #webInvoiceList .page-number-input,
html[data-theme="dark"] #webAccountingDocumentList .page-number-input,
html[data-theme="dark"] #webPaymentList .page-number-input {
    background: #162033;
    color: #e8eef6;
    border-color: #2a3b52;
}

/* Filter dialogs: deep header, dark footer, one input color. */
html[data-theme="dark"] .modal-modal-header {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #fff;
    border-bottom-color: transparent;
}

html[data-theme="dark"] .modal-modal-header .modal-btn-outline {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border-color: rgba(255, 255, 255, .38);
}

html[data-theme="dark"] .modal-modal-header .modal-btn-outline:hover {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

html[data-theme="dark"] .modal-modal-footer {
    background: #121b2c;
    border-top-color: #2a3b52;
}

html[data-theme="dark"] .modal-modal-footer .modal-btn-outline {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .modal-form-control,
html[data-theme="dark"] .modal-date-input,
html[data-theme="dark"] .mf-input,
html[data-theme="dark"] .mf-select {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .modal-form-control::placeholder,
html[data-theme="dark"] .mf-input::placeholder {
    color: #94a3b8;
}

html[data-theme="dark"] .modal-picker-btn,
html[data-theme="dark"] .mf-picker-btn {
    background: #243652;
    color: #dbeafe;
    border-color: #3a4d66;
}

html[data-theme="dark"] .modal-picker-btn:hover,
html[data-theme="dark"] .mf-picker-btn:hover {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

html[data-theme="dark"] .mf-section,
html[data-theme="dark"] .modal-card {
    background: transparent;
    border-color: #2a3b52;
}

html[data-theme="dark"] .mf-section-header,
html[data-theme="dark"] .modal-card-h {
    background: #1a3050;
    color: #dbeafe;
    border-bottom-color: #2a3b52;
}

html[data-theme="dark"] .mf-tabs {
    background: #121b2c;
    border-bottom-color: #2a3b52;
}

/* Shared report chrome that was still painted white. */
html[data-theme="dark"] .filter-section,
html[data-theme="dark"] .summary-box,
html[data-theme="dark"] .rpt-triple-search,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .filter-group .form-control,
html[data-theme="dark"] .form-control {
    background: #162033;
    color: #e8eef6;
    border-color: #2a3b52;
}

html[data-theme="dark"] .filter-section {
    background: #162033;
    box-shadow: none;
}

html[data-theme="dark"] .summary-box {
    background: linear-gradient(145deg, #1a2740, #121b2c);
    box-shadow: none;
}

html[data-theme="dark"] .summary-label,
html[data-theme="dark"] .filter-label {
    color: #cbd5e1;
}

html[data-theme="dark"] .summary-value,
html[data-theme="dark"] .filter-group .form-control {
    color: #dbeafe;
}

html[data-theme="dark"] .rpt-triple-search {
    background: #121b2c;
}

/* Type pickers. */
html[data-theme="dark"] .invoice-type-card,
html[data-theme="dark"] .payment-type-card {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .invoice-type-card__text small,
html[data-theme="dark"] .payment-type-card__text small,
html[data-theme="dark"] .invoice-type-card__key {
    color: #a8b6c8;
}

html[data-theme="dark"] .invoice-type-body {
    background: #121b2c;
}

/* Document, invoice, and receipt editors. */
html[data-theme="dark"] #webAccountingDocument .accounting-document-table thead th {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: #fff;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table-container,
html[data-theme="dark"] #webInvoice .accounting-document-table-container,
html[data-theme="dark"] .payment-grid-wrap {
    background: #121b2c;
    border-color: #2a3b52;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table tbody tr,
html[data-theme="dark"] #webInvoice .accounting-document-table tbody tr,
html[data-theme="dark"] .payment-items-table tbody tr {
    background: #162033;
    color: #e8eef6;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table tbody tr:nth-child(even),
html[data-theme="dark"] #webInvoice .accounting-document-table tbody tr:nth-child(even),
html[data-theme="dark"] .payment-items-table tbody tr:nth-child(even) {
    background: #1a2436;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table tbody tr:hover td,
html[data-theme="dark"] #webInvoice .accounting-document-table tbody tr:hover td,
html[data-theme="dark"] .payment-items-table tbody tr:hover {
    background: #1c2c44;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table tbody tr.selected td,
html[data-theme="dark"] #webInvoice .accounting-document-table tbody tr.selected td {
    background: #1a3050;
}

html[data-theme="dark"] #webAccountingDocument .accounting-document-table td,
html[data-theme="dark"] #webInvoice .accounting-document-table td,
html[data-theme="dark"] .payment-items-table tbody td {
    border-color: #2a3b52;
    color: #e8eef6;
}

html[data-theme="dark"] #webAccountingDocument .wad-cell-input,
html[data-theme="dark"] #webInvoice .wad-cell-input,
html[data-theme="dark"] #webAccountingDocument .wad-cell-input:focus,
html[data-theme="dark"] #webInvoice .wad-cell-input:focus {
    background: transparent;
    color: #e8eef6;
}

html[data-theme="dark"] #webAccountingDocument .wad-cell-input:focus,
html[data-theme="dark"] #webInvoice .wad-cell-input:focus {
    background: #1c2c44;
}

html[data-theme="dark"] #webAccountingDocument .wad-cell-input[readonly],
html[data-theme="dark"] #webInvoice .wad-cell-input[readonly],
html[data-theme="dark"] #webInvoice .wad-cell-input.is-computed,
html[data-theme="dark"] #webAccountingDocument .wad-cell-input:disabled {
    background: #121b2c;
    color: #cbd5e1;
}

html[data-theme="dark"] #webInvoice.has-kind-color .account-header.accounting-document-header {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--kind-color) 28%, #121b2c),
        color-mix(in srgb, var(--kind-color) 10%, #121b2c));
    border-bottom-color: color-mix(in srgb, var(--kind-color) 55%, #121b2c);
}

html[data-theme="dark"] #webInvoice.has-kind-color #wif-title {
    color: color-mix(in srgb, var(--kind-color) 62%, #fff);
}

html[data-theme="dark"] #webPayment.is-receive #wpay-title,
html[data-theme="dark"] #webPayment.is-pay #wpay-title {
    color: color-mix(in srgb, var(--payment-accent) 50%, #fff);
}

html[data-theme="dark"] #webPayment.is-receive .account-header.accounting-document-header,
html[data-theme="dark"] #webPayment.is-pay .account-header.accounting-document-header {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--payment-accent) 28%, #121b2c),
        color-mix(in srgb, var(--payment-accent) 10%, #121b2c));
    border-bottom-color: color-mix(in srgb, var(--payment-accent) 50%, #121b2c);
}

html[data-theme="dark"] .invoice-page .invoice-customer-meta,
html[data-theme="dark"] .payment-page .payment-meta {
    background: #162033;
    border-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .payment-page.is-receive .payment-party-meta {
    background: linear-gradient(145deg, #163024, #102018);
    border-color: rgba(46, 155, 60, .4);
    box-shadow: none;
}

html[data-theme="dark"] .payment-page.is-pay .payment-party-meta {
    background: linear-gradient(145deg, #3a1c1c, #241212);
    border-color: rgba(211, 47, 47, .4);
    box-shadow: none;
}

html[data-theme="dark"] .payment-page .payment-meta .filter-label,
html[data-theme="dark"] .payment-page .payment-party-meta .filter-label,
html[data-theme="dark"] .invoice-check-label {
    color: #cbd5e1;
}

html[data-theme="dark"] .wad-btn-add-row {
    color: #86efac !important;
    background: #143024 !important;
    border-color: #166534 !important;
}

html[data-theme="dark"] .wad-btn-back {
    color: #e8eef6 !important;
    background: #1c2c44 !important;
    border-color: #3a4d66 !important;
}

html[data-theme="dark"] .payment-resize-handle {
    background: #1a2436;
    border-color: #2a3b52;
}

html[data-theme="dark"] .accounting-document-balance.is-balanced {
    background: linear-gradient(135deg, #121b2c, #143024);
    border-color: rgba(76, 175, 80, .45);
}

html[data-theme="dark"] .accounting-document-balance.is-balanced .summary-value {
    color: #86efac;
}

html[data-theme="dark"] .accounting-document-balance.is-unbalanced {
    background: linear-gradient(135deg, #121b2c, #3a1c1c);
    border-color: rgba(244, 67, 54, .45);
}

html[data-theme="dark"] .accounting-document-balance.is-unbalanced .summary-value {
    color: #fca5a5;
}

html[data-theme="dark"] .payment-footer {
    background: #162033;
    border-color: #2a3b52;
}

html[data-theme="dark"] .payment-footer-field label,
html[data-theme="dark"] .payment-footer-field > span,
html[data-theme="dark"] .payment-empty {
    color: #cbd5e1;
}

/* Search modals: zebra was white even-rows from the global tr rule. */
html[data-theme="dark"] .modal-modal tr:nth-child(odd) {
    background: #162033;
    color: #e8eef6;
}

html[data-theme="dark"] .modal-modal tr:nth-child(even) {
    background: #1c2c44;
    color: #e8eef6;
}

html[data-theme="dark"] .modal-modal tr:hover,
html[data-theme="dark"] .modal-modal tbody tr:hover,
html[data-theme="dark"] .modal-table tbody tr:hover {
    background: #243652;
    color: #fff;
    box-shadow: none;
}

html[data-theme="dark"] .modal-modal tbody tr:active {
    background: #1a3050;
}

html[data-theme="dark"] .modal-table tbody td,
html[data-theme="dark"] .modal-table .col-code,
html[data-theme="dark"] .modal-table .col-name,
html[data-theme="dark"] .rrv-table tbody td {
    color: #e8eef6;
    border-color: #2a3b52;
}

html[data-theme="dark"] .modal-table tbody tr.selected,
html[data-theme="dark"] .modal-table tbody tr.selected td {
    background: #1a3050;
    color: #fff;
}

html[data-theme="dark"] .acc-table-scroll,
html[data-theme="dark"] .modal-modal-body--table {
    background: #121b2c;
    border-color: #2a3b52;
}

html[data-theme="dark"] .acc-table-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .modal-modal-body::-webkit-scrollbar-track {
    background: #121b2c;
}

html[data-theme="dark"] .acc-table-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .modal-modal-body::-webkit-scrollbar-thumb {
    background: #3a4d66;
}

/* Column titles that stayed on a light bar, or white text on the pale night primary. */
html[data-theme="dark"] thead th {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: #fff;
    border-color: #163a5f;
}

html[data-theme="dark"] .payment-items-table thead th {
    background: linear-gradient(135deg, var(--pay-head-1), var(--pay-head-2));
    color: #fff;
}

html[data-theme="dark"] .rpt-table thead th {
    background: var(--rpt-header-bg) !important;
    color: var(--rpt-header-fg) !important;
}

html[data-theme="dark"] .modal-table thead th,
html[data-theme="dark"] .modal-table thead th.col-code,
html[data-theme="dark"] .rrv-table thead th,
html[data-theme="dark"] .pwd-table thead th,
html[data-theme="dark"] .password-reset-page .pwd-table thead th,
html[data-theme="dark"] #webInvoice .accounting-document-table thead th,
html[data-theme="dark"] #webAccountingDocument .accounting-document-table thead th {
    background: linear-gradient(135deg, #1565c0, #0d47a1) !important;
    color: #fff !important;
    border-bottom-color: #163a5f;
}

html[data-theme="dark"] #webInvoice.has-kind-color .accounting-document-table thead th,
html[data-theme="dark"] .rrv-modal.has-kind-color .rrv-table thead th {
    background: linear-gradient(135deg, var(--kind-color), color-mix(in srgb, var(--kind-color) 75%, #000)) !important;
    color: #fff !important;
}

html[data-theme="dark"] .modal-table tbody td.col-code {
    background: #162033;
}

html[data-theme="dark"] .modal-table tbody tr:nth-child(even) td.col-code {
    background: #1c2c44;
}

html[data-theme="dark"] .modal-table tbody tr:hover td.col-code,
html[data-theme="dark"] .modal-table tbody tr.selected td.col-code {
    background: inherit;
}

html[data-theme="dark"] .modal-btn.btn-cancel,
html[data-theme="dark"] .btn.btn-cancel,
html[data-theme="dark"] .modal-modal-footer .modal-btn-outline.btn-cancel {
    background: #3f1d24;
    color: #fecdd3;
    border-color: #9f1239;
}

html[data-theme="dark"] .modal-btn.btn-cancel:hover:not(:disabled),
html[data-theme="dark"] .btn.btn-cancel:hover:not(:disabled),
html[data-theme="dark"] .modal-modal-footer .modal-btn-outline.btn-cancel:hover:not(:disabled) {
    background: #5c2430;
    color: #fff;
    border-color: #e11d48;
}

/* Report and list button icons follow the button text. */
html[data-theme="dark"] .btn-outline .rpt-action-icon,
html[data-theme="dark"] .btn-outline .rpt-action-icon svg,
html[data-theme="dark"] .btn-outline .btn-icon,
html[data-theme="dark"] .btn-outline .btn-icon svg,
html[data-theme="dark"] .btn-outline .icon-sidebar,
html[data-theme="dark"] .btn-outline .icon-sidebar svg,
html[data-theme="dark"] .account-header__actions .btn-outline .rpt-action-icon,
html[data-theme="dark"] .account-header__actions .btn-outline .rpt-action-icon svg {
    color: #e8eef6 !important;
}

html[data-theme="dark"] .btn-primary .rpt-action-icon,
html[data-theme="dark"] .btn-primary .rpt-action-icon svg,
html[data-theme="dark"] .btn-primary .btn-icon,
html[data-theme="dark"] .btn-primary .btn-icon svg,
html[data-theme="dark"] .btn-primary .icon-sidebar,
html[data-theme="dark"] .btn-primary .icon-sidebar svg {
    color: #fff !important;
}

/* Checkboxes sit on the row color, not a white sticky cell. */
html[data-theme="dark"] .rpl-check-cell input[type="checkbox"],
html[data-theme="dark"] .wad-list-check input[type="checkbox"] {
    background-color: #121b2c;
    border-color: #64748b;
}

html[data-theme="dark"] .rpl-check-cell input[type="checkbox"]:checked,
html[data-theme="dark"] .wad-list-check input[type="checkbox"]:checked {
    background-color: #1d4ed8;
    border-color: #93c5fd;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.2 8.2 6.4 11.4 12.8 4.6'/%3E%3C/svg%3E");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

html[data-theme="dark"] .rpl-table tbody td {
    color: #e8eef6;
}

html[data-theme="dark"] .rpl-table td.rpl-link,
html[data-theme="dark"] .rpl-table td .rpl-link {
    color: #93c5fd;
}

html[data-theme="dark"] .rpl-table td.rpl-bed {
    color: #93c5fd;
}

html[data-theme="dark"] .num-bed {
    color: #86efac;
}

html[data-theme="dark"] .num-bes {
    color: #fca5a5;
}

html[data-theme="dark"] .num-remain {
    color: #93c5fd;
}

html[data-theme="dark"] #tbl-acc .account-status--debtor {
    color: #93c5fd;
}

html[data-theme="dark"] #tbl-acc .account-status--creditor {
    color: #fca5a5;
}

html[data-theme="dark"] .rpl-table td.rpl-bes {
    color: #f9a8d4;
}

html[data-theme="dark"] .rpl-table td.rpl-net,
html[data-theme="dark"] .rpl-summary .summary-value.rpl-net-value {
    color: #fca5a5;
}

html[data-theme="dark"] .rpl-kind-badge {
    color: #fff;
    background: #334155;
}

html[data-theme="dark"] .rpl-kind-badge.is-kind-2 { background: #166534; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-3 { background: #b91c1c; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-4 { background: #1d4ed8; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-5 { background: #6d28d9; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-6 { background: #7e22ce; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-7 { background: #b45309; }
html[data-theme="dark"] .rpl-kind-badge.is-kind-web { background: #115e59; }

html[data-theme="dark"] .rpl-type-label {
    color: #d5deea;
}

html[data-theme="dark"] .rpl-taraz.is-balanced {
    color: #86efac;
    background: rgba(22, 101, 52, .35);
    border-color: rgba(134, 239, 172, .4);
}

html[data-theme="dark"] .rpl-taraz.is-note {
    color: #fcd34d;
    background: rgba(180, 83, 9, .28);
    border-color: rgba(252, 211, 77, .4);
}

/* Vertical and horizontal report/list scrollbars. */
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .rpt-scroll,
html[data-theme="dark"] .tr-table-container,
html[data-theme="dark"] .rv-table-wrap,
html[data-theme="dark"] .accounting-document-list-table-wrap {
    scrollbar-color: #3a4d66 #121b2c;
}

html[data-theme="dark"] .table-container::-webkit-scrollbar-track,
html[data-theme="dark"] .table-wrap::-webkit-scrollbar-track,
html[data-theme="dark"] .rpt-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .tr-table-container::-webkit-scrollbar-track,
html[data-theme="dark"] .rv-table-wrap::-webkit-scrollbar-track,
html[data-theme="dark"] .rpt-table-panel .table-container::-webkit-scrollbar-track,
html[data-theme="dark"] .rpt-table-panel .tr-table-container::-webkit-scrollbar-track,
html[data-theme="dark"] .rpt-table-panel .rpt-scroll::-webkit-scrollbar-track,
html[data-theme="dark"] .accounting-document-list-table-wrap::-webkit-scrollbar-track {
    background: #121b2c;
}

html[data-theme="dark"] .table-container::-webkit-scrollbar-thumb,
html[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rpt-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .tr-table-container::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rv-table-wrap::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rpt-table-panel .table-container::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rpt-table-panel .tr-table-container::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rpt-table-panel .rpt-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .rv-table-wrap.rpt-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .accounting-document-list-table-wrap::-webkit-scrollbar-thumb {
    background: #3a4d66;
    border-radius: 4px;
}

html[data-theme="dark"] .table-container::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .rpt-table-panel .table-container::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .accounting-document-list-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

html[data-theme="dark"] .table-container::-webkit-scrollbar-corner,
html[data-theme="dark"] .rpt-scroll::-webkit-scrollbar-corner,
html[data-theme="dark"] .accounting-document-list-table-wrap::-webkit-scrollbar-corner {
    background: #121b2c;
}

html[data-theme="dark"] .rpt-resize-handle {
    background: linear-gradient(to bottom, #1a2436, #121b2c);
    border-color: #2a3b52;
    color: #94a3b8;
}

html[data-theme="dark"] .rpt-resize-handle::before {
    background: #64748b;
    box-shadow: 0 3px 0 #64748b;
}

html[data-theme="dark"] .rpt-resize-handle:hover,
html[data-theme="dark"] .rpt-resize-handle.is-dragging {
    background: #1c2c44;
}

html[data-theme="dark"] .rrv-modal .accounting-document-meta,
html[data-theme="dark"] .rrv-modal .filter-section {
    background: transparent;
    box-shadow: none;
}

html[data-theme="dark"] .rrv-modal .accounting-document-field .form-control,
html[data-theme="dark"] .rrv-modal .accounting-document-field .form-control[readonly] {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .rrv-modal .accounting-document-status.is-submitted {
    color: #86efac;
    background: rgba(22, 101, 52, .35);
    border-color: rgba(134, 239, 172, .45);
}

html[data-theme="dark"] .rrv-modal .accounting-document-status.is-draft {
    color: #fcd34d;
    background: rgba(180, 83, 9, .28);
    border-color: rgba(252, 211, 77, .45);
}

html[data-theme="dark"] .rrv-modal .invoice-customer-meta {
    background: #1c2c44;
    border-color: #2a3b52;
}

html[data-theme="dark"] .rrv-table tbody tr,
html[data-theme="dark"] .rrv-table tbody tr:nth-child(even) {
    background: #162033;
    color: #e8eef6;
}

html[data-theme="dark"] .rrv-table tbody tr:nth-child(even) {
    background: #1c2c44;
}

html[data-theme="dark"] .rrv-table tbody tr:hover,
html[data-theme="dark"] .rrv-table tbody tr:hover td,
html[data-theme="dark"] .rrv-table tbody tr:active,
html[data-theme="dark"] .rrv-table tbody tr:active td,
html[data-theme="dark"] .rrv-table tbody tr.selected,
html[data-theme="dark"] .rrv-table tbody tr.selected td {
    background: #1e3a5f;
    color: #f8fafc;
    box-shadow: none;
}

html[data-theme="dark"] .rrv-table td {
    background: inherit;
    border-color: #2a3b52;
    color: #e8eef6;
}

html[data-theme="dark"] .rrv-table td.rrv-bed { color: #93c5fd; }
html[data-theme="dark"] .rrv-table td.rrv-bes { color: #f9a8d4; }

html[data-theme="dark"] .rrv-table ::selection,
html[data-theme="dark"] .rrv-modal ::selection {
    background: #1d4ed8;
    color: #fff;
}

/* Settings, password reset, and admin stay on the night palette. */
html[data-theme="dark"] .account-settings-page {
    --as-text: #e8eef6;
    --as-muted: #a8b6c8;
    --as-border: #2a3b52;
    --as-field-bg: #1c2c44;
    background:
        radial-gradient(900px 320px at 100% 0%, rgba(21, 101, 192, .18), transparent 55%),
        linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
}

html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .settings-card--danger,
html[data-theme="dark"] .delete-account-shell {
    background: #162033;
    border-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .settings-card__header {
    border-bottom-color: #2a3b52;
    background: linear-gradient(135deg, #1a3050 0%, #162033 72%);
}

html[data-theme="dark"] .settings-card__header--danger,
html[data-theme="dark"] .delete-account-hero {
    border-bottom-color: #5c2430;
    background: linear-gradient(135deg, #3f1d24 0%, #162033 78%);
}

html[data-theme="dark"] .settings-card__title,
html[data-theme="dark"] .settings-field__label,
html[data-theme="dark"] .settings-check,
html[data-theme="dark"] .password-settings-show,
html[data-theme="dark"] .delete-account-confirm {
    color: #e8eef6;
}

html[data-theme="dark"] .settings-card__lead,
html[data-theme="dark"] .settings-field__hint,
html[data-theme="dark"] .password-settings-hint {
    color: #a8b6c8;
}

html[data-theme="dark"] .settings-field__input,
html[data-theme="dark"] .password-settings-input,
html[data-theme="dark"] .settings-field__input:focus,
html[data-theme="dark"] .password-settings-input:focus,
html[data-theme="dark"] .settings-card--danger .settings-field__input:focus {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .settings-field__input::placeholder,
html[data-theme="dark"] .password-settings-input::placeholder {
    color: #8aa0b8;
}

html[data-theme="dark"] .settings-field__toggle {
    color: #94a3b8;
}

html[data-theme="dark"] .settings-field__toggle:hover {
    color: #dbeafe;
    background: #1a3050;
}

html[data-theme="dark"] .password-rules {
    border-color: #2a3b52;
    background: #121b2c;
}

html[data-theme="dark"] .password-rules__item {
    color: #a8b6c8;
}

html[data-theme="dark"] .password-rules__item::before {
    border-color: #64748b;
    background: #162033;
}

html[data-theme="dark"] .password-rules__item.is-valid {
    color: #86efac;
}

html[data-theme="dark"] .password-rules__item.is-valid::before {
    border-color: #22c55e;
    background:
        radial-gradient(circle at center, #22c55e 0 35%, transparent 36%),
        #162033;
}

html[data-theme="dark"] .password-rules__item.is-invalid {
    color: #fca5a5;
}

html[data-theme="dark"] .account-settings-message.is-error,
html[data-theme="dark"] .admin-message.is-error,
html[data-theme="dark"] .pwd-alert.is-error {
    color: #fecaca;
    background: #3f1d24;
    border-color: #9f1239;
}

html[data-theme="dark"] .account-settings-message.is-success,
html[data-theme="dark"] .admin-message.is-success,
html[data-theme="dark"] .pwd-alert.is-success {
    color: #86efac;
    background: rgba(22, 101, 52, .35);
    border-color: rgba(134, 239, 172, .45);
}

html[data-theme="dark"] .admin-hero,
html[data-theme="dark"] .admin-form,
html[data-theme="dark"] .admin-table-wrap,
html[data-theme="dark"] .admin-nested-users .admin-table-wrap,
html[data-theme="dark"] .admin-module-item {
    background: #162033;
    border-color: #2a3b52;
    color: #e8eef6;
}

html[data-theme="dark"] .admin-hero {
    background: linear-gradient(180deg, #1c2c44, #162033);
}

html[data-theme="dark"] .admin-title,
html[data-theme="dark"] .admin-quota-card h2,
html[data-theme="dark"] .admin-feature-group h3,
html[data-theme="dark"] .admin-form h2 {
    color: #e8eef6;
}

html[data-theme="dark"] .admin-lead,
html[data-theme="dark"] .admin-hint {
    color: #a8b6c8;
}

html[data-theme="dark"] .admin-eyebrow {
    color: #93c5fd;
}

html[data-theme="dark"] .admin-role-badge {
    background: #1a3050;
    color: #dbeafe;
}

html[data-theme="dark"] .admin-tab {
    background: #121b2c;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .admin-tab.is-active {
    background: #1565c0;
    color: #fff;
    border-color: #1565c0;
}

html[data-theme="dark"] .admin-search-input,
html[data-theme="dark"] .admin-combobox-input,
html[data-theme="dark"] .admin-grid input:not([type="checkbox"]):not([type="hidden"]):not([type="radio"]),
html[data-theme="dark"] .admin-grid textarea,
html[data-theme="dark"] .admin-page .page-number-input {
    background: #1c2c44;
    color: #e8eef6;
    border-color: #3a4d66;
}

html[data-theme="dark"] .admin-search-input::placeholder,
html[data-theme="dark"] .admin-combobox-input::placeholder,
html[data-theme="dark"] .admin-grid input:not([type="checkbox"])::placeholder {
    color: #8aa0b8;
}

html[data-theme="dark"] .admin-search-icon {
    color: #94a3b8;
}

html[data-theme="dark"] .admin-combobox-list {
    background: #162033;
    border-color: #3a4d66;
    box-shadow: none;
}

html[data-theme="dark"] .admin-combobox-option,
html[data-theme="dark"] .admin-combobox-empty,
html[data-theme="dark"] .admin-grid label,
html[data-theme="dark"] .admin-toolbar label {
    color: #e8eef6;
}

html[data-theme="dark"] .admin-combobox-option:hover,
html[data-theme="dark"] .admin-combobox-option:focus {
    background: #1a3050;
}

html[data-theme="dark"] .admin-pager {
    background: #121b2c;
    border-color: #2a3b52;
}

html[data-theme="dark"] .admin-table tbody tr:nth-child(odd),
html[data-theme="dark"] .admin-table tbody tr:nth-child(odd) > td {
    background: #162033;
    color: #e8eef6;
}

html[data-theme="dark"] .admin-table tbody tr:nth-child(even),
html[data-theme="dark"] .admin-table tbody tr:nth-child(even) > td {
    background: #1c2c44;
    color: #e8eef6;
}

html[data-theme="dark"] .admin-table th,
html[data-theme="dark"] .admin-table td {
    color: #e8eef6;
    border-bottom-color: #2a3b52;
}

html[data-theme="dark"] .admin-table tbody tr:hover,
html[data-theme="dark"] .admin-table tbody tr:hover > td,
html[data-theme="dark"] .admin-table tbody tr:active,
html[data-theme="dark"] .admin-table tbody tr:active > td {
    background: #243652;
    color: #f8fafc;
    box-shadow: none;
}

html[data-theme="dark"] .admin-quota-card .admin-hint,
html[data-theme="dark"] #adminQuotaForm .admin-hint,
html[data-theme="dark"] #adminGlobalQuotaWarning,
html[data-theme="dark"] #adminQuotaWarning {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
    white-space: pre-wrap;
    color: #e8eef6;
    font-family: 'IRANSans', sans-serif;
}

html[data-theme="dark"] .admin-clients-detail > td {
    background: #121b2c;
}

html[data-theme="dark"] .pwd-hero {
    background: linear-gradient(145deg, #1a3050, #162033);
    border-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .pwd-hero__title {
    color: #e8eef6;
}

html[data-theme="dark"] .pwd-hero__lead {
    color: #a8b6c8;
}

html[data-theme="dark"] .pwd-hero__eyebrow,
html[data-theme="dark"] .pwd-filter__label {
    color: #93c5fd;
}

html[data-theme="dark"] .pwd-panel {
    background: #162033;
    border-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .pwd-toolbar {
    background: #1c2c44;
    border-bottom-color: #2a3b52;
}

html[data-theme="dark"] .pwd-chips {
    background: #121b2c;
    border-color: #3a4d66;
}

html[data-theme="dark"] .pwd-chip {
    color: #dbeafe;
}

html[data-theme="dark"] .pwd-chip:hover {
    color: #fff;
    background: #1a3050;
}

html[data-theme="dark"] .pwd-chip.is-active {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: #fff;
}

html[data-theme="dark"] .password-reset-page .pwd-table tbody td,
html[data-theme="dark"] .pwd-table tbody td,
html[data-theme="dark"] .pwd-table tbody tr:nth-child(even) td,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:hover,
html[data-theme="dark"] .pwd-table tbody tr:hover,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:hover td,
html[data-theme="dark"] .pwd-table tbody tr:hover td,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:nth-child(even):hover,
html[data-theme="dark"] .pwd-table tbody tr:nth-child(even):hover,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:nth-child(even):hover td,
html[data-theme="dark"] .pwd-table tbody tr:nth-child(even):hover td {
    background: #162033;
    color: #e8eef6;
    border-bottom-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .pwd-table tbody tr:nth-child(even) td,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:nth-child(even) td {
    background: #1c2c44;
}

html[data-theme="dark"] .pwd-table tbody tr:hover td,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:hover td,
html[data-theme="dark"] .pwd-table tbody tr:nth-child(even):hover td,
html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:nth-child(even):hover td {
    background: #243652;
}

html[data-theme="dark"] .pwd-table .pwd-user strong {
    color: #e8eef6;
}

html[data-theme="dark"] .pwd-table .pwd-user span,
html[data-theme="dark"] .pwd-table .pwd-username,
html[data-theme="dark"] .pwd-actions__none,
html[data-theme="dark"] .pwd-empty {
    color: #a8b6c8;
}

html[data-theme="dark"] .pwd-empty__icon {
    background: #1a3050;
    color: #dbeafe;
    border-color: #2a3b52;
    box-shadow: none;
}

html[data-theme="dark"] .pwd-status--pending {
    color: #fdba74;
    background: rgba(180, 83, 9, .28);
    border-color: rgba(253, 186, 116, .45);
}

html[data-theme="dark"] .pwd-status--completed {
    color: #86efac;
    background: rgba(22, 101, 52, .35);
    border-color: rgba(134, 239, 172, .45);
}

html[data-theme="dark"] .pwd-status--rejected {
    color: #fca5a5;
    background: rgba(153, 27, 27, .35);
    border-color: rgba(252, 165, 165, .45);
}

html[data-theme="dark"] .pwd-status--default {
    color: #cbd5e1;
    background: #1c2c44;
    border-color: #3a4d66;
}

html[data-theme="dark"] .pwd-result {
    background: #123024;
    border-color: #166534;
    box-shadow: none;
}

html[data-theme="dark"] .pwd-result__title {
    color: #86efac;
}

html[data-theme="dark"] .pwd-result__hint {
    color: #bbf7d0;
}

html[data-theme="dark"] .pwd-result__password {
    background: #0f2419;
    color: #dcfce7;
    border-color: #22c55e;
}

html[data-theme="dark"] .pwd-result__close {
    color: #a8b6c8;
}

html[data-theme="dark"] .pwd-result__close:hover {
    background: #1c2c44;
    color: #fff;
}

@media (max-width: 768px) {
    html[data-theme="dark"] .password-reset-page .pwd-table tbody tr,
    html[data-theme="dark"] .pwd-table tbody tr,
    html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:nth-child(even),
    html[data-theme="dark"] .pwd-table tbody tr:nth-child(even),
    html[data-theme="dark"] .password-reset-page .pwd-table tbody tr:hover,
    html[data-theme="dark"] .pwd-table tbody tr:hover {
        background: #162033;
        border-color: #2a3b52;
        box-shadow: none;
    }

    html[data-theme="dark"] .password-reset-page .pwd-table tbody td,
    html[data-theme="dark"] .pwd-table tbody td {
        background: transparent !important;
        color: #e8eef6;
    }
}
