/* ============================================================
   DATE WAREHOUSE — SHARED DESIGN SYSTEM
   Version: 1.0.0
   استفاده: در تمام صفحات با <link rel="stylesheet" href="styles.css">
   ============================================================ */

/* ============================================================
   1. RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand Colors */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-300: #93c5fd;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;

    /* Success */
    --success-50: #ecfdf5;
    --success-100: #d1fae5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;

    /* Warning */
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #92400e;

    /* Danger */
    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #991b1b;

    /* Purple */
    --purple-50: #f5f3ff;
    --purple-500: #8b5cf6;
    --purple-600: #7c3aed;
    --purple-700: #6d28d9;

    /* Pink */
    --pink-50: #fdf2f8;
    --pink-500: #ec4899;
    --pink-600: #db2777;
    --pink-700: #be185d;

    /* Cyan */
    --cyan-50: #ecfeff;
    --cyan-500: #06b6d4;
    --cyan-600: #0891b2;
    --cyan-700: #0e7490;

    /* Gold */
    --gold-50: #fffbeb;
    --gold-500: #fbbf24;
    --gold-600: #d97706;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Sidebar */
    --sidebar-bg: #0b1220;
    --sidebar-hover: #1a2333;
    --sidebar-active: #1e40af;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border: #1e293b;

    /* App */
    --bg-app: #f6f7f9;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --border-soft: #f1f3f5;

    /* Typography */
    --font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Monaco, Consolas, monospace;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 2px 4px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, 0.08), 0 4px 8px -2px rgba(16, 24, 40, 0.03);
    --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, 0.18);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Layout */
    --sidebar-width: 268px;
    --topbar-height: 68px;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-app);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ============================================================
   2. LAYOUT
   ============================================================ */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
}

.main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-app);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
}
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   3. SIDEBAR
   ============================================================ */
.sidebar {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 40;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 1px; height: 100%;
    background: linear-gradient(180deg, transparent, var(--sidebar-border) 20%, var(--sidebar-border) 80%, transparent);
}

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

.brand-logo {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
}

.brand-text h1 { color: white; font-size: 15px; font-weight: 800; line-height: 1.2; }
.brand-text p { color: var(--sidebar-text); font-size: 11px; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }

.nav-group { margin-bottom: 20px; }
.nav-group:last-child { margin-bottom: 0; }

.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 12px 8px;
}

.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--sidebar-active), #1e3a8a);
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: 0 4px 12px -2px rgba(30, 64, 175, 0.5);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #60a5fa;
    border-radius: 3px 0 0 3px;
}

