:root {
    /* Design-system.md tokens */
    --ui-primary: #134239;
    --ui-primary-700: #0b2822;
    --ui-bg: #ffffff;
    --ui-surface: #ffffff;
    --ui-soft-surface: #f8f9fa;
    --ui-border: #dee2e6;
    --ui-text: #212529;
    --ui-muted: #6c757d;

    /* Bootstrap theme variables overrides */
    --bs-primary: #134239;
    --bs-primary-rgb: 19, 66, 57;
    --bs-primary-bg-subtle: #e8f3f1;
    --bs-primary-border-subtle: #b6d5ce;
    --bs-link-color: #134239;
    --bs-link-hover-color: #0b2822;

    /* Core Utility sizing tokens */
    --ui-h1: 1.5rem;
    /* 24px */
    --ui-h2: 1.25rem;
    /* 20px */
    --ui-h3: 1.125rem;
    /* 18px */
    --ui-body: 0.875rem;
    /* 14px */
    --ui-label: 0.75rem;
    /* 12px */

    --ui-control-h: 48px;
    --ui-radius-card: 12px;
    --ui-radius-card-sm: 8px;
    --ui-radius-control: 8px;

    --ui-section-gap: 24px;
    --ui-gap-12: 12px;
    --ui-gap-8: 8px;
    --ui-card-pad: 16px;
    --ui-card-pad-lg: 20px;
    --ui-page-pad-x: 16px;
}

/* Bootstrap Button class overrides to match the #134239 theme */
.btn-primary {
    --bs-btn-bg: #134239 !important;
    --bs-btn-border-color: #134239 !important;
    --bs-btn-hover-bg: #0b2822 !important;
    --bs-btn-hover-border-color: #0b2822 !important;
    --bs-btn-active-bg: #0b2822 !important;
    --bs-btn-active-border-color: #0b2822 !important;
    --bs-btn-disabled-bg: #134239 !important;
    --bs-btn-disabled-border-color: #134239 !important;
}

.btn-outline-primary {
    --bs-btn-color: #134239 !important;
    --bs-btn-border-color: #134239 !important;
    --bs-btn-hover-bg: #134239 !important;
    --bs-btn-hover-border-color: #134239 !important;
    --bs-btn-active-bg: #134239 !important;
    --bs-btn-active-border-color: #134239 !important;
}

/* Generic Link Theme Styling */
a:not(.ui-sidebar-link):not(.ui-bottom-nav-link):not(.ui-sidebar-footer-link):not(.btn),
.text-primary:not(.btn) {
    color: #134239 !important;
}

a:not(.ui-sidebar-link):not(.ui-bottom-nav-link):not(.ui-sidebar-footer-link):not(.btn):hover,
.text-primary:not(.btn):hover {
    color: #0b2822 !important;
}

.ui-notification-item {
    color: #334155;
}


/* Mobile optimization */
@media (max-width: 991.98px) {
    :root {
        --ui-card-pad: 12px;
        --ui-section-gap: 16px;
        --ui-gap-12: 12px;
        --ui-gap-8: 8px;
    }

    body {
        overflow-x: hidden;
    }

    .ui-app-shell,
    .ui-app-main,
    .ui-content,
    .ui-card,
    .ui-card-pad,
    .ui-page-header,
    .ui-page-header-actions {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .ui-statement-range-wrap {
        overflow: visible;
    }

    .ui-statement-range-btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
        white-space: normal;
        line-height: 1.15;
        text-align: center;
    }

    .btn,
    .ui-btn,
    .ui-btn-sm,
    .ui-btn-icon {
        max-width: 100%;
        white-space: normal;
    }

    .ui-page-header-actions {
        flex-wrap: wrap !important;
    }

    .ui-gap-8.flex-nowrap,
    .ui-gap-12.flex-nowrap,
    .d-inline-flex.flex-nowrap {
        flex-wrap: nowrap !important;
    }

    .ui-page-header-actions>*,
    .ui-gap-8.flex-nowrap>*,
    .ui-gap-12.flex-nowrap>* {
        min-width: 0;
    }

    /* Stretch all action buttons to full width on mobile */
    .ui-page-header-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .ui-page-header-actions>* {
        width: 100% !important;
        text-align: center;
    }

    /* Customer profile: Add Deposit / Create Invoice row */
    .row.g-2.ui-mb-section>[class*="col-"]>.btn.w-100 {
        font-size: 0.9rem;
    }

    /* Card action button rows (Edit / Deactivate / Delete inside card) */
    .d-flex.gap-2.flex-wrap>.btn,
    .d-flex.gap-2.flex-wrap>form {
        width: 100% !important;
    }

    .d-flex.gap-2.flex-wrap>form>.btn {
        width: 100% !important;
    }

    /* Keep customer profile Edit, Deactivate, and Delete on one single row and make them small */
    .ui-customer-profile-actions {
        flex-wrap: nowrap !important;
    }

    .ui-customer-profile-actions>.btn,
    .ui-customer-profile-actions>form {
        width: auto !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
    }

    .ui-customer-profile-actions .btn {
        width: 100% !important;
        padding: 6px 2px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px;
        text-align: center !important;
    }

    .ui-customer-profile-actions .btn i {
        margin-right: 0 !important;
        flex-shrink: 0;
    }

    /* Deposit/invoice show page action buttons */
    .d-flex.justify-content-end.ui-gap-12.flex-wrap>.btn {
        width: 100% !important;
    }

    /* Mobile-optimized Invoice/Bill Itemized Form Rows */
    .table-responsive:has(tbody[data-ui-invoice-body]) {
        overflow: visible !important;
    }

    table:has(tbody[data-ui-invoice-body]) {
        border: none !important;
        background: transparent !important;
    }

    table:has(tbody[data-ui-invoice-body]) thead {
        display: none !important;
    }

    tbody[data-ui-invoice-body] {
        display: block !important;
        width: 100% !important;
    }

    .ui-invoice-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-gap: 12px 8px !important;
        padding: 16px 0 !important;
        border-bottom: 1px solid var(--ui-border) !important;
        border-top: none !important;
        background: transparent !important;
    }

    .ui-invoice-row>td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        height: auto !important;
    }

    /* Product dropdown: row 1, spans cols 1 & 2 (left side) */
    .ui-invoice-row>td:nth-child(1) {
        grid-row: 1 !important;
        grid-column: 1 / span 2 !important;
    }

    /* Remove/Delete button: row 1, col 3 (right side) */
    .ui-invoice-row>td:nth-child(5) {
        grid-row: 1 !important;
        grid-column: 3 !important;
        display: flex !important;
        justify-content: flex-end !important;
        align-items: flex-end !important;
    }

    .ui-invoice-row>td:nth-child(5) .btn,
    .ui-invoice-row>td:nth-child(5) button {
        width: 48px !important;
        height: 48px !important;
        min-height: 48px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid var(--ui-border) !important;
        background-color: transparent !important;
        color: var(--ui-text) !important;
    }

    /* Quantity: row 2, col 1 */
    .ui-invoice-row>td:nth-child(2) {
        grid-row: 2 !important;
        grid-column: 1 !important;
    }

    .ui-invoice-row>td:nth-child(2) input {
        text-align: start !important;
    }

    /* Rate: row 2, col 2 */
    .ui-invoice-row>td:nth-child(3) {
        grid-row: 2 !important;
        grid-column: 2 !important;
    }

    .ui-invoice-row>td:nth-child(3) input {
        text-align: start !important;
    }

    /* Line Total: row 2, col 3 */
    .ui-invoice-row>td:nth-child(4) {
        grid-row: 2 !important;
        grid-column: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }

    .ui-invoice-row>td:nth-child(4) .ui-label {
        display: none !important;
    }

    .ui-invoice-row>td:nth-child(4) .ui-invoice-line-value {
        height: 48px !important;
        border-radius: 8px !important;
        background-color: var(--ui-soft-surface) !important;
        border: 1px solid var(--ui-border) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 600 !important;
        color: var(--ui-muted) !important;
    }

    /* Full-width Add Item Button */
    button[data-ui-invoice-add-row] {
        width: 100% !important;
    }

}

body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: var(--ui-body);
    color: var(--ui-text);
    background: var(--ui-bg);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

