/* ============================================================
   KOSHA - Master Design System
   ============================================================
   Table of Contents:
   1. CSS Custom Properties (Design Tokens)
   2. Reset & Base
   3. Typography
   4. Layout (Sidebar + Topbar + Main)
   5. Components (Cards, Badges, Buttons, Tables, Forms)
   6. Skeleton Loading
   7. Empty States
   8. Upload Zone
   9. Color Swatches
   10. Toast Notifications
   11. Pagination
   12. Breadcrumb
   13. Stat Cards
   14. Chart Container
   15. Page Header
   16. Dark Mode
   17. Print Styles
   18. Animations
   19. Responsive
   ============================================================ */

/* ─── 1. Design Tokens ───────────────────────────────────────── */
:root {
    /* Colors — GVP Official Theme */
    --primary:         #1065FF;
    --primary-dark:    #0B4FD1;
    --primary-light:   rgba(16,101,255,.12);
    --accent:          #17E6AE;
    --accent-dark:     #0EB78A;
    --accent-light:    rgba(23,230,174,.12);
    --success:         #10B981;
    --success-light:   rgba(16,185,129,.12);
    --warning:         #F59E0B;
    --warning-light:   rgba(245,158,11,.12);
    --danger:          #EF4444;
    --danger-light:    rgba(239,68,68,.12);

    /* Backgrounds */
    --bg:              #F8FAFC;
    --bg-gradient:     radial-gradient(at 0% 0%, rgba(16, 101, 255, 0.04) 0px, transparent 50%),
                       radial-gradient(at 100% 0%, rgba(23, 230, 174, 0.03) 0px, transparent 40%),
                       radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.03) 0px, transparent 50%),
                       #F8FAFC;
    --bg-secondary:    #F1F5F9;
    --card:            rgba(255, 255, 255, 0.82);
    --card-hover:      rgba(255, 255, 255, 0.95);

    /* Text */
    --text-primary:    #0F172A;
    --text-secondary:  #334155;
    --text-muted:      #64748B;
    --text-light:      #94A3B8;

    /* Borders */
    --border:          #E2E8F0;
    --border-light:    #F1F5F9;

    /* Sidebar */
    --sidebar-width:   240px;
    --sidebar-collapsed: 64px;
    --sidebar-bg:      #0B1120;
    --sidebar-text:    rgba(255,255,255,.75);
    --sidebar-text-active: #FFFFFF;
    --sidebar-active-bg: rgba(16,101,255,.25);

    /* Topbar */
    --topbar-height:   64px;
    --topbar-bg:       rgba(255, 255, 255, 0.8);

    /* Shadows */
    --shadow-xs:    0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-card:  0 4px 6px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
    --shadow-lg:    0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
    --shadow-xl:    0 20px 40px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.08);

    /* Border Radius */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-2xl:  20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition:  all .2s ease;

    /* Typography */
    --font-body:    'Darker Grotesque', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-bold:    'Special Gothic Expanded One', sans-serif;

    /* Z-index */
    --z-sidebar:   1000;
    --z-topbar:    900;
    --z-modal:     1050;
    --z-toast:     2000;

    /* 3D Sphere Gradients & Shadows */
    --sphere-1-grad: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(16, 101, 255, 0.15) 20%, rgba(16, 101, 255, 0.4) 60%, rgba(11, 79, 209, 0.5) 100%);
    --sphere-1-shadow: inset -10px -10px 30px rgba(0, 0, 0, 0.15), 10px 10px 30px rgba(16, 101, 255, 0.15), 0 0 80px rgba(16, 101, 255, 0.1);
    --sphere-2-grad: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(23, 230, 174, 0.15) 25%, rgba(23, 230, 174, 0.4) 65%, rgba(14, 183, 138, 0.5) 100%);
    --sphere-2-shadow: inset -8px -8px 24px rgba(0, 0, 0, 0.15), 8px 8px 24px rgba(23, 230, 174, 0.15), 0 0 60px rgba(23, 230, 174, 0.1);
}

