/* ag2mdo */
/* =============================================================================
   Nukunu Mofiala - Feuille de style principale (assets/css/style.css)
   ---------------------------------------------------------------------------
   ag2mdo : ce fichier etait absent du projet alors qu'il est appele par plus
   de 80 pages (<link rel="stylesheet" href="../assets/css/style.css">).
   Son absence provoquait un affichage "brut" (pas de menu lateral, pas de
   barre du haut, tableaux et boutons sans style). Il est reconstruit ici a
   partir de l'inventaire complet des classes utilisees dans les pages.
   Encodage UTF-8. Ne pas renommer : le chemin est reference tel quel.
   ========================================================================== */

/* ag2mdo */
/* ---------------------------------------------------------------------------
   1. VARIABLES GLOBALES                                          [ag2mdo]
   ------------------------------------------------------------------------ */
:root {
    --primary:        #1F4E79;
    --primary-dark:   #163A5C;
    --primary-light:  #2B6294;
    --accent:         #2E75B6;
    --accent-light:   #EAF2FA;
    --accent-dark:    #1D5C95;
    --accent-border:  #BBD4EC;
    --light:          #D6E4F0;
    --bg:             #F4F6F9;
    --white:          #FFFFFF;
    --text:           #1F2937;
    --text-muted:     #6B7280;
    --border:         #E5E7EB;
    --success:        #10B981;
    --success-dark:   #059669;
    --warning:        #F59E0B;
    --danger:         #DC2626;
    --danger-dark:    #B91C1C;
    --info:           #3B82F6;
    --radius:         10px;
    --radius-sm:      6px;
    --shadow:         0 2px 12px rgba(0, 0, 0, .06);
    --shadow-lg:      0 10px 40px rgba(0, 0, 0, .18);
    --sidebar-w:      260px;
    --font-sans:      'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-title:     Georgia, 'Times New Roman', serif;
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   2. SOCLE / RESET                                               [ag2mdo]
   ------------------------------------------------------------------------ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

img { max-width: 100%; }

h1, h2, h3, h4, h5 { font-family: var(--font-title); color: var(--primary); line-height: 1.3; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }

small, .small { font-size: .78rem; }

.mono { font-family: 'Consolas', 'Courier New', monospace; }
.muted, .text-muted { color: var(--text-muted); }
.text-success { color: var(--success-dark); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* Utilitaires d'espacement / flex (compatibles avec l'ecriture Bootstrap) */
.d-flex { display: flex; }
.d-none { display: none; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; }
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.me-1 { margin-right: .25rem; } .me-2 { margin-right: .5rem; }
.ms-1 { margin-left: .25rem; } .ms-2 { margin-left: .5rem; }
.p-0 { padding: 0; } .p-2 { padding: .5rem; } .p-3 { padding: 1rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.w-100 { width: 100%; }
.container-fluid { width: 100%; padding: 0 1rem; }
.scroll-y { overflow-y: auto; }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   3. STRUCTURE : dashboard + sidebar + main-content                [ag2mdo]
   ------------------------------------------------------------------------ */
.dashboard { display: flex; min-height: 100vh; }

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.content,
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ── Menu lateral ─────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: #1F2937;
    color: #E5E7EB;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.1rem;
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    background: rgba(0, 0, 0, .18);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    min-height: 64px;
}
.sidebar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-school-logo {
    width: 38px; height: 38px;
    object-fit: contain;
    background: #FFFFFF;
    border-radius: 8px;
    padding: 2px;
    flex-shrink: 0;
}

.sidebar-menu { list-style: none; flex: 1; overflow-y: auto; padding: .5rem 0 1rem; }
.sidebar-menu::-webkit-scrollbar { width: 6px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1.1rem;
    color: #CBD5E1;
    font-size: .84rem;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.sidebar-menu a:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.sidebar-menu a.active {
    background: rgba(46, 117, 182, .22);
    color: #FFFFFF;
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-menu a i { width: 18px; text-align: center; font-size: .9rem; }

.sidebar-badge { flex-shrink: 0; }

/* Sous-menus deroulants */
.menu-parent > a { cursor: pointer; }
.menu-parent .sub-toggle {
    margin-left: auto;
    font-size: .7rem !important;
    transition: transform .2s ease;
}
.menu-parent.open > a .sub-toggle { transform: rotate(90deg); }
.menu-parent.open > a { background: rgba(255, 255, 255, .05); color: #FFFFFF; }
.sub-menu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, .22);
    transition: max-height .25s ease;
}
.menu-parent.open > .sub-menu { max-height: 900px; }
.sub-menu a { padding-left: 2.6rem; font-size: .8rem; }

/* Pied du menu lateral */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: .75rem 1rem;
    background: rgba(0, 0, 0, .18);
}
.sidebar-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.sidebar-user-avatar,
.sidebar-user-avatar img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.sidebar-user-avatar {
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    color: #FFFFFF;
    font-weight: 700;
    font-size: .8rem;
    overflow: hidden;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: .82rem; font-weight: 600; color: #FFFFFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: .7rem; color: #94A3B8; }
.sidebar-logout {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .6rem;
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, .16);
    color: #FCA5A5;
    font-size: .8rem;
}
.sidebar-logout:hover { background: rgba(220, 38, 38, .3); color: #FFFFFF; }

/* Bouton hamburger (mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: .35rem .5rem;
}

/* ── Barre du haut ────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 64px;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-title {
    font-size: 1.15rem;
    font-family: var(--font-title);
    color: var(--primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-center { flex: 1; text-align: center; }
.topbar-school {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .8rem; font-weight: 600;
    color: var(--primary);
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: .25rem .75rem;
}
.topbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: .55rem; }
.topbar-avatar,
.topbar-avatar img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.topbar-avatar {
    display: flex; align-items: center; justify-content: center;
    background: var(--primary);
    color: #FFFFFF; font-weight: 700; font-size: .78rem;
    overflow: hidden;
}
.topbar-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.topbar-user-role { font-size: .7rem; color: var(--text-muted); }
.topbar-logout {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    background: #FEE2E2;
    color: var(--danger-dark);
    font-size: .78rem;
    font-weight: 600;
}
.topbar-logout:hover { background: var(--danger); color: #FFFFFF; }
.topbar-bell:hover { color: var(--primary) !important; }

.header-bar,
.page-title {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-title { font-family: var(--font-title); color: var(--primary); }


/* ag2mdo */
/* ---------------------------------------------------------------------------
   4. CARTES ET SECTIONS                                          [ag2mdo]
   ------------------------------------------------------------------------ */
.card,
.form-card,
.table-card,
.filters-card,
.selection-card,
.stats-card,
.map-card,
.quick-card,
.preview-card-wrap,
.section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-body,
.form-card,
.section { padding: 1.25rem 1.5rem; }

.card-header,
.card-head,
.card-header-bar,
.tc-header,
.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #FAFBFC;
}

.card-title,
.tc-title,
.stats-card-title,
.form-card-title,
.section-title,
.selection-title {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: .45rem;
}

.section-title { margin-bottom: .9rem; }

.tc-count,
.chip-count {
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--accent-light);
    border-radius: 999px;
    padding: .1rem .55rem;
}