.ui-card {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-card);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    position: relative;
}

.ui-icon-btn {
    width: var(--ui-control-h);
    height: var(--ui-control-h);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ui-radius-control);
    border: 1px solid transparent;
    color: var(--ui-text);
}

.ui-icon-btn:hover {
    background: rgba(15, 23, 42, 0.04);
}

/* Common UI */
.ui-btn {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
    padding: 12px 24px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ui-btn-sm {
    min-height: 28px;
    height: 28px;
    border-radius: var(--ui-radius-card-sm);
    padding: 0 12px;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ui-btn-icon {
    width: var(--ui-control-h);
    height: var(--ui-control-h);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ui-radius-control);
}

.ui-form-control {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
}

.ui-file-input {
    padding: 0;
    min-height: var(--ui-control-h);
    line-height: var(--ui-control-h);
    overflow: hidden;
}

.ui-file-input::file-selector-button {
    height: 100%;
    margin: 0 0.75rem 0 0;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--ui-primary);
    color: #ffffff;
    font-weight: 700;
    border-top-left-radius: var(--ui-radius-control);
    border-bottom-left-radius: var(--ui-radius-control);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.ui-file-input::-webkit-file-upload-button {
    height: 100%;
    margin: 0 0.75rem 0 0;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--ui-primary);
    color: #ffffff;
    font-weight: 700;
    border-top-left-radius: var(--ui-radius-control);
    border-bottom-left-radius: var(--ui-radius-control);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.ui-file-input::file-selector-button:hover,
.ui-file-input::-webkit-file-upload-button:hover,
.ui-file-input:hover::file-selector-button,
.ui-file-input:hover::-webkit-file-upload-button {
    background: #ffffff !important;
    color: #000000 !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.ui-card-pad {
    padding: var(--ui-card-pad);
}

@media (min-width: 992px) {
    .ui-card-pad-lg {
        padding: var(--ui-card-pad-lg);
    }
}

.ui-section {
    margin-bottom: var(--ui-section-gap);
}

.ui-gap-8 {
    gap: var(--ui-gap-8) !important;
}

.ui-gap-12 {
    gap: var(--ui-gap-12) !important;
}

.ui-mb-section {
    margin-bottom: var(--ui-section-gap) !important;
}

.ui-mb-12 {
    margin-bottom: var(--ui-gap-12) !important;
}

.ui-mt-12 {
    margin-top: var(--ui-gap-12) !important;
}

.ui-gutter-12 {
    --bs-gutter-x: 12px;
    --bs-gutter-y: 12px;
}

.ui-gutter-8 {
    --bs-gutter-x: 8px;
    --bs-gutter-y: 8px;
}

.ui-mini-search {
    position: relative;
    width: 260px;
    max-width: 52vw;
}

.ui-mini-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.ui-mini-search .form-control {
    padding-left: 30px;
    border-radius: var(--ui-radius-control);
    background: var(--ui-soft-surface);
    border-color: var(--ui-border);
    min-height: var(--ui-control-h);
}

/* Mobile responsive toggleable search bar styles */
@media (max-width: 991.98px) {
    .ui-mini-search:not(.ui-search-mobile-expanded),
    .ui-mini-search.ui-search-mobile-collapsed {
        width: var(--ui-control-h, 36px) !important;
        height: var(--ui-control-h, 36px) !important;
        max-width: var(--ui-control-h, 36px) !important;
        border-radius: var(--ui-radius-control, 6px) !important;
        background: var(--ui-soft-surface) !important;
        border: 1px solid var(--ui-border) !important;
        overflow: hidden;
        cursor: pointer;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease-in-out;
    }

    .ui-mini-search:not(.ui-search-mobile-expanded) i,
    .ui-mini-search.ui-search-mobile-collapsed i {
        position: static !important;
        transform: none !important;
        font-size: 1.1rem;
        cursor: pointer;
        pointer-events: auto;
        color: #94a3b8;
    }

    .ui-mini-search:not(.ui-search-mobile-expanded) .form-control,
    .ui-mini-search.ui-search-mobile-collapsed .form-control {
        display: none !important;
    }

    .ui-mini-search.ui-search-mobile-expanded {
        width: 100% !important;
        max-width: 100% !important;
        transition: all 0.2s ease-in-out;
        display: flex !important;
        align-items: center;
    }

    .ui-mini-search.ui-search-mobile-expanded i {
        left: 12px !important;
        font-size: 1.2rem;
        color: var(--bs-primary, #0d6efd) !important;
        cursor: pointer;
        z-index: 10;
        padding: 4px;
    }

    .ui-mini-search.ui-search-mobile-expanded .form-control {
        display: block !important;
        width: 100% !important;
        padding-left: 36px !important;
        padding-right: 12px !important;
        border-radius: var(--ui-radius-control) !important;
        background: var(--ui-soft-surface) !important;
        border: 1px solid var(--ui-border) !important;
    }

    /* Hide search input placeholder text on mobile as per user's request (without help text) */
    .ui-mini-search.ui-search-mobile-expanded .form-control::placeholder {
        color: transparent !important;
    }

    /* When mobile search is active, hide the title/helper block */
    .ui-search-active .ui-h3,
    .ui-search-active>div:first-child:not(.ui-mini-search) {
        display: none !important;
    }

    /* When transactions search is active, hide other filter columns */
    .ui-search-active>div:not(:has(.ui-mini-search)) {
        display: none !important;
    }

    /* Dark mode styling for toggleable mobile search */
    [data-theme="dark"] .ui-mini-search:not(.ui-search-mobile-expanded),
    [data-theme="dark"] .ui-mini-search.ui-search-mobile-collapsed {
        border-color: #ffffff !important;
    }

    [data-theme="dark"] .ui-mini-search:not(.ui-search-mobile-expanded) i,
    [data-theme="dark"] .ui-mini-search.ui-search-mobile-collapsed i {
        color: #ffffff !important;
    }

    [data-theme="dark"] .ui-mini-search.ui-search-mobile-expanded i {
        color: #ffffff !important;
    }

    [data-theme="dark"] .ui-mini-search.ui-search-mobile-expanded .form-control {
        border-color: #ffffff !important;
    }

    /* Date input styling */
    input[type="date"],
    input[type="date"].ui-form-control,
    input[type="date"].form-control {
        cursor: pointer !important;
        text-align: left !important;
        min-height: var(--ui-control-h, 36px) !important;
    }

    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none !important;
        -webkit-appearance: none !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        pointer-events: none !important;
    }

    input[type="date"].ui-form-control::-webkit-date-and-time-value {
        text-align: left !important;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 1.5em !important;
        line-height: normal !important;
    }
}

.ui-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--ui-gap-12);
    margin-bottom: var(--ui-section-gap);
}

.ui-page-title {
    font-weight: 700;
    font-size: var(--ui-h1);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.ui-page-subtitle {
    margin-top: 4px;
    color: var(--ui-muted);
    font-weight: 500;
    font-size: var(--ui-body);
}

.ui-doc-hero {
    padding: 20px;
    border-radius: 20px;
    background:
        radial-gradient(circle at top right, rgba(17, 66, 34, 0.14), transparent 38%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.03), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(17, 66, 34, 0.12);
}

.ui-doc-panel {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.ui-doc-search {
    width: min(100%, 320px);
}

.ui-doc-stat {
    min-height: 92px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.ui-doc-stat-label {
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.ui-doc-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ui-doc-feature {
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(17, 66, 34, 0.08), rgba(17, 66, 34, 0.02));
    border: 1px solid rgba(17, 66, 34, 0.12);
}

.ui-doc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(17, 66, 34, 0.12);
    color: var(--ui-primary);
    font-size: 11px;
    font-weight: 800;
}

.ui-doc-item {
    padding: 14px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.ui-doc-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.ui-doc-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ui-doc-icon {
    width: 35px;
    height: 35px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 66, 34, 0.12);
    color: var(--ui-primary);
    flex-shrink: 0;
    font-size: 1.1rem;
}

.ui-doc-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 700;
}

.ui-page-header-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ui-tabs-pills .nav-link {
    border-radius: var(--ui-radius-control);
    min-height: var(--ui-control-h);
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--ui-muted);
    background: rgba(148, 163, 184, 0.14);
    font-size: var(--ui-body);
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.ui-tabs-pills .nav-link.active {
    background: rgba(19, 66, 57, 0.12);
    color: var(--ui-primary);
    border-color: rgba(19, 66, 57, 0.26);
}

.ui-customer-tabs {
    margin-top: 6px;
}

.ui-tabs-pills {
    gap: 8px;
}

.ui-customer-sidekick {
    --bs-offcanvas-width: min(420px, 100vw);
    top: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    background:
        radial-gradient(circle at top right, rgba(148, 163, 184, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 1));
    z-index: 2000;
}

.ui-customer-sidekick-header {
    align-items: flex-start;
    padding: 24px 24px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.ui-customer-sidekick-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 4px;
}

.ui-customer-sidekick-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    height: calc(100vh - 88px);
}

