:root {
    --ui-primary-1: #2563eb;
    --ui-primary-2: #4f46e5;
    --ui-shadow-primary: 0 8px 20px rgba(37, 99, 235, .28);

    --ui-success-1: #059669;
    --ui-success-2: #10b981;
    --ui-shadow-success: 0 8px 20px rgba(5, 150, 105, .28);

    --ui-info-1: #0284c7;
    --ui-info-2: #06b6d4;
    --ui-shadow-info: 0 8px 20px rgba(2, 132, 199, .28);

    --ui-warning-1: #d97706;
    --ui-warning-2: #f59e0b;
    --ui-shadow-warning: 0 8px 20px rgba(217, 119, 6, .28);

    --ui-danger-1: #dc2626;
    --ui-danger-2: #e11d48;
    --ui-shadow-danger: 0 8px 20px rgba(220, 38, 38, .28);

    --ui-dark-1: #334155;
    --ui-dark-2: #1e293b;

    /* Radius scale: 4 (controls) / 6 (default) / 8 (surfaces). */
    --ui-radius-sm: 4px;
    --ui-radius: 6px;
    --ui-radius-lg: 8px;

    --bs-border-radius-sm: 0.25rem;
    --bs-border-radius: 0.375rem;
    --bs-border-radius-lg: 0.5rem;
    --bs-border-radius-xl: 0.5rem;
    --bs-border-radius-xxl: 0.5rem;
    --bs-border-radius-2xl: 0.5rem;

    --rounded-9: 0.5rem;
    --rounded-10: 0.5rem;
    --rounded-11: 0.5rem;
    --rounded-12: 0.5rem;
    --rounded-13: 0.5rem;
    --rounded-16: 0.5rem;
    --rounded-20: 0.5rem;
    --rounded-24: 0.5rem;
    --rounded-28: 0.5rem;
    --rounded-32: 0.5rem;
    --rounded-36: 0.5rem;
    --rounded-40: 0.5rem;
    --rounded-44: 0.5rem;
    --rounded-48: 0.5rem;
    --rounded-50: 0.5rem;
    --rounded-56: 0.5rem;
    --rounded-60: 0.5rem;
    --rounded-64: 0.5rem;
    --rounded-72: 0.5rem;
    --rounded-76: 0.5rem;
    --rounded-80: 0.5rem;
    --rounded-90: 0.5rem;
    --rounded-110: 0.5rem;
    --rounded-120: 0.5rem;
    --rounded-144: 0.5rem;
    --rounded-160: 0.5rem;
    --rounded-170: 0.5rem;
    --rounded-190: 0.5rem;
    --rounded-200: 0.5rem;
    --rounded-240: 0.5rem;
    --rounded-440: 0.5rem;
}

/* Cap template radius utilities that hard-code large values. */
.radius-9,
.radius-10,
.radius-11,
.radius-12,
.radius-13,
.radius-16,
.radius-20,
.radius-24,
.radius-28,
.radius-32,
.radius-36,
.radius-40,
.radius-44,
.radius-48,
.radius-50,
.radius-56,
.radius-60,
.radius-64,
.radius-72,
.radius-76,
.radius-80,
.radius-90,
.radius-110,
.radius-120,
.radius-144,
.radius-160,
.radius-170,
.radius-190,
.radius-200,
.radius-240,
.radius-440 {
    border-radius: var(--ui-radius-lg) !important;
}

.rounded-4,
.rounded-5 {
    border-radius: var(--ui-radius-lg) !important;
}

/* Surfaces */
.card,
.modal-content,
.offcanvas,
.dropdown-menu,
.accordion-item,
.list-group,
.toast,
.popover,
.alert {
    border-radius: var(--ui-radius-lg);
}

/* Opaque modal surfaces (must not inherit glass / transparent card backgrounds) */
.modal-content,
.modal-content.bg-base,
.modal-content.bg-white {
    --bs-modal-bg: #ffffff;
    background-color: #ffffff !important;
    background-image: none !important;
    opacity: 1 !important;
}