.nav-item-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item-badge {
    margin-right: auto;
    background: var(--danger-500);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-item.active .nav-item-badge { background: rgba(255, 255, 255, 0.25); }

.sidebar-user {
    padding: 14px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.user-menu:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--sidebar-border);
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.user-meta { flex: 1; min-width: 0; }
.user-meta-name {
    color: white;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-meta-role { color: var(--sidebar-text); font-size: 11px; margin-top: 1px; }
.user-menu-chevron { color: var(--sidebar-text); font-size: 12px; flex-shrink: 0; }

/* ============================================================
   4. TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 30;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.mobile-menu-btn {
    display: none;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-700);
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.page-info h1 {
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.page-info .breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.breadcrumb .sep { color: var(--gray-300); font-size: 10px; }
.breadcrumb .current { color: var(--brand-600); font-weight: 600; }

.topbar-left { display: flex; align-items: center; gap: 10px; }

.search { position: relative; width: 260px; }

.search input {
    width: 100%;
    height: 38px;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 38px 0 14px;
    font-size: 13px;
    color: var(--gray-800);
    transition: all 0.15s;
}

.search input::placeholder { color: var(--gray-400); }
.search input:focus {
    outline: none;
    background: white;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-50);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 14px;
    pointer-events: none;
}

.icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
    position: relative;
}

.icon-btn:hover { background: var(--gray-200); color: var(--gray-900); }

.icon-btn.has-dot::after {
    content: '';
    position: absolute;
    top: 8px; right: 9px;
    width: 8px; height: 8px;
    background: var(--danger-500);
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.85; }
}

/* Online/Offline Indicator */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
}

.connection-status.online {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid var(--success-500);
}

.connection-status.offline {
    background: var(--danger-50);
    color: var(--danger-700);
    border: 1px solid var(--danger-500);
}

.connection-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

/* ============================================================
   5. PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-title h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-header-title p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   6. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--brand-600);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    background: var(--brand-700);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-success {
    background: var(--success-500);
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    background: var(--success-600);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-500);
    color: white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: var(--danger-600); }

.btn-warning {
    background: var(--warning-500);
    color: white;
}
.btn-warning:hover { background: var(--warning-600); }

.btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}
.btn-gold:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   7. CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header-left { display: flex; align-items: center; gap: 12px; }

.card-header-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--brand-50);
    color: var(--brand-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.card-header-icon.green { background: var(--success-50); color: var(--success-600); }
.card-header-icon.orange { background: var(--warning-50); color: var(--warning-600); }
.card-header-icon.purple { background: var(--purple-50); color: var(--purple-600); }
.card-header-icon.gold { background: var(--gold-50); color: var(--gold-600); }
.card-header-icon.red { background: var(--danger-50); color: var(--danger-600); }
.card-header-icon.pink { background: var(--pink-50); color: var(--pink-600); }
.card-header-icon.cyan { background: var(--cyan-50); color: var(--cyan-600); }

.card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.2px; }
.card-subtitle { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.card-body { padding: 20px; }

/* ============================================================
   8. STATS CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.stat-icon.blue { background: var(--brand-50); color: var(--brand-600); }
.stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat-icon.orange { background: var(--warning-50); color: var(--warning-600); }
.stat-icon.purple { background: var(--purple-50); color: var(--purple-600); }
.stat-icon.gold { background: var(--gold-50); color: var(--gold-600); }
.stat-icon.red { background: var(--danger-50); color: var(--danger-600); }
.stat-icon.pink { background: var(--pink-50); color: var(--pink-600); }
.stat-icon.cyan { background: var(--cyan-50); color: var(--cyan-600); }

.stat-trend {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
}
.stat-trend.up { background: var(--success-50); color: var(--success-700); }
.stat-trend.down { background: var(--danger-50); color: var(--danger-600); }

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.8px;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 5px;
}
.stat-value small { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.stat-label { font-size: 12px; color: var(--gray-500); }

/* ============================================================
   9. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-green { background: var(--success-50); color: var(--success-700); }
.badge-blue { background: var(--brand-50); color: var(--brand-700); }
.badge-orange { background: var(--warning-50); color: var(--warning-600); }
.badge-pink { background: var(--pink-50); color: var(--pink-600); }
.badge-purple { background: var(--purple-50); color: var(--purple-600); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-gold { background: var(--gold-50); color: var(--gold-600); }
.badge-red { background: var(--danger-50); color: var(--danger-600); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   10. AVATARS
   ============================================================ */
.avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    position: relative;
}
.avatar.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar.green { background: linear-gradient(135deg, #10b981, #047857); }
.avatar.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar.pink { background: linear-gradient(135deg, #ec4899, #be185d); }
.avatar.cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.avatar.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.avatar.gold { background: linear-gradient(135deg, #fbbf24, #d97706); }

.avatar.online::after {
    content: '';
    position: absolute;
    bottom: -2px; left: -2px;
    width: 12px; height: 12px;
    background: var(--success-500);
    border-radius: 50%;
    border: 2px solid white;
}

/* ============================================================
   11. FORMS
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 7px;
}
.form-group label .required { color: var(--danger-500); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--gray-50);
    border: 1.5px solid var(--border);
    border-radius: 11px;
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 500;
    transition: all 0.15s;
}
.form-textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 100px; }
.form-input::placeholder { color: var(--gray-400); font-weight: 400; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    background: white;
    box-shadow: 0 0 0 4px var(--brand-50);
}
.form-input.mono, .form-select.mono { font-family: var(--font-mono); letter-spacing: 0.5px; }
.form-input.error { border-color: var(--danger-500); box-shadow: 0 0 0 4px var(--danger-50); }

.form-help { font-size: 11px; color: var(--gray-500); margin-top: 5px; }
.form-error {
    font-size: 11px;
    color: var(--danger-500);
    margin-top: 5px;
    font-weight: 600;
    display: none;
}
.form-error.show { display: block; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px; height: 28px;
    flex-shrink: 0;
    display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 30px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px; width: 20px;
    right: 4px; top: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success-500); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(-20px); }

.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--gray-50);
    border: 1.5px solid var(--border);
    border-radius: 11px;
}
.toggle-info h4 { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.toggle-info p { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ============================================================
   12. TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: right;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
    text-align: right;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

.table-footer {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-soft);
    background: var(--gray-50);
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info { font-size: 12px; color: var(--gray-500); }

.pagination { display: flex; gap: 4px; align-items: center; }

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.page-btn:hover:not(:disabled):not(.active) {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}
.page-btn.active {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   13. MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 20px;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal.modal-sm { max-width: 420px; }
.modal.modal-lg { max-width: 780px; }
.modal.modal-xl { max-width: 1000px; }

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

.modal-title { display: flex; align-items: center; gap: 12px; }

.modal-title-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--brand-50);
    color: var(--brand-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.modal-title-icon.red { background: var(--danger-50); color: var(--danger-600); }
.modal-title-icon.orange { background: var(--warning-50); color: var(--warning-600); }
.modal-title-icon.green { background: var(--success-50); color: var(--success-600); }

.modal-title h3 { font-size: 16px; font-weight: 800; color: var(--gray-900); }
.modal-title p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.modal-close {
    width: 34px; height: 34px;
    border-radius: 10px;
    color: var(--gray-400);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    background: var(--gray-50);
}
.modal-footer .btn { min-width: 100px; }

/* ============================================================
   14. TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 300px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlide 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-right: 4px solid var(--success-500);
}
.toast.error { border-right-color: var(--danger-500); }
.toast.info { border-right-color: var(--brand-500); }
.toast.warning { border-right-color: var(--warning-500); }

@keyframes toastSlide {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--success-50);
    color: var(--success-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.toast.error .toast-icon { background: var(--danger-50); color: var(--danger-500); }
.toast.info .toast-icon { background: var(--brand-50); color: var(--brand-600); }
.toast.warning .toast-icon { background: var(--warning-50); color: var(--warning-600); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.toast-message { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ============================================================
   15. EMPTY STATE
   ============================================================ */
.empty-state { padding: 60px 20px; text-align: center; }

.empty-state-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-400);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
}

.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--gray-800); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--gray-500); }

/* ============================================================
   16. INFO BOX
   ============================================================ */
.info-box {
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
    border: 1px solid;
}
.info-box.info { background: linear-gradient(135deg, var(--brand-50), #f0f9ff); border-color: var(--brand-200); }
.info-box.warning { background: linear-gradient(135deg, var(--warning-50), #fef9e7); border-color: #fcd34d; }
.info-box.success { background: linear-gradient(135deg, var(--success-50), #f0fdf4); border-color: #86efac; }
.info-box.danger { background: linear-gradient(135deg, var(--danger-50), #fef2f2); border-color: #fca5a5; }

.info-box-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.info-box-title { font-size: 13px; font-weight: 800; color: var(--gray-900); }
.info-box-text { font-size: 12px; color: var(--gray-600); margin-top: 3px; line-height: 1.6; }

/* ============================================================
   17. TABS
   ============================================================ */
.tabs {
    display: flex;
    gap: 4px;
    background: white;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

.tab {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    transition: all 0.15s;
    white-space: nowrap;
}
.tab:hover { background: var(--gray-50); }
.tab.active {
    background: var(--brand-600);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* ============================================================
   18. FILTER BAR
   ============================================================ */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group { display: flex; flex-direction: column; gap: 5px; }

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input, .filter-select {
    height: 38px;
    padding: 0 14px;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--gray-800);
    transition: all 0.15s;
    min-width: 140px;
}
.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--brand-500);
    background: white;
    box-shadow: 0 0 0 3px var(--brand-50);
}

.filter-bar-spacer { flex: 1; }

/* ============================================================
   19. PROGRESS
   ============================================================ */
.progress-bar {
    height: 10px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    transition: width 0.6s;
}
.progress-bar-fill.success { background: linear-gradient(90deg, var(--success-500), var(--success-700)); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--warning-500), var(--warning-600)); }
.progress-bar-fill.danger { background: linear-gradient(90deg, var(--danger-500), var(--danger-600)); }

/* ============================================================
   20. CHARTS
   ============================================================ */
.chart-wrapper {
    position: relative;
    height: 300px;
    padding: 20px;
}

/* ============================================================
   21. GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-2-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }

/* ============================================================
   22. OVERLAY (Mobile)
   ============================================================ */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 39;
}
.overlay.show { display: block; }

/* ============================================================
   23. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-2-equal, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: 280px;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 50;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    }
    .mobile-menu-btn { display: flex; }
    .search { display: none; }
}

@media (max-width: 640px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; height: 62px; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; }
    .form-row { grid-template-columns: 1fr; }
    .filter-bar { padding: 12px; }
    .filter-group { flex: 1 1 100%; }
    .filter-input, .filter-select { width: 100%; min-width: 0; }
    thead th { padding: 12px 14px; }
    tbody td { padding: 12px 14px; }
    .modal-body { padding: 18px; }
    .chart-wrapper { height: 240px; padding: 12px; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-fadeInUp { animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards; }

/* ============================================================
   25. UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }

.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-gray-500 { color: var(--gray-500); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }
.text-success { color: var(--success-600); }
.text-danger { color: var(--danger-600); }
.text-warning { color: var(--warning-600); }
.text-brand { color: var(--brand-600); }

.mono { font-family: var(--font-mono); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.hidden { display: none; }
.visible { display: block; }