/* =============================================
   X Market - Design System
   Premium RTL Arabic SaaS Platform
   ============================================= */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* =============================================
   CSS Variables (Design Tokens)
   ============================================= */
:root {
    /* Primary Palette */
    --primary: #6C63FF;
    --primary-light: #8B85FF;
    --primary-dark: #5A52E0;
    --primary-50: rgba(108, 99, 255, 0.08);
    --primary-100: rgba(108, 99, 255, 0.15);
    --primary-200: rgba(108, 99, 255, 0.25);

    /* Accent Colors */
    --accent: #00D9A6;
    --accent-light: #33E4BC;
    --accent-dark: #00B88A;

    /* Semantic Colors */
    --success: #10B981;
    --success-light: #34D399;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-light: #FBBF24;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-light: #F87171;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3B82F6;
    --info-light: #60A5FA;
    --info-bg: rgba(59, 130, 246, 0.12);

    /* Dark Theme */
    --bg-body: #0F0E17;
    --bg-surface: #1A1A2E;
    --bg-card: #16213E;
    --bg-card-hover: #1B2A4A;
    --bg-input: #0F1729;
    --bg-sidebar: #12122B;
    --bg-header: rgba(15, 14, 23, 0.85);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: var(--primary);

    /* Text */
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --text-heading: #FFFFFF;
    --text-inverse: #0F0E17;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.15);

    /* Typography */
    --font-ar: 'Cairo', 'Segoe UI', sans-serif;
    --font-en: 'Inter', 'Segoe UI', sans-serif;

    /* Spacing */
    --sidebar-width: 238px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    background: var(--bg-body);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

img { max-width: 100%; height: auto; }

/* =============================================
   Typography
   ============================================= */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-end { text-align: left; }

/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-ar);
    font-size: 0.93rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 6px 25px rgba(108, 99, 255, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    color: #fff;
}
.btn-success:hover { box-shadow: 0 6px 25px rgba(16, 185, 129, 0.3); color: #fff; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-light));
    color: #fff;
}
.btn-danger:hover { box-shadow: 0 6px 25px rgba(239, 68, 68, 0.3); color: #fff; }

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-light));
    color: var(--text-inverse);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-light);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--primary); background: var(--primary-50); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm); }

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* =============================================
   Form Elements
   ============================================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.93rem;
    transition: var(--transition);
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
    background: var(--bg-card);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-hint {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-error {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--danger);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23A0A0B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    padding-left: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* =============================================
   Cards
   ============================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-glass {
    background: rgba(22, 33, 62, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
}

/* =============================================
   Stats Cards
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.purple::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.blue::before { background: var(--info); }
.stat-card.red::before { background: var(--danger); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card.purple .stat-icon { background: var(--primary-100); color: var(--primary-light); }
.stat-card.green .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.orange .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.blue .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-card.red .stat-icon { background: var(--danger-bg); color: var(--danger); }

.stat-info { flex: 1; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1;
    margin-bottom: 4px;
    font-family: var(--font-en);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =============================================
   Badges
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-100); color: var(--primary-light); }
.badge-secondary { background: rgba(160, 160, 184, 0.12); color: var(--text-secondary); }

/* =============================================
   Tables
   ============================================= */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 18px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* =============================================
   Alerts
   ============================================= */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    position: relative;
    animation: slideDown 0.3s ease;
}

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

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-error, .alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.2);
}

.alert-close {
    margin-right: auto;
    margin-left: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    padding: 0;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* =============================================
   Auth Layout
   ============================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, var(--primary-200) 0%, transparent 70%);
    pointer-events: none;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 50%;
    height: 80%;
    background: radial-gradient(circle, rgba(0, 217, 166, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(22, 33, 62, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-title {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 28px;
    color: var(--text-heading);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-footer a {
    color: var(--primary-light);
    font-weight: 600;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Password Toggle */
.password-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
}

/* =============================================
   Dashboard Layout
   ============================================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: var(--header-height);
}

.sidebar-logo {
    font-size: 1.35rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.sidebar-logo small {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    -webkit-text-fill-color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 14px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--primary-50);
}

.nav-link.active {
    color: var(--primary-light);
    background: var(--primary-100);
    font-weight: 600;
}

.nav-link .icon {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.nav-link .nav-badge {
    margin-right: auto;
    margin-left: 0;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 50px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.sidebar-user:hover { background: var(--primary-50); }

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    transition: var(--transition);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    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 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

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

.menu-toggle {
    display: flex;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* Collapsed Sidebar State (Desktop) */
@media (min-width: 1025px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed);
    }
    body.sidebar-collapsed .main-content {
        margin-right: var(--sidebar-collapsed);
    }
    
    body.sidebar-collapsed .sidebar-logo {
        font-size: 0;
    }
    body.sidebar-collapsed .sidebar-logo::before {
        content: "🏪";
        font-size: 1.8rem;
        display: block;
        text-align: center;
    }
    body.sidebar-collapsed .sidebar-logo small {
        display: none;
    }
    
    body.sidebar-collapsed .nav-section-title,
    body.sidebar-collapsed .nav-link span:not(.icon),
    body.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .nav-badge {
        display: none;
    }
    
    body.sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 12px 0;
    }
    body.sidebar-collapsed .nav-link .icon {
        margin: 0;
        font-size: 1.4rem;
    }
    
    body.sidebar-collapsed .sidebar-footer .sidebar-user {
        justify-content: center;
        padding: 10px 0;
    }
}

.menu-toggle:hover { background: var(--primary-50); }

.page-title-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.page-title-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
    position: relative;
}