.modal {
    --bs-modal-bg: #ffffff;
}

.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1055;
}

/* Controls */
.btn,
.form-control,
.form-select,
.input-group-text,
.page-link {
    border-radius: var(--ui-radius);
}

.btn-sm,
.form-control-sm,
.form-select-sm,
.input-group-sm > .form-control,
.input-group-sm > .form-select,
.input-group-sm > .input-group-text,
.input-group-sm > .btn {
    border-radius: var(--ui-radius-sm);
}

.btn-lg,
.form-control-lg,
.form-select-lg,
.input-group-lg > .form-control,
.input-group-lg > .form-select,
.input-group-lg > .input-group-text,
.input-group-lg > .btn {
    border-radius: var(--ui-radius-lg);
}

/* Keep true circles / pills intact. */
.rounded-circle,
.rounded-pill {
    border-radius: 50% !important;
}

.rounded-pill {
    border-radius: 50rem !important;
}

/* =========================================================
   PRIMARY
   ========================================================= */

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;

    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-primary-1),
        var(--ui-primary-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: var(--ui-shadow-primary);
}

.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: var(--ui-shadow-primary);
}

/* =========================================================
   SUCCESS
   ========================================================= */

.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;

    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-success-1),
        var(--ui-success-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: var(--ui-shadow-success);
}

.btn-success:hover {
    filter: brightness(1.06);
    box-shadow: var(--ui-shadow-success);
}

/* =========================================================
   INFO
   ========================================================= */

.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;

    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-info-1),
        var(--ui-info-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: var(--ui-shadow-info);
}

.btn-info:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(2, 132, 199, .28);
}

/* =========================================================
   WARNING
   ========================================================= */

.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;

    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-warning-1),
        var(--ui-warning-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: var(--ui-shadow-warning);
}

.btn-warning:hover {
    filter: brightness(1.05);
    box-shadow: 0 8px 20px rgba(217, 119, 6, .28);
}

/* =========================================================
   DANGER
   ========================================================= */

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;

    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-danger-1),
        var(--ui-danger-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: var(--ui-shadow-danger);
}

.btn-danger:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 20px rgba(220, 38, 38, .28);
}

/* =========================================================
   SECONDARY
   ========================================================= */

.btn-secondary {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-dark-1),
        var(--ui-dark-2)
    ) !important;

    border-color: transparent !important;
    box-shadow: 0 5px 14px rgba(30, 41, 59, .18);
}

.btn-secondary:hover {
    filter: brightness(1.07);
}

/* =========================================================
   LIGHT / OUTLINE BUTTONS
   ========================================================= */

.btn-light {
    color: #334155 !important;
    background: linear-gradient(135deg, #fff, #f8fafc) !important;
    border-color: #dbe3ed !important;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .06);
}

.btn-light:hover {
    color: #2563eb !important;
    background: #f8fbff !important;
    border-color: #bfd3ff !important;
}

.btn-outline-primary {
    color: #2563eb !important;
    background: #fff !important;
    border-color: #a9c2ff !important;
    box-shadow: 0 2px 7px rgba(37, 99, 235, .05);
}

.btn-outline-primary:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-primary);
}

.btn-outline-success {
    color: #047857 !important;
    background: #fff !important;
    border-color: #9de3ca !important;
}

.btn-outline-success:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-success);
}

.btn-outline-info {
    color: #0369a1 !important;
    background: #fff !important;
    border-color: #9bdcf2 !important;
}

.btn-outline-info:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-info);
}

.btn-outline-danger {
    color: #dc2626 !important;
    background: #fff !important;
    border-color: #fecaca !important;
}

.btn-outline-danger:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-danger-1),
        var(--ui-danger-2)
    ) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-danger);
}

.btn-outline-warning {
    color: #b45309 !important;
    background: #fff !important;
    border-color: #fcd34d !important;
}

.btn-outline-warning:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-warning-1),
        var(--ui-warning-2)
    ) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-warning);
}

.btn-outline-secondary {
    color: #334155 !important;
    background: #fff !important;
    border-color: #cbd5e1 !important;
}

