/* ================================================================
   FINANCE SYSTEM — Design System v4.0
   Professional Financial Application Theme
   ================================================================
   Modern fintech aesthetic: clean surfaces, refined typography,
   sophisticated color palette, and polished micro-interactions.
   Change any --ds-* variable to re-skin the entire application.
   ================================================================ */

/* ─── 1. DESIGN TOKENS ──────────────────────────────────────── */
:root {
    /* ── Brand / Primary ── */
    --ds-primary:         #1e3a5f;
    --ds-primary-600:     #2563eb;
    --ds-primary-500:     #3b82f6;
    --ds-primary-400:     #60a5fa;
    --ds-primary-100:     #dbeafe;
    --ds-primary-50:      #eff6ff;

    /* ── Accent / CTA ── */
    --ds-accent:          #0d9488;
    --ds-accent-600:      #0d9488;
    --ds-accent-500:      #14b8a6;
    --ds-accent-400:      #2dd4bf;
    --ds-accent-100:      #ccfbf1;
    --ds-accent-50:       #f0fdfa;

    /* ── Semantic ── */
    --ds-success:         #059669;
    --ds-success-100:     #d1fae5;
    --ds-success-50:      #ecfdf5;

    --ds-warning:         #d97706;
    --ds-warning-100:     #fef3c7;
    --ds-warning-50:      #fffbeb;

    --ds-danger:          #dc2626;
    --ds-danger-600:      #b91c1c;
    --ds-danger-100:      #fee2e2;
    --ds-danger-50:       #fef2f2;

    --ds-info:            #0284c7;
    --ds-info-100:        #e0f2fe;
    --ds-info-50:         #f0f9ff;

    /* ── Neutrals ── */
    --ds-gray-950:        #020617;
    --ds-gray-900:        #0f172a;
    --ds-gray-800:        #1e293b;
    --ds-gray-700:        #334155;
    --ds-gray-600:        #475569;
    --ds-gray-500:        #64748b;
    --ds-gray-400:        #94a3b8;
    --ds-gray-300:        #cbd5e1;
    --ds-gray-200:        #e2e8f0;
    --ds-gray-100:        #f1f5f9;
    --ds-gray-50:         #f8fafc;

    /* ── Surfaces ── */
    --ds-bg:              #f0f4f8;
    --ds-bg-page:         #f4f6fa;
    --ds-bg-card:         #ffffff;
    --ds-bg-elevated:     #ffffff;
    --ds-bg-inset:        #f1f5f9;
    --ds-bg-overlay:      rgba(15, 23, 42, 0.5);

    /* ── Borders ── */
    --ds-border:          #e5e7eb;
    --ds-border-light:    #f1f5f9;
    --ds-border-strong:   #d1d5db;

    /* ── Text ── */
    --ds-text:            #111827;
    --ds-text-secondary:  #4b5563;
    --ds-text-muted:      #9ca3af;
    --ds-text-inverse:    #ffffff;
    --ds-text-link:       #2563eb;

    /* ── Sidebar ── */
    --ds-sidebar-bg:      linear-gradient(180deg, #0c1222 0%, #111827 40%, #0f172a 100%);
    --ds-sidebar-text:    #e2e8f0;
    --ds-sidebar-muted:   rgba(148, 163, 184, 0.65);
    --ds-sidebar-hover:   rgba(99, 102, 241, 0.08);
    --ds-sidebar-active:  rgba(99, 102, 241, 0.14);
    --ds-sidebar-accent:  #818cf8;
    --ds-sidebar-border:  rgba(255, 255, 255, 0.06);

    /* ── Shadows ── */
    --ds-shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.03);
    --ds-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --ds-shadow-md:  0 2px 4px rgba(0, 0, 0, 0.03), 0 4px 6px rgba(0, 0, 0, 0.05);
    --ds-shadow-lg:  0 4px 6px rgba(0, 0, 0, 0.02), 0 10px 15px rgba(0, 0, 0, 0.06), 0 20px 25px rgba(0, 0, 0, 0.04);
    --ds-shadow-xl:  0 8px 10px rgba(0, 0, 0, 0.02), 0 20px 25px rgba(0, 0, 0, 0.06), 0 25px 50px rgba(0, 0, 0, 0.08);
    --ds-shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.03);
    --ds-shadow-card-hover: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
    --ds-shadow-glow-primary: 0 0 24px rgba(37, 99, 235, 0.12);
    --ds-shadow-glow-accent:  0 0 24px rgba(13, 148, 136, 0.12);

    /* ── Radii ── */
    --ds-radius-xs:   4px;
    --ds-radius-sm:   8px;
    --ds-radius-md:   12px;
    --ds-radius-lg:   16px;
    --ds-radius-xl:   20px;
    --ds-radius-2xl:  24px;
    --ds-radius-full: 9999px;

    /* ── Nav Active Theme (overridden per data-section) ── */
    --ds-nav-active-bg:       rgba(129, 140, 248, 0.15);
    --ds-nav-active-bg-end:   rgba(129, 140, 248, 0.04);
    --ds-nav-accent-start:    #818cf8;
    --ds-nav-accent-end:      #6366f1;
    --ds-nav-accent-glow:     rgba(129, 140, 248, 0.45);
    --ds-nav-icon-active-bg:  rgba(129, 140, 248, 0.18);
    --ds-nav-icon-active-clr: #a5b4fc;

    /* ── Section Theme (overridden per data-section) ── */
    --ds-section-color:    var(--ds-primary-600);
    --ds-section-light:    var(--ds-primary-400);
    --ds-section-bg:       var(--ds-primary-50);
    --ds-section-border:   var(--ds-primary-100);
    --ds-section-gradient: linear-gradient(135deg, var(--ds-primary-600), var(--ds-primary-400));

    /* ── Motion ── */
    --ds-ease:        cubic-bezier(0.4, 0, 0.2, 1);
    --ds-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ds-ease-out:    cubic-bezier(0, 0, 0.2, 1);
    --ds-duration:    0.2s;
    --ds-transition:  var(--ds-duration) var(--ds-ease);

    /* ── Typography ── */
    --ds-font:      'IBM Plex Sans Arabic', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ds-font-mono: 'IBM Plex Mono', 'Fira Code', 'JetBrains Mono', monospace;

    /* ── Layout ── */
    --ds-sidebar-width: 280px;
}

/* ─── 2. RESET & FOUNDATION ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ds-text);
    font-family: var(--ds-font);
    background: var(--ds-bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    font-size: 0.9375rem;
}

a { text-decoration: none; color: var(--ds-text-link); transition: color var(--ds-transition); }
a:hover { color: var(--ds-primary); }

::selection { background: var(--ds-primary-100); color: var(--ds-primary); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ds-gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ds-gray-400); }

*:focus-visible {
    outline: 2px solid var(--ds-primary-500);
    outline-offset: 2px;
}

/* ─── 3. APP SHELL ───────────────────────────────────────────── */
.app-shell { position: relative; z-index: 1; }
.app-shell > .row { flex-wrap: nowrap; }

/* ── Sidebar ── */
.app-sidebar,
.app-offcanvas {
    background: var(--ds-sidebar-bg);
    color: var(--ds-sidebar-text);
    border-inline-end: 1px solid var(--ds-sidebar-border);
}

.app-sidebar {
    height: 100vh;
    max-height: 100vh;
    padding: 0;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.app-offcanvas { width: min(88vw, 320px); }

/* ── Brand Block ── */
.brand-block {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.25rem 1.15rem;
    border-bottom: 1px solid var(--ds-sidebar-border);
    flex-shrink: 0;
    position: relative;
}

.brand-block::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline-start: 1.15rem;
    inset-inline-end: 1.15rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.2), transparent);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: var(--ds-radius-md);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25), inset 0 1px 1px rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.brand-text { min-width: 0; }
.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.brand-subtitle {
    color: rgba(148, 163, 184, 0.75);
    font-size: 0.7rem;
    line-height: 1.4;
}

/* ── Sidebar Search ── */
.sidebar-search {
    position: relative;
    padding: 0.65rem 0.85rem;
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    padding-inline-start: 2.15rem;
    padding-inline-end: 2.2rem;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--ds-radius-sm);
    background: rgba(255,255,255,0.04);
    color: #f1f5f9;
    font-size: 0.8rem;
    font-family: var(--ds-font);
    transition: all var(--ds-transition);
    outline: none;
}

.sidebar-search input::placeholder { color: rgba(148, 163, 184, 0.5); }

.sidebar-search input:focus {
    border-color: rgba(129, 140, 248, 0.35);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.08);
}

.sidebar-search .search-icon {
    position: absolute;
    inset-inline-start: 1.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.45);
    font-size: 0.72rem;
    pointer-events: none;
}

.search-kbd {
    position: absolute;
    inset-inline-end: 1.55rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    font-family: var(--ds-font-mono);
    color: rgba(148, 163, 184, 0.45);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.4;
    pointer-events: none;
    opacity: 0.7;
}
.sidebar-search input:focus ~ .search-kbd { opacity: 0; }

/* ── Scrollable Nav ── */
.nav-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.35rem 0.7rem;
}

.nav-scroll::-webkit-scrollbar { width: 8px; }
.nav-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.08); }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.5); border-radius: 8px; }
.nav-scroll::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.7); }

/* ── Nav Divider ── */
.nav-divider {
    height: 1px;
    background: var(--ds-sidebar-border);
    margin: 0.35rem 0.5rem;
}

/* ── Dashboard link ── */
.nav-link-dashboard { margin-bottom: 0.1rem; }

/* ── Navigation Items ── */
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ds-sidebar-muted);
    margin: 0.85rem 0 0.4rem;
    padding-inline: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ds-sidebar-border);
}

.nav-cluster { display: grid; gap: 2px; flex: 1; }

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.6rem;
    padding-inline-start: 0.5rem;
    border-radius: var(--ds-radius-sm);
    color: #b0bec5;
    transition: all 0.18s var(--ds-ease);
    background: transparent;
    position: relative;
    cursor: pointer;
}

.nav-link-item:hover {
    color: #e2e8f0;
    background: var(--ds-nav-active-bg-end);
}

.nav-link-item.active {
    color: #ffffff;
    background: linear-gradient(90deg, var(--ds-nav-active-bg) 0%, var(--ds-nav-active-bg-end) 100%);
}
[dir="rtl"] .nav-link-item.active {
    background: linear-gradient(270deg, var(--ds-nav-active-bg) 0%, var(--ds-nav-active-bg-end) 100%);
}

.nav-link-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 var(--ds-radius-xs) var(--ds-radius-xs) 0;
    background: linear-gradient(180deg, var(--ds-nav-accent-start), var(--ds-nav-accent-end));
    box-shadow: 0 0 12px var(--ds-nav-accent-glow);
}
[dir="rtl"] .nav-link-item.active::before {
    border-radius: var(--ds-radius-xs) 0 0 var(--ds-radius-xs);
}

.nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    font-size: 0.72rem;
    color: #78909c;
    transition: all 0.18s var(--ds-ease);
}

.nav-link-item:hover .nav-icon {
    background: var(--ds-nav-icon-active-bg);
    color: var(--ds-nav-icon-active-clr);
}

.nav-link-item.active .nav-icon {
    background: var(--ds-nav-icon-active-bg);
    color: var(--ds-nav-icon-active-clr);
    box-shadow: 0 2px 8px var(--ds-nav-accent-glow);
}

.nav-link-text { min-width: 0; flex: 1; }
.nav-label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.3;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-meta {
    color: #546e7a;
    font-size: 0.67rem;
    display: block;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-link-item:hover .nav-meta { color: #78909c; }
.nav-link-item.active .nav-meta { color: var(--ds-nav-icon-active-clr); }

.nav-badge {
    font-size: 0.62rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    padding: 2px 7px;
    border-radius: var(--ds-radius-full);
    line-height: 1.3;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
    animation: badgePulse 2.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 2px 14px rgba(220, 38, 38, 0.5); }
}

.nav-link-item.nav-hidden { display: none; }

/* ── Nav Groups ── */
.nav-group { margin-bottom: 2px; }

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.52rem 0.6rem;
    border: none;
    background: transparent;
    color: #78909c;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.18s var(--ds-ease);
    border-radius: var(--ds-radius-sm);
    text-align: inherit;
    font-family: var(--ds-font);
}

