/* ========================================================================
   CMDL — Application de gestion des étudiants — v2
   Mise en page 4 colonnes selon modèle Word
   ======================================================================== */

:root {
    --color-primary: #1f4e78;
    --color-primary-dark: #163553;
    --color-primary-light: #e8f0f7;
    --color-accent: #c1854b;
    --color-success: #2d7a4f;
    --color-success-bg: #e3f3eb;
    --color-warning: #b87800;
    --color-warning-bg: #fff4dc;
    --color-danger: #b1322a;
    --color-danger-bg: #fbe7e5;
    --color-info: #2d6a91;
    --color-muted: #6b7280;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #d1d8e0;
    --color-bg: #f7f9fb;
    --color-bg-card: #ffffff;
    --color-bg-cell: #f9fafc;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --radius: 8px;
    --radius-sm: 4px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14.5px;
    line-height: 1.5;
}

/* ========== TOPBAR ========== */
.topbar {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.brand {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}
.brand-mark {
    font-size: 24px;
    color: var(--color-accent);
}
.brand-text em {
    font-style: normal;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 4px;
}
.main-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.main-nav a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: background 0.15s;
}
.main-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* ── Dropdown Paramètres ── */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.92);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    transition: background 0.15s;
    white-space: nowrap;
}
.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #1e3a5f;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    z-index: 500;
    padding: 6px 0;
    overflow: hidden;
}
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu a {
    display: block;
    padding: 9px 18px;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.12s;
    border-radius: 0;
}
.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.10);
    color: white;
}
.nav-dropdown-sep {
    height: 1px;
    background: rgba(255,255,255,0.10);
    margin: 5px 0;
}

/* ========== LAYOUT ========== */
.content {
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}
.footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
    padding: 20px;
    border-top: 1px solid var(--color-border);
    background: white;
}

/* ========== STICKY HEADER ZONE (nav-fiche + page-header groupés) ========== */
.sticky-header-zone {
    position: sticky;
    top: 60px;
    z-index: 50;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.sticky-header-zone .nav-fiche {
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
}
.sticky-header-zone .page-header {
    position: static;
    border-bottom: none;
    box-shadow: none;
    margin-bottom: 0;
}

/* ========== PAGE HEADER ========== */
.page-header {
    background: var(--color-bg);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}
.page-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    color: var(--color-primary-dark);
    font-weight: 600;
}
.subtitle {
    color: var(--color-text-light);
    margin: 0;
    font-size: 13.5px;
}
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.header-photo-thumb {
    height: 50px;
    width: auto;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

/* ========== FLASH ========== */
.flash-zone { margin-bottom: 18px; }
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
    border-left: 4px solid;
}
.flash-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.flash-error   { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger); }
.flash-warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning); }
.flash-info    { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }

/* ========== BUTTONS ========== */
.btn, .btn-mini, .btn-tiny {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-weight: 500;
    line-height: 1.2;
    font-family: inherit;
}
.btn:hover, .btn-mini:hover { background: var(--color-bg); border-color: var(--color-primary); }
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: white; }
.btn-success { background: var(--color-success); color: white; border-color: var(--color-success); }
.btn-success:hover { background: #235e3d; color: white; }
.btn-danger { background: var(--color-danger); color: white; border-color: var(--color-danger); }
.btn-danger:hover { background: #8e2722; color: white; }
.btn-ghost { background: transparent; }
.btn-mini { padding: 3px 9px; font-size: 12px; }
.btn-mini-danger { color: var(--color-danger); border-color: var(--color-danger); }
.btn-mini-danger:hover { background: var(--color-danger); color: white; }
.btn-tiny {
    padding: 2px 8px; font-size: 11px; font-weight: 400;
    color: var(--color-text-light); margin-left: 8px; vertical-align: middle;
}
.inline-form { display: inline-block; margin: 0; }

/* ========== STATS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-top: 3px solid var(--color-border);
}
.stat-card.stat-primary { border-top-color: var(--color-primary); }
.stat-card.stat-success { border-top-color: var(--color-success); }
.stat-card.stat-warning { border-top-color: var(--color-warning); }
.stat-card.stat-info { border-top-color: var(--color-info); }
.stat-card.stat-muted { border-top-color: var(--color-muted); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--color-primary-dark); line-height: 1; }
.stat-label { color: var(--color-text-light); font-size: 12.5px; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ========== PANEL ========== */
.panel {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    border: 1px solid var(--color-border);
}
.panel h2 { font-size: 15.5px; margin: 0 0 14px; color: var(--color-primary-dark); font-weight: 600; }
.panel h3 { font-size: 13.5px; margin: 14px 0 8px; color: var(--color-text); font-weight: 600; }
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .dashboard-row { grid-template-columns: 1fr; } }

/* ========== BAR LIST ========== */
.bar-list { list-style: none; padding: 0; margin: 0; }
.bar-list li { margin-bottom: 12px; }
.bar-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }
.bar-count { font-weight: 600; color: var(--color-primary); }
.bar-track { background: var(--color-bg); height: 6px; border-radius: 3px; overflow: hidden; }
.bar-fill { background: var(--color-primary); height: 100%; transition: width 0.4s; }
.bar-fill-alt { background: var(--color-accent); }