.btn-outline-secondary:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-dark-1),
        var(--ui-dark-2)
    ) !important;
    border-color: transparent !important;
    box-shadow: 0 5px 14px rgba(30, 41, 59, .18);
}

/* =========================================================
   NIGHT MODE — outline / light buttons
   ========================================================= */

[data-theme="dark"] .btn-light {
    color: #e8edf5 !important;
    background: var(--neutral-100, #273142) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: none;
}

[data-theme="dark"] .btn-light:hover {
    color: #93c5fd !important;
    background: var(--neutral-200, #323d4e) !important;
    border-color: rgba(147, 197, 253, 0.35) !important;
}

[data-theme="dark"] .btn-outline-primary {
    color: #93c5fd !important;
    background: transparent !important;
    border-color: rgba(147, 197, 253, 0.45) !important;
    box-shadow: none;
}

[data-theme="dark"] .btn-outline-primary:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-primary);
}

[data-theme="dark"] .btn-outline-secondary {
    color: #e8edf5 !important;
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    box-shadow: none;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    color: #fff !important;
    background: var(--neutral-200, #323d4e) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    box-shadow: none;
}

[data-theme="dark"] .btn-outline-success {
    color: #6ee7b7 !important;
    background: transparent !important;
    border-color: rgba(110, 231, 183, 0.4) !important;
}

[data-theme="dark"] .btn-outline-success:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-success);
}

[data-theme="dark"] .btn-outline-info {
    color: #7dd3fc !important;
    background: transparent !important;
    border-color: rgba(125, 211, 252, 0.4) !important;
}

[data-theme="dark"] .btn-outline-info:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-info);
}

[data-theme="dark"] .btn-outline-danger {
    color: #fca5a5 !important;
    background: transparent !important;
    border-color: rgba(252, 165, 165, 0.4) !important;
}

[data-theme="dark"] .btn-outline-danger:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-danger-1),
        var(--ui-danger-2)
    ) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-danger);
}

[data-theme="dark"] .btn-outline-warning {
    color: #fcd34d !important;
    background: transparent !important;
    border-color: rgba(252, 211, 77, 0.4) !important;
}

[data-theme="dark"] .btn-outline-warning:hover {
    color: #fff !important;
    background: linear-gradient(
        135deg,
        var(--ui-warning-1),
        var(--ui-warning-2)
    ) !important;
    border-color: transparent !important;
    box-shadow: var(--ui-shadow-warning);
}

/* =========================================================
   NIGHT MODE — modals / offcanvas (global)
   ========================================================= */

