/* =====================================================================
   SAMEECOLE.ORG — Design system (CSS classique, sans framework)
   Organisation : tokens, base, mise en page, composants, impression, mobile
   ===================================================================== */

/* ----------------------------- 1. Tokens ---------------------------- */

:root {
    --primary: #123a6b;
    --secondary: #0e8a5f;
    --button: #123a6b;
    --menu: #0d2444;
    --bg: #f2f5fa;
    --card: #ffffff;
    --header: #123a6b;
    --text: #111c30;
    --muted: #57657a;
    --border: #cfd9e8;
    --border-strong: #aebdd2;
    --danger: #c62828;
    --success: #15803d;
    --warning: #b45309;

    /* Derives : valeurs de repli pour les navigateurs sans color-mix(),
       puis version moderne. */
    --primary-soft: #e9eff8;
    --primary-soft: color-mix(in srgb, var(--primary) 8%, #fff);
    --secondary-soft: #e4f5ec;
    --secondary-soft: color-mix(in srgb, var(--secondary) 10%, #fff);
    --danger-soft: #fdecec;
    --danger-soft: color-mix(in srgb, var(--danger) 8%, #fff);
    --success-soft: #e6f6ec;
    --success-soft: color-mix(in srgb, var(--success) 9%, #fff);
    --warning-soft: #fdf3e2;
    --warning-soft: color-mix(in srgb, var(--warning) 10%, #fff);
    --menu-soft: #091a31;
    --menu-soft: color-mix(in srgb, var(--menu) 55%, #000);
    --primary-line: #c3d4ea;
    --primary-line: color-mix(in srgb, var(--primary) 20%, #fff);
    --primary-veil: rgba(18, 58, 107, .08);
    --primary-veil: color-mix(in srgb, var(--primary) 8%, transparent);
    --primary-shadow: rgba(18, 58, 107, .28);
    --primary-shadow: color-mix(in srgb, var(--primary) 28%, transparent);
    --secondary-shadow: rgba(14, 138, 95, .3);
    --secondary-shadow: color-mix(in srgb, var(--secondary) 30%, transparent);
    --danger-shadow: rgba(198, 40, 40, .26);
    --danger-shadow: color-mix(in srgb, var(--danger) 26%, transparent);
    --header-veil: rgba(255, 255, 255, .9);
    --header-veil: color-mix(in srgb, var(--card) 88%, transparent);

    --radius-xs: 7px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(16, 30, 54, .06);
    --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06), 0 2px 6px rgba(16, 30, 54, .05);
    --shadow: 0 2px 4px rgba(16, 30, 54, .05), 0 10px 26px rgba(16, 30, 54, .07);
    --shadow-lg: 0 10px 40px rgba(16, 30, 54, .14);
    --shadow-primary: 0 6px 18px var(--primary-shadow);

    --sidebar-w: 268px;
    --topbar-h: 62px;
    --tap: 44px;

    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    /* Ces valeurs sont ecrasees par la charte injectee dans le layout.
       Elles restent ici pour que la feuille reste exploitable seule. */
    --font-size: 15px;
    --font-size-heading: 22px;
    --line-height: 1.5;
    --heading-weight: 700;
    --radius-btn: 10px;
    --radius-card: 14px;
    --gap: 1.5;
    --card-pad: 1;
    --link: var(--primary);
}

/* ------------------------------ 2. Base ----------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Un element plus large que l'ecran (un tableau, un long libelle sans
       espace) ferait deborder toute la page et obligerait a faire defiler
       horizontalement, meme sur les tableaux deja defilables. */
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(1100px 380px at 100% -12%, var(--primary-veil), transparent 70%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* Les titres se calent sur la taille de titre de la charte : changer la
   police ne doit pas laisser les titres a l'echelle de l'ancien theme. */
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: var(--heading-weight); letter-spacing: -.015em; color: var(--text); }
h1 { font-size: var(--font-size-heading); }
h2 { font-size: calc(var(--font-size-heading) * .74); }
h3 { font-size: calc(var(--font-size-heading) * .62); }
h4 { font-size: calc(var(--font-size-heading) * .55); }
p { margin: 0 0 .8em; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
svg { vertical-align: middle; flex: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* -------------------------- 3. Mise en page ------------------------- */

.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Barre laterale */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--menu) 0%, var(--menu-soft) 100%);
    color: #cfdcee;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06);
}

.sidebar__brand {
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    display: flex;
    gap: 11px;
    align-items: center;
    flex: none;
}
.sidebar__brand img {
    height: 40px; width: auto; max-width: 110px;
    border-radius: 9px; background: #fff; padding: 3px; object-fit: contain;
}
.sidebar__brand .avatar { background: rgba(255, 255, 255, .16); }
.sidebar__brand strong { color: #fff; display: block; font-size: 15px; line-height: 1.2; font-weight: 700; }
.sidebar__brand span { font-size: 12px; color: #a8bcd8; text-transform: uppercase; letter-spacing: .07em; }

.sidebar nav { padding: 6px 10px 26px; overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.sidebar nav .nav-group {
    padding: 16px 10px 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 700;
    color: #7f97b8;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    margin-bottom: 1px;
    color: #cfdcee;
    font-size: 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    transition: background .13s ease, color .13s ease;
}
.sidebar nav a svg { opacity: .75; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.sidebar nav a.is-active {
    background: rgba(255, 255, 255, .15);
    border-left-color: var(--secondary);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.sidebar nav a.is-active svg { opacity: 1; }
.sidebar__foot {
    padding: 10px 16px 14px;
    font-size: 12px;
    color: #7f97b8;
    border-top: 1px solid rgba(255, 255, 255, .08);
    flex: none;
}

/* Zone principale */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--header-veil);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--topbar-h);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar h1 { font-size: 17.5px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.topbar__spacer { flex: 1 1 auto; }
.topbar__item { position: relative; }

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background .13s ease, border-color .13s ease;
}
.icon-btn:hover { background: var(--primary-soft); border-color: var(--border); text-decoration: none; }
.icon-btn .badge {
    position: absolute; top: 2px; right: 1px;
    min-width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px;
    background: #e11d48; color: #fff;
    border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 700;
    border: 2px solid var(--card);
    line-height: 1;
}

.user-chip {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 5px 12px 5px 6px;
    border-radius: var(--radius-pill);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    max-width: 230px;
}
.user-chip:hover { text-decoration: none; border-color: var(--border-strong); background: var(--primary-soft); }
.user-chip .avatar { width: 30px; height: 30px; font-size: 12px; background: var(--primary); }
.user-chip strong { display: block; font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.menu-toggle {
    display: none;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: var(--radius-sm);
    width: 40px; height: 40px;
    font-size: 18px; cursor: pointer;
    align-items: center; justify-content: center;
}

.content { padding: 22px 24px 60px; flex: 1 1 auto; max-width: 1480px; width: 100%; }
.content > *:first-child { margin-top: 0; }

.sidebar-backdrop { display: none; }

/* --------------------------- 4. Composants -------------------------- */

/* Cartes */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: calc(18px * var(--card-pad)) calc(20px * var(--card-pad));
    margin-bottom: 18px;
}
.card > h2, .card > h3 { color: var(--text); }
.card--flat { box-shadow: none; }
.card--accent { border-top: 3px solid var(--primary); }
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.card__head h2, .card__head h3 { margin: 0; }
.card__head .card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card__title { display: flex; align-items: center; gap: 9px; }
.card__title svg { color: var(--primary); }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1, .page-head h2 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

/* Grilles */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); }
.grid--5 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1000px) { .grid--sidebar { grid-template-columns: 1fr; } }

/* Statistiques.
   Deux formes acceptees :
   - avec icone   : .stat > .stat__icon + .stat__body > .stat__label/.stat__value
   - sans icone   : .stat > .stat__label + .stat__value (alignes a gauche) */
.stat {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px 14px 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 1px;
}
/* Avec icone : la carte passe en ligne (icone + bloc texte) */
.stat:has(.stat__icon) { flex-direction: row; align-items: center; gap: 13px; min-height: 72px; }
.stat::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--primary);
}
.stat__icon {
    width: 44px; height: 44px; border-radius: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
    flex: none;
}
.stat__body { min-width: 0; flex: 1 1 auto; }
.stat__body > * { display: block; }
.stat__label {
    font-size: 12.5px; color: var(--muted); text-transform: uppercase;
    letter-spacing: .06em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat__value { font-size: 23px; font-weight: 800; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: 12px; color: var(--muted); }
.stat--green::before { background: var(--secondary); }
.stat--green .stat__icon { background: var(--secondary-soft); color: var(--secondary); }
.stat--green .stat__value { color: var(--secondary); }
.stat--red::before { background: var(--danger); }
.stat--red .stat__icon { background: var(--danger-soft); color: var(--danger); }
.stat--red .stat__value { color: var(--danger); }
.stat--amber::before { background: var(--warning); }
.stat--amber .stat__icon { background: var(--warning-soft); color: var(--warning); }
.stat--amber .stat__value { color: var(--warning); }
.stat--plain .stat__value { color: var(--text); }
/* Variante compacte sans icone (statistique simple) */
.stat--simple { min-height: 0; }
.stat--simple .stat__value { font-size: 21px; }

/* Tableaux */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}
table.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card);
    font-size: 14px;
}
table.table th, table.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
table.table thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-strong);
}
table.table thead th:first-child { border-top-left-radius: var(--radius); }
table.table thead th:last-child { border-top-right-radius: var(--radius); }
table.table tbody tr:nth-child(even) { background: #f7f9fc; }
table.table tbody tr:hover { background: var(--primary-soft); }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table td.center, table.table th.center { text-align: center; }
table.table .actions { white-space: nowrap; text-align: right; }
table.table .actions form { display: inline-block; }
table.table tfoot td {
    background: var(--primary-soft);
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border-strong);
}
table.table--compact th, table.table--compact td { padding: 7px 9px; font-size: 13.2px; }
table.table tr.is-total td { background: var(--primary-soft); font-weight: 700; }
table.table tr.is-highlight td { background: var(--secondary-soft); }
.empty { padding: 34px 14px; text-align: center; color: var(--muted); }
.empty svg { color: var(--border-strong); margin-bottom: 8px; }