.ui-customer-sidekick-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ui-customer-sidekick-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ui-text);
}

.ui-customer-sidekick-label i {
    font-size: 15px;
    color: #64748b;
}

.ui-sidekick-choice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.ui-sidekick-choice-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ui-sidekick-choice,
.ui-sidekick-row-choice,
.ui-sidekick-tag {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ui-text);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

.ui-sidekick-choice {
    min-height: 82px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.ui-sidekick-choice i {
    font-size: 18px;
}

.ui-sidekick-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-sidekick-row-choice {
    min-height: 58px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
}

.ui-sidekick-row-main {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ui-sidekick-row-main i {
    font-size: 16px;
    color: #64748b;
}

.ui-sidekick-tag {
    min-height: 40px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 999px;
}

.btn-check:checked + .ui-sidekick-choice,
.btn-check:checked + .ui-sidekick-row-choice,
.btn-check:checked + .ui-sidekick-tag {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(71, 85, 105, 0.36);
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.ui-sidekick-choice:hover,
.ui-sidekick-row-choice:hover,
.ui-sidekick-tag:hover {
    transform: translateY(-1px);
    border-color: rgba(100, 116, 139, 0.35);
}

.ui-customer-sidekick-footer {
    display: flex;
    gap: 12px;
    padding-top: 18px;
    padding-bottom: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.98) 24%);
    backdrop-filter: blur(10px);
}

@media (max-width: 991.98px) {
    .ui-customer-sidekick {
        --bs-offcanvas-width: 100vw;
        inset: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100svh !important;
        border-left: 0 !important;
        border-radius: 0 !important;
    }

    body:has(.ui-customer-sidekick.show) .ui-mobile-bottom-nav {
        display: none !important;
    }

    .ui-mobile-profile-card {
        background: linear-gradient(135deg, rgba(19, 66, 57, 0.05), rgba(255, 255, 255, 0.9)) !important;
        border-color: rgba(19, 66, 57, 0.08) !important;
    }

    [data-theme="dark"] .ui-mobile-profile-card {
        background: linear-gradient(135deg, rgba(19, 66, 57, 0.15), #1c1c1e 60%) !important;
        border-color: #2c2c2e !important;
    }

    .ui-customer-sidekick-header {
        padding: 20px 18px 14px;
    }

    .ui-customer-sidekick-body {
        padding: 16px 18px 18px;
        height: auto !important;
    }

    .ui-sidekick-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ui-tabs-pills .nav-item {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .ui-tabs-pills .nav-link {
        width: 100%;
    }
}

.ui-metric {
    padding: 10px 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-control);
    background: var(--ui-soft-surface);
}

.ui-metric-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.ui-metric-value {
    margin-top: 6px;
    font-weight: 900;
    font-size: var(--ui-h3);
}

.ui-click-row {
    cursor: pointer;
}

/* Typography helpers */
.ui-h1 {
    font-size: var(--ui-h1);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.ui-h2 {
    font-size: var(--ui-h2);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.ui-h3 {
    font-size: var(--ui-h3);
    font-weight: 600;
    line-height: 1.35;
}

.ui-label {
    font-size: var(--ui-label);
    font-weight: 500;
    color: var(--ui-muted);
}

.ui-money {
    font-size: var(--ui-h2);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ui-body-text {
    font-size: var(--ui-body);
    font-weight: 500;
    color: var(--ui-muted);
}

.ui-body-strong {
    font-size: var(--ui-body);
    font-weight: 600;
}

.ui-app-page .form-label {
    font-size: var(--ui-label);
    font-weight: 500;
    color: var(--ui-text);
    margin-bottom: 8px;
}

.ui-app-page .form-check-label {
    font-size: var(--ui-label);
    font-weight: 500;
}

.ui-app-page .form-control:not(.ui-topbar-search-input):not(.ui-input),
.ui-app-page .form-select {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
}

/* Auth */
.ui-auth-page {
    background: radial-gradient(circle at 85% 15%, rgba(17, 66, 34, 0.08), transparent 40%),
        radial-gradient(circle at 15% 85%, rgba(17, 66, 34, 0.06), transparent 45%),
        #ffffff;
    min-height: 100vh;
}

.ui-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 20px 0;
}

.ui-auth-card {
    background: var(--ui-soft-surface);
    border: 2px solid rgba(117, 124, 170, 0.35);
    border-radius: var(--ui-radius-card);
    padding: var(--ui-card-pad);
}

@media (min-width: 992px) {
    .ui-auth-card {
        padding: var(--ui-card-pad-lg);
    }
}

@media (max-width: 991.98px) {
    .ui-auth-mobile-logo {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

.ui-auth-brand {
    text-align: center;
    margin-bottom: 16px;
}

.ui-auth-brand .ui-auth-brand-title {
    font-weight: 700;
    font-size: var(--ui-h1);
    letter-spacing: -0.02em;
    margin: 0;
}

.ui-auth-brand .ui-auth-brand-subtitle {
    color: var(--ui-muted);
    font-weight: 600;
    font-size: var(--ui-h3);
    margin: 6px 0 0;
}

.ui-auth-field-label {
    font-weight: 500;
    color: var(--ui-text);
    margin-bottom: 8px;
    font-size: var(--ui-label);
}

.ui-input {
    height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
    border: 1px solid var(--ui-border);
}

.ui-input:focus {
    border-color: rgba(17, 66, 34, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(17, 66, 34, 0.15);
}

.ui-input-with-icons {
    position: relative;
}

.ui-input-with-icons .ui-input-icon-left,
.ui-input-with-icons .ui-input-icon-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 3;
}

.ui-input-with-icons .ui-input-icon-left {
    left: 16px;
    font-size: 20px;
}

.ui-input-with-icons .ui-input-icon-right {
    right: 14px;
    font-size: 20px;
}

.ui-input-with-icons input {
    padding-left: 48px;
    padding-right: 48px;
}

.ui-input-with-icons.ui-only-right input {
    padding-left: 16px;
}

.ui-eye-btn {
    border: 0;
    background: transparent;
    padding: 6px;
    line-height: 1;
}

.ui-primary-btn {
    background: var(--ui-primary);
    border: 0;
    border-radius: var(--ui-radius-control);
    height: var(--ui-control-h);
    font-weight: 700;
    font-size: 1rem;
}

.ui-primary-btn:hover {
    background: var(--ui-primary-700);
}

.ui-auth-footer-row {
    color: var(--ui-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: var(--ui-label);
    padding: 18px 0 4px;
}

.ui-auth-footer-row .ui-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #a16207;
    display: inline-block;
    margin-right: 10px;
}

.ui-auth-shields i {
    font-size: 24px;
}

/* App Shell */
.ui-app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--ui-bg);
    min-width: 100%;
    width: 100%;
    max-width: 100%;
}

.ui-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid var(--ui-border);
}

.ui-sidebar-inner {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    position: sticky;
    top: 0;
}

.ui-sidebar-brand {
    padding: 6px 12px 22px;
}

.ui-brand-title {
    font-weight: 700;
    font-size: var(--ui-h1);
    letter-spacing: -0.02em;
}

.ui-brand-sub {
    font-weight: 600;
    color: var(--ui-muted);
    margin-top: 4px;
}

.ui-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--ui-gap-8);
    padding: 8px 6px;
}

.ui-sidebar-link {
    position: relative;
    display: flex;
    gap: var(--ui-gap-12);
    align-items: center;
    min-height: var(--ui-control-h);
    padding: 0 14px;
    border-radius: var(--ui-radius-control);
    color: var(--ui-text);
    font-weight: 600;
}

.ui-sidebar-icon {
    font-size: 20px;
    width: 28px;
    display: inline-flex;
    justify-content: center;
    color: var(--ui-muted);
}

.ui-sidebar-link.is-active {
    background: rgba(19, 66, 57, 0.06);
    color: var(--ui-primary);
}

.ui-sidebar-link.is-active .ui-sidebar-icon {
    color: var(--ui-primary);
}

.ui-sidebar-link.is-active::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 8px;
    bottom: 8px;
    width: 6px;
    border-radius: 8px;
    background: var(--ui-primary);
}

