:root {
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --accent: #2b9348;
    --accent-dark: #1f6e35;
    --danger: #e63946;
    --warning: #f4a300;
    --bg: #f3f5f8;
    --card-bg: #ffffff;
    --text: #22303f;
    --text-light: #6b7a8f;
    --border: #e2e8f0;
    --sidebar-width: 260px;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}

/* ---------- Layout global ---------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, #14283f 100%);
    color: #fff;
    padding: 20px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px 20px; font-weight: 700; font-size: 18px;
    border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 10px;
}
.sidebar .brand i { color: var(--warning); font-size: 22px; }
.sidebar .module-group { margin-top: 14px; }
.sidebar .module-title {
    padding: 6px 20px; font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; color: #9fb3c8;
}
.sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: #dce6f0; text-decoration: none; font-size: 14.5px;
    border-left: 3px solid transparent;
}
.sidebar a i { width: 18px; text-align: center; }
.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,.08); border-left-color: var(--warning); color: #fff;
}
.sidebar .super-admin-link { color: var(--warning); font-weight: 600; }

.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 0 0 40px; width: 100%; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--card-bg); padding: 14px 28px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar .user-chip .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.badge-superadmin {
    background: var(--warning); color: #29210a; font-size: 11px; padding: 2px 8px;
    border-radius: 20px; font-weight: 700; margin-left: 6px;
}

.page-body { padding: 24px 28px; }

/* ---------- Cartes / stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid var(--primary-light);
    display: flex; justify-content: space-between; align-items: center;
}
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .label { color: var(--text-light); font-size: 13px; margin-top: 2px; }
.stat-card i { font-size: 28px; color: var(--primary-light); opacity: .35; }
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }

.card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 22px; border: 1px solid var(--border);
}
.card h2, .card h3 { margin-top: 0; display: flex; align-items: center; gap: 8px; }

/* ---------- Formulaires ---------- */
form.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label { font-size: 13px; font-weight: 600; color: var(--text-light); display: block; margin-bottom: 4px; }
input, select, textarea {
    padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
    font-size: 14px; background: #fbfcfe; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); background: #fff; }
.field { display: flex; flex-direction: column; min-width: 160px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer;
    padding: 9px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; text-decoration: none;
    transition: filter .15s;
}
.btn:hover { filter: brightness(0.92); }
.btn-primary { background: var(--primary-light); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #29210a; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
    background: #eef2f7; text-align: left; padding: 10px 12px; font-size: 12.5px;
    text-transform: uppercase; letter-spacing: .03em; color: var(--text-light);
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:hover td { background: #f8fafc; }

/* ---------- Badges de statut ---------- */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-success { background: #e3f6e9; color: var(--accent-dark); }
.badge-warning { background: #fff3d6; color: #8a6100; }
.badge-danger { background: #fde1e3; color: var(--danger); }
.badge-info { background: #e3edfb; color: var(--primary-light); }
.badge-muted { background: #eceff3; color: var(--text-light); }

/* ---------- Alertes ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #e3f6e9; color: var(--accent-dark); }
.alert-error { background: #fde1e3; color: var(--danger); }
.alert-info { background: #e3edfb; color: var(--primary-light); }

/* ---------- Module toggle (super admin) ---------- */
.module-toggle-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 16px; }
.module-toggle-card {
    border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff;
    display: flex; flex-direction: column; gap: 10px;
}
.module-toggle-card .icon-circle {
    width: 46px; height: 46px; border-radius: 50%; background: #eef2f7; display: flex;
    align-items: center; justify-content: center; font-size: 20px; color: var(--primary-light);
}
.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle {
    position: absolute; cursor: pointer; inset: 0; background-color: #ccc; transition: .2s; border-radius: 24px;
}
.slider-toggle:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .2s; border-radius: 50%;
}
input:checked + .slider-toggle { background-color: var(--accent); }
input:checked + .slider-toggle:before { transform: translateX(22px); }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, #14283f 100%); }
.login-box { background: #fff; padding: 36px 34px; border-radius: 14px; width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand i { font-size: 40px; color: var(--primary-light); }
.login-brand h1 { font-size: 20px; margin: 8px 0 2px; }
.login-brand p { color: var(--text-light); font-size: 13px; margin: 0; }