/* ─── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background Glow */
body::before {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    top: -10%;
    right: -10%;
    background: radial-gradient(circle, rgba(16, 101, 255, 0.12) 0%, transparent 70%);
    filter: blur(100px);
    z-index: -2;
    pointer-events: none;
    animation: float-ambient 25s ease-in-out infinite;
    will-change: transform;
}

/* 3D perspective grid */
body::after {
    content: '';
    position: fixed;
    bottom: -150px;
    left: -50%;
    right: -50%;
    height: 400px;
    background-image: 
        linear-gradient(to top, rgba(16, 101, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to right, rgba(16, 101, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(300px) rotateX(75deg);
    transform-origin: center bottom;
    z-index: -2;
    pointer-events: none;
    mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 80%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 80%);
    opacity: 0.8;
}

/* Global App Starfield Particles */
#app-particle-canvas {
    position: fixed;
    inset: 0;
    z-index: -3; /* Placed behind the 3D perspective grid and glows */
    pointer-events: none;
    width: 100vw;
    height: 100vh;
    display: none;
}
body:has(#main-content:not([style*="display: none"])) #app-particle-canvas {
    display: block;
}

@keyframes float-ambient {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.05);
    }
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ─── 3. Typography ──────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6,
strong, b,
.fw-600, .fw-700, .fw-800,
.fw-bold, .fw-semibold, .fw-bolder,
.font-weight-bold,
.bold-text,
th {
    font-family: var(--font-bold);
    font-weight: normal;
}
h1,h2,h3,h4,h5,h6 { line-height: 1.3; color: var(--text-primary); }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.text-muted  { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-primary-color { color: var(--primary) !important; }
.required { color: var(--danger); margin-left: .125rem; }

/* ─── 4. Layout (Topbar & Navbar) ────────────────────────────── */

.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: var(--z-topbar);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.topbar-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.topbar-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}
.topbar-logo-link:hover .topbar-logo-img {
    transform: scale(1.02);
}

/* Horizontal Nav Links */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    margin-left: 2rem;
}
.mobile-nav-header,
.mobile-nav-actions {
    display: none;
}

.topbar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}
.topbar-nav-link .nav-icon {
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.topbar-nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}
.topbar-nav-link:hover .nav-icon {
    color: var(--primary);
}
.topbar-nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-color: rgba(16, 101, 255, 0.25);
}
.topbar-nav-link.active .nav-icon {
    color: var(--primary);
}

/* ── Lucide Global Styles ── */
svg.lucide {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
}
.stat-icon svg.lucide {
    width: 22px;
    height: 22px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.topbar-btn, .mobile-menu-btn {
    width: 36px; height: 36px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-secondary);
    color: var(--text-muted); cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative;
}
.topbar-btn:hover, .mobile-menu-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.mobile-menu-btn { display: none; }

/* Desktop CTA button */
.desktop-new-invoice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 36px;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0 0.875rem;
    transition: all 0.2s ease;
}

/* Search */
.search-wrapper { position: relative; }
.search-icon { position: absolute; left: .625rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .8rem; pointer-events: none; }
.search-bar {
    height: 36px; padding: 0 .875rem 0 2rem;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-secondary); color: var(--text-primary);
    font-size: .8375rem; font-family: inherit;
    width: 180px; outline: none; transition: var(--transition);
}
.search-bar:focus { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-light); width: 220px; }