.header-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: var(--radius-full);
}

/* Content Area */
.content-area {
    padding: 28px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.page-header p {
    color: var(--text-secondary);
    margin: 2px 0 0 0;
    font-size: 0.88rem;
}

/* =============================================
   Quick Actions
   ============================================= */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.quick-action:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: var(--primary-50);
    transform: translateY(-2px);
}

.quick-action .icon {
    font-size: 1.5rem;
}

/* =============================================
   Data Lists
   ============================================= */
.data-list {
    list-style: none;
    padding: 0;
}

.data-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.data-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.data-list-info { flex: 1; min-width: 0; }
.data-list-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-heading);
    margin-bottom: 2px;
}
.data-list-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* =============================================
   Pagination
   ============================================= */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-en);
    text-decoration: none;
    transition: var(--transition-fast);
}

.pagination li a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination li.active a {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* =============================================
   Loading Spinner
   ============================================= */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 14, 23, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* =============================================
   Sidebar Overlay (Mobile)
   ============================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* =============================================
   Scrollbar
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =============================================
   Install page progress
   ============================================= */
.install-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.install-step.active {
    color: var(--primary-light);
}

.install-step.done {
    color: var(--success);
}

.install-step-num {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-en);
}

.install-step.active .install-step-num {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.install-step.done .install-step-num {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.install-step-line {
    width: 40px;
    height: 2px;
    background: var(--border);
}

.install-check {
    list-style: none;
    padding: 0;
    margin-bottom: 28px;
}

.install-check li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.install-check li:last-child { border-bottom: none; }

.check-icon { font-size: 1.1rem; }
.check-ok { color: var(--success); }
.check-fail { color: var(--danger); }

/* =============================================
   Utility Classes
   ============================================= */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-md); }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    html { font-size: 14px; }

    .auth-card {
        padding: 32px 24px;
    }

    .content-area {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }

/* =============================================
   404 Page
   ============================================= */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.error-code {
    font-size: 8rem;
    font-weight: 900;
    font-family: var(--font-en);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}
/* =============================================
   Utility Classes for Print
   ============================================= */
.print-only { display: none; }

/* =============================================
   Print Styles
   ============================================= */
@media print {
    /* Hide System UI (Nuclear Fix) */
    .sidebar, .top-header, .sidebar-overlay, .menu-toggle, .header-actions, 
    .btn, .btn-icon, .no-print, .alert, .nav-section-title, .breadcrumb,
    .filter-card, .header, header, form:not(.print-form) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        position: absolute !important;
    }
    
    /* Layout Reset */
    .app-wrapper { display: block !important; }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        min-height: auto !important;
    }

    .content-area {
        padding: 0 !important;
        margin: 0 !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 12pt;
    }

    /* Professional Report Look */
    .card {
        background: #fff !important;
        border: 1px solid #eee !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 25px !important;
        break-inside: avoid;
    }

    .card-header {
        border-bottom: 2px solid #333 !important;
        margin-bottom: 15px !important;
    }

    .table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .table thead th {
        background: #f8f9fa !important;
        color: #000 !important;
        border: 1px solid #ddd !important;
        padding: 8px !important;
    }

    .table tbody td {
        border: 1px solid #eee !important;
        padding: 8px !important;
        color: #333 !important;
    }

    .stat-card {
        border: 1px solid #ddd !important;
        background: #fff !important;
        break-inside: avoid;
    }
    
    .stat-value { color: #000 !important; }

    /* Utilities */
    .print-only {
        display: block !important;
    }
    
    .text-primary, .text-success, .text-danger {
        color: #000 !important;
        font-weight: bold;
    }

    /* Force link display (optional: hidden by default here) */
    a { text-decoration: none !important; color: #000 !important; }
}