.ui-sidebar-footer {
    margin-top: auto;
    padding: 16px 10px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ui-sidebar-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ui-text);
    font-weight: 600;
    min-height: var(--ui-control-h);
    padding: 0 8px;
    border-radius: var(--ui-radius-control);
}

.ui-sidebar-footer-link i {
    font-size: 22px;
}

.ui-app-main {
    flex: 1 1 0%;
    min-width: 0;
    width: auto;
    max-width: 100%;
    overflow: visible;
}

.ui-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--ui-border);
}

.ui-topbar-inner {
    height: 60px;
    padding: 8px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex: 1 1 auto;
}

.ui-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}

.ui-topbar-search {
    flex: 0 0 auto;
    width: clamp(180px, 22vw, 260px);
    max-width: 52vw;
    position: relative;
}

.ui-topbar-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 20px;
}

.ui-topbar-search-input {
    height: var(--ui-control-h);
    padding-left: 48px;
    border-radius: var(--ui-radius-control);
    border: 1px solid var(--ui-border);
    background: var(--ui-soft-surface);
}

.ui-topbar-search-input:focus {
    background: #ffffff;
}

.ui-topbar-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.ui-topbar-account-text {
    min-width: 0;
}

@media (max-width: 1199.98px) {
    .ui-topbar-account-text {
        display: none;
    }
}

/* Desktop fixed header: respect sidebar width */
@media (min-width: 992px) {
    .ui-topbar {
        position: fixed;
        top: 0;
        left: 280px;
        /* matches .ui-sidebar width */
        right: 0;
        z-index: 1030;
    }
}

.ui-notification-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #ef4444;
    top: 8px;
    right: 10px;
    border: 2px solid #ffffff;
}

.ui-topbar-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ui-topbar-account-name {
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    font-size: var(--ui-body);
}

.ui-topbar-account-tier {
    color: var(--ui-muted);
    font-weight: 600;
    text-align: right;
    margin-top: 2px;
    font-size: var(--ui-label);
}

.ui-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.ui-content {
    padding: var(--ui-card-pad);
    min-width: 100%;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

@media (min-width: 992px) {
    .ui-content {
        padding: var(--ui-card-pad-lg);
        padding-top: calc(var(--ui-card-pad-lg) + 60px);
    }
}

/* Mobile header + bottom nav */
.ui-mobile-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #ffffff;
    border-bottom: 1px solid var(--ui-border);
}

.ui-mobile-header-inner {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ui-mobile-header-search {
    flex: 1 1 auto;
    min-width: 0;
}

.ui-mobile-search-wrap {
    position: relative;
    width: 100%;
}

.ui-mobile-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ui-muted);
}

.ui-mobile-search-input {
    padding-left: 44px;
}

.ui-mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ui-app-mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ui-app-mobile-brand-icon {
    color: var(--ui-primary);
    font-size: 28px;
    line-height: 1;
}

.ui-app-mobile-brand-text {
    font-weight: 700;
    font-size: var(--ui-h2);
    color: var(--ui-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-mobile-brand-icon {
    width: 44px;
    height: 44px;
    background: var(--ui-primary);
    border-radius: 10px;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.ui-mobile-brand-text {
    font-weight: 700;
    font-size: var(--ui-h2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-mobile-header-actions {
    display: inline-flex;
    gap: 8px;
}

.ui-mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: #ffffff;
    border-top: 1px solid var(--ui-border);
}

.ui-bottom-nav-inner {
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 8px 12px;
}

.ui-bottom-nav-link {
    color: var(--ui-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 84px;
    font-weight: 700;
}

.ui-bottom-nav-icon {
    font-size: 24px;
    line-height: 1;
}

.ui-bottom-nav-label {
    font-size: var(--ui-label);
    line-height: 1;
}

.ui-bottom-nav-link.is-active {
    color: var(--ui-primary);
}

@media (max-width: 991.98px) {
    .ui-content {
        padding: 12px var(--ui-page-pad-x) 96px;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    /* Mobile dashboard: allow recent customer details to wrap */
    .ui-mobile-recent-customer {
        white-space: normal;
    }

    .ui-mobile-recent-customer a {
        word-break: break-word;
    }

}

/* Dashboard specifics */
.ui-kpi-card {
    padding: 13px;
    border-radius: var(--ui-radius-card-sm);
}

.ui-kpi-title {
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    font-size: var(--ui-label);
}

.ui-kpi-value {
    font-weight: 700;
    margin-top: 8px;
    font-size: var(--ui-h2);
}

.ui-kpi-note {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: var(--ui-label);
    color: #64748b;
}

.ui-kpi-note.ui-note-success {
    color: #16a34a;
}

.ui-kpi-note.ui-note-danger {
    color: #dc2626;
}

.ui-kpi-note.ui-note-warning {
    color: #b45309;
}

.ui-kpi-note.ui-note-primary {
    color: var(--ui-primary);
}

.ui-tone-primary .ui-kpi-value {
    color: var(--ui-primary);
}

.ui-tone-danger .ui-kpi-value {
    color: #dc2626;
}

.ui-tone-success .ui-kpi-value {
    color: #16a34a;
}

.ui-tone-warning .ui-kpi-value {
    color: #b45309;
}

.ui-fab {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: var(--ui-control-h);
    height: var(--ui-control-h);
    background: var(--ui-primary);
    border-radius: var(--ui-radius-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(17, 66, 34, 0.25);
}

.ui-fab i {
    font-size: 24px;
}

.ui-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: rgba(15, 23, 42, 0.02);
    margin: 0;
}

.ui-table thead th {
    border-bottom: 1px solid var(--ui-border);
    font-weight: 700;
    color: var(--ui-text);
    font-size: 14px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.ui-table tbody tr {
    border-top: 1px solid var(--ui-border);
}

.ui-table tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.ui-table th,
.ui-table td {
    white-space: nowrap;
}

.ui-table td {
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Ensure columns auto-expand to fit text without clipping when using a scroll container */
.table-responsive .ui-table td,
.table-responsive .ui-table th {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
}

.ui-text-wrap,
.ui-table td.ui-text-wrap,
.ui-table th.ui-text-wrap {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
    word-break: break-word !important;
}

.ui-dashboard-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.ui-dashboard-table-scroll>.ui-table {
    min-width: 920px;
}

.ui-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: var(--ui-label);
    font-weight: 600;
    line-height: 1;
}

/* Compact due pill for customer list */
.ui-due-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.ui-due-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.ui-customer-actions {
    width: fit-content;
    max-width: 100%;
}

.ui-customer-actions-toggle {
    min-width: 96px;
}

.ui-customer-actions-menu {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        max-height 180ms ease-out,
        opacity 180ms ease-out,
        transform 180ms ease-out;
    pointer-events: none;
}

.ui-customer-actions[data-ui-open="true"] .ui-customer-actions-menu {
    max-height: 180px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ui-customer-actions-menu .btn {
    min-height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ui-customer-actions-menu .d-flex {
    align-items: center;
}

@media (min-width: 992px) {
    .ui-customer-actions {
        display: inline-flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .ui-customer-actions-menu {
        position: static;
        z-index: auto;
        min-width: 96px;
        width: max-content;
    }

    .ui-customer-actions[data-ui-open="true"] .ui-customer-actions-menu {
        max-height: 180px;
    }
}

@media (max-width: 991.98px) {
    .ui-customer-actions-toggle {
        min-width: 72px;
        padding-inline: 10px;
        font-size: 10px;
        height: 20px;
    }

    .ui-customer-actions-menu {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .ui-customer-actions-menu::-webkit-scrollbar {
        display: none;
    }

    .ui-customer-actions-menu .btn {
        min-height: 34px;
        padding: 0 14px;
        font-size: 12px;
        flex: 0 0 auto;
    }

    .ui-customer-actions-menu form {
        flex: 0 0 auto;
    }
}

.ui-customer-row td {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.ui-initial-avatar {
    width: 37px;
    height: 37px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.ui-avatar-soft-primary {
    background: rgba(17, 66, 34, 0.14);
    color: var(--ui-primary);
}

.ui-avatar-soft-muted {
    background: rgba(100, 116, 139, 0.14);
    color: var(--ui-muted);
}

.ui-avatar-soft-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.ui-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--ui-radius-control);
    border: 1px solid var(--ui-border);
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.05));
}

.ui-thumb-primary {
    background: linear-gradient(135deg, rgba(17, 66, 34, 0.25), rgba(17, 66, 34, 0.05));
}

.ui-thumb-danger {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.22), rgba(220, 38, 38, 0.05));
}

.ui-thumb-success {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.22), rgba(22, 163, 74, 0.05));
}

.ui-progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
}

.ui-progress .progress-bar {
    border-radius: 999px;
}

.ui-outline-btn {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
    font-weight: 700;
    font-size: var(--ui-body);
    background: #ffffff;
}

.ui-action-tile {
    border: 1px solid var(--ui-primary) !important;
    border-radius: var(--ui-radius-card-sm);
    background: var(--ui-primary) !important;
    padding: 11px 8px;
    min-height: var(--ui-control-h);
    color: #ffffff !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ui-action-tile:hover,
.ui-action-tile:focus,
.ui-action-tile:active {
    border: 1px solid var(--ui-primary) !important;
    background: #ffffff !important;
    color: var(--ui-primary) !important;
}

.ui-action-tile i {
    font-size: 19px;
}

.ui-mobile-kpi i {
    font-size: 19px;
}

.ui-mobile-kpi {
    border-radius: var(--ui-radius-card-sm);
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.ui-mobile-kpi-primary {
    background: var(--ui-primary);
    border-color: transparent;
}

.ui-mobile-hero {
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(17, 66, 34, 0.08), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(17, 66, 34, 0.12);
}

.ui-mobile-kicker {
    color: var(--ui-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.ui-mobile-kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ui-mobile-kpi-icon-soft {
    background: rgba(17, 66, 34, 0.08);
}

.ui-mobile-kpi-icon-strong {
    background: rgba(255, 255, 255, 0.18);
}

.ui-mobile-note {
    max-width: 58%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 991.98px) {
    .ui-mobile-note {
        max-width: calc(100% - 52px);
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.1;
        font-size: 10px;
        padding: 4px 8px;
    }
}

.ui-stock-banner {
    background: #e8f3f1;
    border-radius: var(--ui-radius-card);
}

.ui-stock-banner-img {
    width: 140px;
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.08));
    border-left: 1px solid rgba(15, 23, 42, 0.06);
}

.ui-due-pill {
    border-radius: var(--ui-radius-control);
    padding: 10px 14px;
    min-width: 110px;
    text-align: center;
    font-weight: 900;
}

@media (max-width: 991.98px) {
    .ui-due-pill {
        padding: 6px 10px;
        min-width: 74px;
    }
}

.ui-due-pill-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.ui-due-pill-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--ui-muted);
}

/* Menu */
.ui-hero-card {
    background: var(--ui-primary);
    border: 0;
    border-radius: var(--ui-radius-card);
}

.ui-hero-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--ui-radius-control);
    background: rgba(255, 255, 255, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ui-hero-link {
    color: rgba(255, 255, 255, 0.9);
}

.ui-hero-link:hover {
    color: #ffffff;
}

.ui-hero-watermark {
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-45%);
    font-size: 110px;
    opacity: 0.12;
    pointer-events: none;
}

.ui-tile-card {
    border-radius: var(--ui-radius-card);
}

.ui-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--ui-radius-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--ui-muted);
}

.ui-tile-icon-primary {
    background: rgba(17, 66, 34, 0.14);
    color: var(--ui-primary);
}

.ui-tile-icon-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.ui-tile-icon-danger {
    background: rgba(220, 38, 38, 0.14);
    color: #b91c1c;
}

.ui-tile-icon-muted {
    background: rgba(100, 116, 139, 0.14);
    color: var(--ui-muted);
}

.ui-plus-circle {
    width: var(--ui-control-h);
    height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-primary);
}