.nav-group-toggle:hover { color: #b0bec5; background: rgba(255,255,255,0.03); }
.nav-group--open > .nav-group-toggle { color: #e2e8f0; }

.nav-group-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    font-size: 0.62rem;
    color: #546e7a;
    transition: all 0.18s var(--ds-ease);
}
.nav-group-toggle:hover .nav-group-icon { color: #78909c; }
.nav-group--open .nav-group-icon { background: rgba(129, 140, 248, 0.1); color: #818cf8; }

.nav-group-label { flex: 1; }

.nav-group-count {
    font-size: 0.58rem;
    font-weight: 600;
    color: #546e7a;
    background: rgba(255,255,255,0.04);
    padding: 1px 6px;
    border-radius: var(--ds-radius-full);
    line-height: 1.4;
    transition: all 0.18s var(--ds-ease);
}
.nav-group-toggle:hover .nav-group-count { color: #78909c; }

.nav-group-arrow {
    font-size: 0.48rem;
    transition: transform 0.3s var(--ds-ease);
    opacity: 0.35;
}
.nav-group-toggle:hover .nav-group-arrow { opacity: 0.6; }
.nav-group--open > .nav-group-toggle .nav-group-arrow { transform: rotate(180deg); opacity: 0.65; }

.nav-group-items {
    display: grid;
    gap: 1px;
    padding-inline-start: 0.35rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ds-ease), opacity 0.25s var(--ds-ease);
    opacity: 0;
}
.nav-group--open > .nav-group-items { max-height: 600px; opacity: 1; }
.nav-group.nav-hidden { display: none; }

/* ── Sidebar Footer ── */
.sidebar-footer {
    flex-shrink: 0;
    padding: 0.65rem;
    border-top: 1px solid var(--ds-sidebar-border);
    position: relative;
}

.sidebar-footer::before {
    content: '';
    position: absolute;
    top: -1px;
    inset-inline-start: 0.85rem;
    inset-inline-end: 0.85rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.15), transparent);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--ds-radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    transition: all 0.18s var(--ds-ease);
}
.sidebar-user-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.07); }

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--ds-radius-sm);
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-foot-name {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 0.82rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-foot-role {
    color: #78909c;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-foot-label {
    color: var(--ds-sidebar-muted);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

/* ── Main Area ── */
.app-main {
    padding: 1.35rem 1.85rem;
    background: var(--ds-bg-page);
    position: relative;
}

/* ── Topbar ── */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.25rem;
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    backdrop-filter: blur(16px) saturate(1.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--ds-radius-xl);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03), 0 4px 16px rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0.75rem;
    z-index: 100;
}

.topbar-meta { display: flex; align-items: center; gap: 0.75rem; }

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.8rem;
    border-radius: var(--ds-radius-full);
    background: var(--ds-gray-50);
    color: var(--ds-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--ds-border);
    transition: all var(--ds-transition);
}
.topbar-chip:hover { background: var(--ds-gray-100); }

.topbar-user { display: flex; align-items: center; gap: 0.75rem; }

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--ds-radius-md);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #6366f1, #818cf8);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

/* ─── 4. PAGE STRUCTURE ──────────────────────────────────────── */
.content-stage { padding: 0 0 2rem; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--ds-border-light);
}

.page-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ds-section-color);
    margin-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.6rem;
    background: var(--ds-section-bg);
    border-radius: var(--ds-radius-full);
    border: 1px solid var(--ds-section-border);
    transition: color 0.2s, background 0.2s;
}
.page-eyebrow i { font-size: 0.68rem; }

.page-title {
    margin: 0.25rem 0 0;
    font-size: clamp(1.4rem, 2vw, 1.85rem);
    font-weight: 800;
    color: var(--ds-text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.small-muted { color: var(--ds-text-secondary); font-size: 0.88rem; }

/* ─── 5. SURFACES & CARDS ───────────────────────────────────── */
.surface,
.table-wrap {
    background: var(--ds-bg-card);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-card);
    padding: 1.35rem;
    transition: box-shadow 0.3s var(--ds-ease);
}
.surface:hover { box-shadow: var(--ds-shadow-card-hover); }

.surface-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    /* Pull to surface edges and add colored banner */
    margin: -1.35rem -1.35rem 1.35rem;
    padding: 1.1rem 1.35rem 1rem;
    background: linear-gradient(135deg, var(--ds-section-bg) 0%, transparent 100%);
    border-bottom: 1px solid var(--ds-section-border);
    border-radius: calc(var(--ds-radius-xl) - 1px) calc(var(--ds-radius-xl) - 1px) 0 0;
    position: relative;
    overflow: hidden;
}
/* Decorative gradient accent on the inline-start edge */
.surface-head::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--ds-section-gradient);
    border-radius: 0 2px 2px 0;
}

.surface-title {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ds-text);
}

.surface-subtitle { color: var(--ds-text-secondary); font-size: 0.88rem; margin: 0; }

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ds-section-color);
    margin-bottom: 0.15rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.section-label i { font-size: 0.66rem; }

.section-label-icon {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-section-bg);
    color: var(--ds-section-color);
    box-shadow: inset 0 0 0 1px var(--ds-section-border);
}

.section-label--alert {
    gap: 0.45rem;
}

.section-label--alert .section-label-icon i {
    font-size: 0.72rem;
}

/* ─── 6. METRIC CARDS ───────────────────────────────────────── */
.metric-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-radius: var(--ds-radius-lg);
    border: 1px solid var(--ds-border);
    background: var(--ds-bg-card);
    box-shadow: var(--ds-shadow-card);
    transition: all 0.3s var(--ds-ease);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ds-shadow-card-hover);
}

.metric-card::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--ds-radius-xs) var(--ds-radius-xs) 0;
    transition: width 0.3s var(--ds-ease);
}
[dir="rtl"] .metric-card::after { border-radius: var(--ds-radius-xs) 0 0 var(--ds-radius-xs); }
.metric-card:hover::after { width: 5px; }

.metric-card--accent::after  { background: linear-gradient(180deg, var(--ds-accent-400), var(--ds-accent)); }
.metric-card--gold::after    { background: linear-gradient(180deg, #fbbf24, var(--ds-warning)); }
.metric-card--danger::after  { background: linear-gradient(180deg, #f87171, var(--ds-danger)); }
.metric-card--success::after { background: linear-gradient(180deg, #4ade80, var(--ds-success)); }
.metric-card--info::after    { background: linear-gradient(180deg, #38bdf8, var(--ds-info)); }
.metric-card--primary::after { background: linear-gradient(180deg, var(--ds-primary-400), var(--ds-primary-600)); }

.metric-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: var(--ds-radius-md);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    transition: transform 0.3s var(--ds-ease-spring);
}
.metric-card:hover .metric-icon { transform: scale(1.06); }

.metric-card--accent  .metric-icon { background: var(--ds-accent-50);  color: var(--ds-accent); }
.metric-card--gold    .metric-icon { background: var(--ds-warning-50); color: var(--ds-warning); }
.metric-card--danger  .metric-icon { background: var(--ds-danger-50);  color: var(--ds-danger); }
.metric-card--success .metric-icon { background: var(--ds-success-50); color: var(--ds-success); }
.metric-card--info    .metric-icon { background: var(--ds-info-50);    color: var(--ds-info); }
.metric-card--primary .metric-icon { background: var(--ds-primary-50); color: var(--ds-primary); }

.metric-body { flex: 1; min-width: 0; }

.metric-label {
    color: var(--ds-text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.metric-value {
    font-size: clamp(1.25rem, 1.8vw, 1.6rem);
    font-weight: 800;
    color: var(--ds-text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.metric-meta {
    color: var(--ds-text-muted);
    font-size: 0.72rem;
    margin-top: 0.2rem;
    line-height: 1.3;
}

/* ─── 7. BADGES & STATUS PILLS ──────────────────────────────── */
.badge-soft,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--ds-radius-full);
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--ds-primary-50);
    color: var(--ds-primary);
    border: 1px solid var(--ds-primary-100);
    transition: all var(--ds-transition);
}

.badge-soft:hover, .status-pill:hover { filter: brightness(0.97); }

.badge-soft--gold, .status-pill--warning {
    background: var(--ds-warning-50); color: var(--ds-warning); border-color: var(--ds-warning-100);
}
.badge-soft--danger, .status-pill--danger {
    background: var(--ds-danger-50); color: var(--ds-danger); border-color: var(--ds-danger-100);
}
.badge-soft--success, .status-pill--success {
    background: var(--ds-success-50); color: var(--ds-success); border-color: var(--ds-success-100);
}
.badge-soft--info, .status-pill--info {
    background: var(--ds-info-50); color: var(--ds-info); border-color: var(--ds-info-100);
}

.stack-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* ─── 8. FORMS ───────────────────────────────────────────────── */
.form-label {
    color: var(--ds-text);
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.form-label i { color: var(--ds-text-muted); font-size: 0.76rem; }
.form-label .text-danger { font-size: 0.9em; }

.form-control,
.form-select {
    min-height: 2.85rem;
    border-radius: var(--ds-radius-md);
    border: 1.5px solid var(--ds-border);
    background-color: var(--ds-bg-card);
    padding-inline: 0.85rem;
    font-size: 0.9rem;
    color: var(--ds-text);
    box-shadow: var(--ds-shadow-xs);
    transition: border-color 0.18s var(--ds-ease), box-shadow 0.18s var(--ds-ease);
}

.form-control::placeholder { color: var(--ds-text-muted); }
textarea.form-control { min-height: 110px; padding-top: 0.75rem; }

.form-control:hover, .form-select:hover { border-color: var(--ds-gray-300); }

.form-control:focus, .form-select:focus {
    border-color: var(--ds-primary-500);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
    outline: none;
}

.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.35rem;
    border: 1.5px solid var(--ds-border-strong);
    transition: all 0.15s var(--ds-ease);
}
.form-check-input:checked { background-color: var(--ds-primary-600); border-color: var(--ds-primary-600); }
.form-check-input:focus { border-color: var(--ds-primary-500); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08); }

.input-group .form-control:focus { z-index: 3; }

/* ─── 9. BUTTONS ─────────────────────────────────────────────── */
.btn {
    border-radius: var(--ds-radius-md);
    font-weight: 600;
    padding: 0.58rem 1.15rem;
    font-size: 0.87rem;
    transition: all 0.18s var(--ds-ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
}
.btn i { font-size: 0.85em; }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.82rem; border-radius: var(--ds-radius-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.18) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
}
.btn:active::after { opacity: 1; }

.btn-primary {
    border: 0;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3), inset 0 1px 1px rgba(255,255,255,0.1);
}
.btn-primary:hover, .btn-primary:focus {
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35), inset 0 1px 1px rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn-success {
    border: 0;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, var(--ds-accent-600) 0%, #0f766e 100%);
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}
.btn-success:hover, .btn-success:focus {
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    border: 0;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, var(--ds-danger) 0%, #b91c1c 100%);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-outline-secondary {
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-border);
    color: var(--ds-text-secondary);
}
.btn-outline-secondary:hover {
    background: var(--ds-gray-50);
    border-color: var(--ds-gray-300);
    color: var(--ds-text);
    transform: translateY(-1px);
}

.btn-outline-primary {
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-primary-100);
    color: var(--ds-primary-600);
}
.btn-outline-primary:hover {
    background: var(--ds-primary-50);
    border-color: var(--ds-primary-500);
    color: var(--ds-primary);
    transform: translateY(-1px);
}

.btn-outline-danger {
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-danger-100);
    color: var(--ds-danger);
}
.btn-outline-danger:hover {
    background: var(--ds-danger-50);
    border-color: var(--ds-danger);
    transform: translateY(-1px);
}

.btn-outline-dark {
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-border);
    color: var(--ds-text);
}
.btn-outline-dark:hover {
    background: var(--ds-gray-50);
    border-color: var(--ds-gray-400);
    transform: translateY(-1px);
}

.btn-outline-light {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
}
.btn-outline-light:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.45);
    color: #ffffff;
}