.prog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.prog-header h1 { font-size: 1.5rem; }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   5. BOUTONS                                                     [ag2mdo]
   ------------------------------------------------------------------------ */
.btn,
.bd-btn,
.ld-btn,
.btn-submit,
.btn-save,
.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: .55rem 1.15rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s, color .18s, box-shadow .18s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary,
.btn-submit,
.btn-save,
.btn-login,
.btn-filter-primary { background: var(--primary); color: #FFFFFF; }
.btn-primary:hover,
.btn-submit:hover,
.btn-save:hover,
.btn-login:hover,
.btn-filter-primary:hover { background: var(--primary-dark); color: #FFFFFF; }

.btn-light,
.btn-cancel,
.btn-filter,
.btn-outline-secondary { background: #E5E7EB; color: #374151; }
.btn-light:hover,
.btn-cancel:hover,
.btn-filter:hover,
.btn-outline-secondary:hover { background: #D1D5DB; color: #1F2937; }

.btn-danger,
.btn-delete { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover,
.btn-delete:hover { background: var(--danger-dark); color: #FFFFFF; }

.btn-success { background: var(--success); color: #FFFFFF; }
.btn-success:hover { background: var(--success-dark); color: #FFFFFF; }

.btn-warning { background: var(--warning); color: #FFFFFF; }
.btn-warning:hover { background: #D97706; color: #FFFFFF; }

.btn-info { background: var(--info); color: #FFFFFF; }
.btn-info:hover { background: #2563EB; color: #FFFFFF; }

.btn-accent,
.btn-add,
.btn-edit,
.btn-upload { background: var(--accent); color: #FFFFFF; }
.btn-accent:hover,
.btn-add:hover,
.btn-edit:hover,
.btn-upload:hover { background: var(--accent-dark); color: #FFFFFF; }

.btn-view { background: var(--accent-light); color: var(--primary); }
.btn-view:hover { background: var(--light); color: var(--primary-dark); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #FFFFFF; }

.btn-link {
    background: none;
    color: var(--accent);
    padding: .2rem .3rem;
    font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

.btn-sm { padding: .35rem .7rem; font-size: .75rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: .9rem; }
.btn-block { width: 100%; }

/* Petits boutons d'action dans les tableaux */
.btn-action,
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text-muted);
    font-size: .78rem;
    cursor: pointer;
    transition: all .15s;
}
.btn-action:hover,
.btn-icon:hover { background: var(--accent-light); color: var(--primary); border-color: var(--accent-border); }
.btn-action.btn-danger,
.btn-action.btn-delete { color: var(--danger); }
.btn-action.btn-danger:hover,
.btn-action.btn-delete:hover { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }

.btn-group,
.stats-actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}
.form-actions { margin-top: 1.25rem; }

.ghost {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
}

.seg-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.seg-toggle > * { padding: .35rem .8rem; font-size: .78rem; background: var(--white); border: none; cursor: pointer; }
.seg-toggle > *.active { background: var(--primary); color: #FFFFFF; }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   6. FORMULAIRES ET FILTRES                                      [ag2mdo]
   ------------------------------------------------------------------------ */
.form-group,
.filter-group,
.select-group,
.fg { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .3rem; }

.form-group > label,
.filter-group > label,
.select-group > label,
.select-label,
.toggle-label,
.lbl,
.label,
.res-label,
.fg > label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary);
}
.toggle-label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; color: var(--text); }

input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="tel"], input[type="search"],
input[type="file"], select, textarea,
.form-control, .form-select, .select-input, .grade-input, .appr-select {
    width: 100%;
    padding: .5rem .7rem;
    border: 1px solid #D1D5DB;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .84rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus,
.form-control:focus, .form-select:focus, .select-input:focus, .grade-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, .15);
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); cursor: pointer; }
textarea { min-height: 90px; resize: vertical; }
select { cursor: pointer; }

.form-row,
.filters-row,
.selection-row,
.stats-bar,
.filter-bar,
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.filters-card { padding: 1.1rem 1.25rem; }
.filters-row .filter-group,
.form-row .form-group { flex: 1 1 180px; min-width: 150px; margin-bottom: 0; }
.form-row .full,
.form-grid-2 .full { flex-basis: 100%; grid-column: 1 / -1; }

.form-grid,
.form-grid-2,
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.map-grid,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.radio-group { gap: .8rem; align-items: center; }
.radio-group label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; }

.grade-input { text-align: center; max-width: 90px; font-weight: 600; }
.grade-input.invalid { border-color: var(--danger); background: #FEF2F2; }

.upload-zone {
    border: 2px dashed var(--accent-border);
    border-radius: var(--radius);
    background: #FAFCFE;
    padding: 1.75rem 1rem;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-light); }
.file-name { font-size: .78rem; color: var(--primary); font-weight: 600; }

.error-message,
.empty-msg,
.info-line,
.badge-info-msg {
    font-size: .8rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    margin-bottom: .8rem;
}
.error-message { background: #FEF2F2; color: var(--danger-dark); border-left: 3px solid var(--danger); }
.badge-info-msg,
.info-line { background: var(--accent-light); color: var(--primary); border-left: 3px solid var(--accent); }
.empty-msg { background: #F9FAFB; color: var(--text-muted); text-align: center; }

/* Messages flash generiques (alert-*) */
.alert { padding: .7rem 1rem; border-radius: var(--radius-sm); font-size: .82rem; margin-bottom: 1rem; border-left: 3px solid; }
.alert-success { background: #ECFDF5; color: #065F46; border-color: var(--success); }
.alert-danger,
.alert-error   { background: #FEF2F2; color: #991B1B; border-color: var(--danger); }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: var(--warning); }
.alert-info    { background: var(--accent-light); color: var(--primary); border-color: var(--accent); }


/* ag2mdo */
/* ---------------------------------------------------------------------------
   7. TABLEAUX                                                    [ag2mdo]
   ------------------------------------------------------------------------ */
.data-table-wrapper,
.table-responsive { width: 100%; overflow-x: auto; }

.prog-table,
.data-table,
.table-mini,
.saisie-table,
.grades {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.prog-table thead,
.data-table thead,
.saisie-table thead {
    background: var(--primary);
    color: #FFFFFF;
}
.prog-table th,
.data-table th,
.saisie-table th {
    padding: .65rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}
.prog-table td,
.data-table td,
.saisie-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.prog-table tbody tr:hover,
.data-table tbody tr:hover { background: #F9FAFB; }
.prog-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: none; }

.prog-table th a,
.data-table th a,
.sort-link,
.sort-th { color: #FFFFFF; }
.sort-link:hover,
.sort-th:hover { color: #FFFFFF; opacity: .85; }
.sort-icon { font-size: .68rem; margin-left: .2rem; }

.table-mini { font-size: .78rem; }
.table-mini th,
.table-mini td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
.table-mini thead { background: #F3F4F6; color: var(--primary); }

.num,
.val,
.valeur,
.value,
.total,
.sous-total,
.sous-total-final,
.c-num { text-align: right; font-variant-numeric: tabular-nums; }
.num, .total, .sous-total, .sous-total-final { font-weight: 600; }
.total, .sous-total-final { background: #F3F4F6; }

.student-name { font-weight: 600; color: var(--primary); }
.matiere { font-weight: 500; }
.left-td { text-align: left; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    flex-wrap: wrap;
    padding: 1rem;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px; height: 32px;
    padding: 0 .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--primary);
    font-size: .8rem;
}
.page-link:hover { background: var(--accent-light); }
.page-link.active { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   8. STATISTIQUES / KPI / CARTES RAPIDES                         [ag2mdo]
   ------------------------------------------------------------------------ */
.stats-grid,
.dash-stats,
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card,
.dash-stat,
.kpi-card,
.stat-box,
.detail-stat-box,
.dup-stat,
.ld-stat,
.kpi,
.quick-card,
.trimestre-box {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.15rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}

.stat-icon,
.dash-stat-icon,
.kpi-icon,
.quick-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-info,
.dash-stat-info,
.stat-content { display: flex; flex-direction: column; min-width: 0; }

.stat-value,
.stat-val,
.stat-num,
.dash-stat-nb,
.kpi-val,
.k-value,
.detail-stat-val,
.ld-stat-nb,
.ld-fv-nb {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.stat-label,
.stat-lbl,
.kpi-lbl,
.k-label,
.detail-stat-lbl,
.ld-stat-lb,
.ld-fv-lb,
.quick-card-label {
    font-size: .74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.kpi-sub,
.quick-card-desc { font-size: .74rem; color: var(--text-muted); }

/* Variantes de couleur utilisees sur les cartes */
.stat-card.blue,   .dash-stat.blue,   .kpi-card.blue   { border-left-color: var(--info); }
.stat-card.green,  .dash-stat.green,  .kpi-card.green  { border-left-color: var(--success); }
.stat-card.orange, .dash-stat.orange, .kpi-card.orange { border-left-color: var(--warning); }
.stat-card.purple, .dash-stat.purple, .kpi-card.purple { border-left-color: #8B5CF6; }
.stat-card.red,    .dash-stat.red,    .kpi-card.red    { border-left-color: var(--danger); }
.blue   .stat-icon, .blue   .dash-stat-icon { background: #DBEAFE; color: #1D4ED8; }
.green  .stat-icon, .green  .dash-stat-icon { background: #D1FAE5; color: #047857; }
.orange .stat-icon, .orange .dash-stat-icon { background: #FEF3C7; color: #B45309; }
.purple .stat-icon, .purple .dash-stat-icon { background: #EDE9FE; color: #6D28D9; }

.quick-card,
.selection-card,
.map-card { flex-direction: column; align-items: flex-start; }
.quick-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, .1); }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   9. BADGES, PASTILLES, PUCES                                    [ag2mdo]
   ------------------------------------------------------------------------ */
.badge,
.chip,
.tag,
.status-badge,
.format-tag,
.found-badge,
.ip-chip,
.badge-p,
.badge-completion {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.5;
    background: #F3F4F6;
    color: #374151;
    white-space: nowrap;
}
.badge-primary { background: var(--accent-light); color: var(--primary); }
.badge-success,
.badge-ok,
.status-active,
.ok { background: #D1FAE5; color: #065F46; }
.badge-danger,
.status-inactive { background: #FEE2E2; color: #991B1B; }
.badge-warning,
.partial { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-muted { background: #F3F4F6; color: var(--text-muted); }

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.dot.ok { background: var(--success); }
.dot.ko { background: var(--danger); }

.bar-seg { height: 8px; border-radius: 4px; background: var(--accent); }
.badge-completion { background: var(--accent-light); color: var(--primary); }

.perf-miss,
.perf-note,
.subj-note,
.obs-line { font-size: .78rem; color: var(--text-muted); }
.perf-miss { color: var(--danger); }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   10. MODALES                                                    [ag2mdo]
   ------------------------------------------------------------------------ */
.modal-overlay,
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 1500;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open,
.modal-overlay.show,
.modal-overlay.active,
.modal.open,
.modal.show { display: flex; }

.modal-box {
    background: var(--white);
    border-radius: 12px;
    padding: 1.75rem;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-box.wide { max-width: 820px; }
.modal-box h2,
.modal-box h3 {
    font-size: 1.12rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.modal-actions {
    display: flex;
    gap: .7rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   11. TOASTS                                                     [ag2mdo]
   ------------------------------------------------------------------------ */
.toast-container {
    position: fixed;
    bottom: 30px; right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: 380px;
    padding: 12px 18px;
    background: var(--white);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    font-size: .85rem;
    animation: slideIn .3s ease;
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }
@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   12. ETATS VIDES, LISTES, DIVERS                                [ag2mdo]
   ------------------------------------------------------------------------ */
.empty-state,
.empty {
    text-align: center;
    padding: 2.75rem 1rem;
    color: #9CA3AF;
}
.empty-state i { font-size: 2.2rem; margin-bottom: .6rem; display: block; opacity: .5; }

.list { list-style: none; }
.item,
.line,
.info-item,
.carte-ligne,
.obs-line,
.template-info-row,
.ld-school-row,
.bd-row2 {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: .82rem;
}
.item:last-child,
.line:last-child,
.info-item:last-child { border-bottom: none; }
.info-item .label,
.template-info-row .label { min-width: 140px; color: var(--text-muted); font-weight: 500; }

.dropdown-item {
    display: block;
    padding: .45rem .8rem;
    font-size: .82rem;
    color: var(--text);
}
.dropdown-item:hover { background: var(--accent-light); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--border); margin: .3rem 0; }

/* Messagerie */
.msg-list { list-style: none; }
.msg-item,
.msg-view { border-bottom: 1px solid var(--border); }
.msg-body { display: flex; gap: .75rem; padding: .8rem 1rem; }
.msg-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .78rem;
    flex-shrink: 0;
}
.msg-subj { font-weight: 600; color: var(--primary); }
.msg-sender { font-size: .8rem; font-weight: 600; }
.msg-date,
.msg-meta,
.p-time { font-size: .72rem; color: var(--text-muted); }
.msg-content { font-size: .85rem; line-height: 1.6; padding: 1rem; }

/* Aperçus / previsualisation */
.preview-box,
.preview-card-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #FCFCFD;
    padding: 1rem;
    overflow: auto;
}

/* Signatures (bulletins, recus) */
.signatures { display: flex; justify-content: space-between; gap: 2rem; margin-top: 2rem; flex-wrap: wrap; }
.signature-box,
.sig-title,
.sig-name { font-size: .8rem; text-align: center; }
.signature-box { min-width: 180px; border-top: 1px solid #94A3B8; padding-top: .35rem; }
.sig-title { font-weight: 600; color: var(--primary); }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   13. ETABLISSEMENT EN LECTURE SEULE                             [ag2mdo]
   ---------------------------------------------------------------------------
   ag2mdo : regle centrale. Quand le <body> porte la classe .etab-readonly,
   toutes les commandes d'ecriture sont masquees, en complement du controle
   serveur (le blocage reel reste cote PHP).
   ------------------------------------------------------------------------ */
.etab-readonly .btn-add,
.etab-readonly .btn-edit,
.etab-readonly .btn-delete,
.etab-readonly .bd-add,
.etab-readonly .btn-save,
.etab-readonly .btn-submit,
.etab-readonly .btn-upload,
.etab-readonly .btn-primary,
.etab-readonly .btn-danger,
.etab-readonly .btn-light[title='Modifier'],
.etab-readonly a[href*='action=edit'],
.etab-readonly a[href*='action=add'],
.etab-readonly button[onclick*='openAddModal'],
.etab-readonly button[onclick*='confirmDelete'] { display: none !important; }

/* Le bouton d'export/impression reste autorise en lecture seule. */
.etab-readonly .btn-export,
.etab-readonly .btn-print,
.etab-readonly .btn-view { display: inline-flex !important; }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   13 bis. ELEMENTS PILOTES PAR main.js                            [ag2mdo]
   Voile du menu mobile, etats de chargement, fermeture des alertes et
   detail interne des notifications.
   ------------------------------------------------------------------------ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 900;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

@media (min-width: 769px) {
    .sidebar-overlay { display: none; }
}

body.modal-open { overflow: hidden; }

.toast-icon { flex: 0 0 auto; font-size: 1rem; line-height: 1; }
.toast-msg  { flex: 1 1 auto; }
.toast { cursor: pointer; }
.toast-out {
    animation: none;
    opacity: 0;
    transform: translateX(110%);
    transition: opacity .25s ease, transform .25s ease;
}

/* Bouton neutralise pendant l'envoi d'un formulaire. */
.is-busy {
    opacity: .65;
    cursor: progress !important;
    pointer-events: none;
}

.alert { position: relative; }
.alert-close,
.alert .close {
    position: absolute;
    top: .35rem; right: .5rem;
    background: none;
    border: 0;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: .6;
}
.alert-close:hover,
.alert .close:hover { opacity: 1; }

/* ag2mdo */
/* ---------------------------------------------------------------------------
   14. IMPRESSION                                                 [ag2mdo]
   ------------------------------------------------------------------------ */
@media print {
    .sidebar,
    .topbar,
    .menu-toggle,
    .sidebar-overlay,
    .toast-container,
    .filters-card,
    .pagination,
    .no-print,
    .noprint { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #FFFFFF; }
    .card,
    .table-card { box-shadow: none; border: 1px solid #D1D5DB; }
    a { color: inherit; text-decoration: none; }
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   15. RESPONSIVE                                                 [ag2mdo]
   ------------------------------------------------------------------------ */
@media (max-width: 1024px) {
    .form-grid, .form-grid-2, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); box-shadow: 4px 0 24px rgba(0, 0, 0, .25); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 1rem; }
    .topbar { padding: .6rem .9rem; gap: .5rem; }
    .topbar-center { display: none; }
    .topbar-user-info { display: none; }
    .topbar-logout span { display: none; }
    .prog-table th, .prog-table td,
    .data-table th, .data-table td { padding: .5rem .6rem; font-size: .78rem; }
    .filters-row .filter-group,
    .form-row .form-group { flex-basis: 100%; }
    .toast-container { left: 12px; right: 12px; bottom: 12px; }
    .toast { max-width: none; }
    .modal-box { padding: 1.25rem; }
    .signatures { flex-direction: column; gap: 1.25rem; }
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   16. CLASSES COMPLEMENTAIRES                                    [ag2mdo]
   ---------------------------------------------------------------------------
   ag2mdo : classes presentes dans les pages PHP mais qui n'avaient encore
   aucune regle (ni ici, ni en style inline). Regroupees par ecran.
   ------------------------------------------------------------------------ */

/* ag2mdo -- 16.1 Page de connexion et double authentification
   (auth/login.php, auth/2fa_verify.php) */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2rem;
    text-align: center;
}
.login-box h1,
.login-box h2 {
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: .35rem;
}
.login-box p { color: var(--text-muted); font-size: .82rem; margin-bottom: 1.4rem; }
.login-box .form-group { text-align: left; }
.login-box .btn-login { width: 100%; margin-top: .4rem; }
.btn-login-secondary {
    background: var(--light);
    color: var(--primary);
    margin-top: .6rem;
}
.btn-login-secondary:hover { background: var(--accent-border); color: var(--primary-dark); }

/* ag2mdo -- 16.2 Matrice des permissions (admin/permissions.php) */
.perm-wrapper { overflow-x: auto; }
.perm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
    background: var(--white);
}
.perm-table th,
.perm-table td {
    border: 1px solid var(--border);
    padding: .45rem .55rem;
    text-align: center;
    vertical-align: middle;
}
.perm-table thead th {
    background: var(--accent-light);
    color: var(--primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.perm-module {
    text-align: left !important;
    font-weight: 600;
    color: var(--primary);
    background: #FAFBFD;
    white-space: nowrap;
}
.perm-label { text-align: left !important; color: var(--text); }
.perm-cell { width: 46px; }
.perm-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.perm-row:hover td { background: #F6F9FC; }
.perm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
}
.perm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .75rem;
}

/* ag2mdo -- 16.3 Fiche utilisateur (admin/user_detail.php) */
.perm-detail-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.perm-detail-card,
.detail-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}
.perm-detail-title,
.detail-title {
    font-size: .74rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .5rem;
}
.perm-detail-list,
.detail-list { list-style: none; margin: 0; padding: 0; }
.perm-detail-list li,
.detail-list li {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .35rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: .82rem;
}
.perm-detail-list li:last-child,
.detail-list li:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); }
.detail-value { color: var(--text); font-weight: 600; text-align: right; }
.detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    align-items: center;
}
.user-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--light);
    background: var(--accent-light);
}
.role-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--primary);
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
}
.badge-super { background: #F3E8FF; color: #6B21A8; }
.badge-admin { background: var(--accent-light); color: var(--primary); }

/* ag2mdo -- 16.4 Accordeons (admin/council_thresholds.php) */
.acc-body {
    padding: .9rem 1rem;
    border-top: 1px solid var(--border);
    background: #FCFDFE;
}
.acc-body[hidden] { display: none; }
.acc-chevron {
    margin-left: auto;
    font-size: .72rem;
    color: var(--text-muted);
    transition: transform .2s;
}
.acc-open .acc-chevron,
.active .acc-chevron { transform: rotate(180deg); }
.grades-group-header td,
.grades-group-header th {
    background: var(--accent-light);
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}
.grades-group-header:hover td { background: var(--light); }

/* ag2mdo -- 16.5 Discipline : categories dans les listes deroulantes */
.cat-sanction { color: var(--danger); }
.cat-recompense { color: var(--success-dark); }

/* ag2mdo -- 16.6 Onglets, grilles et divers */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    border-bottom: 2px solid var(--border);
}
.tab-nav a,
.tab-nav button {
    padding: .5rem .95rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab-nav a:hover,
.tab-nav button:hover { color: var(--primary); }
.tab-nav a.active,
.tab-nav button.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: .4rem .8rem;
    border-radius: var(--radius-sm);
    background: var(--light);
    color: var(--primary);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
}
.btn-back:hover { background: var(--accent-border); color: var(--primary-dark); }
.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #FFFFFF; }
.btn-outline-success {
    background: transparent;
    color: var(--success-dark);
    border: 1px solid var(--success-dark);
}
.btn-outline-success:hover { background: var(--success-dark); color: #FFFFFF; }
.photo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}
.topbar-messages a { color: var(--primary); }
.topbar-messages .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: #FFFFFF;
    font-size: .64rem;
    padding: 1px 5px;
    border-radius: 9px;
}
.cls-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.bulletin-rappel { color: var(--text); }

/* ag2mdo -- 16.7 Utilitaires facon Bootstrap encore manquants. Les pages en
   utilisent alors que Bootstrap n'est pas charge. Ceux deja definis au
   chapitre 2 (marges, .text-center, .d-none, .w-100...) ne sont pas repetes. */
h5, .h5 { font-size: 1rem; font-weight: 600; }
h6, .h6 { font-size: .88rem; font-weight: 600; }
.text-white { color: #FFFFFF; }
.text-end { text-align: right; }
.bg-success { background-color: var(--success); }
.bg-light { background-color: var(--bg); }
.rounded { border-radius: var(--radius-sm); }
.float-end { float: right; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.me-0 { margin-right: 0; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -.5rem;
    margin-right: -.5rem;
}
.row > [class*="col-"] { padding-left: .5rem; padding-right: .5rem; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.form-check { display: flex; align-items: center; gap: .4rem; }
.form-check-input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.form-check-label { font-size: .82rem; color: var(--text); cursor: pointer; }
.form-check-inline { display: inline-flex; margin-right: 1rem; }

/* ag2mdo -- 16.8 Adaptation mobile des blocs ci-dessus */
@media (max-width: 768px) {
    .login-box { padding: 1.5rem 1.15rem; }
    .dashboard-grid-2 { grid-template-columns: 1fr; }
    .perm-detail-grid,
    .detail-grid { grid-template-columns: 1fr; }
    .col-md-4,
    .col-md-6,
    .col-6 { flex: 0 0 100%; max-width: 100%; }
    .perm-table { font-size: .72rem; }
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   17. ECRANS SPECIFIQUES                                         [ag2mdo]
   ---------------------------------------------------------------------------
   Classes employees par une seule page (ou par un petit groupe de pages) et
   qui n'avaient aucune definition : matrice des permissions, fiche detaillee
   d'un utilisateur, seuils de conseil, recadrage des photos, cases a cocher
   de selection multiple, plus quelques utilitaires manquants.
   ------------------------------------------------------------------------ */

/* ag2mdo -- 17.1 Matrice des permissions (admin/permissions.php) */
.perm-group {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.perm-group-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .8rem 1rem;
    background: var(--primary);
    color: var(--white);
    font-size: .92rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.perm-group-title i { opacity: .85; }
.perm-matrix-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.perm-matrix {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: .8rem;
}
.perm-matrix th,
.perm-matrix td {
    border: 1px solid var(--border);
    padding: .45rem .55rem;
    text-align: center;
    vertical-align: middle;
}
.perm-matrix thead th {
    background: var(--accent-light);
    color: var(--primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.perm-matrix tbody tr:nth-child(even) { background: #FAFBFD; }
.perm-matrix tbody tr:hover { background: var(--accent-light); }
.perm-page-col {
    min-width: 210px;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--accent-light);
}
.perm-page-label {
    text-align: left;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
}
.perm-page-label i {
    color: var(--accent);
    width: 1.1rem;
    margin-right: .35rem;
}
.perm-role-col {
    background: var(--primary-light);
    color: var(--white);
    border-bottom: 2px solid var(--primary);
}
.perm-action-col {
    min-width: 62px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    background: var(--bg);
}

/* ag2mdo -- 17.2 Fiche utilisateur : mise en page 2 colonnes (admin/user_detail.php) */
.detail-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
.detail-col-left,
.detail-col-right {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.detail-profile-card {
    text-align: center;
    padding: 1.5rem 1.15rem;
}
.detail-name {
    margin-top: .8rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    word-break: break-word;
}
.detail-email {
    font-size: .82rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: .6rem;
}
.detail-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    text-align: left;
}
.detail-info-table th,
.detail-info-table td {
    padding: .5rem .35rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.detail-info-table th {
    width: 42%;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.detail-info-table tr:last-child th,
.detail-info-table tr:last-child td { border-bottom: none; }
.detail-linked-student {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .8rem;
    margin-bottom: .5rem;
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: .82rem;
    text-align: left;
}
.detail-linked-student i { color: var(--accent); }

/* ag2mdo -- 17.3 Fiche utilisateur : permissions effectives */
.perm-detail-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .9rem;
    overflow: hidden;
}
.perm-detail-group-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .8rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary);
}
.perm-detail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .8rem;
    border-bottom: 1px solid var(--border);
}
.perm-detail-row:last-child { border-bottom: none; }
.perm-detail-row:hover { background: #FAFBFD; }
.perm-detail-page {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--text);
    min-width: 180px;
}
.perm-detail-page i {
    color: var(--accent);
    width: 1.1rem;
    text-align: center;
}
.perm-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

/* ag2mdo -- 17.4 Accordeon des seuils de conseil (admin/council_thresholds.php) */
.acc {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}
.acc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease;
}
.acc-header:hover { background: var(--accent-light); }
.acc-header:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.acc-header[aria-expanded="false"] + .acc-body { display: none; }
.acc-body { padding: 0; }
.acc-header .acc-caret,
.acc-header > i:last-child { transition: transform .2s ease; }
.acc-header[aria-expanded="false"] .acc-caret,
.acc-header[aria-expanded="false"] > i:last-child { transform: rotate(-90deg); }
.level-toggle {
    cursor: pointer;
    user-select: none;
}
.level-toggle:hover { filter: brightness(.97); }
.level-toggle.collapsed td { opacity: .75; }

/* ag2mdo -- 17.5 Recadrage des photos (admin/photo_crop.php)
   La page porte deja ses propres styles internes ; on complete uniquement les
   elements sans regle : curseur de zoom, boutons et champ technique cache. */
.crop-image-data { display: none; }
.crop-zoom {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--light);
    cursor: pointer;
}
.crop-zoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--white);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    cursor: pointer;
}
.crop-zoom::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid var(--white);
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.crop-reset,
.crop-save { cursor: pointer; }
.crop-save:disabled,
.crop-reset:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ag2mdo -- 17.6 Cases a cocher de selection multiple (listes et imports) */
.cb,
.class-cb,
.chk-arc,
.ip-chk,
.row-check,
.groupCheck {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    vertical-align: middle;
}
.cb:disabled,
.class-cb:disabled,
.chk-arc:disabled,
.ip-chk:disabled,
.row-check:disabled,
.groupCheck:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ag2mdo -- 17.7 Utilitaires encore manquants */
.container {
    display: grid;
    gap: 1rem;
    width: 100%;
}
.bg-white { background-color: var(--white); }
.align-items-end { align-items: flex-end; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-muted); }
.form-select-sm {
    padding: .3rem .5rem;
    font-size: .78rem;
    height: auto;
    line-height: 1.3;
}
.adventist { --brand-accent: var(--accent); }
.portal-toggle { display: none; }

/* ag2mdo -- 17.8 Adaptation mobile des ecrans specifiques */
@media (max-width: 992px) {
    .detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .perm-matrix { font-size: .72rem; }
    .perm-page-col { min-width: 150px; }
    .perm-detail-row { align-items: flex-start; }
    .perm-detail-page { min-width: 100%; }
    .portal-toggle { display: block; }
}

/* ag2mdo */
/* ---------------------------------------------------------------------------
   18. MENU PRINCIPAL HORIZONTAL (au-dessus du contenu)            [ag2mdo]
   ---------------------------------------------------------------------------
   Le menu etait affiche en colonne fixe a gauche du contenu.
   Il est desormais affiche en barre horizontale AU-DESSUS du contenu.
   Tout est fait en CSS : aucune page HTML/PHP n'a besoin d'etre modifiee.
   ------------------------------------------------------------------------ */

/* La coquille passe d'une mise en page en colonnes a un empilement vertical */
.dashboard {                       /* ag2mdo */
    display: block;
    min-height: 100vh;
}

/* Le contenu occupe toute la largeur : plus de retrait a gauche */
.main-content {                    /* ag2mdo */
    margin-left: 0;
    width: 100%;
    display: block;
}

/* Le menu devient une barre pleine largeur, dans le flux, avant le contenu */
.sidebar {                         /* ag2mdo */
    position: relative;
    top: auto; left: auto; bottom: auto;
    width: 100%;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
    transform: none !important;
    transition: none;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .18);
}

/* Nom de l'ecole + logo : a gauche de la barre */
.sidebar-brand {                   /* ag2mdo */
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, .08);
    padding: .5rem 1rem;
    min-height: 0;
    flex-shrink: 0;
    max-width: 34%;
}
.sidebar-school-logo { width: 32px; height: 32px; }   /* ag2mdo */

/* Les entrees de menu s'alignent horizontalement */
.sidebar-menu {                    /* ag2mdo */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    flex: 1 1 auto;
    overflow: visible;
    padding: 0 .25rem;
    margin: 0;
}
.sidebar-menu > li { position: relative; }            /* ag2mdo */

.sidebar-menu a {                  /* ag2mdo */
    padding: .7rem .8rem;
    gap: .45rem;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 3px solid transparent;
}
.sidebar-menu a.active {           /* ag2mdo */
    border-left-color: transparent;
    border-bottom-color: var(--accent);
}

/* Les sous-menus s'ouvrent en liste deroulante sous leur entree */
.menu-parent .sub-toggle { margin-left: .3rem; }      /* ag2mdo */
.menu-parent.open > a .sub-toggle { transform: rotate(90deg); }  /* ag2mdo */

.sub-menu {                        /* ag2mdo */
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #1F2937;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .3);
    z-index: 1200;
}
.menu-parent.open > .sub-menu {    /* ag2mdo */
    max-height: 70vh;
    overflow-y: auto;
}
.sub-menu a {                      /* ag2mdo */
    padding: .55rem 1rem;
    white-space: normal;
    border-bottom: 0;
    border-left: 3px solid transparent;
}
.sub-menu a.active { border-left-color: var(--accent); }   /* ag2mdo */

/* Le dernier sous-menu de la barre s'ouvre vers la gauche pour rester visible */
.sidebar-menu > li:last-child .sub-menu { left: auto; right: 0; }  /* ag2mdo */

/* Un sous-menu de 2e niveau s'ouvre sur le cote, et non par-dessus le premier */
.sub-menu .menu-parent { position: relative; }        /* ag2mdo */
.sub-menu .menu-parent > .sub-menu {                  /* ag2mdo */
    top: 0;
    left: 100%;
    right: auto;
    border-radius: var(--radius-sm);
}
.sidebar-menu > li:last-child .sub-menu .menu-parent > .sub-menu {  /* ag2mdo */
    left: auto;
    right: 100%;
}
.sub-menu .menu-parent > a .sub-toggle { margin-left: auto; }       /* ag2mdo */

/* Utilisateur connecte + deconnexion : a droite de la barre */
.sidebar-footer {                  /* ag2mdo */
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .4rem 1rem;
    margin-left: auto;
    flex-shrink: 0;
}
.sidebar-user { margin-bottom: 0; }                   /* ag2mdo */
.sidebar-user-avatar,
.sidebar-user-avatar img { width: 30px; height: 30px; }   /* ag2mdo */
.sidebar-logout { white-space: nowrap; }              /* ag2mdo */

/* Le voile d'arriere-plan n'a plus d'utilite */
.sidebar-overlay { display: none !important; }        /* ag2mdo */

/* Affichage compact : le menu se replie et s'ouvre avec le bouton hamburger */
@media (max-width: 768px) {                           /* ag2mdo */
    .sidebar { flex-wrap: wrap; }
    .sidebar-brand { max-width: 100%; flex: 1 1 auto; border-right: 0; }
    .menu-toggle { display: inline-flex; }

    .sidebar-menu {
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height .25s ease;
    }
    .sidebar.active .sidebar-menu {
        max-height: 70vh;
        overflow-y: auto;
        padding: .35rem 0 .6rem;
        border-top: 1px solid rgba(255, 255, 255, .08);
    }
    .sidebar-menu a { white-space: normal; }

    .sub-menu {
        position: static;
        min-width: 0;
        max-height: 0;
        overflow: hidden;
        box-shadow: none;
        background: rgba(0, 0, 0, .22);
    }
    .menu-parent.open > .sub-menu { max-height: 900px; }
    .sub-menu a { padding-left: 2.4rem; }
    .sidebar-menu > li:last-child .sub-menu { right: auto; left: auto; }
    .sub-menu .menu-parent > .sub-menu {              /* ag2mdo */
        position: static;
        top: auto; left: auto; right: auto;
    }
    .sub-menu .sub-menu a { padding-left: 3.4rem; }   /* ag2mdo */

    .sidebar-footer {
        margin-left: 0;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .08);
        flex: 1 1 100%;
        justify-content: space-between;
    }
}

/* A l'impression, le menu reste masque */
@media print {                                        /* ag2mdo */
    .sidebar { display: none !important; }
    .main-content { margin-left: 0 !important; }
}

/* ag2mdo -- 18.1 Bouton d'ouverture du menu (barre horizontale) */
.menu-toggle {                     /* ag2mdo */
    color: #E5E7EB;
    align-self: center;
    margin-left: .25rem;
}
/* Le bouton du portail etait colle au bord gauche de l'ecran : il rejoint
   la barre de menu. */
.sidebar .portal-toggle {           /* ag2mdo */
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm) !important;
    order: 2;
    display: none;
}
@media (max-width: 768px) {         /* ag2mdo */
    .sidebar .portal-toggle { display: inline-flex !important; align-items: center; justify-content: center; }
}
