:root {
    --primary: #4c44e0;
    --primary-dark: #3730a3;

    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-alt: #fafbfc;

    --text: #172033;
    --muted: #7b8498;
    --border: #e8ebf2;

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;

    --sidebar: #111827;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #1f2937;
    --sidebar-border: #1f2937;

    --input-bg: #ffffff;
    --table-hover: #fafbff;
    --button-light-bg: #f1f5f9;
    --button-light-text: #334155;

    --stat-icon-bg: #eef2ff;

    --radius: 16px;
}

/* =========================
   Dark Theme
   ========================= */

html[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-alt: #172033;

    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #334155;

    --sidebar: #020617;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #1e293b;
    --sidebar-border: #334155;

    --input-bg: #111827;
    --table-hover: #263449;

    --button-light-bg: #334155;
    --button-light-text: #e2e8f0;

    --stat-icon-bg: #312e81;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: Tahoma, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.app {
    min-height: 100vh;
    display: flex;
}

/* =========================
   Sidebar
   ========================= */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sidebar);
    color: white;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 28px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.brand-text strong {
    display: block;
    font-size: 17px;
}

.brand-text span {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 11px;
}

.nav-title {
    color: #64748b;
    font-size: 11px;
    padding: 0 12px;
    margin: 8px 0 10px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-size: 14px;
    transition: 0.2s ease;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
    transform: translateX(-2px);
}

.nav-link.active {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.95),
        rgba(124, 58, 237, 0.95)
    );
    color: white;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.22);
}

.nav-icon {
    width: 24px;
    text-align: center;
    font-size: 17px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--sidebar-border);
}

/* =========================
   Main
   ========================= */

.main {
    flex: 1;
    margin-right: 260px;
    min-width: 0;
}

.topbar {
    height: 76px;
    background: color-mix(
        in srgb,
        var(--surface) 94%,
        transparent
    );
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 1100;
    backdrop-filter: blur(12px);
}

.page-title {
    font-size: 19px;
    font-weight: 700;
}

.page-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    text-align: left;
}

.user-info strong {
    display: block;
    font-size: 13px;
}

.user-info span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.content {
    padding: 30px;
}

/* =========================
   Dashboard
   ========================= */

.welcome {
    margin-bottom: 25px;
}

.welcome h1 {
    margin: 0;
    font-size: 25px;
}

.welcome p {
    color: var(--muted);
    margin: 8px 0 0;
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 21px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.035);
    transition: 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-icon {
    width: 43px;
    height: 43px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    background: var(--stat-icon-bg);
    color: var(--primary);
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
}

.stat-value {
    font-size: 27px;
    font-weight: 800;
    margin-top: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    gap: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.035);
}

.card-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 15px;
    margin: 0;
}

.card-body {
    padding: 22px;
}

/* =========================
   Tables
   ========================= */

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    background: var(--surface-alt);
    padding: 13px 14px;
    text-align: right;
    white-space: nowrap;
}

.table td {
    padding: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
}

.table tbody tr:hover {
    bbackground: var(--table-hover);
}

/* =========================
   Badges
   ========================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.badge-success {
    color: #15803d;
    background: #dcfce7;
}

.badge-danger {
    color: #b91c1c;
    background: #fee2e2;
}

.badge-warning {
    color: #b45309;
    background: #fef3c7;
}

.badge-neutral {
    color: #475569;
    background: #f1f5f9;
}

/* =========================
   Buttons
   ========================= */

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-light {
    background: var(--button-light-bg);
    color: var(--button-light-text);
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

html[data-theme="dark"] .btn-danger {
    background: #451a1a;
    color: #fca5a5;
}

/* =========================
   Forms
   ========================= */

.form-group {
    margin-bottom: 17px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    transition: 0.2s ease;
    font-size: 13px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* =========================
   Mobile
   ========================= */

.mobile-menu {
    display: none;
    border: 0;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}
.mobile-menu {
    position: relative;
    z-index: 2000;
}
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-right: 0;
    }

    .mobile-menu {
        display: block;
    }

    .topbar {
        padding: 0 18px;
    }

    .content {
        padding: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .user-info {
        display: none;
    }
}
/* Mobile sidebar control */

#sidebarOverlay {

    display:none;

    position:fixed;

    inset:0;

    background:rgba(0,0,0,0.4);

    z-index:999;

}
.mobile-menu {
    position: relative;
    z-index: 2001;
}