/* ─── 10. TABLES ─────────────────────────────────────────────── */
.table-responsive {
    border-radius: var(--ds-radius-lg);
    overflow: auto;
}

.table { --bs-table-bg: transparent; margin-bottom: 0; }

.table > :not(caption) > * > * {
    padding: 0.85rem 0.8rem;
    border-bottom: 1px solid var(--ds-border-light);
    vertical-align: middle;
}

.table thead th {
    color: var(--ds-section-color);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--ds-section-bg);
    border-bottom: 2px solid var(--ds-section-border) !important;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}

.table tbody tr { transition: background 0.15s var(--ds-ease); }
.table tbody tr:hover { background: var(--ds-section-bg); }
.table tbody tr:last-child > * { border-bottom: 0; }

.table tbody td:first-child {
    font-weight: 600;
    color: var(--ds-text-muted);
    font-size: 0.82rem;
}

/* ─── 11. INFO LIST ──────────────────────────────────────────── */
.info-list { display: grid; gap: 0.65rem; }

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--ds-border-light);
    transition: background 0.15s var(--ds-ease);
}
.info-row:hover {
    background: var(--ds-gray-50);
    margin: 0 -0.5rem;
    padding-inline: 0.5rem;
    border-radius: var(--ds-radius-sm);
}
.info-row:last-child { padding-bottom: 0; border-bottom: 0; }

/* ─── 12. ALERTS ─────────────────────────────────────────────── */
.alert {
    border: 1px solid transparent;
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-sm);
    font-size: 0.9rem;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 4px;
    height: 100%;
}

.alert-success { background: var(--ds-success-50); color: var(--ds-success); border-color: var(--ds-success-100); }
.alert-success::before { background: var(--ds-success); }
.alert-danger  { background: var(--ds-danger-50);  color: var(--ds-danger);  border-color: var(--ds-danger-100); }
.alert-danger::before  { background: var(--ds-danger); }
.alert-warning { background: var(--ds-warning-50); color: var(--ds-warning); border-color: var(--ds-warning-100); }
.alert-warning::before { background: var(--ds-warning); }
.alert-info    { background: var(--ds-info-50);    color: var(--ds-info);    border-color: var(--ds-info-100); }
.alert-info::before    { background: var(--ds-info); }

/* ── Toast Notifications ── */
.ds-toast {
    position: fixed;
    top: 1.5rem;
    inset-inline-end: 1.5rem;
    z-index: 9999;
    min-width: 320px;
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-card);
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInToast 0.35s var(--ds-ease-spring);
}
.ds-toast.hiding { animation: slideOutToast 0.25s var(--ds-ease) forwards; }

.ds-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-radius-sm);
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.ds-toast--success .ds-toast-icon { background: var(--ds-success-50); color: var(--ds-success); }
.ds-toast--danger  .ds-toast-icon { background: var(--ds-danger-50);  color: var(--ds-danger); }
.ds-toast--warning .ds-toast-icon { background: var(--ds-warning-50); color: var(--ds-warning); }

.ds-toast-body { flex: 1; }
.ds-toast-title   { font-weight: 700; font-size: 0.9rem; }
.ds-toast-message { font-size: 0.82rem; color: var(--ds-text-secondary); }

.ds-toast-close {
    background: none;
    border: none;
    color: var(--ds-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: color var(--ds-transition);
}
.ds-toast-close:hover { color: var(--ds-text); }

/* ─── 13. EMPTY STATE ────────────────────────────────────────── */
.empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--ds-text-muted);
}
.empty-state i {
    display: block;
    font-size: 2.8rem;
    margin-bottom: 0.85rem;
    color: var(--ds-gray-300);
    animation: float 3s ease-in-out infinite;
}
.empty-state p { max-width: 320px; margin: 0 auto; font-size: 0.9rem; line-height: 1.5; }

/* ─── 14. LOGIN PAGE ─────────────────────────────────────────── */
.login-shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
}

.login-panel,
.brand-panel {
    border-radius: var(--ds-radius-2xl);
    overflow: hidden;
    box-shadow: var(--ds-shadow-xl);
}

.brand-panel {
    position: relative;
    padding: 2.5rem;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1), rgba(15, 23, 42, 0.04)), rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.brand-panel .brand-mark {
    width: 60px;
    height: 60px;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3), inset 0 1px 1px rgba(255,255,255,0.15);
}

.brand-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #a5b4fc;
}

.brand-title-login {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1.3;
    margin: 0.5rem 0 1rem;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

/* Alias for blade templates using .brand-title inside login */
.brand-panel .brand-title {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1.3;
    margin: 0.5rem 0 1rem;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

.brand-copy {
    max-width: 460px;
    color: var(--ds-gray-400);
    line-height: 1.9;
    margin-bottom: 1.8rem;
}

.feature-stack { display: grid; gap: 0.75rem; }

.feature-card {
    padding: 1rem 1.15rem;
    border-radius: var(--ds-radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s var(--ds-ease);
}
.feature-card:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.feature-card strong { display: block; margin-bottom: 0.25rem; color: #f1f5f9; }
.feature-card strong i { color: #a5b4fc; margin-inline-end: 0.4rem; }

.login-panel {
    background: var(--ds-bg-card);
    border: 1px solid var(--ds-border);
    padding: 2.25rem;
}

.panel-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ds-primary-600);
}
.panel-kicker i { margin-inline-end: 0.3rem; }

.panel-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0.5rem 0 0.5rem;
    color: var(--ds-text);
    letter-spacing: -0.02em;
}

.panel-copy {
    color: var(--ds-text-secondary);
    margin-bottom: 1.5rem;
}

/* Login container (subscription auth pages) */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ds-gray-900) 0%, #1e293b 50%, #0f172a 100%);
    padding: 1rem;
    position: relative;
}
.login-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 50%, rgba(99, 102, 241, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse at 75% 50%, rgba(129, 140, 248, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-2xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 2.5rem 2rem;
    position: relative;
    z-index: 1;
}

.login-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--ds-radius-lg);
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ds-text-inverse);
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
    margin: 0 auto 1.5rem;
}

/* ─── 15. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .app-main { padding: 0.95rem; }
    .app-topbar { border-radius: var(--ds-radius-lg); top: 0.5rem; }
}

@media (max-width: 991.98px) {
    .login-shell { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    .app-topbar,
    .page-head,
    .surface-head {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-meta, .topbar-user {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .app-topbar { position: relative; top: 0; }
    .table-wrap, .surface { padding: 1rem; }
    .surface-head {
        margin: -1rem -1rem 1rem;
        padding: 0.85rem 1rem;
        border-radius: calc(var(--ds-radius-xl) - 1px) calc(var(--ds-radius-xl) - 1px) 0 0;
    }
    .metric-card { padding: 0.85rem; gap: 0.75rem; }
    .metric-icon { width: 40px; height: 40px; min-width: 40px; font-size: 0.95rem; }
    .topbar-chip { justify-content: center; }
    .page-title { font-size: 1.35rem; }
    .metric-value { font-size: 1.15rem; }
    .page-head { padding-bottom: 0.85rem; }
}

@media (max-width: 575.98px) {
    .app-main { padding: 0.75rem; }
    .surface, .table-wrap { padding: 0.75rem; border-radius: var(--ds-radius-lg); }
    .metric-card { border-radius: var(--ds-radius-md); }
    .page-eyebrow { font-size: 0.65rem; }
}

/* ─── 16. ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

[dir="rtl"] .ds-toast { animation-name: slideInToastRtl; }
@keyframes slideInToastRtl {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutToast {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.12); }
    50%      { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.content-stage { animation: fadeInUp 0.3s var(--ds-ease); }

/* Staggered metric card entrance */
.row > [class*="col"]:nth-child(1) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.0s both; }
.row > [class*="col"]:nth-child(2) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.06s both; }
.row > [class*="col"]:nth-child(3) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.12s both; }
.row > [class*="col"]:nth-child(4) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.18s both; }
.row > [class*="col"]:nth-child(5) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.24s both; }
.row > [class*="col"]:nth-child(6) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.3s both; }
.row > [class*="col"]:nth-child(7) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.36s both; }
.row > [class*="col"]:nth-child(8) .metric-card { animation: fadeInUp 0.3s var(--ds-ease) 0.42s both; }

/* ─── 17. UTILITIES ──────────────────────────────────────────── */
.text-accent  { color: var(--ds-accent) !important; }
.text-primary { color: var(--ds-primary-600) !important; }
.text-warning { color: var(--ds-warning) !important; }
.text-danger  { color: var(--ds-danger) !important; }
.text-success { color: var(--ds-success) !important; }
.text-info    { color: var(--ds-info) !important; }
.text-muted   { color: var(--ds-text-muted) !important; }

.bg-accent-soft  { background: var(--ds-accent-50) !important; }
.bg-primary-soft { background: var(--ds-primary-50) !important; }
.bg-warning-soft { background: var(--ds-warning-50) !important; }
.bg-danger-soft  { background: var(--ds-danger-50) !important; }
.bg-success-soft { background: var(--ds-success-50) !important; }

/* Skeleton loaders */
.ds-skeleton {
    background: linear-gradient(90deg, var(--ds-gray-100) 25%, var(--ds-gray-50) 50%, var(--ds-gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--ds-radius-sm);
}
.ds-skeleton--text   { height: 1rem; width: 60%; margin-bottom: 0.5rem; }
.ds-skeleton--title  { height: 1.5rem; width: 40%; margin-bottom: 0.75rem; }
.ds-skeleton--avatar { width: 44px; height: 44px; border-radius: var(--ds-radius-md); }

/* Divider */
.ds-divider { height: 1px; background: var(--ds-border); margin: 1.25rem 0; border: none; }

/* ─── 18. PRINT ──────────────────────────────────────────────── */
@media print {
    .app-sidebar, .app-offcanvas, .app-topbar, .btn, .sidebar-search { display: none !important; }
    .app-main { padding: 0; }
    .surface, .table-wrap, .metric-card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
    .content-stage { animation: none; }
    .metric-card { animation: none !important; }
}

/* ─── 19. TABS ───────────────────────────────────────────────── */
.ds-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--ds-border);
    margin-bottom: 1.5rem;
    padding: 0;
    list-style: none;
    overflow-x: auto;
}
.ds-tabs::-webkit-scrollbar { display: none; }

.ds-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ds-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    border-radius: var(--ds-radius-xs) var(--ds-radius-xs) 0 0;
    position: relative;
}
.ds-tab:hover { color: var(--ds-primary); background: var(--ds-primary-50); }

.ds-tab.active,
.ds-tab[aria-selected="true"] {
    color: var(--ds-primary);
    border-bottom-color: var(--ds-primary);
    background: var(--ds-primary-50);
    font-weight: 700;
}
.ds-tab i { font-size: 0.83rem; }

.ds-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--ds-radius-full);
    background: var(--ds-gray-100);
    color: var(--ds-text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
}
.ds-tab.active .tab-count { background: var(--ds-primary-100); color: var(--ds-primary); }

/* Sub-tabs */
.ds-subtabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--ds-border-light);
    margin-bottom: 1rem;
    padding: 0;
    list-style: none;
}

.ds-subtab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ds-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.ds-subtab:hover { color: var(--ds-text-secondary); }
.ds-subtab.active, .ds-subtab[aria-selected="true"] { color: var(--ds-primary-600); border-bottom-color: var(--ds-primary-600); }

.ds-tab-content { display: none; }
.ds-tab-content.active { display: block; animation: fadeInUp 0.2s ease; }

@media (max-width: 576px) {
    .ds-tabs { gap: 0; }
    .ds-tab { padding: 8px 12px; font-size: 0.82rem; }
}

/* ─── 20. BACK TO TOP ────────────────────────────────────────── */
.ds-back-to-top {
    position: fixed;
    bottom: 2rem;
    inset-inline-end: 2rem;
    width: 42px;
    height: 42px;
    border-radius: var(--ds-radius-full);
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: var(--ds-text-inverse);
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s var(--ds-ease);
    z-index: 999;
}
.ds-back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.ds-back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