.ui-plus-circle i {
    font-size: 24px;
}

.ui-status-bar {
    border-radius: var(--ui-radius-card);
    background: #e8f3f1;
}

.ui-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    display: inline-block;
}

.ui-menu-list .list-group-item {
    border-color: var(--ui-border);
    padding-left: 18px;
    padding-right: 18px;
}

.ui-menu-icon {
    width: var(--ui-control-h);
    height: var(--ui-control-h);
    border-radius: var(--ui-radius-control);
    background: rgba(17, 66, 34, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-primary);
    font-size: 24px;
}

.ui-menu-icon-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.ui-help-card {
    background: var(--ui-primary);
    border: 0;
    border-radius: var(--ui-radius-card);
    position: relative;
    overflow: hidden;
}

.ui-help-watermark {
    position: absolute;
    right: -10px;
    bottom: -18px;
    font-size: 110px;
    opacity: 0.12;
    pointer-events: none;
}

.ui-searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.ui-searchable-select-input {
    cursor: pointer;
    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='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
}

.ui-searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.10), 0 2px 6px -1px rgba(0, 0, 0, 0.06);
    z-index: 1050;
    margin-top: 4px;
    padding: 6px;
}

.ui-searchable-select-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ui-text);
    border-radius: 4px;
    transition: background 0.1s ease, color 0.1s ease;
    margin-bottom: 2px;
}

.ui-searchable-select-item:last-child {
    margin-bottom: 0;
}

.ui-searchable-select-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ui-searchable-select-item.selected {
    background: #e8f3f1;
    color: #134239;
    font-weight: 600;
}

.ui-searchable-select-item.d-none {
    display: none !important;
}

.ui-searchable-select-no-results {
    padding: 10px;
    color: #64748b;
    font-style: italic;
    font-size: 13px;
    text-align: center;
}

/* Disable all list, navigation, and table hover backgrounds globally */
.table-hover>tbody>tr:hover>*,
.table-hover>tbody>tr:hover,
.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
    background-color: transparent !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.ui-sidebar-link:hover {
    background-color: transparent !important;
}

.ui-searchable-select-item:hover {
    background-color: transparent !important;
    background: transparent !important;
}

.list-group-item-action:hover {
    background-color: transparent !important;
}

.ui-icon-btn:hover {
    background-color: transparent !important;
}

/* Logo light/dark mode visibility rules */
.ui-logo-light {
    display: inline-block;
}

.ui-logo-dark {
    display: none;
}

/* ==========================================================================
   Dark Mode Theme System
   ========================================================================== */
[data-theme="dark"] {
    --ui-primary: #ffffff;
    --ui-primary-700: #e5e5ea;
    --ui-bg: #000000;
    --ui-surface: #1c1c1e;
    --ui-soft-surface: #2c2c2e;
    --ui-border: #2c2c2e;
    --ui-text: #ffffff;
    --ui-muted: #98989d;

    background-color: #000000 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-logo-light {
    display: none !important;
}

[data-theme="dark"] .ui-logo-dark {
    display: inline-block !important;
}

#vehicle_number_input {
    text-transform: uppercase !important;
}

