:root {
    --brand-primary: #0f6b5c;
    --brand-primary-dark: #0a4a40;
    --brand-gold: #c9a227;
    --sidebar-width: 260px;
}

* {
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

body {
    background-color: #f4f6f8;
    margin: 0;
}

/* ===== تخطيط الصفحة ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.sidebar-logo {
    font-size: 1.75rem;
}

.sidebar-logo img {
    height: 40px;
    width: auto;
    max-width: 60px;
    display: block;
}

.sidebar-title {
    line-height: 1.4;
}

.sidebar-menu {
    list-style: none;
    padding: .75rem 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: rgba(255,255,255,.9);
    text-decoration: none;
    padding: .7rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    transition: background .15s;
}

.sidebar-menu li a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,.15);
    margin: .5rem 1rem;
}

.main-content {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    background: #fff;
    padding: .75rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 20;
}

.role-badge {
    background-color: var(--brand-gold);
    color: #2b2200;
}

.page-content {
    padding: 1.5rem;
}

/* ===== بطاقات الإحصائيات ===== */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border-inline-start: 4px solid var(--brand-primary);
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--brand-primary-dark);
}

.stat-card .stat-label {
    color: #6b7280;
    font-weight: 600;
    font-size: .9rem;
}

.card-kpi {
    border: none;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.card-kpi .card-header {
    background: var(--brand-primary);
    color: #fff;
    border-radius: .75rem .75rem 0 0 !important;
    font-weight: 700;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.table-responsive-card {
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    padding: 1rem;
}

@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        inset-inline-start: 0;
        z-index: 1050;
        transform: translateX(100%);
        transition: transform .2s;
    }
    html[dir="rtl"] .sidebar.show {
        transform: translateX(0);
    }
}

/* ===== طباعة التقارير ===== */
@media print {
    .sidebar, .topbar, .no-print {
        display: none !important;
    }
    .main-content {
        width: 100% !important;
    }
    .page-content {
        padding: 0 !important;
    }
    body {
        background: #fff !important;
    }
    .table-responsive-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}