/* ─── 21. TOOLTIPS ───────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    inset-inline-start: 50%;
    transform: translateX(-50%);
    padding: 0.35rem 0.65rem;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-gray-900);
    color: var(--ds-text-inverse);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s var(--ds-ease);
    z-index: 999;
}
[dir="rtl"] [data-tooltip]::before { transform: translateX(50%); }
[data-tooltip]:hover::before { opacity: 1; }

/* ─── 22. PROGRESS BAR ──────────────────────────────────────── */
.ds-progress {
    height: 6px;
    border-radius: var(--ds-radius-full);
    background: var(--ds-gray-100);
    overflow: hidden;
}
.ds-progress-bar {
    height: 100%;
    border-radius: var(--ds-radius-full);
    background: linear-gradient(90deg, #6366f1, #818cf8);
    transition: width 0.6s var(--ds-ease);
}
.ds-progress-bar--success { background: linear-gradient(90deg, var(--ds-accent-400), var(--ds-accent-600)); }
.ds-progress-bar--danger  { background: linear-gradient(90deg, #f87171, var(--ds-danger)); }
.ds-progress-bar--warning { background: linear-gradient(90deg, #fbbf24, var(--ds-warning)); }

/* ─── 23. MOBILE BOTTOM NAV ─────────────────────────────────── */
@media (max-width: 575.98px) {
    .ds-mobile-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--ds-bg-card);
        border-top: 1px solid var(--ds-border);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
        display: flex;
        justify-content: space-around;
        padding: 0.5rem 0;
        padding-bottom: env(safe-area-inset-bottom, 0.5rem);
    }

    .ds-mobile-bar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        font-size: 0.65rem;
        color: var(--ds-text-muted);
        padding: 0.35rem 0.5rem;
        border-radius: var(--ds-radius-sm);
        transition: all var(--ds-transition);
    }
    .ds-mobile-bar a.active { color: var(--ds-primary-600); }
    .ds-mobile-bar a i { font-size: 1.1rem; }
}

/* ─── 24. CLICKABLE ROWS ────────────────────────────────────── */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: rgba(99, 102, 241, 0.03) !important; }

/* ─── 25. RESPONSIVE ENHANCEMENTS (Mobile & Tablet) ─────────── */

/* --- Tablet (≤991px) --- */
@media (max-width: 991.98px) {
    .row > [class*="col-md-3"] { flex: 0 0 50%; max-width: 50%; }
    .row > [class*="col-md-4"] { flex: 0 0 50%; max-width: 50%; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Small Tablet / Large Mobile (≤767px) --- */
@media (max-width: 767.98px) {
    /* Page header buttons */
    .page-head .d-flex.gap-2 {
        width: 100%;
        flex-wrap: wrap;
    }
    .page-head .btn { flex: 1 1 auto; min-width: 0; text-align: center; }

    /* Metric cards: 2-column grid */
    .row > [class*="col-md-3"],
    .row > [class*="col-md-4"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Surface head inline search */
    .surface-head form {
        min-width: 0 !important;
        width: 100%;
    }

    /* Filter grid stack */
    .filter-grid { grid-template-columns: 1fr; }

    /* Summary grids */
    .summary-grid { grid-template-columns: 1fr 1fr !important; }

    /* Tabs: scroll hints */
    .ds-tabs {
        scroll-snap-type: x mandatory;
        padding-bottom: 4px;
    }
    .ds-tab { scroll-snap-align: start; }

    /* Table: prevent overflow */
    .table-responsive { overflow-x: auto; }
    .table th, .table td { white-space: nowrap; }

    /* Section label headers */
    .section-label { font-size: 0.68rem; }

    /* Data cards in partner info */
    .data-card-grid .row > [class*="col-md"] { flex: 0 0 50%; max-width: 50%; }
}

/* --- Mobile (≤575px) --- */
@media (max-width: 575.98px) {
    /* Metric cards: full width stack */
    .row > [class*="col-md-3"],
    .row > [class*="col-md-4"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Metric card: compact horizontal */
    .metric-card {
        padding: 0.7rem 0.85rem;
        gap: 0.6rem;
        flex-direction: row;
        align-items: center;
    }
    .metric-icon { width: 36px; height: 36px; min-width: 36px; font-size: 0.85rem; }
    .metric-value { font-size: 1.05rem; }
    .metric-label { font-size: 0.72rem; }
    .metric-meta { font-size: 0.62rem; }

    /* Page head: compact */
    .page-head { gap: 0.5rem; padding-bottom: 0.6rem; }
    .page-head .d-flex.gap-2 {
        display: flex !important;
        gap: 0.35rem !important;
    }
    .page-head .btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    /* Tabs: compact & scrollable */
    .ds-tabs { gap: 0; margin-bottom: 1rem; }
    .ds-tab {
        padding: 7px 10px;
        font-size: 0.76rem;
        gap: 4px;
    }
    .ds-tab i { font-size: 0.72rem; }

    /* Surface spacing */
    .surface { border-radius: var(--ds-radius-md); }
    .surface-head {
        margin: -0.75rem -0.75rem 1rem;
        padding: 0.75rem;
        border-radius: calc(var(--ds-radius-md) - 1px) calc(var(--ds-radius-md) - 1px) 0 0;
    }
    .surface-head .section-label { font-size: 0.62rem; }
    .surface-title { font-size: 0.95rem; }
    .surface-subtitle { font-size: 0.72rem; }
    .p-3 { padding: 0.75rem !important; }

    /* Table mobile tweaks */
    .table thead th {
        font-size: 0.7rem;
        padding: 0.5rem 0.4rem;
    }
    .table tbody td {
        font-size: 0.78rem;
        padding: 0.5rem 0.4rem;
    }

    /* Badge */
    .badge-soft { font-size: 0.65rem !important; padding: 0.18rem 0.45rem !important; }

    /* Form controls compact */
    .form-label { font-size: 0.76rem; }
    .form-control, .form-select {
        font-size: 0.82rem;
        padding: 0.4rem 0.65rem;
    }

    /* Button compact */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
    }

    /* Summary grids: stack on mobile */
    .summary-grid { grid-template-columns: 1fr 1fr !important; }

    /* Balance card responsive */
    .balance-alert { flex-direction: column; text-align: center; gap: 0.5rem !important; }

    /* Empty state */
    .empty-state { font-size: 0.78rem; padding: 1.5rem 0.5rem; }

    /* Row numbers */
    .table th:first-child,
    .table td:first-child { min-width: 28px; padding-left: 0.3rem; padding-right: 0.3rem; }

    /* Hide less important columns on mobile */
    .table .d-mobile-none { display: none; }
}

/* ─── 25. FORM SURFACE WIDTHS ────────────────────────────────── */
.form-surface { max-width: 800px; }
.form-surface--narrow { max-width: 600px; }
.form-surface--wide { max-width: 1000px; }

/* ─── 26. BREAKDOWN ROWS ────────────────────────────────────── */
.breakdown-row { background: var(--ds-bg-inset); }
.breakdown-row td { padding-inline-start: 2rem; }

/* ─── 27. REPORT COMPONENTS ──────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.kpi-card {
    border-radius: var(--ds-radius-lg);
    border: 1px solid var(--ds-border);
    background: var(--ds-bg-card);
    padding: 1rem 1.1rem;
    box-shadow: var(--ds-shadow-card);
    transition: box-shadow 0.25s var(--ds-ease), transform 0.25s var(--ds-ease);
}
.kpi-card:hover { box-shadow: var(--ds-shadow-card-hover); transform: translateY(-2px); }

.kpi-label {
    color: var(--ds-text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.kpi-value {
    margin: 0.4rem 0 0.15rem;
    color: var(--ds-text);
    font-size: clamp(1.15rem, 1.6vw, 1.5rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.kpi-meta { font-size: 0.78rem; color: var(--ds-text-muted); }

/* Report Builder */
.builder-surface {
    border-radius: var(--ds-radius-xl);
    border: 1px solid var(--ds-border);
    background: var(--ds-bg-card);
    box-shadow: var(--ds-shadow-card);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ds-border);
    background: var(--ds-gray-50);
}

.builder-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ds-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.builder-header-title i { color: var(--ds-primary-600); }
.builder-body { padding: 1.25rem; }

/* Report Dropdown */
.rpt-dropdown { position: relative; width: 100%; }

.rpt-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--ds-radius-md);
    border: 1.5px solid var(--ds-border);
    background: var(--ds-bg-card);
    cursor: pointer;
    transition: all 0.18s var(--ds-ease);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ds-text);
    font-family: var(--ds-font);
}
.rpt-dropdown-toggle:hover,
.rpt-dropdown-toggle.open {
    border-color: var(--ds-primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.rpt-dropdown-toggle .rpt-dd-selected { display: flex; align-items: center; gap: 0.5rem; }

.rpt-dropdown-toggle .rpt-dd-arrow {
    transition: transform 0.25s var(--ds-ease);
    color: var(--ds-text-muted);
}
.rpt-dropdown-toggle.open .rpt-dd-arrow { transform: rotate(180deg); }

.rpt-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 50;
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
    padding: 0.35rem;
    max-height: min(70vh, 560px);
    overflow-y: auto;
}
.rpt-dropdown-menu::-webkit-scrollbar { width: 5px; }
.rpt-dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.rpt-dropdown-menu::-webkit-scrollbar-thumb { background: var(--ds-border); border-radius: 3px; }
.rpt-dropdown-menu.show { display: block; animation: rptDropIn 0.18s ease; }

@keyframes rptDropIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rpt-dd-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: background 0.15s var(--ds-ease);
    position: relative;
}
.rpt-dd-item:hover { background: var(--ds-gray-50); }
.rpt-dd-item.active { background: var(--ds-primary-50); }
.rpt-dd-item input { position: absolute; opacity: 0; width: 0; height: 0; }

.rpt-dd-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--ds-border);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all 0.15s var(--ds-ease);
    color: transparent;
    font-size: 0.65rem;
}
.rpt-dd-item.active .rpt-dd-check {
    background: var(--ds-primary-600);
    border-color: var(--ds-primary-600);
    color: #fff;
}

.rpt-dd-mark {
    width: 30px;
    height: 30px;
    border-radius: var(--ds-radius-sm);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--ds-primary-50);
    color: var(--ds-primary-600);
    flex-shrink: 0;
}
.rpt-dd-item.active .rpt-dd-mark { background: var(--ds-primary-600); color: #fff; }
.rpt-dd-text { font-weight: 600; font-size: 0.82rem; color: var(--ds-text); }

/* Filter Grid */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: end;
}
.filter-grid .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ds-text-secondary);
    margin-bottom: 0.3rem;
}

/* ═══ Filter Actions ═══ */
.filter-actions {
    display: flex;
    align-items: end;
}

/* ═══ Filter Panel (category/partner chips) ═══ */
.filter-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--ds-radius-lg, 0.75rem);
    background: var(--ds-gray-50, #f9fafb);
    border: 1px dashed var(--ds-border);
}
.filter-panel-label {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 0.25rem;
    color: var(--ds-text);
}
.filter-panel-hint {
    font-size: 0.78rem;
    color: var(--ds-text-muted);
    margin-bottom: 0.75rem;
}
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.category-chip {
    cursor: pointer;
    margin: 0;
}
.category-chip input[type="checkbox"] {
    display: none;
}
.category-chip-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--ds-border);
    background: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ds-text-secondary);
    transition: all 0.18s;
    -webkit-user-select: none;
    user-select: none;
}
.category-chip-label:hover {
    border-color: var(--ds-primary-400);
    color: var(--ds-primary);
}
.category-chip input:checked + .category-chip-label {
    background: var(--ds-primary-50);
    border-color: var(--ds-primary-500);
    color: var(--ds-primary);
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--ds-primary-100);
}