/* Notification dot */
.notif-count {
    position: absolute; top: 2px; right: 2px;
    background: var(--danger); color: #fff;
    font-size: .55rem; font-weight: 800;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* Profile dropdown */
.profile-dropdown { position: relative; }
.profile-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 800; color: #fff;
    cursor: pointer; user-select: none; border: 2px solid var(--border);
    transition: var(--transition); flex-shrink: 0;
}
.profile-avatar:hover { border-color: var(--primary); }
.dropdown-menu-custom {
    position: absolute; right: 0; top: calc(100% + .5rem);
    width: 220px; background: var(--card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); z-index: 600;
    opacity: 0; transform: translateY(-8px) scale(.96);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.dropdown-menu-custom.show { opacity: 1; transform: none; pointer-events: all; }
.dropdown-user-info { padding: .875rem 1rem; border-bottom: 1px solid var(--border-light); }
.dropdown-user-name { font-size: .875rem; font-weight: 700; color: var(--text-primary); }
.dropdown-user-email { font-size: .75rem; color: var(--text-muted); margin-top: .125rem; }
.dropdown-item-custom {
    display: flex; align-items: center; gap: .625rem;
    padding: .625rem 1rem; font-size: .8375rem; color: var(--text-secondary);
    transition: var(--transition); cursor: pointer;
}
.dropdown-item-custom:hover { background: var(--bg-secondary); color: var(--text-primary); }
.dropdown-item-custom.danger:hover { color: var(--danger); background: var(--danger-light); }
.dropdown-item-custom i, .dropdown-item-custom svg { width: 16px; text-align: center; flex-shrink: 0; }

/* Main content */
.main-content {
    margin-left: 0;
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
}

.page-content {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-inline: clamp(20px, 3vw, 48px);
    padding-block: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* ─── CSS Grid Dashboard Alignments ─── */
#stat-cards-row {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 1.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
#stat-cards-row > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

#stat-cards-row + .row {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 1.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
#stat-cards-row + .row > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

#stat-cards-row + .row + .quick-actions-row + .kosha-card + .row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
#stat-cards-row + .row + .quick-actions-row + .kosha-card + .row > div {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
}

/* Responsive grid styles */
@media (max-width: 1024px) {
    #stat-cards-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    #stat-cards-row + .row {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    #stat-cards-row + .row + .quick-actions-row + .kosha-card + .row {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
@media (max-width: 576px) {
    #stat-cards-row {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* Overlay */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 999;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ─── 5. Components ──────────────────────────────────────────── */

/* Cards */
.kosha-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: var(--transition);
}
.kosha-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(16, 101, 255, 0.15);
}
.kosha-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-light);
    background: transparent;
}
.kosha-card-title { font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.kosha-card-subtitle { font-size: .8125rem; color: var(--text-muted); margin-top: .125rem; }
.kosha-card-body { padding: 1.25rem; }
.kosha-card-footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.015);
}
[data-theme="dark"] .kosha-card-footer {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges */
.kosha-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .72rem; font-weight: 700;
    padding: .2rem .625rem; border-radius: var(--radius-full);
    white-space: nowrap;
}
.badge-draft     { background: #F3F4F6; color: #374151; }
.badge-sent      { background: rgba(59,130,246,.12); color: var(--primary); }
.badge-pending   { background: rgba(245,158,11,.12); color: #B45309; }
.badge-paid      { background: rgba(34,197,94,.12); color: #15803D; }
.badge-overdue   { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-cancelled { background: rgba(107,114,128,.12); color: #6B7280; }

/* Buttons */
.btn {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    cursor: pointer;
    line-height: 1;
}
.btn i, .btn svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    line-height: 1;
    flex-shrink: 0;
}
.btn-primary { background: var(--primary); color: #fff; border: none; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.35); }
.btn-ghost { background: none; border: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn-outline-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* Form Controls */
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .375rem; }
.form-control, .form-select {
    font-family: inherit; border: 1.5px solid var(--border);
    border-radius: var(--radius-md); background: var(--bg-secondary);
    color: var(--text-primary); transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary); background: var(--card);
    box-shadow: 0 0 0 3px var(--primary-light); outline: none;
}
.form-control::placeholder { color: var(--text-light); }

/* Tables */
.kosha-table-wrapper { overflow-x: auto; }
.kosha-table { width: 100%; border-collapse: collapse; font-size: .8375rem; }
.kosha-table thead tr { background: var(--bg-secondary); }
.kosha-table thead th {
    padding: .75rem 1rem; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
    border-bottom: 2px solid var(--border); white-space: nowrap;
    text-align: left;
}
.kosha-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.kosha-table tbody tr:last-child { border-bottom: none; }
.kosha-table tbody tr:hover { background: var(--bg-secondary); cursor: pointer; }
.kosha-table tbody td { padding: .75rem 1rem; color: var(--text-secondary); vertical-align: middle; }
.kosha-table .fw-600 { font-weight: 600; color: var(--text-primary); }

/* ─── 6. Skeleton Loading ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.6s ease-in-out infinite;
}
.skeleton-text { height: 1rem; border-radius: var(--radius-full); width: 100%; }
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── 7. Empty State ─────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem 1.5rem; text-align: center;
}
.empty-state-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; margin-bottom: 1.25rem;
}
.empty-state-title { font-size: 1rem; font-weight: 700; margin-bottom: .375rem; }
.empty-state-text { font-size: .875rem; color: var(--text-muted); margin-bottom: 1.25rem; max-width: 320px; line-height: 1.6; }

/* ─── 8. Upload Zone ─────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius-md);
    padding: 1.5rem; text-align: center;
    cursor: pointer; transition: var(--transition);
    color: var(--text-muted); background: var(--bg-secondary);
}
.upload-zone:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.upload-zone i, .upload-zone svg { margin-bottom: .5rem; display: block; margin-inline: auto; }
.upload-zone i { font-size: 1.5rem; }
.upload-zone svg { width: 24px; height: 24px; }
.upload-zone-text { font-size: .875rem; font-weight: 600; }
.upload-zone-hint { font-size: .75rem; color: var(--text-light); margin-top: .25rem; }

/* ─── 9. Color Swatches ──────────────────────────────────────── */
.color-swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-swatch {
    width: 30px; height: 30px; border-radius: 50%;
    cursor: pointer; border: 3px solid transparent;
    transition: var(--transition); flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--primary); }
.color-swatch-custom {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px dashed var(--border); cursor: pointer;
    padding: 0; overflow: hidden; background: none;
}

/* ─── 10. Toast Notifications ────────────────────────────────── */
#toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    z-index: var(--z-toast); display: flex; flex-direction: column; gap: .625rem;
    pointer-events: none;
}
.kosha-toast {
    display: flex; align-items: center; gap: .75rem;
    min-width: 280px; max-width: 380px;
    padding: .875rem 1.125rem;
    border-radius: var(--radius-lg); font-size: .875rem; font-weight: 500;
    box-shadow: var(--shadow-xl); pointer-events: all;
    transform: translateX(120%); transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.kosha-toast.show { transform: translateX(0); }
.kosha-toast.hiding { transform: translateX(120%); transition: transform .3s ease; }
.kosha-toast-success { background: #16A34A; color: #fff; }
.kosha-toast-error   { background: #DC2626; color: #fff; }
.kosha-toast-warning { background: #D97706; color: #fff; }
.kosha-toast-info    { background: var(--primary); color: #fff; }
.kosha-toast i, .kosha-toast svg { font-size: 1rem; width: 16px; height: 16px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close {
    background: none; border: none; color: rgba(255,255,255,.7);
    cursor: pointer; font-size: 1.125rem; padding: 0; flex-shrink: 0;
    line-height: 1;
}
.toast-close:hover { color: #fff; }

/* ─── 11. Pagination ─────────────────────────────────────────── */
.pagination-nav { display: flex; gap: .25rem; align-items: center; }
.page-btn {
    min-width: 32px; height: 32px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-secondary);
    color: var(--text-muted); font-size: .8125rem; font-weight: 600;
    cursor: pointer; transition: var(--transition); padding: 0 .5rem;
    display: flex; align-items: center; justify-content: center; font-family: inherit;
}
.page-btn:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn[disabled] { opacity: .4; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); padding: 0 .25rem; }

/* ─── 12. Breadcrumb ─────────────────────────────────────────── */
.kosha-breadcrumb {
    display: none !important;
}
.kosha-breadcrumb-item { color: var(--text-muted); }
.kosha-breadcrumb-item.active { color: var(--text-primary); font-weight: 600; }
.kosha-breadcrumb-item a { color: var(--text-muted); }
.kosha-breadcrumb-item a:hover { color: var(--primary); }
.kosha-breadcrumb-sep { color: var(--text-light); font-size: .75rem; }

/* ─── 13. Stat Cards ─────────────────────────────────────────── */
.stat-card {
    background: var(--card); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 1.375rem;
    box-shadow: var(--shadow-card); position: relative; overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(16, 101, 255, 0.15); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: #fff; margin-bottom: .875rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.stat-icon.bg-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.stat-icon.bg-success { background: linear-gradient(135deg, #22C55E, #10B981); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-icon.bg-danger  { background: linear-gradient(135deg, #EF4444, #DC2626); }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); margin-bottom: .25rem; line-height: 1; }
.stat-label { font-size: .8125rem; color: var(--text-muted); }
.stat-trend { font-size: .75rem; font-weight: 700; position: absolute; top: 1rem; right: 1rem; padding: .2rem .5rem; border-radius: var(--radius-full); }
.stat-trend.up { background: var(--success-light); color: #15803D; }
.stat-trend.down { background: var(--danger-light); color: var(--danger); }

/* ─── 14. Chart Container ────────────────────────────────────── */
.chart-container {
    position: relative; width: 100%; overflow: hidden;
}

/* ─── 15. Page Header ────────────────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 800; margin-bottom: .125rem; letter-spacing: -.02em; }
.page-subtitle { font-size: .875rem; color: var(--text-muted); }

/* Spin animation */
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 16. Dark Mode ──────────────────────────────────────────── */
[data-theme="dark"] {
    --bg:              #090D16;
    --bg-gradient:     radial-gradient(at 0% 0%, rgba(16, 101, 255, 0.08) 0px, transparent 50%),
                       radial-gradient(at 100% 0%, rgba(23, 230, 174, 0.05) 0px, transparent 40%),
                       radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.06) 0px, transparent 50%),
                       #090D16;
    --bg-secondary:    #0E131F;
    --card:            rgba(20, 27, 45, 0.7);
    --card-hover:      rgba(26, 35, 57, 0.85);
    --text-primary:    #F0F6FC;
    --text-secondary:  #C9D1D9;
    --text-muted:      #8B949E;
    --text-light:      #6E7681;
    --border:          rgba(255, 255, 255, 0.08);
    --border-light:    rgba(255, 255, 255, 0.05);
    --topbar-bg:       rgba(20, 27, 45, 0.8);
    --sidebar-bg:      #090D16;
    --primary-light:   rgba(59,130,246,.15);
    --accent-light:    rgba(6,182,212,.15);
    --success-light:   rgba(34,197,94,.15);
    --warning-light:   rgba(245,158,11,.15);
    --danger-light:    rgba(239,68,68,.15);

    /* 3D Sphere Gradients & Shadows */
    --sphere-1-grad: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25) 0%, rgba(16, 101, 255, 0.1) 20%, rgba(16, 101, 255, 0.3) 60%, rgba(11, 79, 209, 0.4) 100%);
    --sphere-1-shadow: inset -10px -10px 30px rgba(0, 0, 0, 0.5), 10px 10px 40px rgba(16, 101, 255, 0.2), 0 0 100px rgba(16, 101, 255, 0.1);
    --sphere-2-grad: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25) 0%, rgba(23, 230, 174, 0.1) 25%, rgba(23, 230, 174, 0.3) 65%, rgba(14, 183, 138, 0.4) 100%);
    --sphere-2-shadow: inset -8px -8px 24px rgba(0, 0, 0, 0.5), 8px 8px 30px rgba(23, 230, 174, 0.2), 0 0 80px rgba(23, 230, 174, 0.1);
}
[data-theme="dark"] .kosha-badge.badge-draft { background: rgba(255,255,255,.08); color: #C9D1D9; }
[data-theme="dark"] .search-bar { background: var(--bg-secondary); color: var(--text-primary); }
[data-theme="dark"] .topbar-btn { background: var(--bg-secondary); border-color: var(--border); color: var(--text-muted); }

/* ─── 17. Print ──────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .sidebar-edge-toggle, #toast-container, .btn, nav { display: none !important; }
    .main-content { margin: 0 !important; }
    body { background: #fff !important; color: #000 !important; }
    .kosha-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ─── 18. Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes bounceIn {
    0%   { opacity: 0; transform: scale(.9) translateY(20px); }
    70%  { opacity: 1; transform: scale(1.02) translateY(-4px); }
    100% { transform: scale(1) translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp .4s ease both; }
.animate-fade-in    { animation: fadeIn .3s ease both; }

/* ─── 19. Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .mobile-menu-btn { display: flex; }
    .desktop-new-invoice { display: none !important; }

    .topbar-nav {
        position: fixed; top: 0; left: 0;
        width: 280px; height: 100vh;
        background: linear-gradient(180deg, #0B1120 0%, #060913 100%);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 0.5rem; padding: 1.5rem 1rem; margin-left: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    }
    .topbar-nav.mobile-open {
        transform: translateX(0);
    }

    .mobile-nav-header {
        display: flex; align-items: center; justify-content: space-between;
        margin-bottom: 2rem; padding-bottom: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mobile-nav-logo { height: 32px; width: auto; }
    .mobile-nav-close {
        background: none; border: none; color: rgba(255, 255, 255, 0.6);
        font-size: 1.75rem; line-height: 1; cursor: pointer; padding: 0.25rem;
        transition: color 0.2s ease;
    }
    .mobile-nav-close:hover { color: #fff; }
    .mobile-nav-actions {
        display: block; margin-top: auto; padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .topbar-nav-link {
        width: 100%; padding: 0.75rem 1rem; border-radius: 10px;
        color: rgba(255, 255, 255, 0.7);
        background: transparent;
        border-color: transparent;
    }
    .topbar-nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
    .topbar-nav-link.active {
        background: var(--primary); color: #fff;
        border-color: transparent;
    }
    .topbar-nav-link i.nav-icon { color: rgba(255, 255, 255, 0.5); }
    .topbar-nav-link.active i.nav-icon { color: #fff; }

    .search-bar { width: 150px; }
    .search-bar:focus { width: 180px; }
}
@media (max-width: 768px) {
    .page-content { padding: 1rem; }
    .search-bar { width: 120px; }
    .kosha-table tbody td::before {
        content: attr(data-label);
        font-weight: 700; color: var(--text-muted);
        font-size: .7rem; display: block; margin-bottom: .25rem; text-transform: uppercase;
    }
}
@media (max-width: 576px) {
    .topbar { padding: 0 1rem; }
    .page-header { flex-direction: column; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.375rem; }
    .search-wrapper { display: none; }
}

/* ─── Offline / Online Network Status Banner ─────────────────── */
.kosha-net-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    padding: 0.6rem 1rem;
    background: rgba(251, 191, 36, 0.15);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    color: #FDE68A;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.kosha-net-banner.visible {
    transform: translateY(0);
}
.kosha-net-banner.online {
    background: rgba(16, 185, 129, 0.15);
    border-bottom-color: rgba(16, 185, 129, 0.3);
    color: #6EE7B7;
}

/* ─── SPA Progress Bar ────────────────────────────────────────── */
.spa-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #1065FF 0%, #17E6AE 50%, #06B6D4 100%);
    box-shadow: 0 0 10px rgba(23, 230, 174, 0.6);
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

/* ─── Bulk Actions Bar ────────────────────────────────────────── */
#bulk-actions-bar {
    max-width: 90vw;
    width: max-content;
    flex-wrap: wrap;
    justify-content: center;
}

