:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #121826;
    --bg-card: rgba(18, 24, 38, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #10b981;
    
    --primary: #3b82f6;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.brand-icon img.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
}

.logo-badge {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.logo-badge img.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-info h1 {
    font-size: 16px;
    font-weight: 800;
}

.brand-info span {
    font-size: 12px;
    color: var(--success);
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
    width: 100%;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(-4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    color: var(--success);
    border-right: 3px solid var(--success);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill .avatar {
    width: 38px;
    height: 38px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details .name {
    font-size: 13px;
    font-weight: 700;
    display: block;
}

.user-details .role {
    font-size: 11px;
    color: var(--text-dim);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    padding: 24px 32px;
    background: rgba(18, 24, 38, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title h2 { font-size: 22px; font-weight: 800; }
.page-title p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

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

.content-body { padding: 32px; flex: 1; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease; }

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

/* METRICS */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-card);
}

.metric-card .icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-green .icon-wrap { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.card-amber .icon-wrap { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.card-blue .icon-wrap { background: rgba(59, 130, 246, 0.15); color: var(--primary); }

.metric-data .label { font-size: 13px; color: var(--text-muted); display: block; }
.metric-data h3 { font-size: 26px; font-weight: 800; margin: 4px 0; }
.metric-data .currency-tag { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.metric-data .subtext { font-size: 11px; color: var(--text-dim); }

/* PANELS */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* TABLES */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: right; }
.data-table th { padding: 12px 16px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.02); }
.data-table td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* BADGES */
.badge { padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; display: inline-block; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); }

/* BUTTONS */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-primary:hover { transform: translateY(-2px); }

.btn-success { background: var(--success); color: #fff; border: none; padding: 10px 18px; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); }
.btn-success:hover { background: #059669; transform: translateY(-2px); }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: var(--radius-md); font-weight: 600; cursor: pointer; }
.btn-small { padding: 6px 12px; font-size: 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-color); color: var(--text-main); border-radius: var(--radius-sm); cursor: pointer; }
.btn-icon { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 8px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* TOOLBAR & SEARCH */
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.search-box { position: relative; flex: 1; max-width: 380px; }
.search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.search-box input { width: 100%; padding: 10px 42px 10px 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-main); font-size: 13px; outline: none; }

.filter-tabs { display: flex; gap: 8px; }
.filter-btn { padding: 8px 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: var(--radius-md); cursor: pointer; font-weight: 600; font-size: 13px; }
.filter-btn.active { background: var(--success); color: #fff; border-color: var(--success); }

/* MODALS */
.auth-overlay, .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay { display: none; }
.modal-overlay.active { display: flex; }

.auth-card, .modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-large { max-width: 800px; }

.auth-header { text-align: center; margin-bottom: 24px; }
.logo-badge { width: 60px; height: 60px; background: linear-gradient(135deg, var(--success), var(--primary)); border-radius: var(--radius-lg); display: inline-flex; align-items: center; justify-content: center; font-size: 28px; color: #fff; margin-bottom: 16px; }

.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.input-group input, .input-group select { width: 100%; padding: 10px 14px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-main); font-size: 14px; outline: none; }
.input-group input:focus, .input-group select:focus { border-color: var(--border-focus); }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border-color); }

/* STATEMENT PRINT SHEET */
.statement-sheet {
    background: #fff;
    color: #1e293b;
    padding: 32px;
    border-radius: var(--radius-md);
}

.statement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.statement-header h2 { font-size: 22px; color: #0f172a; }
.stmt-badge { text-align: left; }
.stmt-badge span { font-size: 12px; color: #64748b; }
.stmt-badge h3 { font-size: 24px; color: #059669; }

.stmt-client-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: #f8fafc;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
}

.statement-sheet .data-table th { background: #f1f5f9; color: #475569; border-bottom: 2px solid #cbd5e1; }
.statement-sheet .data-table td { color: #1e293b; border-bottom: 1px solid #e2e8f0; }

.stmt-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
}

.stmt-footer .signature { text-align: center; width: 200px; }
.sign-line { border-bottom: 1px dashed #94a3b8; height: 50px; margin-top: 10px; }

@media print {
    body * { visibility: hidden; }
    .statement-sheet, .statement-sheet * { visibility: visible; }
    .statement-sheet { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none !important; }
}

@media (max-width: 900px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .form-grid { grid-template-columns: 1fr; }
    .stmt-client-card { grid-template-columns: 1fr; }
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    background: rgba(18, 24, 38, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: #fff;
    font-size: 14px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-success { border-color: var(--success); }
.toast-success i { color: var(--success); font-size: 18px; }
.toast-error { border-color: var(--danger); }
.toast-error i { color: var(--danger); font-size: 18px; }
.toast-info { border-color: var(--primary); }
.toast-info i { color: var(--primary); font-size: 18px; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-15px) scale(0.95); }
}

/* PROGRESS BAR FOR REMAINING DEBT */
.debt-progress-wrap {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 4px;
}
.debt-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 9999px;
    transition: width 0.3s ease;
}
.btn-share {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.btn-share:hover {
    background: #3b82f6;
    color: #fff;
}

/* MULTI-CURRENCY PILLS */
.currency-pill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.currency-pill-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.currency-pill-card .curr-title {
    font-size: 13px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.currency-pill-card .curr-body {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* WHATSAPP ACTION */
.btn-whatsapp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.15);
    color: #25d366;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}
.btn-whatsapp-icon:hover {
    background: #25d366;
    color: #fff;
    transform: scale(1.1);
}

.balance-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.text-success { color: #10b981 !important; }
.text-danger { color: #ef4444 !important; }
.text-muted { color: var(--text-muted) !important; }

/* ============================================================ */
/* NEW ADDITIONS: Sync Indicator, Treasury, Users, Currencies   */
/* ============================================================ */

/* Sync Status Indicator */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #10b981;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3);
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: default;
}

.sync-countdown {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* Small Buttons */
.btn-small {
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.3);
    transition: all 0.2s ease;
}
.btn-small:hover { background: rgba(99,102,241,0.3); color: #fff; }
.btn-small.btn-success { background: rgba(16,185,129,0.15); color: #34d399; border-color: rgba(16,185,129,0.3); }
.btn-small.btn-success:hover { background: rgba(16,185,129,0.3); color: #fff; }
.btn-small.btn-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.btn-small.btn-danger:hover { background: rgba(239,68,68,0.3); color: #fff; }

/* Badges Extended */
.badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-purple  { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.badge-blue    { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }

/* Whatsapp icon button */
.btn-whatsapp-icon {
    color: #25D366;
    background: rgba(37,211,102,0.1);
    border: 1px solid rgba(37,211,102,0.2);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.btn-whatsapp-icon:hover { background: rgba(37,211,102,0.2); }

/* btn-share */
.btn-share {
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.3);
}
.btn-share:hover { background: rgba(59,130,246,0.3); }

/* Balance cell */
.balance-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

/* Currency pill card extended */
.currency-pill-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 150px;
    flex: 1;
    transition: transform 0.2s ease;
}
.currency-pill-card:hover { transform: translateY(-2px); }
.curr-title { font-weight: 700; margin-bottom: 8px; color: #e2e8f0; font-size: 14px; }
.curr-body { font-size: 13px; color: var(--text-muted); line-height: 1.8; }

/* Alert error */
.alert-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ==========================================================================
   ALIMONZ ENTERPRISE UI/UX UPGRADE: LIGHT THEME, SKELETONS, CHARTS & RESPONSIVE
   ========================================================================== */

/* 1. LIGHT MODE THEME */
body.light-theme {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #10b981;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
}

body.light-theme .sidebar {
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
}

body.light-theme .topbar {
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-theme .card-panel,
body.light-theme .metric-card,
body.light-theme .currency-pill-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body.light-theme .data-table thead th {
    background: #f8fafc;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

body.light-theme .data-table tbody td {
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

body.light-theme .data-table tbody tr:hover {
    background: #f8fafc;
}

body.light-theme .nav-item {
    color: #475569;
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .modal-container {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

body.light-theme .curr-title {
    color: #1e293b;
}

body.light-theme .btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

body.light-theme .btn-secondary:hover {
    background: #e2e8f0;
}

/* 2. THEME & HAMBURGER BUTTONS */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: rotate(15deg);
}

.sidebar-toggle-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* 3. SKELETON LOADERS */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.10) 37%, rgba(255, 255, 255, 0.04) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.6s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

body.light-theme .skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 37%, #e2e8f0 63%);
    background-size: 400% 100%;
}

.skeleton-text {
    height: 14px;
    margin: 6px 0;
    border-radius: 4px;
}

.skeleton-text.sm { height: 10px; width: 60%; }
.skeleton-text.lg { height: 24px; width: 80%; }
.skeleton-pill { height: 24px; width: 75px; border-radius: var(--radius-full); display: inline-block; }
.skeleton-card { height: 110px; width: 100%; border-radius: var(--radius-md); }

/* 4. MODERN EMPTY STATE COMPONENT */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 340px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.empty-state-btn {
    font-size: 13px;
    padding: 8px 18px;
}

/* 5. TABLE SORTING & EXPORT UTILITIES */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
}

th.sortable:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

th.sortable .sort-indicator {
    display: inline-block;
    margin-right: 6px;
    font-size: 11px;
    opacity: 0.35;
    transition: opacity 0.2s;
}

th.sortable.asc .sort-indicator,
th.sortable.desc .sort-indicator {
    opacity: 1;
    color: var(--primary);
}

.btn-export-csv {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: var(--transition);
}

.btn-export-csv:hover {
    background: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
    transform: translateY(-1px);
}

.table-toolbar-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

/* 6. CHARTS CANVAS STYLING */
.chart-canvas-box {
    position: relative;
    width: 100%;
    min-height: 220px;
    max-height: 280px;
}

/* 7. BUTTON LOADING STATE */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.82;
}

.btn-loading i.fa-spin {
    margin-left: 6px;
}

/* 8. KEYBOARD SHORTCUTS HINT CHIP */
.kbd-hint {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 6px;
}

/* 9. RESPONSIVE BREAKPOINTS */
@media (max-width: 992px) {
    .sidebar-toggle-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        right: -300px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        width: 280px;
        height: 100vh;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.6);
    }

    .sidebar.open {
        right: 0;
    }

    .main-content {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 14px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .page-title h2 {
        font-size: 18px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-actions .btn-primary,
    .topbar-actions .btn-success,
    .topbar-actions .btn-secondary {
        font-size: 13px;
        padding: 8px 12px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .section-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        overflow-x: auto;
        padding-bottom: 6px;
        white-space: nowrap;
    }

    .modal-container {
        width: 95% !important;
        margin: 10px auto;
        padding: 18px !important;
        max-height: 92vh;
    }
}

@media (max-width: 480px) {
    .content-body {
        padding: 12px;
    }
    
    .sync-indicator {
        font-size: 11px;
        padding: 4px 8px;
    }
}