/* ═══ Expense Category Cards ═══ */
.expense-cat-card {
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg, 0.75rem);
    overflow: hidden;
    background: #fff;
}
.expense-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.expense-cat-header:hover {
    background: var(--ds-gray-50, #f9fafb);
}
.expense-cat-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.92rem;
}
.cat-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    background: var(--ds-danger);
    flex-shrink: 0;
}
.expense-cat-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.expense-cat-stat {
    text-align: center;
}
.expense-cat-stat-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ds-text);
}
.expense-cat-stat-label {
    font-size: 0.7rem;
    color: var(--ds-text-muted);
}
.expense-cat-toggle {
    color: var(--ds-text-muted);
    transition: transform 0.25s;
}
.expense-cat-toggle.rotated {
    transform: rotate(180deg);
}
.expense-cat-bar {
    height: 4px;
    background: var(--ds-gray-100, #f3f4f6);
}
.expense-cat-bar-fill {
    height: 100%;
    background: var(--ds-danger);
    border-radius: 0 4px 4px 0;
    transition: width 0.4s ease;
}
.expense-cat-details {
    display: none;
    border-top: 1px solid var(--ds-border);
}
.expense-cat-details.open {
    display: block;
}
.expense-cat-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--ds-border-light, rgba(0,0,0,0.04));
}
.expense-cat-detail-row:last-child {
    border-bottom: none;
}

@media (max-width: 767.98px) {
    .expense-cat-header {
        flex-direction: column;
        align-items: stretch;
    }
    .expense-cat-stats {
        justify-content: space-around;
    }
    .expense-cat-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

.surface-title--alert {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.surface-title-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.62rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ds-warning-100) 0%, #fff4d6 100%);
    color: var(--ds-warning-700);
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.16);
    flex-shrink: 0;
}

.surface-title-icon i {
    font-size: 0.84rem;
}

.report-hero {
    border-radius: var(--ds-radius-xl);
    border: 1px solid var(--ds-border);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--ds-shadow-card);
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
    gap: 0.9rem;
}

.report-hero--primary {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.96));
}

.report-hero--danger {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.96), rgba(255, 255, 255, 0.96));
}

.report-hero--success {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.96));
}

.report-hero--gold,
.report-hero--neutral {
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.96));
}

.report-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.report-hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ds-text-secondary);
}

.report-hero-title {
    margin: 0;
    font-size: clamp(1.2rem, 1.9vw, 1.6rem);
    font-weight: 800;
    color: var(--ds-text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.report-hero-icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--ds-text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
}

.report-hero-desc {
    margin: 0;
    color: var(--ds-text-secondary);
    font-size: 0.88rem;
    line-height: 1.65;
}

.report-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-hero-stats {
    display: grid;
    gap: 0.55rem;
}

.report-hero-stat {
    border-radius: var(--ds-radius-lg);
    border: 1px solid var(--ds-border);
    background: rgba(255, 255, 255, 0.82);
    padding: 0.8rem 0.85rem;
}

.report-hero-stat span {
    font-size: 0.77rem;
    color: var(--ds-text-muted);
    display: block;
    margin-bottom: 0.2rem;
}

.report-hero-stat strong {
    color: var(--ds-text);
    font-size: 1.1rem;
}

.kpi-card--focus {
    position: relative;
    overflow: hidden;
}

.kpi-card--focus::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0;
    width: 100%;
    height: 4px;
    background: var(--ds-primary-500);
}

.kpi-card--danger::before { background: var(--ds-danger-500); }
.kpi-card--success::before { background: var(--ds-success-500); }
.kpi-card--gold::before,
.kpi-card--neutral::before { background: var(--ds-warning-500); }

.kpi-value--adaptive {
    font-size: clamp(1rem, 1.5vw, 1.45rem);
    line-height: 1.35;
}

.builder-surface--modern {
    border-radius: var(--ds-radius-xl);
    overflow: hidden;
}

.builder-header-desc {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--ds-text-muted);
}

.results-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--ds-text-muted);
}

@media (max-width: 1199.98px) {
    .report-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .builder-header,
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── Notification Bell ──────────────────────────────────────────── */
.notif-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notif-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1.5px solid var(--ds-border);
    background: var(--ds-bg-card);
    color: var(--ds-text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.notif-btn:hover {
    border-color: var(--ds-primary-500);
    color: var(--ds-primary-500);
    background: var(--ds-primary-50);
    transform: scale(1.05);
}

.notif-badge {
    position: absolute;
    top: -0.3rem;
    inset-inline-end: -0.3rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--ds-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.2rem;
    text-align: center;
    border: 2px solid var(--ds-bg-card);
    pointer-events: none;
}

/* Notification Panel */
.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    inset-inline-end: 0;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
    z-index: 1080;
    overflow: hidden;
    animation: notifSlideIn 0.18s ease;
}

.notif-panel--open {
    display: flex;
    flex-direction: column;
}

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1.5px solid var(--ds-border);
    background: var(--ds-primary-50);
}

.notif-panel-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ds-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.notif-panel-close {
    background: none;
    border: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: var(--ds-radius-sm);
    transition: background 0.15s;
    line-height: 1;
}

.notif-panel-close:hover {
    background: var(--ds-bg-surface);
    color: var(--ds-danger);
}

.notif-panel-body {
    max-height: 22rem;
    overflow-y: auto;
}

/* Group header */
.notif-group-label {
    padding: 0.45rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ds-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--ds-bg-surface);
    border-bottom: 1px solid var(--ds-border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.notif-group-count {
    margin-inline-start: auto;
    background: var(--ds-primary-100);
    color: var(--ds-primary);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Notification item */
.notif-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--ds-border);
    text-decoration: none;
    color: var(--ds-text-primary);
    transition: background 0.14s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--ds-primary-50);
}

.notif-item-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.notif-item-icon--warning { background: #fff4d6; color: #d97706; }
.notif-item-icon--danger  { background: #fee2e2; color: var(--ds-danger); }
.notif-item-icon--gold    { background: var(--ds-gold-100, #fef3c7); color: #b45309; }

/* ═══════════════════════════════════════════════════════════════
   RTL LAYOUT OVERRIDES — Arabic (dir="rtl")
   Bootstrap RTL CSS + direction:rtl inheritance handles flex
   ordering automatically. Only override text-align, direction,
   and physical properties that can't use logical CSS.
   ═══════════════════════════════════════════════════════════════ */

/* ── Base ── */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}
[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

/* ── Sidebar borders ── */
[dir="rtl"] .app-sidebar,
[dir="rtl"] .app-offcanvas {
    border-inline-end: none;
    border-inline-start: 1px solid var(--ds-sidebar-border);
}
[dir="rtl"] .brand-block::after {
    background: linear-gradient(270deg, transparent, rgba(129, 140, 248, 0.2), transparent);
}

/* ── Topbar: ensure direction propagates ── */
[dir="rtl"] .app-topbar { direction: rtl; }

/* ── Nav text alignment ── */
[dir="rtl"] .nav-group-toggle { text-align: right; }
[dir="rtl"] .nav-link-item    { text-align: right; }
[dir="rtl"] .nav-section-label { text-align: right; }

/* ── Active nav indicator flips to right edge ── */
[dir="rtl"] .nav-link-item.active::before {
    border-radius: var(--ds-radius-xs) 0 0 var(--ds-radius-xs);
}

/* ── Page title ── */
[dir="rtl"] .page-title { text-align: right; }

/* ── Metric cards ── */
[dir="rtl"] .metric-body  { text-align: right; }
[dir="rtl"] .metric-label,
[dir="rtl"] .metric-value,
[dir="rtl"] .metric-meta  { text-align: right; }

/* ── Surfaces & cards ── */
[dir="rtl"] .surface-head > div  { text-align: right; }
[dir="rtl"] .surface-title       { text-align: right; }
[dir="rtl"] .surface-subtitle    { text-align: right; }
[dir="rtl"] .surface-head::before {
    border-radius: 2px 0 0 2px;
}
[dir="rtl"] .section-label      { text-align: right; }

/* ── Forms ── */
[dir="rtl"] .form-label { text-align: right; }
[dir="rtl"] .form-text  { text-align: right; display: block; }
[dir="rtl"] .form-control,
[dir="rtl"] .form-select {
    text-align: right;
    direction: rtl;
}
/* Numbers/dates keep LTR but align right */
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="date"],
[dir="rtl"] input[type="month"],
[dir="rtl"] input[type="time"] {
    direction: ltr;
    text-align: right;
}

/* ── Force Western (Latin) numerals in date inputs for LTR/English pages ──
   Chrome's native date picker inherits the page lang; the ::-webkit-datetime-edit
   pseudo-elements let us override the displayed text inside the input box itself.
   The popup calendar is controlled via the JS lang-fix below (see layout). */
[dir="ltr"] input[type="date"],
[dir="ltr"] input[type="month"],
[dir="ltr"] input[type="time"],
[dir="ltr"] input[type="datetime-local"] {
    font-variant-numeric: normal;
    font-feature-settings: normal;
}
[dir="ltr"] input[type="date"]::-webkit-datetime-edit,
[dir="ltr"] input[type="date"]::-webkit-datetime-edit-fields-wrapper,
[dir="ltr"] input[type="date"]::-webkit-datetime-edit-text,
[dir="ltr"] input[type="date"]::-webkit-datetime-edit-month-field,
[dir="ltr"] input[type="date"]::-webkit-datetime-edit-day-field,
[dir="ltr"] input[type="date"]::-webkit-datetime-edit-year-field,
[dir="ltr"] input[type="month"]::-webkit-datetime-edit,
[dir="ltr"] input[type="month"]::-webkit-datetime-edit-fields-wrapper,
[dir="ltr"] input[type="month"]::-webkit-datetime-edit-month-field,
[dir="ltr"] input[type="month"]::-webkit-datetime-edit-year-field {
    font-family: 'Segoe UI', Arial, system-ui, sans-serif;
    unicode-bidi: isolate;
    direction: ltr;
    font-variant-numeric: normal;
}
/* Checkboxes: use physical padding so checkbox sits on right */
[dir="rtl"] .form-check {
    padding-left: 0;
    padding-right: 1.5em;
    text-align: right;
}
[dir="rtl"] .form-check-input {
    float: right;
    margin-left: 0;
    margin-right: -1.5em;
}
[dir="rtl"] .form-check-label { text-align: right; }

/* ── Tables ── */
[dir="rtl"] .table th,
[dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .table th:last-child,
[dir="rtl"] .table td:last-child { text-align: center; }

/* ── Modals ── */
/* Ensure modal always appears above backdrop and other overlays */
.modal { --bs-modal-zindex: 1060; }
.modal-backdrop { --bs-backdrop-zindex: 0; }

[dir="rtl"] .modal-header { direction: rtl; text-align: right; }
[dir="rtl"] .modal-header .btn-close { margin-left: 0; margin-right: auto; }
[dir="rtl"] .modal-title { text-align: right; }
[dir="rtl"] .modal-body  { direction: rtl; text-align: right; }

/* ── Alerts ── */
[dir="rtl"] .alert { direction: rtl; text-align: right; }

/* ── Tabs: set direction so they flow right-to-left ── */
[dir="rtl"] .ds-tabs      { direction: rtl; }
[dir="rtl"] .sales-stepper { direction: rtl; }

/* ── Dropdowns ── */
[dir="rtl"] .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}
[dir="rtl"] .dropdown-item { text-align: right; }

/* ── Badges & pills ── */
[dir="rtl"] .badge-soft { direction: rtl; }

/* ── Review card ── */
[dir="rtl"] .review-grid { direction: rtl; }

/* ── Toast ── */
[dir="rtl"] .ds-toast { direction: rtl; text-align: right; }

/* ── Notification panel ── */
[dir="rtl"] .notif-panel      { direction: rtl; text-align: right; }
[dir="rtl"] .notif-item-body  { text-align: right; }

/* ══════════════════════════════════════════════════════════════
   LTR EXPLICIT OVERRIDES — English (dir="ltr")
   Resets the few physical-property overrides from the RTL block.
   ══════════════════════════════════════════════════════════════ */
[dir="ltr"] {
    direction: ltr;
    text-align: left;
}
[dir="ltr"] body { direction: ltr; text-align: left; }
[dir="ltr"] .app-topbar { direction: ltr; }
[dir="ltr"] .form-label  { text-align: left; }
[dir="ltr"] .form-control,
[dir="ltr"] .form-select { text-align: left; direction: ltr; }
[dir="ltr"] .form-check  { padding-left: 1.5em; padding-right: 0; }
[dir="ltr"] .form-check-input { float: left; margin-left: -1.5em; margin-right: 0; }
[dir="ltr"] .modal-header { direction: ltr; }
[dir="ltr"] .modal-header .btn-close { margin-right: 0; margin-left: auto; }
[dir="ltr"] .modal-body  { direction: ltr; }
[dir="ltr"] .alert       { direction: ltr; text-align: left; }
[dir="ltr"] .ds-tabs      { direction: ltr; }
[dir="ltr"] .sales-stepper { direction: ltr; }
[dir="ltr"] .dropdown-menu { right: auto; left: 0; text-align: left; }
[dir="ltr"] .dropdown-item { text-align: left; }
[dir="ltr"] .table th,
[dir="ltr"] .table td { text-align: left; }
[dir="ltr"] .table th:last-child,
[dir="ltr"] .table td:last-child { text-align: center; }

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ds-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-meta {
    font-size: 0.72rem;
    color: var(--ds-text-secondary);
    margin-top: 0.1rem;
}

/* Loading / Empty */
.notif-loading,
.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ds-text-secondary);
    font-size: 0.875rem;
}

.notif-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.notif-empty p {
    margin: 0;
}

/* ── Report Group Tabs ──────────────────────────────────────── */
.rpt-group-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    -ms-overflow-style: none;
}
.rpt-group-tabs::-webkit-scrollbar { display: none; }