.empty { color: var(--color-text-light); font-style: italic; text-align: center; padding: 16px; }
.empty-state {
    text-align: center; padding: 60px 20px;
    background: var(--color-bg-card); border-radius: var(--radius);
}
.empty-state p { color: var(--color-text-light); margin-bottom: 16px; }
.quick-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ========== FILTER BAR ========== */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap;
    background: white; padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.filter-bar input, .filter-bar select {
    padding: 7px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: white;
}
.search-input { flex: 1 1 300px; min-width: 200px; }

/* ========== DATA TABLE ========== */
.table-wrap {
    background: white; border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--color-border);
}
.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--color-bg); }
.data-table th.sortable { cursor: pointer; white-space: nowrap; }
.data-table th.sortable a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 3px; }
.data-table th.sortable a:hover { text-decoration: underline; }
.data-table th.sortable:not(.sort-active) a::after { content: ' ⇅'; font-size: 10px; opacity: 0.4; }
.data-table th.sort-active { background: var(--color-primary); color: #fff; }
.data-table th.sort-asc a::after { content: ' ▲'; font-size: 10px; }
.data-table th.sort-desc a::after { content: ' ▼'; font-size: 10px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.row-inactive { opacity: 0.55; }
.actions-col { white-space: nowrap; text-align: right; }
.td-sub { color: var(--color-text-light); font-size: 12px; font-weight: 400; margin-left: 4px; }

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11.5px;
    border-radius: 12px;
    font-weight: 500;
    background: var(--color-bg);
    color: var(--color-text-light);
}
.badge-actif { background: var(--color-success-bg); color: var(--color-success); }
.badge-suspendu { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-sorti { background: #eef2f7; color: var(--color-muted); }
.badge-diplome { background: #e3eef9; color: var(--color-info); }

.badge-bool {
    display: inline-block; padding: 1px 8px; font-size: 12px;
    border-radius: 10px; background: var(--color-bg); color: var(--color-muted);
}
.badge-bool-yes { background: var(--color-success-bg); color: var(--color-success); }

.required-mark { color: var(--color-danger); }
.empty-value { color: var(--color-text-light); font-style: italic; }
.custom-tag { color: var(--color-accent); font-size: 11px; margin-left: 4px; }

/* ========================================================================
   RUBRIQUES — affichage en tableau 4 colonnes (modèle Word)
   ======================================================================== */
.rubrique {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.rubrique-titre {
    margin: 0;
    padding: 11px 18px;
    background: var(--color-primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 0;
}
fieldset.rubrique { border: 1px solid var(--color-border); }
fieldset.rubrique legend.rubrique-titre {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    margin-left: 12px;
    font-size: 13.5px;
}

/* Grille 4 colonnes : titres + valeurs en dessous */
.rubrique-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.grid-cell {
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 6px 6px 10px;
    background: white;
    min-height: 60px;
}
.grid-cell:nth-child(4n) { border-right: 0; }
/* Pas de bordure basse pour la dernière ligne */
.rubrique-grid .grid-cell:nth-last-child(-n+4):nth-child(4n+1),
.rubrique-grid .grid-cell:nth-last-child(-n+4):nth-child(4n+1) ~ .grid-cell {
    border-bottom: 0;
}

.cell-label {
    font-size: 11.5px;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
}
.cell-value {
    font-size: 14px;
    color: var(--color-text);
    word-break: break-word;
    padding: 0 8px;
    min-height: 22px;
}
.grid-cell-custom { background: #fcfaf6; }

/* Champ pleine largeur (ex : commentaires_scolarite) */
.grid-cell-full {
    grid-column: 1 / -1;
    border-right: 0;
}
/* Valeur en rouge (commentaires scolarité) */
.cell-value-alert {
    color: #c0392b;
    font-weight: 500;
    white-space: pre-wrap;
}

/* Mode édition : champs dans les cellules */
.cell-input input,
.cell-input select,
.cell-input textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cell-input input:focus,
.cell-input select:focus,
.cell-input textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.12);
}
.cell-input input[disabled],
.cell-input input[readonly] {
    background: var(--color-bg);
    color: var(--color-text-light);
    cursor: not-allowed;
}
.cell-input small {
    font-size: 11px;
    color: var(--color-text-light);
    display: block;
    margin-top: 3px;
}
.checkbox-cell {
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; padding: 4px 0;
}

/* En-tête fiche : photo + ID */
.fiche-entete, .form-entete {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.fiche-photo-block, .entete-grid {
    display: flex;
    align-items: center;
    gap: 24px;
}
.entete-grid { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 32px; }
.entete-photo { display: flex; flex-direction: column; gap: 8px; }
.entete-id { display: flex; flex-direction: column; gap: 4px; max-width: 320px; }
.entete-id input { padding: 7px 11px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.entete-id small { font-size: 12px; color: var(--color-text-light); }

.fiche-photo-block img,
.photo-mini img,
.entete-photo img {
    width: 100px; height: 120px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border);
}
.photo-placeholder {
    width: 100px; height: 120px;
    background: var(--color-primary-light); color: var(--color-primary);
    font-size: 36px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}
.fiche-id { display: flex; flex-direction: column; gap: 4px; }
.fiche-id-label {
    font-size: 11px; color: var(--color-text-light);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.fiche-id-value {
    font-size: 24px; font-weight: 700;
    color: var(--color-primary-dark);
    font-family: "SF Mono", Monaco, Consolas, monospace;
}

/* Responsive : moins de colonnes sur petits écrans */
@media (max-width: 1100px) {
    .rubrique-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-cell:nth-child(4n) { border-right: 1px solid var(--color-border); }
    .grid-cell:nth-child(2n) { border-right: 0; }
}
@media (max-width: 600px) {
    .rubrique-grid { grid-template-columns: 1fr; }
    .grid-cell { border-right: 0; }
}

/* ========== FORM ACTIONS ========== */
.form-etudiant, .export-form { max-width: 100%; }
.form-actions {
    display: flex; gap: 10px;
    margin-top: 18px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: sticky;
    bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.form-field { display: flex; flex-direction: column; }
.form-field label {
    font-size: 13px; font-weight: 500;
    color: var(--color-text); margin-bottom: 4px;
}
.form-field small { font-size: 12px; color: var(--color-text-light); margin-top: 4px; }
.form-field input, .form-field select, .form-field textarea {
    padding: 7px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: white;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.12);
}
.form-inline-stacked {
    display: flex; flex-direction: column; gap: 12px;
    max-width: 520px;
}

/* ========== RÉFÉRENTIELS ========== */
.ref-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
}
@media (max-width: 800px) { .ref-layout { grid-template-columns: 1fr; } }
.ref-aside {
    background: white;
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    height: fit-content;
}
.ref-aside h3 {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.ref-codes { list-style: none; padding: 0; margin: 0; }
.ref-codes li { margin-bottom: 2px; }
.ref-code-link {
    display: block;
    padding: 7px 11px;
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 13px;
    transition: background 0.15s;
}
.ref-code-link:hover { background: var(--color-primary-light); color: var(--color-primary); }
.ref-code-link.active { background: var(--color-primary); color: white; font-weight: 600; }

.ref-add-form {
    display: flex; gap: 8px; flex-wrap: wrap;
    background: var(--color-bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    align-items: center;
}
.ref-add-form input {
    flex: 1; min-width: 120px;
    padding: 7px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: white;
}

/* ========== HISTORIQUE ========== */
.historique-list {
    list-style: none; padding: 14px 18px; margin: 0;
    font-size: 13px; background: white;
}
.historique-list li {
    display: grid;
    grid-template-columns: 100px 1fr 160px;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}
.historique-list li:last-child { border-bottom: 0; }
.hist-action { font-weight: 600; color: var(--color-primary); font-size: 12px; }
.hist-details { color: var(--color-text); }
.hist-date { color: var(--color-text-light); font-size: 12px; text-align: right; }

/* ========== EXPORT ========== */
.export-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; gap: 8px; flex-wrap: wrap;
}
.export-cat {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
    margin-top: 10px;
}
.export-cat h3 {
    font-size: 12.5px;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 8px;
    font-weight: 600;
}
.cb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 16px;
}
.cb-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; cursor: pointer;
    padding: 3px 0;
}
.cb-item input { margin: 0; }

.cols-grid {
    list-style: none; padding: 0; margin: 12px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 16px;
    font-size: 13px;
}
.cols-grid code {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 1px 6px; border-radius: 3px;
    font-size: 12px;
}

code {
    background: var(--color-bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12.5px;
    font-family: "SF Mono", Monaco, Consolas, monospace;
}

.info-bloc {
    background: var(--color-primary-light);
    border-left: 4px solid var(--color-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 14px 0;
    font-size: 13.5px;
}

/* ========================================================================
   LISTE — en-têtes triables et choix des colonnes
   ======================================================================== */
.th-sort {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    width: 100%;
}
.th-sort:hover { color: var(--color-primary); }
.th-sort-active { color: var(--color-primary); }
.sort-arrow { font-size: 10px; opacity: 0.7; }

.cols-panel {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    display: none;
}
.cols-panel.show { display: block; }
.cols-panel.cols-panel-large { max-height: 70vh; overflow-y: auto; }
.cols-panel h3 { margin: 0 0 4px; font-size: 14px; color: var(--color-primary-dark); }
/* Rubrique dans le panneau colonnes */
.cb-rub { margin-bottom: 14px; }
.cb-rub-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}
.cb-rub-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-primary-dark);
    flex: 1;
}
.cols-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    align-items: center;
    flex-wrap: wrap;
}

/* ========================================================================
   CANDIDATS — badges décision et liens pièces jointes
   ======================================================================== */
.badge-decision-en_attente { background: #f3f4f6; color: var(--color-text-light); }
.badge-decision-convoque { background: #e3eef9; color: var(--color-info); }
.badge-decision-present_audition { background: #fef3c7; color: var(--color-warning); }
.badge-decision-admis { background: var(--color-success-bg); color: var(--color-success); font-weight: 600; }
.badge-decision-liste_attente { background: #fef3c7; color: var(--color-warning); }
.badge-decision-refuse { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-decision-desistement { background: #f3f4f6; color: var(--color-text-light); text-decoration: line-through; }

.row-converti { background: #f0f9f4 !important; }
.row-converti:hover { background: #e3f3eb !important; }

.pj-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 13px;
    word-break: break-all;
}
.pj-link:hover { text-decoration: underline; }

.num-cell { text-align: right; font-variant-numeric: tabular-nums; }

.info-bloc-success {
    background: var(--color-success-bg);
    border-left-color: var(--color-success);
    color: var(--color-success);
}
.info-bloc-success a {
    color: var(--color-success);
    font-weight: 600;
}

/* ========== ACTIONS EN MASSE ========== */
.bulk-bar {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: var(--color-primary-dark);
    color: white;
    padding: 10px 20px;
    display: none;
    align-items: center;
    gap: 16px;
    border-top: 3px solid var(--color-accent);
    box-shadow: 0 -4px 20px rgba(15,23,42,.22);
    flex-wrap: wrap;
}
.bulk-bar.visible { display: flex; }
.bulk-count { font-weight: 600; font-size: 14px; min-width: 130px; }
.bulk-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bulk-actions select {
    padding: 5px 10px; border-radius: 5px; border: none;
    font-size: 13px; background: rgba(255,255,255,.14);
    color: white; cursor: pointer;
}
.bulk-actions select option { background: #163553; color: white; }
.btn-bulk {
    padding: 6px 14px; border-radius: 5px; font-size: 13px;
    cursor: pointer; border: none; font-weight: 500;
}
.btn-bulk-apply { background: var(--color-accent); color: white; }
.btn-bulk-apply:hover { background: #a36e39; }
.btn-bulk-danger { background: var(--color-danger); color: white; }
.btn-bulk-danger:hover { background: #8b1f19; }
.btn-bulk-cancel {
    background: transparent; color: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.35);
}
.btn-bulk-cancel:hover { background: rgba(255,255,255,.1); color: white; }
.col-check { width: 38px; text-align: center !important; padding: 0 4px !important; }
tr.row-selected > td { background: var(--color-primary-light) !important; }

/* ========== FORMAT EXPORT ========== */
.export-format-bar {
    display: flex; gap: 10px; align-items: center; margin-bottom: 16px;
}
.export-format-bar label { font-weight: 600; font-size: 13px; }
.radio-btn-group { display: flex; gap: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--color-border); }
.radio-btn-group input[type=radio] { display: none; }
.radio-btn-group label {
    padding: 6px 14px; font-size: 13px; cursor: pointer;
    background: white; color: var(--color-text); border-right: 1px solid var(--color-border);
    transition: background .15s;
}
.radio-btn-group label:last-of-type { border-right: none; }
.radio-btn-group input[type=radio]:checked + label {
    background: var(--color-primary); color: white; font-weight: 600;
}

/* ========================================================================
   DOCUMENTS ET MAILS
   ======================================================================== */
.vars-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.var-tag {
    display: inline-block;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11.5px;
    cursor: pointer;
    user-select: all;
    border: 1px solid transparent;
}
.var-tag:hover {
    border-color: var(--color-primary);
    background: white;
}

.mail-modele-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: white;
}
.mail-modele-item summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13.5px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.mail-modele-item summary::-webkit-details-marker { display: none; }
.mail-modele-item summary::before {
    content: '▶';
    font-size: 10px;
    color: var(--color-text-light);
    transition: transform 0.15s;
}
.mail-modele-item[open] > summary::before { transform: rotate(90deg); }
.mail-modele-item[open] > summary {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

details.panel {
    border: 1px solid var(--color-border);
}
details.panel summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
details.panel summary::before {
    content: '▶ ';
    font-size: 11px;
    color: var(--color-text-light);
}
details.panel[open] summary::before {
    content: '▼ ';
}

.info-bloc-warning {
    background: var(--color-warning-bg);
    border-left-color: var(--color-warning);
    color: var(--color-warning);
}
.info-bloc-warning a {
    color: var(--color-warning);
    font-weight: 600;
}

/* ========================================================================
   NAVIGATION ENTRE FICHES (Précédent / Suivant)
   ======================================================================== */
.nav-fiche {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 8px 14px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.nav-fiche-left,
.nav-fiche-right {
    flex: 0 0 auto;
}
.nav-fiche-center {
    flex: 1;
    text-align: center;
    color: var(--color-text-light);
    font-size: 13px;
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
}
.nav-position {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 3px 12px;
    border-radius: 12px;
    font-weight: 600;
}
.btn-nav {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 500;
}
.btn-nav:hover {
    background: var(--color-primary-dark);
    color: white;
}
.btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }

/* ========================================================================
   IMPORT MULTI-FICHIERS
   ======================================================================== */
.import-ligne {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--color-bg);
}
.import-ligne .form-field {
    margin-bottom: 0;
}
.import-ligne label.checkbox-cell {
    flex: 0 0 auto;
    margin: 0;
}

/* ========================================================================
   IMPORT : grille des formations avec cases à cocher
   ======================================================================== */
.formations-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.formation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.formation-item:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}
.formation-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}
.formation-item input[type="checkbox"]:checked + .formation-item-content {
    color: var(--color-primary-dark);
}
.formation-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.formation-nom {
    font-weight: 600;
    font-size: 14px;
}
.formation-nb {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 2px;
}
.total-coche {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 3px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
}

/* ========================================================================
   ONGLETS (tabs)
   ======================================================================== */
.tabs-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 14px;
}
.tab {
    padding: 10px 18px;
    text-decoration: none;
    color: var(--color-text-light);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover {
    color: var(--color-primary);
}
.tab-active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}
.hidden { display: none; }

/* ========================================================================
   RADIOS OUI/NON dans les formulaires (style "pilules séparées")
   ======================================================================== */
.bool-radios {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.bool-radio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border: 1px solid var(--color-border);
    border-radius: 999px;          /* forme pilule arrondie */
    background: white;
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
    min-width: 50px;
}

/* On masque le rond standard du radio, on garde seulement le texte stylé */
.bool-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.bool-radio:hover {
    border-color: var(--color-primary);
}

/* Pilule sélectionnée : fond bleu CMDL */
.bool-radio:has(input:checked) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 600;
}

/* ========================================================================
   v12 — Cases à cocher cours/enseignants
   ======================================================================== */
.cours-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}
.cours-checkboxes .checkbox-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.12s;
}
.cours-checkboxes .checkbox-cell:hover {
    border-color: var(--color-primary);
}
.cours-checkboxes .checkbox-cell:has(input:checked) {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    font-weight: 500;
}
.cours-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}
.cours-list li {
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}

/* ========================================================================
   v13 — Groupes de cours par formation (formulaire enseignant)
   ======================================================================== */
.cours-groupe {
    margin-bottom: 14px;
    padding: 10px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}
.cours-groupe-titre {
    margin: 0 0 8px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cours-groupe-nb {
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: normal;
    margin-left: auto;
}
.cours-groupe .cours-checkboxes {
    max-height: none;
    padding: 0;
    background: transparent;
}

/* Badges multi-formations sur cours */
.formations-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}
.formations-badges .badge {
    font-size: 11px;
}

/* ========================================================================
   v13 — Cases à cocher formations (cours)
   ======================================================================== */
.formations-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.formation-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.12s;
    user-select: none;
}
.formation-check:hover {
    border-color: var(--color-primary);
}
.formation-check:has(input:checked) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 600;
}
.formation-check input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.formation-check:has(input:checked) input[type="checkbox"] {
    accent-color: white;
}

/* ========================================================================
   AUTHENTIFICATION — login / setup
   ======================================================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}
.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.login-logo-mark {
    font-size: 2rem;
    color: var(--color-primary);
}
.login-logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    letter-spacing: 1px;
}
.login-title {
    text-align: center;
    font-size: 1.15rem;
    color: var(--color-text);
    margin: 0 0 1.5rem;
    font-weight: 600;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-field { display: flex; flex-direction: column; gap: 0.3rem; }
.login-field label { font-size: 0.82em; font-weight: 600; color: #475569; }
.login-btn { margin-top: 0.5rem; width: 100%; justify-content: center; }

/* ========================================================================
   TOPBAR — utilisateur connecté
   ======================================================================== */
.topbar-inner { height: 60px; }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.topbar-user-name {
    color: rgba(255,255,255,0.92);
    font-size: 13px;
    white-space: nowrap;
}
.topbar-user-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.badge-role-admin     { background: #fbbf24; color: #78350f; }
.badge-role-enseignant { background: #6ee7b7; color: #065f46; }
.badge-role-etudiant  { background: #a5b4fc; color: #3730a3; }
.btn-logout {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* Badges rôle dans le tableau utilisateurs */
.badge-role-admin     { background: #fef3c7; color: #92400e; }
.badge-role-enseignant { background: #d1fae5; color: #065f46; }
.badge-role-etudiant  { background: #ede9fe; color: #4c1d95; }

/* ========================================================================
   STICKY TABLE HEADERS
   ======================================================================== */
.table-wrap { overflow-x: auto; }

/* ========================================================================
   EDT — Grille globale (créneaux × enseignants)
   ======================================================================== */
.edt-grid-panel {
    margin-bottom: 16px;
}
.edt-grid-today {
    border-left: 4px solid var(--color-primary);
}
.edt-grid-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--color-primary-light);
    border-bottom: 2px solid var(--color-border);
}
.edt-grid-today .edt-grid-day-header {
    background: var(--color-primary);
}
.edt-grid-day-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-primary-dark);
    min-width: 70px;
}
.edt-grid-today .edt-grid-day-name,
.edt-grid-today .edt-grid-day-date {
    color: white;
}
.edt-grid-day-date {
    color: var(--color-text-light);
    font-size: 13px;
    flex: 1;
}
.edt-grid-day-badge {
    font-size: 11px;
}
.edt-grid-today .edt-grid-day-badge {
    background: rgba(255,255,255,0.25);
    color: white;
}
.edt-grid-table {
    table-layout: auto;
    min-width: 600px;
}
.edt-th-heure {
    width: 100px;
    min-width: 80px;
    background: #f1f5f9 !important;
    color: #475569 !important;
    text-align: center;
    font-size: 11px !important;
    white-space: nowrap;
    border-right: 2px solid var(--color-border);
}
.edt-th-slot {
    min-width: 140px;
    border-left: 1px solid var(--color-border);
    padding: 0 !important;
    background: var(--color-primary-light);
}
.edt-td-heure {
    background: #f8fafc;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    border-right: 2px solid var(--color-border);
    padding: 10px 8px !important;
    vertical-align: middle;
}
.edt-heure-debut { font-weight: 700; font-size: 14px; color: #1e293b; display: block; }
.edt-heure-sep   { color: #94a3b8; font-size: 11px; }
.edt-heure-fin   { font-size: 12px; color: #64748b; }
.edt-td-slot {
    vertical-align: top;
    padding: 0 !important;
    border-left: 1px solid var(--color-border);
    min-width: 140px;
}
.edt-td-slot.edt-td-occupied { background: #eff6ff; }

/* Contenu d'une cellule : cours + enseignant + salle */
.edt-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 28px 8px 10px;
    border-bottom: 1px dashed var(--color-border);
    position: relative;
}
.edt-cell:last-child { border-bottom: none; }
.edt-cell-cours {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.3;
    display: block;
}
.edt-cell-cours:hover { color: var(--color-primary); text-decoration: underline; }
.edt-cell-ens  { font-size: 12px; color: #374151; display: block; }
.edt-cell-salle { font-size: 11.5px; color: #64748b; display: block; }
.edt-cell-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 13px;
    opacity: 0.4;
    text-decoration: none;
}
.edt-cell-btn:hover { opacity: 1; }

.edt-grid-table tbody tr:hover td               { background: #f8fafc; }
.edt-grid-table tbody tr:hover .edt-td-heure    { background: #eef2f7; }
.edt-grid-table tbody tr:hover .edt-td-occupied { background: #dbeafe; }

/* ========================================================================
   EDT Individuel (étudiant / enseignant) — vue liste par jour
   ======================================================================== */
.edt-indiv-table { min-width: 500px; }

/* ========================================================================
   RESPONSIVE MOBILE — ≤ 768 px
   ======================================================================== */
@media (max-width: 768px) {

    /* ── Topbar ── */
    .topbar-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 10px 14px 6px;
        gap: 6px;
    }
    .brand-text em { display: none; }
    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        gap: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .nav-dropdown-btn { font-size: 13px; padding: 6px 10px; white-space: nowrap; }
    .nav-dropdown-menu { right: auto; left: 0; }
    .main-nav a {
        white-space: nowrap;
        font-size: 13px;
        padding: 6px 10px;
    }
    .topbar-user {
        font-size: 12px;
        gap: 6px;
    }
    .topbar-user-name { display: none; }

    /* ── Layout ── */
    .content { padding: 12px 12px 40px; }

    /* ── Sticky header zone ── */
    .sticky-header-zone {
        position: static;
        box-shadow: none;
        border-bottom: none;
        margin-bottom: 12px;
    }
    .sticky-header-zone .nav-fiche {
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        margin-bottom: 8px;
    }
    /* ── Page header ── */
    .page-header {
        padding-bottom: 10px;
        margin-bottom: 12px;
    }
    .page-header h1 { font-size: 1.2rem; }
    .page-header-flex {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .page-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .page-actions .btn { font-size: 0.8rem; padding: 6px 12px; }

    /* ── Panels ── */
    .panel { padding: 14px 12px; }

    /* ── Tables : scroll horizontal ── */
    .data-table { min-width: 540px; }
    .panel > .data-table,
    .panel > table,
    table.data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* ── Boutons ── */
    .btn { min-height: 38px; }
    .btn-mini { padding: 4px 8px; font-size: 12px; }

    /* ── Fiche étudiant/enseignant — rubriques ── */
    .rubrique-grid { grid-template-columns: 1fr !important; }
    .grid-cell { border-right: 0 !important; }
    .nav-fiche { overflow-x: auto; flex-wrap: nowrap; }
    .nav-fiche a { white-space: nowrap; }

    /* ── Tableau de bord ── */
    .tbd-seance-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .tbd-seance-heure { min-width: unset; }
    .tbd-seance-right { align-self: flex-end; }
    .tbd-seance-actions { flex-wrap: wrap; gap: 6px; }
    .tbd-cours-grid { grid-template-columns: 1fr; }

    /* ── EDT individuel ── */
    .edt-indiv-wrap { overflow-x: auto; }

    /* ── QR plein écran ── */
    .qr-fs-img { max-width: 85vw !important; }

    /* ── Barre de défilement flottante ── */
    .sticky-hscroll { display: none !important; }
}

/* ========================================================================
   BARRE DE DÉFILEMENT HORIZONTALE FLOTTANTE
   Apparaît en bas de l'écran quand un tableau dépasse la largeur visible.
   ======================================================================== */
.sticky-hscroll {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 14px;
    overflow-x: scroll;
    overflow-y: hidden;
    z-index: 200;
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.08);
}
.sticky-hscroll-inner {
    height: 1px;
    pointer-events: none;
}

/* ========================================================================
   RESPONSIVE MOBILE — ≤ 480 px (très petits écrans)
   ======================================================================== */
@media (max-width: 480px) {
    .page-header h1 { font-size: 1.05rem; }
    .content { padding: 8px 8px 32px; }
    .panel { padding: 10px 10px; }
    .btn { font-size: 0.8rem; padding: 7px 12px; }
    .login-card { padding: 1.8rem 1.2rem; margin: 0 12px; }
}

/* ========================================================================
   PHOTO CROP MODAL
   ======================================================================== */
.crop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.crop-box {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 580px;
    width: 100%;
}
.crop-box h3 { margin: 0; font-size: 1rem; color: var(--color-primary-dark); }
.crop-box p  { margin: 0; font-size: 0.82rem; color: var(--color-text-light); }
.crop-img-wrap {
    width: 100%;
    max-height: 440px;
    overflow: hidden;
    background: #111;
    border-radius: var(--radius-sm);
}
.crop-img-wrap img { display: block; max-width: 100%; }
.crop-btn-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.crop-btn-bar .btn-mini-tool {
    background: var(--color-bg-cell);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--color-text);
}
.crop-btn-bar .btn-mini-tool:hover { background: var(--color-primary-light); }
.btn-photo-edit {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.8rem;
    padding: 4px 10px;
    background: var(--color-bg-cell);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text);
}
.btn-photo-edit:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.photo-preview-new {
    margin-top: 8px;
    padding: 8px;
    background: var(--color-success-bg);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--color-success);
    display: flex;
    align-items: center;
    gap: 8px;
}
.photo-preview-new img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* ========================================================================
   Impression feuille de présence
   ======================================================================== */
@media print {
    .data-table,
    .data-table th,
    .data-table td,
    .data-table td strong,
    .data-table td * { font-size: 9pt !important; }
}