table.table input[type=text], table.table input[type=number], table.table select {
    padding: 7px 8px; font-size: 13.5px; min-width: 70px;
}

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list > li {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border);
}
.list > li:last-child { border-bottom: 0; }
.list > li .list__body { min-width: 0; flex: 1 1 auto; }
.list > li .list__title { font-weight: 600; }
.list__meta { font-size: 12.5px; color: var(--muted); }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 15px; }
.form-grid--1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: #2c3a4f; letter-spacing: .01em; }
/* Le texte d'aide guide la saisie : il doit rester lisible, pas disparaitre. */
.field .hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.field--wide, .span-2 { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=tel], input[type=search], input[type=color], select, textarea {
    width: 100%;
    padding: 11px 13px;
    /* Une bordure trop claire se perd sur un fond clair : on la renforce
       pour que le champ soit visible avant meme d'y cliquer. */
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: calc(var(--font-size) - 1px);
    background: #fff;
    color: var(--text);
    transition: border-color .13s ease, box-shadow .13s ease;
    min-height: var(--tap);
}
/* Le focus doit etre visible au doigt comme a la souris. */
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
/* Un gris tres clair ne se lit plus sur un fond clair : l'indicatif d'un champ
   doit se lire aussi bien que le texte qu'il remplace. */
input::placeholder, textarea::placeholder, select::placeholder { color: #5d6a80; opacity: 1; }
input:focus, select:focus, textarea:focus {
    /* Le focus reste visible : sans cela, on ne sait pas quel champ est actif. */
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 58, 107, .18);
}
input[type=file] { padding: 8px; background: var(--primary-soft); }
/* Le fond des groupes de champs doit rester clair et le texte lisible. */
fieldset { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; background: #f7f9fc; }
legend { font-weight: 700; color: var(--primary); padding: 0 8px; font-size: 13px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 7px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; min-height: 34px; }
.check input { width: auto; min-height: 0; width: 18px; height: 18px; accent-color: var(--primary); }
.check span small { display: block; }
input[type=checkbox]:not(.check input) { accent-color: var(--primary); }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 16px;
    min-height: var(--tap);
    /* Le rayon des boutons est un choix de la charte, pas une constante. */
    border-radius: var(--radius-btn);
    border: 1px solid transparent;
    background: var(--button);
    color: #fff;
    font: inherit; font-size: calc(var(--font-size) - 1px); font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 6px 18px var(--primary-shadow);
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--secondary { background: var(--card); color: var(--primary); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { background: var(--primary-soft); color: var(--primary); }
.btn--green { background: var(--secondary); box-shadow: 0 6px 18px var(--secondary-shadow); }
.btn--danger { background: var(--danger); box-shadow: 0 6px 18px var(--danger-shadow); }
.btn--amber { background: var(--warning); }
.btn--grey { background: #64748b; box-shadow: none; }
.btn--ghost { background: transparent; color: var(--primary); box-shadow: none; border-color: var(--border-strong); }
.btn--sm { padding: 6px 12px; font-size: 13px; min-height: 34px; border-radius: var(--radius-pill); }
.btn--xs { padding: 4px 9px; font-size: 12px; min-height: 28px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.btn-row--tight { gap: 6px; flex-wrap: nowrap; }
.row-inline { display: flex; align-items: center; gap: 8px; }
.row-inline svg { color: var(--primary); flex: none; }
/* Barre de recherche (annuaire des acces, listes) */.search-bar {
    display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
}
.search-bar input[type="search"], .search-bar input[type="text"] {
    flex: 1 1 320px; min-width: 0;
}
.search-bar select { flex: 0 0 auto; width: auto; }

/* Tuile de reinitialisation (Admin) */
.reset-tile {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px 16px; background: #fbfcfe; height: 100%;
}
.reset-tile__icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--danger-soft); color: var(--danger);
    display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.reset-tile p { margin: 6px 0 0; }

/* Carte d'examen officiel (eleve, parent) */
.exam-card__date {
    display: flex; align-items: center; gap: 12px;
    border: 2px solid var(--primary); border-radius: var(--radius-md);
    padding: 12px 16px; background: var(--primary-soft);
}
.exam-card__date svg { color: var(--primary); flex: none; }
.exam-card__date strong { display: block; font-size: 17px; }
.exam-card__date span { display: block; }
.exam-highlight { border-left: 4px solid var(--primary); }
.exam-highlight__row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
}
.exam-highlight__row span { display: block; }
.exam-highlight__row strong { font-size: 15px; }
.toolbar { display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { min-width: 165px; }
.toolbar .field--grow { flex: 1 1 220px; }

/* Alertes */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-left-width: 4px;
    font-size: 14px;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert svg { flex: none; margin-top: 1px; }
.alert--success { background: var(--success-soft); color: #14532d; border-color: #a7d9b8; border-left-color: var(--success); }
.alert--error { background: var(--danger-soft); color: #7f1d1d; border-color: #f3b6b6; border-left-color: var(--danger); }
.alert--warning { background: var(--warning-soft); color: #7c4a03; border-color: #f0d09a; border-left-color: var(--warning); }
.alert--info { background: var(--primary-soft); color: #1e3a5f; border-color: #b7cdea; border-left-color: var(--primary); }
.alert p:last-child { margin-bottom: 0; }

/* Etiquettes */
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12.5px; font-weight: 700;
    background: var(--primary-soft); color: var(--primary);
    border: 1px solid var(--primary-line);
    white-space: nowrap;
}
.tag--green { background: var(--success-soft); color: #14532d; border-color: #b6e2c6; }
.tag--red { background: var(--danger-soft); color: #7f1d1d; border-color: #f3c1c1; }
.tag--amber { background: var(--warning-soft); color: #7c4a03; border-color: #f2d5a4; }
.tag--grey { background: #eef1f6; color: #475569; border-color: #dde3ec; }
.tag--blue { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.tag--solid { background: var(--primary); color: #fff; border-color: var(--primary); }

.badge {
    background: #e11d48; color: #fff;
    border-radius: var(--radius-pill);
    font-size: 12px; padding: 1px 7px; font-weight: 700;
}

/* Divers */
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex: none; letter-spacing: .02em;
}
.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--lg { width: 96px; height: 96px; font-size: 30px; }
.avatar--xl { width: 132px; height: 132px; font-size: 40px; }

.progress { height: 8px; background: #e8edf5; border-radius: var(--radius-pill); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--secondary), var(--primary)); border-radius: var(--radius-pill); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pagination a, .pagination span {
    padding: 8px 13px; min-height: 36px;
    display: inline-flex; align-items: center;
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    background: var(--card); font-size: 13.5px; color: var(--text);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .is-current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.timeline > li { position: relative; padding: 0 0 16px 14px; }
.timeline > li::before {
    content: ""; position: absolute; left: -28px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--card);
}
.timeline > li.is-done::before { background: var(--success); }
.timeline > li.is-pending::before { background: var(--warning); }

.notif {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    margin-bottom: 9px;
}
.notif.is-unread { background: var(--primary-soft); border-color: var(--primary-line); }
.notif__icon {
    width: 36px; height: 36px; border-radius: 10px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
}
.notif.is-unread .notif__icon { background: var(--primary); color: #fff; }

/* Menu deroulant */
.dropdown { position: relative; }
.dropdown__panel {
    position: absolute; right: 0; top: calc(100% + 8px);
    width: min(360px, calc(100vw - 24px));
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 70;
    overflow: hidden;
    display: none;
}
.dropdown.is-open .dropdown__panel { display: block; }
.dropdown__head {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #f7f9fc;
    font-weight: 700; font-size: 14px;
}
.dropdown__body { max-height: 62vh; overflow-y: auto; padding: 6px; }
.dropdown__foot { padding: 9px 14px; border-top: 1px solid var(--border); text-align: center; background: #f7f9fc; }

/* Barre d'actions mobile (bas d'ecran) */
.mobile-bar { display: none; }

/* Encart d'aide / info */
.callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    border: 1px solid var(--primary-line);
    margin-bottom: 16px;
}
.callout--green { background: var(--success-soft); border-color: #b6e2c6; }
.callout--amber { background: var(--warning-soft); border-color: #f2d5a4; }
.callout--warning { background: var(--warning-soft); border-color: #f2d5a4; }
.callout--warning svg { color: var(--warning); }
.callout--red { background: var(--danger-soft); border-color: #f3c1c1; }
.callout svg { flex: none; color: var(--primary); }
.callout__title { font-weight: 700; margin-bottom: 2px; }
.callout p:last-child { margin-bottom: 0; }

/* Emploi du temps */
.timetable { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: 13px; }
.timetable th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 4px; }
.timetable td { padding: 0; vertical-align: top; }
.timetable .slot {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    padding: 8px 9px;
    min-height: 62px;
    border-left: 3px solid var(--primary);
}
.timetable .slot--free { border-left-color: var(--border-strong); background: #f7f9fc; }
.timetable .slot strong { display: block; font-size: 13px; }
.timetable .slot span { font-size: 12.5px; color: var(--muted); display: block; }
.timetable .slot--now { box-shadow: 0 0 0 2px var(--secondary); }

/* -------------------------- 5. Impression -------------------------- */

@media print {
    .sidebar, .topbar, .no-print, .btn, .toolbar, .mobile-bar, .pagination, .sidebar-backdrop, .dropdown { display: none !important; }
    .content { padding: 0; max-width: none; }
    .card, .table-wrap { box-shadow: none; border: 1px solid #ccc; }
    body { background: #fff; }
    a { color: #000; text-decoration: none; }
    table.table thead th { position: static; }
}

/* ---------------------------- 6. Mobile ---------------------------- */

@media (max-width: 1024px) {
    :root { --sidebar-w: 250px; }
    .content { padding: 18px 16px 90px; }
}

@media (max-width: 900px) {
    .menu-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w) - 8px);
        top: 0; bottom: 0;
        height: 100%;
        transition: left .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { left: 0; }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(9, 20, 38, .5); z-index: 55;
        opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
    .layout { flex-direction: column; }
    .grid--sidebar { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 16px; }

    /* Barre de navigation basse, ideale pour le tactile */
    .mobile-bar {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0;
        z-index: 45;
        background: var(--header-veil);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -2px 14px rgba(16, 30, 54, .07);
    }
    .mobile-bar a {
        flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 5px 2px;
        font-size: 12px; font-weight: 600;
        color: var(--muted);
        text-decoration: none;
        border-radius: var(--radius-sm);
    }
    .mobile-bar a.is-active { color: var(--primary); background: var(--primary-soft); }
    .content { padding-bottom: 86px; }
}

@media (max-width: 640px) {
    body { font-size: 14.8px; }
    .topbar { padding: 8px 12px; gap: 6px; }
    .topbar h1 { font-size: 15.5px; width: 100%; order: -1; padding-right: 0; }
    .user-chip { padding: 4px 8px 4px 4px; }
    .user-chip .user-chip__name { display: none; }
    .content { padding: 14px 12px 90px; }
    .card { padding: 14px; border-radius: 12px; }
    .card__head { margin-bottom: 11px; }
    .grid { gap: 12px; }
    .grid--2, .grid--3, .grid--4, .grid--5 { grid-template-columns: 1fr; }
    .grid--2.keep-2, .grid--4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { padding: 12px 13px; }
    .stat__icon { width: 38px; height: 38px; }
    .stat__value { font-size: 20px; }
    .form-grid { grid-template-columns: 1fr; gap: 13px; }
    .btn { width: 100%; }
    .btn-row .btn, .toolbar .btn, .table-wrap .btn { width: auto; }
    .btn--block { width: 100%; }
    .field { gap: 4px; }
    table.table { font-size: 13.4px; }
    table.table th, table.table td { padding: 8px 9px; }
    .table-wrap { border-radius: 12px; }
    .timeline { padding-left: 18px; }
    .timetable { font-size: 12.5px; border-spacing: 2px; }
    .timetable .slot { padding: 6px; min-height: 52px; }
    .dropdown__panel { position: fixed; left: 8px; right: 8px; top: 66px; width: auto; }
}

@media (max-width: 380px) {
    body { font-size: 14.2px; }
    .grid--4.keep-2 { grid-template-columns: 1fr; }
}

/* Accessibilite : focus visible au clavier */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* Preferences systeme */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* =====================================================================
   EXERCICES : saisie riche (comme dans Word) et lecture de la consigne
   ===================================================================== */

.editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.editor__bar {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 7px 8px;
    background: #f6f8fc; border-bottom: 1px solid var(--border);
}
.editor__btn {
    border: 1px solid var(--border); background: #fff; color: var(--text);
    border-radius: 7px; padding: 5px 10px; font-size: 13px; font-weight: 600;
    cursor: pointer; line-height: 1.4;
}
.editor__btn:hover { background: #eaf0fa; }
.editor__area { min-height: 190px; padding: 13px 14px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.editor__area:focus { outline: none; }
.editor__area:empty::before {
    content: attr(data-placeholder); color: #93a3ba; pointer-events: none; display: block;
}
.editor__area p { margin: 0 0 8px; }
.editor__area ul, .editor__area ol { margin: 0 0 8px; padding-left: 22px; }
.editor__area h3 { margin: 0 0 8px; font-size: 16.5px; }
.editor__area h4 { margin: 0 0 8px; font-size: 15.5px; }

.rich-text { line-height: 1.65; overflow-wrap: anywhere; }
.rich-text p { margin: 0 0 10px; }
.rich-text ul, .rich-text ol { margin: 0 0 10px; padding-left: 22px; }
.rich-text h3 { margin: 16px 0 8px; font-size: 17px; }
.rich-text h4 { margin: 14px 0 8px; font-size: 15.5px; }
.rich-text blockquote {
    margin: 0 0 10px; padding: 8px 14px; border-left: 4px solid var(--primary);
    background: #f6f8fc; border-radius: 0 8px 8px 0; color: #43536c;
}
.rich-text table { width: 100%; border-collapse: collapse; margin: 0 0 12px; }
.rich-text th, .rich-text td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; }

/* =====================================================================
   GROUPES DE TRAVAIL : discussion de la classe
   ===================================================================== */

.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.chat__msg {
    align-self: flex-start; max-width: 88%;
    background: #f4f7fc; border: 1px solid var(--border); border-radius: 14px 14px 14px 4px;
    padding: 10px 13px;
}
.chat__msg.is-mine {
    align-self: flex-end; background: #e7f6ec; border-color: #c4e5d1;
    border-radius: 14px 14px 4px 14px;
}
.chat__meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; font-size: 13px; }
.chat__body { white-space: normal; font-size: 14.5px; line-height: 1.55; }

/* Fil de discussion : on parle comme dans un groupe de messagerie, pas
   comme dans un forum. Les messages s'empilent, les siens sont a droite. */
.chat__thread { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px; }
.chat__line { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.chat__line--mine { align-self: flex-end; align-items: flex-end; }
.chat__line--mine .chat__meta { flex-direction: row-reverse; }
.chat__bubble {
    background: #eef3fb;
    border: 1px solid var(--border);
    border-radius: 4px 14px 14px 14px;
    padding: 10px 14px;
    color: var(--text);
}
.chat__line--mine .chat__bubble {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 14px 4px 14px 14px;
    color: #fff;
}
.chat__line--mine .chat__meta .muted { color: var(--muted); }
.chat__bubble .btn--secondary {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .4);
    color: #fff;
}
.chat__line--mine .chat__bubble .btn--secondary:hover { background: rgba(255, 255, 255, .26); }
/* Sur un petit ecran, une bulle large coupe la ligne trop tot. */
@media (max-width: 620px) { .chat__line { max-width: 94%; } }

/* =====================================================================
   PWA ET MODE LEGER (connexion Internet faible)
   ===================================================================== */

.pwa-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fff7e6; border: 1px solid #f2d5a4; color: #7c4a03;
    border-radius: 10px; padding: 10px 13px; margin-bottom: 14px; font-size: 14px;
}
.pwa-bar[hidden] { display: none; }

/* Mode leger : on supprime les effets couteux en bande passante et CPU. */
body.lite .card,
body.lite .pwa-bar { box-shadow: none; }
body.lite .hero,
body.lite .public-nav { background-image: none; }
body.lite .card { border-color: #d7dee9; }
body.lite img { max-width: 100%; }
@media (prefers-reduced-data: reduce) {
    .course__thumb img { content-visibility: auto; }
}

/* =====================================================================
   ASSISTANT PEDAGOGIQUE (IA)
   ===================================================================== */

.assistant-answer {
    background: #f4f9fe; border: 1px solid #d6e8f8; border-left: 4px solid var(--secondary);
    border-radius: 12px; padding: 14px 16px; line-height: 1.65; font-size: 15px;
}
.assistant-answer p { margin: 0 0 8px; }

/* =====================================================================
   RECHERCHE RAPIDE (barre superieure) ET LISIBILITE
   ===================================================================== */

.topbar__search { display: flex; align-items: center; }
.topbar__search input {
    width: 230px; padding: 7px 12px; border-radius: 999px;
    border: 1px solid var(--border); background: #f6f9fd; font-size: 13.5px;
}
.topbar__search input:focus { background: #fff; border-color: var(--accent, #38bdf8); }
@media (max-width: 1100px) { .topbar__search input { width: 150px; } }
@media (max-width: 820px) { .topbar__search { display: none; } }

/* =====================================================================
   CONCEPTEUR DE BULLETIN (mise en page visuelle type editeur graphique)
   ===================================================================== */

.designer { display: flex; justify-content: center; padding: 8px 0 4px; }
.designer__page {
    position: relative; width: 100%; max-width: 620px; aspect-ratio: 210 / 297;
    background: #fff; border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 6px 20px rgba(11, 42, 77, .10); overflow: hidden;
}
.designer.is-landscape .designer__page { max-width: 760px; aspect-ratio: 297 / 210; }
.designer__guides { position: absolute; inset: 0; pointer-events: none; opacity: .5; }
.designer .guide { position: absolute; background: #dbeafe; }
.designer .guide--v { top: 0; bottom: 0; width: 1px; }
.designer .guide--h { left: 0; right: 0; height: 1px; }
.designer__head { position: absolute; top: 2%; left: 24%; right: 24%; text-align: center; }
.designer__head .sheet__republic { font-size: 8px; color: #888; }
.designer__head .sheet__school { font-size: 12px; font-weight: 800; margin: 2px 0; }
.designer__head .sheet__title { font-size: 9px; font-weight: 700; letter-spacing: .06em; margin-top: 4px; }
.designer__block {
    position: absolute; left: 5%; right: 5%; border: 1px dashed #bfd7f0; border-radius: 4px;
    background: repeating-linear-gradient(45deg, #f6faff, #f6faff 6px, #eef5fd 6px, #eef5fd 12px);
}

.element {
    position: absolute; border: 1.5px dashed #f97316; border-radius: 6px;
    background: rgba(249, 115, 22, .10); cursor: move; user-select: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden;
}
.element.is-active { border-style: solid; box-shadow: 0 0 0 3px rgba(249, 115, 22, .25); }
.element__label { font-size: 9px; color: #9a3412; font-weight: 700; text-align: center; padding: 2px 3px; }
.element img { max-width: 100%; max-height: 78%; object-fit: contain; }
.element__qr { width: 74%; height: 74%; background: #fff; border: 1px solid #ddd; border-radius: 3px;
    background-size: cover; background-position: center; }
.element--sign { background: rgba(56, 189, 248, .10); border-color: #38bdf8; }
.element--sign .element__label { color: #0b4a8a; }
.element__handle {
    position: absolute; right: -5px; bottom: -5px; width: 11px; height: 11px;
    background: var(--secondary, #f97316); border: 1px solid #fff; border-radius: 2px; cursor: nwse-resize;
}

/* ------------------------------------------------------------------ */
/* Editeur de charte : palettes et apercu vivant                       */
/* ------------------------------------------------------------------ */

.palette-row {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px; margin-bottom: 18px;
}
.palette {
    display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
    padding: 11px 13px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-card); cursor: pointer; text-align: left;
    font: inherit; color: var(--text); transition: border-color .12s ease, box-shadow .12s ease;
}
.palette:hover, .palette:focus-visible {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-veil); outline: none;
}
.palette__chips { display: flex; gap: 4px; }
.palette__chips span {
    width: 26px; height: 26px; border-radius: var(--radius-btn);
    border: 1px solid var(--border); display: block;
}
.palette__label { font-size: 13px; font-weight: 600; }

/* L'apercu n'ecrit jamais dans la page : il n'influence que lui-meme, ce qui
   evite qu'un choix en cours de construction casse la page de reglages. */
.theme-preview {
    margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-card);
    overflow: hidden; background: var(--bg);
    font-family: var(--pv-font, var(--font));
    font-size: var(--pv-fs, 15px);
    line-height: var(--pv-line, 1.5);
}
.theme-preview__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(10px * var(--pv-pad, 1)) calc(14px * var(--pv-pad, 1));
    background: var(--pv-menu, var(--menu)); color: var(--pv-onmenu, #fff);
    flex-wrap: wrap;
}
.theme-preview__brand { font-size: var(--pv-fh, 22px); font-weight: var(--pv-weight, 700); }
.theme-preview__nav { font-size: .85em; opacity: .85; }
.theme-preview__body {
    padding: calc(16px * var(--pv-pad, 1));
    background: var(--pv-bg, var(--bg));
}
.theme-preview__card {
    background: var(--pv-card, var(--card)); color: var(--pv-oncard, var(--text));
    border: 1px solid var(--pv-border, var(--border));
    border-top: 3px solid var(--pv-primary, var(--primary));
    border-radius: var(--pv-cardr, var(--radius-card));
    padding: calc(16px * var(--pv-pad, 1)) calc(18px * var(--pv-pad, 1));
    line-height: var(--pv-line, 1.5);
}
.theme-preview__card h4 {
    margin: 0 0 calc(6px * var(--pv-gap, 1.5));
    font-size: calc(var(--pv-fh, 22px) * .62);
    font-weight: var(--pv-weight, 700);
}
.theme-preview__card p { margin: 0 0 calc(6px * var(--pv-gap, 1.5)); }
.theme-preview__muted { color: var(--pv-muted, var(--muted)); font-size: .85em; }
.theme-preview__btn {
    display: inline-block; margin: 4px 6px 0 0; padding: 8px 15px;
    background: var(--pv-button, var(--button)); color: var(--pv-onbutton, #fff);
    border-radius: var(--pv-btnr, 10px); font-size: .93em; font-weight: 600;
}
.theme-preview__btn--alt {
    background: var(--pv-card, var(--card)); color: var(--pv-primary, var(--primary));
    border: 1px solid var(--pv-border, var(--border));
}

/* Curseurs : le pouce doit rester visible meme quand la piste est coloree. */
input[type="range"] {
    width: 100%; accent-color: var(--primary); cursor: pointer;
    min-height: 32px; background: transparent;
}
input[type="color"] {
    width: 100%; height: 42px; padding: 3px; cursor: pointer;
    background: var(--card); border: 1px solid var(--border-strong, var(--border));
    border-radius: var(--radius-btn);
}
output { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Un champ couleur herite est grise : on voit d'un coup d'oeil ce qui vient
   de la plateforme et ce qui est propre a l'ecole. */
.color-field { display: flex; flex-direction: column; gap: 5px; }
.check--inline { gap: 7px; }
.check--inline input[type="checkbox"] { width: auto; }
.color-field input[type="color"][disabled] { opacity: .45; cursor: not-allowed; }

/* Editeur de modele de bulletin */
[data-bp-html-area], [data-bp-css-area] {
    width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.55;
    border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius-btn);
    padding: 11px 13px; background: var(--card); color: var(--text);
    resize: vertical; min-height: 160px; tab-size: 2;
}
.editor__bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.editor__btn {
    font: inherit; font-size: 12px; padding: 4px 9px; cursor: pointer;
    background: var(--card); color: var(--primary);
    border: 1px solid var(--border); border-radius: var(--radius-btn);
}
.editor__btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.details-variables { margin-top: 14px; }
.details-variables > summary { cursor: pointer; font-weight: 600; padding: 7px 0; }
.details-variables[open] > summary { margin-bottom: 8px; }
.badge--muted { background: var(--bg); color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-actions form.inline { display: inline; margin: 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
    font-size: 13px; padding: 5px 11px; border-radius: var(--radius-pill);
    color: var(--muted); border: 1px solid transparent;
}
.tab:hover { background: var(--card); color: var(--text); }
.tab.is-active { background: var(--primary); color: #fff; }

/* Cartes du catalogue de modeles */
.bp-card { border: 1px solid var(--border); }
.bp-swatches { display: flex; gap: 5px; margin: 8px 0; }
.bp-swatches span {
    width: 24px; height: 24px; border-radius: var(--radius-btn);
    border: 1px solid var(--border); display: block;
}
.bp-adopt { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

/* Resultats de recherche d'eleve */
.picker { position: relative; margin-top: 6px; }
.picker__item {
    display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
    padding: 8px 11px; background: var(--card); color: var(--text);
    border: 1px solid var(--border); border-bottom: none;
}
.picker__item:first-child { border-radius: var(--radius-btn) var(--radius-btn) 0 0; }
.picker__item:last-child { border-bottom: 1px solid var(--border); border-radius: 0 0 var(--radius-btn) var(--radius-btn); }
.picker__item:hover, .picker__item:focus {
    background: var(--primary-soft); border-color: var(--primary); outline: none;
}
.picker__empty {
    margin: 0; padding: 9px 11px; font-size: 13px; color: var(--muted);
    background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-btn);
}
.field--grow { flex: 1 1 320px; }
.hint--warn { color: var(--warning); }

/* Grille de disponibilite du professeur : des cases a cocher grandes
   suffisent, parce qu'on les coche au doigt sur un telephone. */
.dispo { width: 100%; }
.dispo th, .dispo td { text-align: center; padding: 3px 2px; }
.dispo th:first-child { text-align: left; white-space: nowrap; }
.dispo__case {
    display: block;
    width: 100%;
    min-width: 30px;
    height: 30px;
    cursor: pointer;
    position: relative;
}
.dispo__case input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}
/* L'etat coche est dessine, pas seulement feltin par le navigateur :
   sur fond clair, une case vide doit quand meme se voir. */
.dispo__case::after {
    content: '';
    display: block;
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: #fff;
    transition: background .1s ease, border-color .1s ease;
}
.dispo__case:has(input:checked)::after { background: var(--primary); border-color: var(--primary); }
.dispo__case:hover::after { border-color: var(--primary); }
.dispo__case:has(input:focus-visible)::after { outline: 2px solid var(--primary); outline-offset: 1px; }
.dispo tr:has(input:checked) td:not(:last-child) { background: #f4f7fc; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Heure en cours dans l'emploi du temps : une etiquette, une cellule mise
   en evidence, et un trait rouge qui avance dans la colonne du jour. */
.tt-now {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--border-strong);
    border-left: 4px solid var(--muted);
    border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px;
}
.tt-now--live { border-left-color: #b91c1c; background: #fff5f5; }
.tt-now--repos { border-left-color: var(--border-strong); }
.tt-now__heure {
    font-variant-numeric: tabular-nums; font-weight: 800;
    font-size: 20px; color: #7f1d1d; letter-spacing: .01em;
    min-width: 62px;
}
.tt-now__texte { font-size: 14.5px; color: var(--text); }
.tt-now__texte strong { color: var(--text); }

.tt-wrap--live { position: relative; }
.tt-wrap--live td.tt-en-cours { background: #fff1f1; box-shadow: inset 0 0 0 2px #dc2626; }
.tt-wrap--live td.tt-en-cours .slot { background: transparent; }

/* Le trait rouge : place en absolu d'apres les mesures reelles des
   cellules, et non d'apres des pourcentages supposes — la grille est
   libre dans sa largeur. */
.tt-cursor {
    position: absolute; pointer-events: none; z-index: 5;
    border-top: 2px solid #dc2626;
}
.tt-cursor span {
    position: absolute; right: -1px; top: -9px;
    background: #dc2626; color: #fff; font-size: 11px; font-weight: 700;
    padding: 1px 5px; border-radius: 4px; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tt-cursor::before {
    content: ''; position: absolute; left: -4px; top: -4px;
    width: 7px; height: 7px; border-radius: 50%; background: #dc2626;
}