input[type="date"] {
    cursor: pointer !important;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
    display: none !important;
    -webkit-appearance: none !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

/* Dark Mode Action Buttons (No borders) */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .ui-primary-btn {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #48484a !important;
    --bs-btn-border-color: transparent !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #545458 !important;
    --bs-btn-hover-border-color: transparent !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #636366 !important;
    --bs-btn-active-border-color: transparent !important;
    background-color: #48484a !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .ui-primary-btn:hover,
[data-theme="dark"] .btn-primary:active,
[data-theme="dark"] .btn-primary.active,
[data-theme="dark"] .ui-primary-btn:active {
    background-color: #545458 !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #2c2c2e !important;
    --bs-btn-border-color: transparent !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #48484a !important;
    --bs-btn-hover-border-color: transparent !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #48484a !important;
    --bs-btn-active-border-color: transparent !important;
    background-color: #2c2c2e !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-primary:active,
[data-theme="dark"] .btn-outline-primary.active,
[data-theme="dark"] .btn-outline-secondary:active,
[data-theme="dark"] .btn-outline-secondary.active {
    background-color: #48484a !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

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

[data-theme="dark"] .ui-tabs-pills .nav-link.active {
    border-color: #6b7280 !important;
}

[data-theme="dark"] .ui-customer-sidekick {
    background:
        radial-gradient(circle at top right, rgba(148, 163, 184, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(18, 18, 20, 0.98), rgba(8, 8, 10, 1));
}

[data-theme="dark"] .ui-customer-sidekick-header,
[data-theme="dark"] .ui-customer-sidekick-footer {
    border-color: #2c2c2e !important;
}

[data-theme="dark"] .ui-sidekick-choice,
[data-theme="dark"] .ui-sidekick-row-choice,
[data-theme="dark"] .ui-sidekick-tag {
    background: rgba(28, 28, 30, 0.92);
    border-color: #3a3a3c;
    color: #ffffff;
}

[data-theme="dark"] .ui-sidekick-row-main i,
[data-theme="dark"] .ui-customer-sidekick-label i {
    color: #cbd5e1;
}

[data-theme="dark"] .btn-check:checked + .ui-sidekick-choice,
[data-theme="dark"] .btn-check:checked + .ui-sidekick-row-choice,
[data-theme="dark"] .btn-check:checked + .ui-sidekick-tag {
    background: rgba(71, 85, 105, 0.28);
    border-color: #94a3b8;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .ui-customer-sidekick-footer {
    background: linear-gradient(180deg, rgba(8, 8, 10, 0.2), rgba(8, 8, 10, 0.98) 24%);
}

[data-theme="dark"] .ui-customer-actions-menu .btn-outline-primary,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-secondary {
    background-color: transparent !important;
    border: 1px solid #545458 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-customer-actions-menu .btn-outline-primary:hover,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-secondary:hover,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-primary:active,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-secondary:active,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-primary.active,
[data-theme="dark"] .ui-customer-actions-menu .btn-outline-secondary.active {
    background-color: #2c2c2e !important;
    border: 1px solid #6b7280 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-customer-profile-actions .btn-outline-secondary,
[data-theme="dark"] .ui-customer-profile-actions .btn-outline-warning,
[data-theme="dark"] .ui-customer-profile-actions .btn-outline-success,
[data-theme="dark"] .ui-customer-profile-actions .btn-outline-danger {
    border: 1px solid #545458 !important;
}

/* Dark Mode Action Tiles & Dashboard Quick Action Buttons (No borders) */
[data-theme="dark"] .ui-action-tile,
[data-theme="dark"] .ui-tile-card,
[data-theme="dark"] .ui-mobile-kpi,
[data-theme="dark"] .btn.ui-action-tile {
    background: #2c2c2e !important;
    background-color: #2c2c2e !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-action-tile i,
[data-theme="dark"] .ui-action-tile span,
[data-theme="dark"] .ui-mobile-kpi i,
[data-theme="dark"] .ui-mobile-kpi span,
[data-theme="dark"] .ui-tile-card i,
[data-theme="dark"] .ui-tile-card span {
    color: #ffffff !important;
}

[data-theme="dark"] .ui-action-tile:hover,
[data-theme="dark"] .ui-tile-card:hover,
[data-theme="dark"] .ui-mobile-kpi:hover,
[data-theme="dark"] .btn.ui-action-tile:hover {
    background: #48484a !important;
    background-color: #48484a !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-action-tile:hover i,
[data-theme="dark"] .ui-action-tile:hover span,
[data-theme="dark"] .ui-mobile-kpi:hover i,
[data-theme="dark"] .ui-mobile-kpi:hover span {
    color: #ffffff !important;
}

[data-theme="dark"] .ui-action-tile:active,
[data-theme="dark"] .ui-action-tile.active,
[data-theme="dark"] .ui-mobile-kpi:active,
[data-theme="dark"] .btn.ui-action-tile:active {
    background: #545458 !important;
    background-color: #545458 !important;
    border: none !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

/* Dark Mode Link Text Styling - Kept Pure White */
[data-theme="dark"] a:not(.ui-sidebar-link):not(.ui-bottom-nav-link):not(.ui-sidebar-footer-link):not(.btn),
[data-theme="dark"] .text-primary:not(.btn),
[data-theme="dark"] a.text-primary:not(.btn) {
    color: #ffffff !important;
}

[data-theme="dark"] a:not(.ui-sidebar-link):not(.ui-bottom-nav-link):not(.ui-sidebar-footer-link):not(.btn):hover,
[data-theme="dark"] .text-primary:not(.btn):hover,
[data-theme="dark"] a.text-primary:not(.btn):hover {
    color: #e5e5ea !important;
}

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

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

[data-theme="dark"] body {
    background-color: #000000 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-sidebar {
    background-color: #121214 !important;
    border-right: 1px solid #2c2c2e !important;
}

[data-theme="dark"] .ui-sidebar-link {
    color: #98989d !important;
}

[data-theme="dark"] .ui-sidebar-link:hover {
    color: #ffffff !important;
    background-color: #2c2c2e !important;
}

[data-theme="dark"] .ui-sidebar-link.is-active,
[data-theme="dark"] .ui-sidebar-link.is-active:hover {
    color: #ffffff !important;
    background-color: #3a3a3c !important;
}

[data-theme="dark"] .ui-topbar {
    background-color: #121214 !important;
    border-bottom: 1px solid #2c2c2e !important;
}

/* Inset Cards & Mobile Item Containers (iOS dark style) */
[data-theme="dark"] .ui-card,
[data-theme="dark"] .card,
[data-theme="dark"] .bg-white {
    background-color: #1c1c1e !important;
    border-color: #2c2c2e !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light-subtle {
    background-color: #252528 !important;
    border-color: #2c2c2e !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .ui-form-control {
    background-color: #2c2c2e !important;
    border-color: #3a3a3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .ui-form-control::placeholder {
    color: #7c7c80 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .ui-form-control:focus {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
    border-color: #48484a !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.15) !important;
}

/* File input custom styling (Light & Dark Mode) */
input[type="file"].form-control,
input[type="file"].ui-form-control,
.ui-file-input {
    padding: 5px 8px;
}

input[type="file"].form-control::file-selector-button,
input[type="file"].ui-form-control::file-selector-button,
.ui-file-input::file-selector-button,
input[type="file"].form-control::-webkit-file-upload-button,
input[type="file"].ui-form-control::-webkit-file-upload-button,
.ui-file-input::-webkit-file-upload-button {
    background-color: #e8f3f1;
    color: #134239;
    border: 1px solid #b6d5ce;
    border-radius: 6px;
    padding: 4px 12px;
    margin-right: 10px;
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

input[type="file"].form-control::file-selector-button:hover,
input[type="file"].ui-form-control::file-selector-button:hover,
.ui-file-input::file-selector-button:hover,
input[type="file"].form-control::-webkit-file-upload-button:hover,
input[type="file"].ui-form-control::-webkit-file-upload-button:hover,
.ui-file-input::-webkit-file-upload-button:hover {
    background-color: #134239;
    color: #ffffff;
    border-color: #134239;
}

[data-theme="dark"] input[type="file"].form-control,
[data-theme="dark"] input[type="file"].ui-form-control,
[data-theme="dark"] .ui-file-input {
    background-color: #2c2c2e !important;
    border-color: #3a3a3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] input[type="file"].form-control::file-selector-button,
[data-theme="dark"] input[type="file"].ui-form-control::file-selector-button,
[data-theme="dark"] .ui-file-input::file-selector-button,
[data-theme="dark"] input[type="file"].form-control::-webkit-file-upload-button,
[data-theme="dark"] input[type="file"].ui-form-control::-webkit-file-upload-button,
[data-theme="dark"] .ui-file-input::-webkit-file-upload-button {
    background-color: #3a3a3c !important;
    color: #ffffff !important;
    border: 1px solid #48484a !important;
    border-radius: 6px !important;
    padding: 4px 12px !important;
    margin-right: 10px !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
}

[data-theme="dark"] input[type="file"].form-control::file-selector-button:hover,
[data-theme="dark"] input[type="file"].ui-form-control::file-selector-button:hover,
[data-theme="dark"] .ui-file-input::file-selector-button:hover,
[data-theme="dark"] input[type="file"].form-control::-webkit-file-upload-button:hover,
[data-theme="dark"] input[type="file"].ui-form-control::-webkit-file-upload-button:hover,
[data-theme="dark"] .ui-file-input::-webkit-file-upload-button:hover {
    background-color: #48484a !important;
    border-color: #545458 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table-bordered,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .table-bordered> :not(caption)>*,
[data-theme="dark"] .table-bordered> :not(caption)>*>* {
    color: #ffffff !important;
    --bs-table-color: #ffffff !important;
    --bs-table-bg: #1c1c1e !important;
    --bs-table-border-color: #2c2c2e !important;
    border-color: #2c2c2e !important;
}

[data-theme="dark"] .table-hover>tbody>tr:hover>*,
[data-theme="dark"] .table-hover>tbody>tr:hover,
[data-theme="dark"] .table-hover tbody tr:hover td,
[data-theme="dark"] .table-hover tbody tr:hover th {
    background-color: #2c2c2e !important;
    background: #2c2c2e !important;
    color: #ffffff !important;
    --bs-table-hover-color: #ffffff !important;
    --bs-table-hover-bg: #2c2c2e !important;
}

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

[data-theme="dark"] .text-secondary,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text {
    color: #98989d !important;
}

[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end,
[data-theme="dark"] .border,
[data-theme="dark"] .border-light-subtle {
    border-color: #2c2c2e !important;
}

[data-theme="dark"] .ui-searchable-select-dropdown {
    background-color: #1c1c1e !important;
    border-color: #2c2c2e !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

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

[data-theme="dark"] .ui-searchable-select-item:hover {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ui-searchable-select-item.selected {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
    font-weight: bold !important;
}

[data-theme="dark"] .modal-content {
    background-color: #1c1c1e !important;
    border-color: #2c2c2e !important;
    color: #ffffff !important;
}

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

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

[data-theme="dark"] .list-group-item-action:hover {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
}

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

[data-theme="dark"] .page-link:hover {
    background-color: #2c2c2e !important;
    border-color: #3a3a3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .page-link:focus {
    background-color: #2c2c2e !important;
    box-shadow: none !important;
}

[data-theme="dark"] .page-item.active .page-link {
    background-color: #3a3a3c !important;
    border-color: #3a3a3c !important;
    color: #ffffff !important;
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #1c1c1e !important;
    border-color: #2c2c2e !important;
    color: #98989d !important;
    opacity: 0.5;
}

[data-theme="dark"] .ui-mobile-bottom-nav,
[data-theme="dark"] .ui-bottom-nav-inner {
    background-color: #121214 !important;
    border-top: 1px solid #2c2c2e !important;
}

[data-theme="dark"] .ui-bottom-nav-link {
    color: #98989d !important;
}

[data-theme="dark"] .ui-bottom-nav-link.is-active {
    color: #ffffff !important;
}

[data-theme="dark"] .ui-mobile-header {
    background-color: #121214 !important;
    border-bottom: 1px solid #2c2c2e !important;
}

[data-theme="dark"] .ui-notifications-dropdown {
    background-color: #1c1c1e !important;
    border-color: #2c2c2e !important;
}

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

[data-theme="dark"] .ui-initial-avatar {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
    border: 1px solid #3a3a3c !important;
}

[data-theme="dark"] .ui-icon-btn {
    color: #98989d !important;
}

[data-theme="dark"] .ui-icon-btn:hover {
    color: #ffffff !important;
    background-color: #2c2c2e !important;
}

[data-theme="dark"] .ui-avatar {
    background-color: #2c2c2e !important;
    color: #ffffff !important;
    border: 1px solid #3a3a3c !important;
}

[data-theme="dark"] .ui-page-header {
    border-bottom-color: #2c2c2e !important;
}

[data-theme="dark"] #notification-dropdown-menu {
    border-color: #2c2c2e !important;
    background-color: #1c1c1e !important;
}

[data-theme="dark"] .list-group-item-action:active,
[data-theme="dark"] .list-group-item-action:focus {
    background-color: #2c2c2e !important;
}

/* ==========================================================================
   Dark Mode - Documents Page Overrides
   ========================================================================== */
[data-theme="dark"] .ui-doc-hero {
    background: radial-gradient(circle at top right, rgba(17, 66, 34, 0.15), transparent 50%), #000000 !important;
    border-color: var(--ui-border) !important;
}

[data-theme="dark"] .ui-doc-panel {
    background: #000000 !important;
}

[data-theme="dark"] .ui-doc-stat {
    background: #000000 !important;
    border-color: var(--ui-border) !important;
}

[data-theme="dark"] .ui-doc-item {
    border-top-color: var(--ui-border) !important;
}

[data-theme="dark"] .ui-doc-icon {
    background: rgba(17, 66, 34, 0.2) !important;
    color: var(--ui-primary) !important;
}

[data-theme="dark"] .ui-doc-chip {
    background-color: #111111 !important;
    color: var(--ui-text) !important;
    border: 1px solid var(--ui-border) !important;
}

[data-theme="dark"] .ui-doc-badge {
    background: rgba(17, 66, 34, 0.2) !important;
    color: var(--ui-primary) !important;
}

/* ==========================================================================
   Dark Mode - Statement Page Overrides
   ========================================================================== */
[data-theme="dark"] .bg-white {
    background-color: #000000 !important;
}

[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light th,
[data-theme="dark"] .table-light td,
[data-theme="dark"] thead.table-light th {
    --bs-table-bg: #111111 !important;
    --bs-table-color: var(--ui-text) !important;
    color: var(--ui-text) !important;
}

[data-theme="dark"] .ui-statement-range-btn.btn-outline-primary {
    border-color: var(--ui-border) !important;
    color: #888888 !important;
}

[data-theme="dark"] .ui-statement-range-btn.btn-outline-primary:hover {
    border-color: var(--ui-primary) !important;
    color: #ffffff !important;
    background-color: transparent !important;
}

/* ==========================================================================
   Print Mode - Force White Backgrounds for Clean Hardcopy Print
   ========================================================================== */
@media print {

    body,
    html,
    [data-theme="dark"] body,
    [data-theme="dark"] html {
        background-color: #ffffff !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    [data-theme="dark"] .bg-white,
    [data-theme="dark"] .rounded-4.border.shadow-sm {
        background-color: #ffffff !important;
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #dee2e6 !important;
        box-shadow: none !important;
    }

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

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

    [data-theme="dark"] .table {
        color: #212529 !important;
        --bs-table-color: #212529 !important;
        --bs-table-bg: transparent !important;
        --bs-table-border-color: #dee2e6 !important;
    }

    [data-theme="dark"] .table-light {
        --bs-table-bg: #f8f9fa !important;
        --bs-table-color: #212529 !important;
    }

    [data-theme="dark"] .bg-primary {
        background-color: #114222 !important;
        color: #ffffff !important;
    }
}

/* Hide spin-button arrows in Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide spin-button arrows in Firefox */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ==========================================================================
   Statement Page Dark Mode (Black) Background Overrides
   ========================================================================== */
@media screen {

    [data-theme="dark"] .ui-statement-page,
    [data-theme="dark"] .ui-statement-page .ui-app-main,
    [data-theme="dark"] .ui-statement-page .ui-content,
    [data-theme="dark"] .ui-statement-page .bg-white {
        background-color: #000000 !important;
        background: #000000 !important;
        color: #ffffff !important;
    }

    [data-theme="dark"] .ui-statement-page .bg-white {
        border-color: #222222 !important;
    }

    [data-theme="dark"] .ui-statement-page .table,
    [data-theme="dark"] .ui-statement-page .table th,
    [data-theme="dark"] .ui-statement-page .table td {
        color: #ffffff !important;
        --bs-table-color: #ffffff !important;
        --bs-table-bg: #000000 !important;
        --bs-table-border-color: #222222 !important;
        border-color: #222222 !important;
    }

    [data-theme="dark"] .ui-statement-page .table-light,
    [data-theme="dark"] .ui-statement-page .table-light th,
    [data-theme="dark"] .ui-statement-page .table-light td,
    [data-theme="dark"] .ui-statement-page thead.table-light th {
        --bs-table-bg: #111111 !important;
        --bs-table-color: #ffffff !important;
        color: #ffffff !important;
    }

    [data-theme="dark"] .ui-statement-page .text-secondary,
    [data-theme="dark"] .ui-statement-page .text-muted,
    [data-theme="dark"] .ui-statement-page .form-text {
        color: #888888 !important;
    }

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

    [data-theme="dark"] .ui-statement-page .border-bottom,
    [data-theme="dark"] .ui-statement-page .border-top,
    [data-theme="dark"] .ui-statement-page .border-start,
    [data-theme="dark"] .ui-statement-page .border-end,
    [data-theme="dark"] .ui-statement-page .border {
        border-color: #222222 !important;
    }

    [data-theme="dark"] .ui-statement-page .form-control,
    [data-theme="dark"] .ui-statement-page .form-select,
    [data-theme="dark"] .ui-statement-page .ui-form-control {
        background-color: #000000 !important;
        border-color: #222222 !important;
        color: #ffffff !important;
    }

    [data-theme="dark"] .ui-statement-page .form-control:focus,
    [data-theme="dark"] .ui-statement-page .form-select:focus,
    [data-theme="dark"] .ui-statement-page .ui-form-control:focus {
        background-color: #000000 !important;
        color: #ffffff !important;
        border-color: var(--ui-primary) !important;
    }
}

/* Page & Component Transition Animations */
@keyframes uiFadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ui-content,
.ui-card,
.ui-tile-card,
.ui-hero-card {
    animation: uiFadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Smooth transitions on interactive elements */
.btn,
.ui-btn,
.ui-card,
.ui-tile-card,
.ui-sidebar-link,
.ui-bottom-nav-link,
.badge,
.form-control,
.form-select {
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

/* Micro-interaction Hover & Active states */
.ui-tile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.table-hover tbody tr:hover {
    background-color: var(--ui-surface-soft, rgba(0, 0, 0, 0.025));
}

.btn:active,
.ui-btn:active {
    transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {

    .ui-content,
    .ui-card,
    .ui-tile-card,
    .ui-hero-card {
        animation: none !important;
        transition: none !important;
    }
}

/* PWA Standalone Mode & Safe Area Inset Styles */
@media all and (display-mode: standalone) {

    header,
    .ui-topbar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    body {
        overscroll-behavior-y: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    .ui-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

.safe-area-inset-top {
    padding-top: env(safe-area-inset-top, 0px);
}

.safe-area-inset-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.pwa-install-banner {
    animation: pwaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pwaSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* ==========================================================================
   Dark Mode KPI Adjustments
   ========================================================================== */
[data-theme="dark"] .ui-tone-primary .ui-kpi-value {
    color: #ffffff !important;
}

[data-theme="dark"] .ui-tone-success .ui-kpi-value {
    color: #10b981 !important;
}

[data-theme="dark"] .ui-tone-danger .ui-kpi-value {
    color: #ef4444 !important;
}

[data-theme="dark"] .ui-tone-warning .ui-kpi-value {
    color: #f59e0b !important;
}

[data-theme="dark"] .ui-kpi-title {
    color: #94a3b8 !important;
}

[data-theme="dark"] .ui-kpi-note.ui-note-success {
    color: #10b981 !important;
}

[data-theme="dark"] .ui-kpi-note.ui-note-danger {
    color: #ef4444 !important;
}

[data-theme="dark"] .ui-kpi-note.ui-note-warning {
    color: #f59e0b !important;
}

[data-theme="dark"] .ui-kpi-note.ui-note-muted {
    color: #94a3b8 !important;
}

/* ==========================================================================
   Dark Mode Badge & Pill Overrides (iOS Dark Palette)
   ========================================================================== */
[data-theme="dark"] .badge.bg-primary-subtle,
[data-theme="dark"] .ui-pill.bg-primary-subtle {
    background-color: #0b2822 !important;
    border-color: #155447 !important;
    color: #34d399 !important;
}

[data-theme="dark"] .badge.bg-success-subtle,
[data-theme="dark"] .ui-pill.bg-success-subtle {
    background-color: #08321a !important;
    border-color: #0f592e !important;
    color: #30d158 !important;
}

[data-theme="dark"] .badge.bg-danger-subtle,
[data-theme="dark"] .ui-pill.bg-danger-subtle {
    background-color: #3b1416 !important;
    border-color: #5c1d1f !important;
    color: #ff453a !important;
}

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

[data-theme="dark"] .badge.bg-warning-subtle,
[data-theme="dark"] .ui-pill.bg-warning-subtle {
    background-color: #332204 !important;
    border-color: #593c07 !important;
    color: #ffd60a !important;
}

[data-theme="dark"] .badge.bg-secondary-subtle,
[data-theme="dark"] .ui-pill.bg-secondary-subtle {
    background-color: #2c2c2e !important;
    border-color: #3a3a3c !important;
    color: #e5e5ea !important;
}

/* ==========================================================================
   Dark Mode Warning & Danger Button Contrast Overrides
   ========================================================================== */
[data-theme="dark"] .btn-warning {
    --bs-btn-color: #212529 !important;
    --bs-btn-bg: #ffc107 !important;
    --bs-btn-border-color: #ffc107 !important;
    --bs-btn-hover-color: #212529 !important;
    --bs-btn-hover-bg: #ffca2c !important;
    --bs-btn-hover-border-color: #ffc720 !important;
    --bs-btn-active-color: #212529 !important;
    --bs-btn-active-bg: #ffcd39 !important;
    --bs-btn-active-border-color: #ffc720 !important;

    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #212529 !important;
}

[data-theme="dark"] .btn-warning.text-dark,
[data-theme="dark"] .btn-warning.text-dark *,
[data-theme="dark"] .btn-warning * {
    color: #212529 !important;
}

[data-theme="dark"] .btn-danger {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #dc3545 !important;
    --bs-btn-border-color: #dc3545 !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #bb2d3b !important;
    --bs-btn-hover-border-color: #b02a37 !important;
    --bs-btn-active-color: #ffffff !important;
    --bs-btn-active-bg: #b02a37 !important;
    --bs-btn-active-border-color: #a52834 !important;

    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

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

[data-theme="dark"] .btn-danger:disabled {
    background-color: rgba(220, 53, 69, 0.4) !important;
    border-color: rgba(220, 53, 69, 0.4) !important;
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 0.65 !important;
}

[data-theme="dark"] .btn-warning:disabled {
    background-color: rgba(255, 193, 7, 0.4) !important;
    border-color: rgba(255, 193, 7, 0.4) !important;
    color: rgba(33, 37, 41, 0.5) !important;
    opacity: 0.65 !important;
}

[data-theme="dark"] .btn-secondary {
    --bs-btn-color: #ffffff !important;
    --bs-btn-bg: #374151 !important;
    --bs-btn-border-color: #374151 !important;
    --bs-btn-hover-color: #ffffff !important;
    --bs-btn-hover-bg: #4b5563 !important;
    --bs-btn-hover-border-color: #4b5563 !important;

    background-color: #374151 !important;
    border-color: #374151 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .alert.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}

[data-theme="dark"] .alert.bg-danger-subtle *,
[data-theme="dark"] .alert.bg-danger-subtle strong {
    color: #f87171 !important;
}

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

/* Premium Validation Styles for Required Fields */
.was-validated .ui-form-control:invalid,
.ui-form-control.is-invalid,
.ui-form-control:user-invalid {
    border-color: #dc3545 !important;
}

.was-validated .ui-form-control:invalid:focus,
.ui-form-control.is-invalid:focus,
.ui-form-control:user-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

/* Red asterisks for labels of required inputs */
label:has(+ .ui-form-control[required])::after,
label:has(+ select[required])::after,
label:has(+ .input-group > .ui-form-control[required])::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Full-width plain search bar (e.g. Transactions page) */
.ui-search-full {
    position: relative;
    width: 100%;
}

.ui-search-full .form-control {
    width: 100%;
    border-radius: var(--ui-radius-control, 6px);
}
