/* Présences EEDF — mobile first
   Charte graphique EEDF (avril 2026) : palette rouge / orange / jaune / vert / bleu,
   palette tamisée pour les fonds, police Montserrat (sans empattement, lisible pour les personnes dys). */

/* Montserrat (SIL Open Font License, voir fonts/Montserrat-OFL.txt), hébergée ici : aucun appel à Google */
@font-face {
    font-family: "Montserrat"; font-style: normal; font-display: swap; font-weight: 100 900;
    src: url(fonts/montserrat-latin-wght-normal.woff2) format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Montserrat"; font-style: normal; font-display: swap; font-weight: 100 900;
    src: url(fonts/montserrat-latin-ext-wght-normal.woff2) format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Palette EEDF */
    --eedf-rouge: #bd1220;
    --eedf-orange: #f05a24;
    --eedf-jaune: #f7a800;
    --eedf-vert: #96bf0d;
    --eedf-bleu: #29a3c0;
    /* Palette tamisée (fonds) */
    --eedf-rouge-t: #f5dcde;
    --eedf-orange-t: #fbeae4;
    --eedf-jaune-t: #fbeece;
    --eedf-vert-t: #eff5db;
    --eedf-bleu-t: #dff1f6;

    --bg: #f6f6f4;
    --card: #fff;
    --text: #1c2430;
    --muted: #5f6772;
    --line: #e2e3e0;
    --primary: var(--eedf-rouge);     /* rouge du typogramme EEDF : contraste suffisant avec le blanc */
    --primary-text: #fff;
    --accent: var(--eedf-bleu);
    --ok: #6f8f00;                    /* vert EEDF assombri pour les contours sur fond clair */
    --ok-bg: var(--eedf-vert-t);
    --warn-bg: var(--eedf-jaune-t);
    --err: #9e0f1b;
    --err-bg: var(--eedf-rouge-t);
    --topbar-bg: #fff;
    --topbar-text: var(--text);
    --radius: 14px;
    --tap: 52px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171b; --card: #1e2329; --text: #eceef0; --muted: #a2a9b2; --line: #2e353e;
        --primary: var(--eedf-orange); --primary-text: #14171b; --accent: var(--eedf-bleu);
        --ok: var(--eedf-vert); --ok-bg: #26301a; --warn-bg: #3a3218; --err: #ff8a80; --err-bg: #3d1d1f;
        --topbar-bg: #1e2329; --topbar-text: var(--text);
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 .5rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* Barre du haut */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .75rem; padding-top: max(.5rem, env(safe-area-inset-top));
    background: var(--topbar-bg); color: var(--topbar-text);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
/* Liseré aux cinq couleurs EEDF sous la barre */
.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
    background: linear-gradient(90deg,
        var(--eedf-rouge) 0 20%, var(--eedf-orange) 20% 40%, var(--eedf-jaune) 40% 60%,
        var(--eedf-vert) 60% 80%, var(--eedf-bleu) 80% 100%);
}
.topbar-back { font-size: 1.8rem; line-height: 1; text-decoration: none; width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.topbar-back:hover { background: var(--bg); }
/* Griffe EEDF (trèfle et arcs) : fond blanc imposé par la charte, y compris en mode sombre */
.topbar-logo { flex: none; display: block; width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 2px; }
.topbar-logo img { display: block; width: 100%; height: 100%; }
.topbar-title { flex: 1; font-size: 1.05rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-login { text-decoration: none; font-weight: 600; color: var(--primary); }
.menu { position: relative; }
.menu summary {
    list-style: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center; background: var(--primary); color: var(--primary-text); font-weight: 700;
}
.menu summary::-webkit-details-marker { display: none; }
.menu nav {
    position: absolute; right: 0; top: 48px; min-width: 240px; background: var(--card); color: var(--text);
    border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: .4rem; display: flex; flex-direction: column;
}
.menu nav a { padding: .75rem .9rem; text-decoration: none; border-radius: 10px; }
.menu nav a:hover { background: var(--bg); }
.menu-who { padding: .6rem .9rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; font-weight: 600; }
.menu-who small { display: block; color: var(--muted); font-weight: 400; }

.container { max-width: 760px; margin: 0 auto; padding: 1.25rem .9rem 2rem; }
/* Logo complet (bloc marque) : 160 px, au-dessus de la taille minimale de la charte (20 mm) */
.logo-full { display: block; width: 160px; height: auto; margin: .5rem auto 1rem; background: #fff; border-radius: 12px; padding: 8px; }
.has-savebar .container { padding-bottom: 6rem; }
.section-title { margin: 1.4rem 0 .6rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Cartes, tuiles */
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card > summary { cursor: pointer; padding: .2rem 0; }
.tiles { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile {
    --c: var(--primary);
    display: flex; flex-direction: column; gap: .2rem; text-decoration: none;
    background: var(--card); border-radius: var(--radius); padding: 1.1rem 1rem;
    border-left: 8px solid var(--c); box-shadow: 0 1px 2px rgba(0,0,0,.06); min-height: 84px; justify-content: center;
}
.tile:active { transform: scale(.98); }
.tile-title { font-size: 1.2rem; font-weight: 700; }
.tile-sub { color: var(--muted); font-size: .9rem; }
/* Fond « tamisé » de la couleur de branche : texte foncé lisible quelle que soit la couleur */
.tile-big { background: color-mix(in srgb, var(--c) 18%, var(--card)); margin-bottom: .5rem; }
.tile-big .tile-title { font-size: 1.35rem; }

.unit-head {
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
    border-left: 6px solid var(--c); padding: .3rem .7rem; margin-bottom: .8rem; color: var(--muted);
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.stats > div { background: var(--card); border-radius: var(--radius); padding: .7rem .5rem; text-align: center; }
.stats strong { display: block; font-size: 1.35rem; }
.stats span { font-size: .78rem; color: var(--muted); }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 44px; padding: .55rem 1rem; border-radius: 12px; border: 1px solid var(--line);
    background: var(--card); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn-block { display: flex; width: 100%; margin-bottom: .6rem; }
.btn-xl { min-height: 58px; font-size: 1.1rem; }
.btn-small { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.actions-list { display: flex; flex-direction: column; gap: .5rem; }
.actions-list .btn { justify-content: flex-start; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: .8rem; margin-top: .5rem; }
.form label, .inline label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
input, select, textarea {
    font: inherit; font-size: 16px; color: var(--text); background: var(--card);
    border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem; min-height: 46px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input[type=file] { padding: .5rem; }
.inline { display: flex; align-items: flex-end; gap: .5rem; flex-wrap: wrap; }
.inline select, .inline input { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; }
.row-inline { display: flex; gap: .5rem; margin-top: .5rem; }
.select-small { width: auto; max-width: 48%; min-height: 40px; padding: .3rem .5rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: .5rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 500; cursor: pointer; }
.chip input:checked + span { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.chips-nav { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; }
.chip-link { padding: .4rem .8rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; white-space: nowrap; }

/* Listes */
.list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.list-item {
    display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; min-height: var(--tap);
    background: var(--card); border-radius: 12px; text-decoration: none;
}
.list-edit { display: block; }
.list-edit > summary { display: flex; cursor: pointer; list-style: none; }
.list-edit > summary::-webkit-details-marker { display: none; }
.list-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.list-title { font-weight: 600; }
.list-sub { font-size: .85rem; color: var(--muted); }
.inactif { opacity: .55; }
.date-badge { min-width: 62px; text-align: center; font-size: .85rem; font-weight: 700; color: var(--primary); }
.count { font-weight: 700; font-size: 1.1rem; }
.count small { color: var(--muted); font-weight: 400; }
.count-todo { font-size: .8rem; color: var(--err); background: var(--err-bg); padding: .2rem .5rem; border-radius: 999px; }
.tag { font-size: .7rem; background: var(--bg); border: 1px solid var(--line); padding: 0 .4rem; border-radius: 6px; font-weight: 500; vertical-align: middle; }

/* Saisie des présences */
.act-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: var(--card); padding: .8rem; border-radius: var(--radius); }
.saisie-tools { display: flex; gap: .5rem; margin-top: 1rem; align-items: center; }
.saisie-tools input { flex: 1; }
.checks { display: grid; grid-template-columns: 1fr; gap: .45rem; }
@media (min-width: 480px) { .checks { grid-template-columns: 1fr 1fr; } }
.check { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.check input { position: absolute; opacity: 0; }
.check span {
    display: flex; align-items: center; gap: .6rem; min-height: 56px; padding: .6rem .9rem;
    background: var(--card); border: 2px solid var(--line); border-radius: 12px; transition: background .1s, border-color .1s;
}
.check span::before {
    content: ""; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg);
}
.check input:checked + span { background: var(--ok-bg); border-color: var(--ok); }
.check input:checked + span::before { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 4px var(--ok-bg); }
.check input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.check.hidden { display: none; }
.checks-staff .check span { min-height: 48px; }
.ajout { margin-top: .7rem; }
.ajout summary { cursor: pointer; color: var(--muted); padding: .4rem 0; }
.savebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .7rem 1rem; padding-bottom: max(.7rem, env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.savebar .btn { min-width: 150px; min-height: 50px; }

/* Messages */
.flash { padding: .75rem .9rem; border-radius: 12px; margin-bottom: 1rem; background: var(--ok-bg); }
.flash-err { background: var(--err-bg); color: var(--err); }
.flash-warn { background: var(--warn-bg); }

/* Tableaux */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, .col2-texte th:nth-child(2), .col2-texte td:nth-child(2) { text-align: left; }
thead th { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
tfoot th { border-top: 2px solid var(--line); }

.print-only { display: none; }
@media print {
    .topbar, .no-print, .savebar { display: none !important; }
    .print-only { display: block; }
    /* Logo EEDF obligatoire sur les documents officiels (charte) : 96 px ≈ 25 mm, au-dessus du minimum de 20 mm */
    .print-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
    .print-head img { width: 25mm; height: auto; }
    /* Tableaux entiers sur papier : pas de défilement, en-têtes sur plusieurs lignes */
    .table-wrap { overflow: visible; }
    table { font-size: .75rem; }
    th, td { padding: .35rem .4rem; }
    thead th { white-space: normal; }
    body { background: #fff; color: #000; }
    .card, .table-wrap, .stats > div { box-shadow: none; border: 1px solid #ccc; }
}