[data-theme="dark"] .modal,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-content.bg-base,
[data-theme="dark"] .modal-content.bg-white {
    --bs-modal-bg: var(--neutral-100, #273142);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-content.bg-base,
[data-theme="dark"] .modal-content.bg-white {
    color: #e8edf5 !important;
    background-color: var(--neutral-100, #273142) !important;
    background-image: none !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    opacity: 1 !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
    background: transparent !important;
}

[data-theme="dark"] .modal-header.bg-neutral-50,
[data-theme="dark"] .modal-header.bg-light,
[data-theme="dark"] .modal-header.bg-base,
[data-theme="dark"] .modal-footer.bg-neutral-50,
[data-theme="dark"] .modal-footer.bg-light {
    background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .modal-title,
[data-theme="dark"] .modal-header .modal-title,
[data-theme="dark"] .modal-header h1,
[data-theme="dark"] .modal-header h5,
[data-theme="dark"] .modal-header h6 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-body {
    color: #e2e8f0;
}

[data-theme="dark"] .modal-body .form-label,
[data-theme="dark"] .modal-body label:not(.form-check-label) {
    color: #cbd5e1;
}

[data-theme="dark"] .modal-body .text-muted,
[data-theme="dark"] .modal-body .form-text,
[data-theme="dark"] .modal-body .text-secondary,
[data-theme="dark"] .modal-body .text-secondary-light,
[data-theme="dark"] .modal-body small.text-muted,
[data-theme="dark"] .modal-body .text-primary-light {
    color: #94a3b8 !important;
}

[data-theme="dark"] .modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
    opacity: 0.75;
}

[data-theme="dark"] .modal .btn-close:hover {
    opacity: 1;
}

[data-theme="dark"] .modal .bg-light,
[data-theme="dark"] .modal .bg-neutral-50,
[data-theme="dark"] .modal .bg-base,
[data-theme="dark"] .modal .bg-white,
[data-theme="dark"] .modal .card,
[data-theme="dark"] .modal .alert-light {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0;
}

[data-theme="dark"] .modal .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

[data-theme="dark"] .modal-backdrop.show {
    opacity: 0.72;
}

[data-theme="dark"] .offcanvas,
[data-theme="dark"] .offcanvas-lg,
[data-theme="dark"] .offcanvas-md,
[data-theme="dark"] .offcanvas-sm,
[data-theme="dark"] .offcanvas-xl,
[data-theme="dark"] .offcanvas-xxl {
    color: #e8edf5;
    background-color: var(--neutral-100, #273142) !important;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .offcanvas-header,
[data-theme="dark"] .offcanvas-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .offcanvas-title {
    color: #f1f5f9;
}

[data-theme="dark"] .offcanvas .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
    opacity: 0.75;
}

/* =========================================================
   STAT CARDS
   ========================================================= */

.kp-stat {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 92px;
    padding: 0.9rem 1rem;
    border-radius: var(--ui-radius-lg);
}

.kp-stat::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -26px;
    width: 110px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

.kp-stat-icon,
.kp-stat-value,
.kp-stat-label,
.kp-stat > .card-body {
    position: relative;
    z-index: 1;
}

.kp-stat > .card-body {
    width: 100%;
    padding: 0;
    background: transparent;
}

.kp-stat.dashboard-stat-card > .card-body {
    padding: 0 !important;
}

.kp-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: var(--ui-radius);
    background: rgba(255, 255, 255, 0.72);
    font-size: 1.15rem;
}

.kp-stat-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.kp-stat-label {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.kp-stat-sales {
    background: linear-gradient(180deg, #ecfdf3 0%, #bbf7d0 100%);
    color: #15803d;
}

.kp-stat-payments {
    background: linear-gradient(180deg, #eff6ff 0%, #bfdbfe 100%);
    color: #1d4ed8;
}

.kp-stat-info {
    background: linear-gradient(180deg, #ecfeff 0%, #a5f3fc 100%);
    color: #0e7490;
}

.kp-stat-warning {
    background: linear-gradient(180deg, #fffbeb 0%, #fde68a 100%);
    color: #b45309;
}

.kp-stat-balance {
    background: linear-gradient(180deg, #fff1f2 0%, #fecdd3 100%);
    color: #be123c;
}

.kp-stat-limit {
    background: linear-gradient(180deg, #f5f3ff 0%, #ddd6fe 100%);
    color: #6d28d9;
}

[data-theme="dark"] .kp-stat::after {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .kp-stat-sales {
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.28), rgba(22, 163, 74, 0.12));
    color: #86efac;
}

[data-theme="dark"] .kp-stat-payments {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.28), rgba(37, 99, 235, 0.12));
    color: #bfdbfe;
}

[data-theme="dark"] .kp-stat-info {
    background: linear-gradient(180deg, rgba(8, 145, 178, 0.28), rgba(8, 145, 178, 0.12));
    color: #a5f3fc;
}

[data-theme="dark"] .kp-stat-warning {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.28), rgba(217, 119, 6, 0.12));
    color: #fde68a;
}

[data-theme="dark"] .kp-stat-balance {
    background: linear-gradient(180deg, rgba(225, 29, 72, 0.28), rgba(225, 29, 72, 0.12));
    color: #fecdd3;
}

[data-theme="dark"] .kp-stat-limit {
    background: linear-gradient(180deg, rgba(109, 40, 217, 0.28), rgba(109, 40, 217, 0.12));
    color: #ddd6fe;
}