.rpt-group-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--ds-radius-lg);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    color: var(--ds-text-secondary);
    background: var(--ds-bg-card);
    border: 1.5px solid var(--ds-border);
    transition: all 0.18s ease;
    cursor: pointer;
}
.rpt-group-tab:hover {
    border-color: var(--ds-primary-400);
    color: var(--ds-primary);
    background: var(--ds-primary-50);
}
.rpt-group-tab--active {
    color: #fff !important;
    background: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
}

/* Tone overrides for active tabs */
.rpt-group-tab--danger.rpt-group-tab--active  { background: var(--ds-danger) !important; border-color: var(--ds-danger) !important; }
.rpt-group-tab--success.rpt-group-tab--active { background: var(--ds-success) !important; border-color: var(--ds-success) !important; }
.rpt-group-tab--gold.rpt-group-tab--active    { background: var(--ds-gold, #b45309) !important; border-color: var(--ds-gold, #b45309) !important; }
.rpt-group-tab--primary.rpt-group-tab--active { background: var(--ds-primary) !important; border-color: var(--ds-primary) !important; }

/* Tone hover */
.rpt-group-tab--danger:hover  { border-color: var(--ds-danger); color: var(--ds-danger); background: var(--ds-danger-50, #fef2f2); }
.rpt-group-tab--success:hover { border-color: var(--ds-success); color: var(--ds-success); background: var(--ds-success-100); }
.rpt-group-tab--gold:hover    { border-color: var(--ds-gold, #b45309); color: var(--ds-gold, #b45309); background: var(--ds-gold-100, #fef3c7); }

/* ── Report Type Cards ──────────────────────────────────────── */
.rpt-type-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rpt-type-card {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: var(--ds-radius-lg);
    border: 1.5px solid var(--ds-border);
    background: var(--ds-bg-card);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ds-text-secondary);
    transition: all 0.18s ease;
    -webkit-user-select: none;
    user-select: none;
}
.rpt-type-card:hover {
    border-color: var(--ds-primary-400);
    background: var(--ds-primary-50);
    color: var(--ds-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.rpt-type-card-mark {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    background: var(--ds-gray-400);
    flex-shrink: 0;
    transition: background 0.18s;
}

.rpt-type-card-label {
    white-space: nowrap;
}

.rpt-type-card-check {
    display: none;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--ds-primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    flex-shrink: 0;
}

/* Active state */
.rpt-type-card--active {
    border-color: var(--ds-primary-500);
    background: var(--ds-primary-50);
    color: var(--ds-primary);
    box-shadow: 0 0 0 2px var(--ds-primary-100);
}
.rpt-type-card--active .rpt-type-card-check {
    display: flex;
}
.rpt-type-card--active .rpt-type-card-mark {
    background: var(--ds-primary);
}

/* Tone mark backgrounds for active cards */
.rpt-type-card--danger.rpt-type-card--active { border-color: var(--ds-danger); box-shadow: 0 0 0 2px #fee2e2; color: var(--ds-danger); background: #fef2f2; }
.rpt-type-card--danger.rpt-type-card--active .rpt-type-card-mark { background: var(--ds-danger); }
.rpt-type-card--danger.rpt-type-card--active .rpt-type-card-check { background: var(--ds-danger); }

.rpt-type-card--success.rpt-type-card--active { border-color: var(--ds-success); box-shadow: 0 0 0 2px var(--ds-success-100); color: var(--ds-success); background: #f0fdf4; }
.rpt-type-card--success.rpt-type-card--active .rpt-type-card-mark { background: var(--ds-success); }
.rpt-type-card--success.rpt-type-card--active .rpt-type-card-check { background: var(--ds-success); }

.rpt-type-card--gold.rpt-type-card--active { border-color: var(--ds-gold, #b45309); box-shadow: 0 0 0 2px var(--ds-gold-100, #fef3c7); color: var(--ds-gold, #b45309); background: #fffbeb; }
.rpt-type-card--gold.rpt-type-card--active .rpt-type-card-mark { background: var(--ds-gold, #b45309); }
.rpt-type-card--gold.rpt-type-card--active .rpt-type-card-check { background: var(--ds-gold, #b45309); }

.rpt-type-card--primary.rpt-type-card--active .rpt-type-card-mark { background: var(--ds-primary); }

/* Tone hover */
.rpt-type-card--danger:hover  { border-color: var(--ds-danger); color: var(--ds-danger); background: #fef2f2; }
.rpt-type-card--success:hover { border-color: var(--ds-success); color: var(--ds-success); background: #f0fdf4; }
.rpt-type-card--gold:hover    { border-color: var(--ds-gold, #b45309); color: var(--ds-gold, #b45309); background: #fffbeb; }

/* KPI Card Tone Accent */
.kpi-card--danger  { border-top: 3px solid var(--ds-danger); }
.kpi-card--success { border-top: 3px solid var(--ds-success); }
.kpi-card--gold    { border-top: 3px solid var(--ds-gold, #b45309); }
.kpi-card--primary { border-top: 3px solid var(--ds-primary); }

/* ═══ Report Section Divider ═══ */
.rpt-section-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0.5rem;
}
.rpt-section-divider::before,
.rpt-section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ds-border);
}
.rpt-section-badge {
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Report Analytics (Charts) ─────────────────────────────── */
.report-analytics {
    border-radius: var(--ds-radius-xl);
    border: 1px solid var(--ds-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--ds-shadow-card);
    margin-bottom: 1rem;
}

.report-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    padding: 0 1.1rem 1.1rem;
}

.analytics-card {
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-card);
    box-shadow: var(--ds-shadow-xs);
    overflow: hidden;
}

.analytics-card--wide {
    grid-column: span 2;
}

.analytics-card-head {
    padding: 0.85rem 0.95rem;
    border-bottom: 1px solid var(--ds-border-light);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.analytics-card-head h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ds-text);
}

.analytics-card-head small {
    font-size: 0.75rem;
    color: var(--ds-text-muted);
}

.analytics-canvas-wrap {
    position: relative;
    height: 260px;
    padding: 0.6rem 0.7rem 0.8rem;
}

.analytics-card--wide .analytics-canvas-wrap {
    height: 280px;
}

.analytics-empty {
    position: absolute;
    inset: 0.8rem;
    border: 1px dashed var(--ds-border);
    border-radius: var(--ds-radius-md);
    display: grid;
    place-items: center;
    text-align: center;
    padding: 1rem;
    color: var(--ds-text-muted);
    font-size: 0.85rem;
    background: var(--ds-gray-50);
}

@media (max-width: 767.98px) {
    .rpt-type-cards {
        gap: 0.35rem;
    }
    .rpt-type-card {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
    .rpt-type-card-mark {
        width: 1.3rem;
        height: 1.3rem;
        font-size: 0.65rem;
    }

    .report-analytics-grid {
        grid-template-columns: 1fr;
        padding: 0 0.75rem 0.85rem;
    }

    .analytics-card--wide {
        grid-column: auto;
    }

    .analytics-canvas-wrap,
    .analytics-card--wide .analytics-canvas-wrap {
        height: 235px;
    }
}
.modal-backdrop{
  z-index: 0!important;}
/* ══════════════════════════════════════════════════════════════
   FLATPICKR THEME — integrates with the design system
   ══════════════════════════════════════════════════════════════ */
.flatpickr-calendar {
    font-family: var(--ds-font, 'IBM Plex Sans Arabic', sans-serif);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg, 12px);
    box-shadow: var(--ds-shadow-lg);
    background: var(--ds-bg-card, #fff);
    z-index: 99999 !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month,
.flatpickr-monthDropdown-months {
    background: var(--ds-primary, #1e3a5f);
    color: #fff;
    border-radius: var(--ds-radius-lg, 12px) var(--ds-radius-lg, 12px) 0 0;
}
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: rgba(255,255,255,.85) !important;
    fill: rgba(255,255,255,.85) !important;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: #fff !important;
    fill: #fff !important;
}
.flatpickr-weekdays { background: var(--ds-primary-50, #eff6ff); }
span.flatpickr-weekday {
    color: var(--ds-primary, #1e3a5f);
    font-weight: 600;
    font-size: 0.78rem;
}
.flatpickr-day {
    border-radius: var(--ds-radius-md, 8px);
    font-size: 0.875rem;
    color: var(--ds-text, #111827);
    font-variant-numeric: normal;
    font-feature-settings: normal;
}
.flatpickr-day.today {
    border-color: var(--ds-primary-500, #3b82f6);
    color: var(--ds-primary-600, #2563eb);
    font-weight: 700;
}
.flatpickr-day.today:not(.selected):hover {
    background: var(--ds-primary-50, #eff6ff);
    border-color: var(--ds-primary-500, #3b82f6);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--ds-primary, #1e3a5f);
    border-color: var(--ds-primary, #1e3a5f);
    color: #fff;
}
.flatpickr-day:hover:not(.selected):not(.today) {
    background: var(--ds-bg-inset, #f1f5f9);
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--ds-gray-300, #cbd5e1);
}
/* RTL calendar layout */
[dir="rtl"] .flatpickr-calendar { direction: rtl; }
[dir="rtl"] .flatpickr-months  { direction: rtl; }
[dir="rtl"] .flatpickr-weekdays span { direction: rtl; }

/* Make Flatpickr input look identical to .form-control */
.flatpickr-input {
    background-color: var(--ds-bg-card, #fff) !important;
    cursor: pointer;
}
.flatpickr-input.active,
.flatpickr-input:focus {
    border-color: var(--ds-primary-500, #3b82f6) !important;
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,.15) !important;
    outline: none !important;
}

/* ══════════════════════════════════════════════════════════════
   PAY MODAL — invoice payment modal redesign
   ══════════════════════════════════════════════════════════════ */
.pay-modal-content {
    border: none;
    border-radius: var(--ds-radius-lg, 12px);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.pay-modal-header {
    background: linear-gradient(135deg, var(--ds-primary, #1e3a5f) 0%, #2c5282 100%);
    color: #fff;
    border-bottom: none;
    padding: 1.1rem 1.4rem;
}
.pay-modal-header .modal-title { font-size: 1.05rem; font-weight: 700; }
.pay-modal-header .btn-close-white { filter: invert(1) grayscale(1); }

/* ── Summary grid ── */
.pay-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}
.pay-summary-item {
    background: var(--ds-bg-muted, #f8fafc);
    border: 1.5px solid var(--ds-border, #e2e8f0);
    border-radius: var(--ds-radius, 8px);
    padding: 0.55rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pay-summary-item--highlight {
    grid-column: 1 / -1;
    background: #fff5f5;
    border-color: #feb2b2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}
.pay-summary-label {
    font-size: 0.72rem;
    color: var(--ds-text-muted, #64748b);
    font-weight: 500;
    white-space: nowrap;
}
.pay-summary-value {
    font-size: 0.9rem;
    color: var(--ds-text-primary, #1e293b);
    word-break: break-word;
}


/* ══════════════════════════════════════════════════════════════
   ATTACHMENTS GRID — file attachment display
   ══════════════════════════════════════════════════════════════ */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}
.attachment-card {
    border: 1.5px solid var(--ds-border, #e2e8f0);
    border-radius: var(--ds-radius, 8px);
    padding: 0.6rem;
    background: var(--ds-bg-card, #fff);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: box-shadow 0.15s;
}
.attachment-card:hover { box-shadow: var(--ds-shadow, 0 2px 8px rgba(0,0,0,.08)); }
.attachment-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    border-radius: var(--ds-radius-sm, 6px);
    overflow: hidden;
    background: var(--ds-bg-muted, #f8fafc);
    text-decoration: none;
}
.attachment-preview--file { cursor: pointer; }
.attachment-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.attachment-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.attachment-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ds-text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-size {
    font-size: 0.68rem;
    color: var(--ds-text-muted, #64748b);
}

/* ══════════════════════════════════════════════════════════════
   TRANSACTION DETAIL — dl grid
   ══════════════════════════════════════════════════════════════ */
.txn-dl { display: grid; gap: 0; }
.txn-dl-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--ds-border-light);
    align-items: center;
}
.txn-dl-row:last-child { border-bottom: none; }
.txn-dl-row dt {
    font-size: 0.78rem;
    color: var(--ds-text-muted);
    font-weight: 500;
}
.txn-dl-row dd {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ds-text);
    margin: 0;
    text-align: end;
}

/* ══════════════════════════════════════════════════════════════
   STMT MODAL — Attachment grid (built by JS, no innerHTML string)
   ══════════════════════════════════════════════════════════════ */
.stmt-att-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.stmt-att-card {
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    background: var(--ds-bg-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s var(--ds-ease), transform 0.2s var(--ds-ease);
    box-shadow: var(--ds-shadow-xs);
}
.stmt-att-card:hover { box-shadow: var(--ds-shadow-md); transform: translateY(-2px); }

/* image preview */
.stmt-att-preview { position: relative; flex-shrink: 0; }

.stmt-att-img-wrap {
    display: block;
    width: 100%;
    height: 110px;
    overflow: hidden;
    background: var(--ds-gray-100);
    position: relative;
    cursor: zoom-in;
}
.stmt-att-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s var(--ds-ease);
}
.stmt-att-card:hover .stmt-att-img { transform: scale(1.06); }

.stmt-att-zoom {
    position: absolute;
    inset: 0;
    background: rgba(10,15,40,0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.stmt-att-card:hover .stmt-att-zoom { opacity: 1; }

.stmt-att-fallback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 110px;
    font-size: 2.2rem;
    color: var(--ds-info);
    background: var(--ds-info-50, #f0f9ff);
}

/* file type placeholder */
.stmt-att-file-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    height: 110px;
    font-size: 2.4rem;
    color: var(--ds-gray-400);
    background: var(--ds-gray-50);
    text-decoration: none;
    transition: filter 0.2s;
}
.stmt-att-file-wrap--pdf { color: #dc2626; background: #fef2f2; }
.stmt-att-card:hover .stmt-att-file-wrap { filter: brightness(0.95); }

.stmt-att-ext {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    opacity: 0.65;
}

/* info bar */
.stmt-att-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.45rem 0.55rem;
    border-top: 1px solid var(--ds-border-light);
}
.stmt-att-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ds-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
}
.stmt-att-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}
.stmt-att-size {
    font-size: 0.6rem;
    color: var(--ds-text-muted);
}
.stmt-att-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--ds-radius-xs);
    background: var(--ds-section-bg);
    color: var(--ds-section-color);
    font-size: 0.62rem;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s;
}
.stmt-att-dl:hover { background: var(--ds-section-border); color: var(--ds-section-color); }

/* ══════════════════════════════════════════════════════════════
   ATTACHMENT VIEWER v3 — Professional grid + full lightbox
   ══════════════════════════════════════════════════════════════ */

/* ── Grid ── */
.attach-viewer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

/* ── Card ── */
.attach-card {
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.22s var(--ds-ease), transform 0.22s var(--ds-ease), border-color 0.22s;
    box-shadow: var(--ds-shadow-card);
}
.attach-card:hover {
    box-shadow: var(--ds-shadow-card-hover);
    transform: translateY(-3px);
    border-color: var(--ds-section-border);
}

/* ── Image preview button ── */
.attach-preview {
    position: relative;
    flex-shrink: 0;
}
.attach-img-btn {
    position: relative;
    display: block;
    width: 100%;
    height: 140px;
    background: var(--ds-gray-100);
    border: none;
    padding: 0;
    cursor: zoom-in;
    overflow: hidden;
    outline: none;
}
.attach-img-btn--error {
    cursor: default;
    background: var(--ds-gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    image-orientation: from-image;
    transition: transform 0.35s var(--ds-ease), opacity 0.25s;
    display: block;
}
.attach-card:hover .attach-thumb { transform: scale(1.06); }

.attach-err-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--ds-gray-300);
}

.attach-zoom-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 40, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    opacity: 0;
    transition: opacity 0.2s var(--ds-ease);
    pointer-events: none;
}
.attach-card:hover .attach-zoom-overlay { opacity: 1; }

/* ── File-type cards (PDF, Excel, generic) ── */
.attach-file-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 140px;
    font-size: 2.75rem;
    text-decoration: none;
    overflow: hidden;
    transition: filter 0.2s;
}
.attach-card:hover .attach-file-btn { filter: brightness(0.95); }

.attach-file-btn--pdf    { color: #dc2626; background: linear-gradient(160deg, #fef2f2 0%, #fee2e2 100%); }
.attach-file-btn--excel  { color: #16a34a; background: linear-gradient(160deg, #f0fdf4 0%, #dcfce7 100%); }
.attach-file-btn--generic {
    color: var(--ds-gray-400);
    background: linear-gradient(160deg, var(--ds-gray-50) 0%, var(--ds-gray-100) 100%);
}

.attach-file-ext {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-top: -0.25rem;
}

.attach-open-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 40, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.attach-card:hover .attach-open-overlay { opacity: 1; }

/* ── Info bar ── */
.attach-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.6rem 0.7rem;
    border-top: 1px solid var(--ds-border-light);
}

.attach-filename {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--ds-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.35;
}

.attach-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
}

.attach-size {
    font-size: 0.66rem;
    color: var(--ds-text-muted);
    font-variant-numeric: tabular-nums;
}

.attach-dl-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-section-bg);
    color: var(--ds-section-color);
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
    text-decoration: none;
}
.attach-dl-link:hover {
    background: var(--ds-section-border);
    color: var(--ds-section-color);
    transform: translateY(-1px);
}

/* ── Empty state ── */
.attach-empty {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ds-text-muted);
    font-size: 0.88rem;
    padding: 1rem 0;
}
.attach-empty i { font-size: 1.3rem; color: var(--ds-gray-300); }

/* ── DS Lightbox ── */
.ds-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.ds-lightbox--open { display: flex !important; }

.ds-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 22, 0.88);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: lbFadeIn 0.22s ease forwards;
}

@keyframes lbFadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbFadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes lbSlideUp  { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes lbSlideDown{ from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); } }

/* closing state — applied just before display:none */
.ds-lightbox--closing .ds-lightbox-backdrop { animation: lbFadeOut 0.22s ease forwards; }
.ds-lightbox--closing .ds-lightbox-panel    { animation: lbSlideDown 0.22s var(--ds-ease) forwards; }
.ds-lightbox--closing .ds-lightbox-nav      { opacity: 0; pointer-events: none; }

.ds-lightbox-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    max-width: min(94vw, 1100px);
    width: 100%;
    animation: lbSlideUp 0.25s var(--ds-ease) forwards;
}

.ds-lightbox-close {
    position: absolute;
    top: -3.2rem;
    inset-inline-end: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--ds-radius-full);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    display: grid;
    place-items: center;
    transition: background 0.15s, transform 0.15s;
    z-index: 2;
}
.ds-lightbox-close:hover { background: rgba(255,255,255,0.28); transform: scale(1.08) rotate(90deg); }

.ds-lightbox-body {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.ds-lightbox-img-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.ds-lightbox-img {
    max-width: 100%;
    max-height: calc(80vh - 6rem);
    width: auto;
    height: auto;
    border-radius: var(--ds-radius-xl);
    object-fit: contain;
    image-orientation: from-image;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
    transition: opacity 0.3s ease;
    display: block;
}

.ds-lightbox-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
}

.ds-lightbox-dl {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.1rem;
    border-radius: var(--ds-radius-full);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.ds-lightbox-dl:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ── Lightbox nav prev/next ── */
.ds-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.8rem;
    height: 2.8rem;
    border-radius: var(--ds-radius-full);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    display: grid;
    place-items: center;
    z-index: 3;
    transition: background 0.15s, opacity 0.15s, transform 0.15s;
}
.ds-lightbox-nav:hover { background: rgba(255, 255, 255, 0.28); }
.ds-lightbox-nav[hidden] { display: none !important; }
/* inset-inline-start = right in RTL → where "previous" image is */
.ds-lightbox-nav--prev { inset-inline-start: 0.75rem; }
.ds-lightbox-nav--next { inset-inline-end:   0.75rem; }

/* ── Lightbox footer (caption + counter) ── */
.ds-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: wrap;
}
.ds-lightbox-caption {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    margin: 0;
    text-align: center;
    word-break: break-word;
    line-height: 1.5;
    flex: 1 1 auto;
    max-width: 600px;
}
.ds-lightbox-counter {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.55rem;
    border-radius: var(--ds-radius-full);
}

@media (max-width: 575.98px) {
    .ds-lightbox-nav--prev { inset-inline-start: 0.25rem; }
    .ds-lightbox-nav--next { inset-inline-end:   0.25rem; }
    .ds-lightbox-nav { width: 2.2rem; height: 2.2rem; font-size: 0.85rem; }
}

/* ══════════════════════════════════════════════════════════════
   SUPPLIER — Avatar, debt progress bar
   ══════════════════════════════════════════════════════════════ */
.supplier-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--ds-radius-md);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--ds-primary) 0%, var(--ds-primary-600) 100%);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.supplier-avatar--lg {
    width: 54px;
    height: 54px;
    border-radius: var(--ds-radius-lg);
    font-size: 1.35rem;
    box-shadow: 0 4px 14px rgba(30, 58, 95, 0.28);
}

.supplier-debt-bar {
    height: 4px;
    border-radius: var(--ds-radius-full);
    background: var(--ds-gray-100);
    overflow: hidden;
    margin-top: 5px;
}
.supplier-debt-fill {
    height: 100%;
    border-radius: var(--ds-radius-full);
    transition: width 0.45s var(--ds-ease);
}
.supplier-debt-fill--ok      { background: linear-gradient(90deg, var(--ds-success), #4ade80); }
.supplier-debt-fill--warning { background: linear-gradient(90deg, var(--ds-warning), #fbbf24); }
.supplier-debt-fill--danger  { background: linear-gradient(90deg, var(--ds-danger), #f87171); }

/* ── Supplier table row avatar cell ── */
.supplier-row-name {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.supplier-row-name .supplier-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
    border-radius: var(--ds-radius-sm);
    flex-shrink: 0;
}
.supplier-row-info { min-width: 0; }
.supplier-row-title {
    font-weight: 700;
    color: var(--ds-text);
    font-size: 0.9rem;
    line-height: 1.2;
}
.supplier-row-meta {
    font-size: 0.74rem;
    color: var(--ds-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Remaining amount cell with mini bar ── */
.remaining-cell { min-width: 120px; }
.remaining-cell .status-pill { display: inline-block; margin-bottom: 3px; }

@media (max-width: 767.98px) {
    .attach-viewer { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.65rem; }
    .attach-img-btn, .attach-file-btn { height: 110px; }
}
@media (max-width: 575.98px) {
    .attach-viewer { grid-template-columns: repeat(2, 1fr); }
    .attach-img-btn, .attach-file-btn { height: 96px; }
}

/* ================================================================
   SECTION THEME COLORS  v2
   Each route group gets its own accent via data-section on <body>.
   Overrides --ds-section-* (content) AND --ds-nav-* (sidebar).
   Bootstrap primary / focus rings are NOT changed.
   ================================================================ */

/* ── helpers used by nav + surface ── */
.surface {
    border-top: 3px solid var(--ds-section-color);
    border-radius: var(--ds-radius-xl);
}
.page-head { border-bottom-color: var(--ds-section-border); }

/* ── Form section dividers ── */
.form-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ds-section-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--ds-section-border);
    margin-bottom: 0.25rem;
}
.form-section-title i { font-size: 0.68rem; }

/* ── Cheque card ── */
.cheque-card {
    background: var(--ds-section-bg);
    border: 1px solid var(--ds-section-border);
    border-inline-start: 3px solid var(--ds-section-color);
    border-radius: var(--ds-radius-md);
    padding: 1rem 1.25rem;
}
.cheque-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ds-section-color);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ──────────────────────────────────────────────────────────────
   DASHBOARD — Blue (default :root values, no override needed)
   ────────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────────────────────
   SALES — Emerald
   ────────────────────────────────────────────────────────────── */
body[data-section="sales"] {
    --ds-section-color:       #059669;
    --ds-section-light:       #34d399;
    --ds-section-bg:          #ecfdf5;
    --ds-section-border:      #a7f3d0;
    --ds-section-gradient:    linear-gradient(135deg, #059669, #34d399);
    /* nav */
    --ds-nav-active-bg:       rgba(5, 150, 105, 0.18);
    --ds-nav-active-bg-end:   rgba(5, 150, 105, 0.05);
    --ds-nav-accent-start:    #34d399;
    --ds-nav-accent-end:      #059669;
    --ds-nav-accent-glow:     rgba(5, 150, 105, 0.45);
    --ds-nav-icon-active-bg:  rgba(5, 150, 105, 0.2);
    --ds-nav-icon-active-clr: #6ee7b7;
}

/* ──────────────────────────────────────────────────────────────
   EXPENSES — Rose / Red
   ────────────────────────────────────────────────────────────── */
body[data-section="expenses"] {
    --ds-section-color:       #e11d48;
    --ds-section-light:       #fb7185;
    --ds-section-bg:          #fff1f2;
    --ds-section-border:      #fecdd3;
    --ds-section-gradient:    linear-gradient(135deg, #e11d48, #fb7185);
    /* nav */
    --ds-nav-active-bg:       rgba(225, 29, 72, 0.18);
    --ds-nav-active-bg-end:   rgba(225, 29, 72, 0.05);
    --ds-nav-accent-start:    #fb7185;
    --ds-nav-accent-end:      #e11d48;
    --ds-nav-accent-glow:     rgba(225, 29, 72, 0.45);
    --ds-nav-icon-active-bg:  rgba(225, 29, 72, 0.2);
    --ds-nav-icon-active-clr: #fda4af;
}

/* ──────────────────────────────────────────────────────────────
   PURCHASES — Amber / Orange
   ────────────────────────────────────────────────────────────── */
body[data-section="purchases"] {
    --ds-section-color:       #b45309;
    --ds-section-light:       #f59e0b;
    --ds-section-bg:          #fffbeb;
    --ds-section-border:      #fde68a;
    --ds-section-gradient:    linear-gradient(135deg, #b45309, #f59e0b);
    /* nav */
    --ds-nav-active-bg:       rgba(180, 83, 9, 0.18);
    --ds-nav-active-bg-end:   rgba(180, 83, 9, 0.05);
    --ds-nav-accent-start:    #fbbf24;
    --ds-nav-accent-end:      #b45309;
    --ds-nav-accent-glow:     rgba(180, 83, 9, 0.45);
    --ds-nav-icon-active-bg:  rgba(180, 83, 9, 0.2);
    --ds-nav-icon-active-clr: #fcd34d;
}

/* ──────────────────────────────────────────────────────────────
   BANK & TRANSFERS — Sky Blue
   ────────────────────────────────────────────────────────────── */
body[data-section="bank"] {
    --ds-section-color:       #0284c7;
    --ds-section-light:       #38bdf8;
    --ds-section-bg:          #f0f9ff;
    --ds-section-border:      #bae6fd;
    --ds-section-gradient:    linear-gradient(135deg, #0284c7, #38bdf8);
    /* nav */
    --ds-nav-active-bg:       rgba(2, 132, 199, 0.18);
    --ds-nav-active-bg-end:   rgba(2, 132, 199, 0.05);
    --ds-nav-accent-start:    #38bdf8;
    --ds-nav-accent-end:      #0284c7;
    --ds-nav-accent-glow:     rgba(2, 132, 199, 0.45);
    --ds-nav-icon-active-bg:  rgba(2, 132, 199, 0.2);
    --ds-nav-icon-active-clr: #7dd3fc;
}

/* ──────────────────────────────────────────────────────────────
   SUPPLIERS — Warm Amber
   ────────────────────────────────────────────────────────────── */
body[data-section="suppliers"] {
    --ds-section-color:       #92400e;
    --ds-section-light:       #d97706;
    --ds-section-bg:          #fef9ee;
    --ds-section-border:      #fde9a0;
    --ds-section-gradient:    linear-gradient(135deg, #92400e, #d97706);
    /* nav */
    --ds-nav-active-bg:       rgba(146, 64, 14, 0.18);
    --ds-nav-active-bg-end:   rgba(146, 64, 14, 0.05);
    --ds-nav-accent-start:    #f59e0b;
    --ds-nav-accent-end:      #92400e;
    --ds-nav-accent-glow:     rgba(146, 64, 14, 0.45);
    --ds-nav-icon-active-bg:  rgba(146, 64, 14, 0.2);
    --ds-nav-icon-active-clr: #fcd34d;
}

/* ──────────────────────────────────────────────────────────────
   EMPLOYEES — Violet / Purple
   ────────────────────────────────────────────────────────────── */
body[data-section="employees"] {
    --ds-section-color:       #7c3aed;
    --ds-section-light:       #a78bfa;
    --ds-section-bg:          #f5f3ff;
    --ds-section-border:      #ddd6fe;
    --ds-section-gradient:    linear-gradient(135deg, #7c3aed, #a78bfa);
    /* nav */
    --ds-nav-active-bg:       rgba(124, 58, 237, 0.18);
    --ds-nav-active-bg-end:   rgba(124, 58, 237, 0.05);
    --ds-nav-accent-start:    #c4b5fd;
    --ds-nav-accent-end:      #7c3aed;
    --ds-nav-accent-glow:     rgba(124, 58, 237, 0.45);
    --ds-nav-icon-active-bg:  rgba(124, 58, 237, 0.2);
    --ds-nav-icon-active-clr: #c4b5fd;
}

/* ──────────────────────────────────────────────────────────────
   PARTNERS — Indigo
   ────────────────────────────────────────────────────────────── */
body[data-section="partners"] {
    --ds-section-color:       #4f46e5;
    --ds-section-light:       #818cf8;
    --ds-section-bg:          #eef2ff;
    --ds-section-border:      #c7d2fe;
    --ds-section-gradient:    linear-gradient(135deg, #4f46e5, #818cf8);
    /* nav */
    --ds-nav-active-bg:       rgba(79, 70, 229, 0.18);
    --ds-nav-active-bg-end:   rgba(79, 70, 229, 0.05);
    --ds-nav-accent-start:    #a5b4fc;
    --ds-nav-accent-end:      #4f46e5;
    --ds-nav-accent-glow:     rgba(79, 70, 229, 0.45);
    --ds-nav-icon-active-bg:  rgba(79, 70, 229, 0.2);
    --ds-nav-icon-active-clr: #a5b4fc;
}

/* ──────────────────────────────────────────────────────────────
   FINANCE / CASHBOX / TRANSACTIONS — Slate Navy
   ────────────────────────────────────────────────────────────── */
body[data-section="finance"] {
    --ds-section-color:       #1e3a5f;
    --ds-section-light:       #3b82f6;
    --ds-section-bg:          #eff6ff;
    --ds-section-border:      #bfdbfe;
    --ds-section-gradient:    linear-gradient(135deg, #1e3a5f, #3b82f6);
    /* nav */
    --ds-nav-active-bg:       rgba(30, 58, 95, 0.22);
    --ds-nav-active-bg-end:   rgba(30, 58, 95, 0.06);
    --ds-nav-accent-start:    #60a5fa;
    --ds-nav-accent-end:      #1e3a5f;
    --ds-nav-accent-glow:     rgba(59, 130, 246, 0.45);
    --ds-nav-icon-active-bg:  rgba(30, 58, 95, 0.25);
    --ds-nav-icon-active-clr: #93c5fd;
}

/* ──────────────────────────────────────────────────────────────
   REPORTS — Teal
   ────────────────────────────────────────────────────────────── */
body[data-section="reports"] {
    --ds-section-color:       #0d9488;
    --ds-section-light:       #2dd4bf;
    --ds-section-bg:          #f0fdfa;
    --ds-section-border:      #99f6e4;
    --ds-section-gradient:    linear-gradient(135deg, #0d9488, #2dd4bf);
    /* nav */
    --ds-nav-active-bg:       rgba(13, 148, 136, 0.18);
    --ds-nav-active-bg-end:   rgba(13, 148, 136, 0.05);
    --ds-nav-accent-start:    #2dd4bf;
    --ds-nav-accent-end:      #0d9488;
    --ds-nav-accent-glow:     rgba(13, 148, 136, 0.45);
    --ds-nav-icon-active-bg:  rgba(13, 148, 136, 0.2);
    --ds-nav-icon-active-clr: #5eead4;
}

/* ──────────────────────────────────────────────────────────────
   OPERATING DAYS & MONTHS — Lime Green
   ────────────────────────────────────────────────────────────── */
body[data-section="days"] {
    --ds-section-color:       #16a34a;
    --ds-section-light:       #4ade80;
    --ds-section-bg:          #f0fdf4;
    --ds-section-border:      #bbf7d0;
    --ds-section-gradient:    linear-gradient(135deg, #16a34a, #4ade80);
    /* nav */
    --ds-nav-active-bg:       rgba(22, 163, 74, 0.18);
    --ds-nav-active-bg-end:   rgba(22, 163, 74, 0.05);
    --ds-nav-accent-start:    #4ade80;
    --ds-nav-accent-end:      #16a34a;
    --ds-nav-accent-glow:     rgba(22, 163, 74, 0.45);
    --ds-nav-icon-active-bg:  rgba(22, 163, 74, 0.2);
    --ds-nav-icon-active-clr: #86efac;
}

/* ──────────────────────────────────────────────────────────────
   MANAGEMENT — Slate Gray
   ────────────────────────────────────────────────────────────── */
body[data-section="management"] {
    --ds-section-color:       #475569;
    --ds-section-light:       #94a3b8;
    --ds-section-bg:          #f8fafc;
    --ds-section-border:      #e2e8f0;
    --ds-section-gradient:    linear-gradient(135deg, #475569, #94a3b8);
    /* nav */
    --ds-nav-active-bg:       rgba(71, 85, 105, 0.22);
    --ds-nav-active-bg-end:   rgba(71, 85, 105, 0.06);
    --ds-nav-accent-start:    #94a3b8;
    --ds-nav-accent-end:      #475569;
    --ds-nav-accent-glow:     rgba(71, 85, 105, 0.4);
    --ds-nav-icon-active-bg:  rgba(71, 85, 105, 0.2);
    --ds-nav-icon-active-clr: #cbd5e1;
}

