/* ==========================================================================
   Design system « Sauge » — application personnelle de Léa (ATSEM)
   Ivoire · vert sauge · serif éditorial pour les titres · SF pour le texte.
   Voir DESIGN_SYSTEM.md pour la documentation des jetons et composants.
   ========================================================================== */

:root {
  /* Couleurs — neutres chauds */
  --ivoire: #FAF7F1;
  --ivoire-2: #F3EEE4;
  --surface: #FFFFFF;
  --surface-2: #FCFAF6;
  --encre: #1E2621;
  --texte-2: #535D57;
  --texte-3: #737C76;
  --ligne: #E6E0D4;
  --ligne-2: #EFEAE0;

  /* Couleurs — sauge (marque) */
  --marque-900: #1F3027;
  --marque-700: #3B5747;
  --marque-600: #4C6B58;
  --marque-500: #68876F;
  --marque-300: #A8BDAA;
  --marque-100: #DCE6DA;
  --marque-50: #EDF2EA;
  --sur-marque: #FFFFFF;
  --sur-fait: #FFFFFF;

  /* Couleurs — états */
  --fait: #4C6B58;      --fait-bg: #E3ECE1;
  --reporte: #84540F;   --reporte-bg: #F7ECD6;
  --nonfait: #A2442D;   --nonfait-bg: #F6E4DD;
  --info: #45596B;      --info-bg: #E9EEF2;

  /* Typographie */
  --f-titre: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-texte: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --t-xs: 12px; --t-s: 13.5px; --t-m: 15.5px; --t-l: 17px; --t-xl: 22px; --t-2xl: 30px; --t-3xl: 40px;

  /* Espacements (base 4) */
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px; --e-5: 20px; --e-6: 24px; --e-8: 32px; --e-10: 40px;

  /* Rayons, ombres, mouvement */
  --r-s: 10px; --r-m: 14px; --r-l: 20px; --r-xl: 26px; --r-plein: 999px;
  --ombre-1: 0 1px 2px rgba(31, 48, 39, .05);
  --ombre-2: 0 10px 30px -12px rgba(31, 48, 39, .18), 0 2px 6px rgba(31, 48, 39, .04);
  --ombre-3: 0 24px 60px -20px rgba(31, 48, 39, .35);
  --courbe: cubic-bezier(.22, .8, .24, 1);
  --vite: 160ms; --moyen: 260ms;

  --barre-h: 66px;
  color-scheme: light;
}

/* Mode sombre : choisi (« sombre ») ou automatique selon le téléphone (« auto », par défaut). */
:root[data-mode="sombre"] {
    --ivoire: #121815; --ivoire-2: #18201B; --surface: #1B231E; --surface-2: #1F2822;
    --encre: #EDF0EC; --texte-2: #B5BFB8; --texte-3: #93A097; --ligne: #2C3730; --ligne-2: #252F29;
    --marque-900: #E3ECE1; --marque-700: #A9C4AE; --marque-600: #95B49B; --marque-500: #7FA087; --marque-300: #4F6B57; --marque-100: #2A3A2F; --marque-50: #212D25; --sur-marque: #10170F; --sur-fait: #10170F;
    --fait: #A2C2A8; --fait-bg: #253328; --reporte: #E9C27E; --reporte-bg: #3A2E18; --nonfait: #F0A28E; --nonfait-bg: #3D231C; --info: #AFC3D3; --info-bg: #222D36;
    --ombre-1: none; --ombre-2: 0 10px 30px -12px rgba(0, 0, 0, .6); --ombre-3: 0 24px 60px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"], :root:not([data-mode]) {
    --ivoire: #121815; --ivoire-2: #18201B; --surface: #1B231E; --surface-2: #1F2822;
    --encre: #EDF0EC; --texte-2: #B5BFB8; --texte-3: #93A097; --ligne: #2C3730; --ligne-2: #252F29;
    --marque-900: #E3ECE1; --marque-700: #A9C4AE; --marque-600: #95B49B; --marque-500: #7FA087; --marque-300: #4F6B57; --marque-100: #2A3A2F; --marque-50: #212D25; --sur-marque: #10170F; --sur-fait: #10170F;
    --fait: #A2C2A8; --fait-bg: #253328; --reporte: #E9C27E; --reporte-bg: #3A2E18; --nonfait: #F0A28E; --nonfait-bg: #3D231C; --info: #AFC3D3; --info-bg: #222D36;
    --ombre-1: none; --ombre-2: 0 10px 30px -12px rgba(0, 0, 0, .6); --ombre-3: 0 24px 60px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--ivoire); color: var(--encre); font: 400 var(--t-m)/1.45 var(--f-texte); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2.5px solid var(--marque-500); outline-offset: 2px; border-radius: 8px; }
.ic { width: 22px; height: 22px; flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 560px; margin: 0 auto; padding: 0 var(--e-4) calc(var(--barre-h) + 28px + env(safe-area-inset-bottom)); min-height: 100vh; }
.vue { animation: apparition var(--moyen) var(--courbe); }
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }


/* ---------- En-tête ---------- */
.entete { padding: calc(var(--e-4) + env(safe-area-inset-top)) 0 var(--e-4); }
.entete-haut { display: flex; align-items: center; justify-content: space-between; gap: var(--e-3); min-height: 40px; margin-bottom: 6px; }
.entete-haut .surtitre { margin: 0; }
.surtitre { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--texte-2); font-weight: 600; margin: 0 0 4px; }
.titre { font: 600 var(--t-2xl)/1.12 var(--f-titre); letter-spacing: -.01em; margin: 0; color: var(--encre); }
.sous-titre { margin: 6px 0 0; color: var(--texte-2); font-size: var(--t-m); }
.entete-actions { display: flex; gap: var(--e-2); align-items: center; }
.etat-sync { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: var(--r-plein); background: var(--surface); box-shadow: var(--ombre-1); border: 1px solid var(--ligne-2); font-size: var(--t-xs); font-weight: 600; color: var(--texte-2); white-space: nowrap; }
.etat-sync .point { width: 7px; height: 7px; border-radius: 50%; background: var(--texte-3); }
.etat-sync.ok .point { background: var(--fait); }
.etat-sync.attente .point { background: var(--reporte); animation: pulse 1.4s infinite; }
.etat-sync.ko { color: var(--nonfait); } .etat-sync.ko .point { background: var(--nonfait); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 var(--e-5); border-radius: var(--r-m); font-weight: 600; font-size: var(--t-m); transition: transform var(--vite) var(--courbe), background var(--vite), box-shadow var(--vite); user-select: none; }
.btn:active { transform: scale(.97); }
.btn .ic { width: 19px; height: 19px; }
.btn-primaire { background: var(--marque-700); color: var(--sur-marque); box-shadow: 0 6px 16px -8px rgba(59, 87, 71, .7); }
.btn-primaire:hover { background: var(--marque-600); }
.btn-secondaire { background: var(--surface); color: var(--marque-700); border: 1px solid var(--ligne); box-shadow: var(--ombre-1); }
.btn-doux { background: var(--marque-50); color: var(--marque-700); }
.btn-fantome { color: var(--marque-700); min-height: 40px; padding: 0 var(--e-3); }
.btn-danger { background: var(--nonfait-bg); color: var(--nonfait); }
.btn-bloc { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icone-btn { width: 40px; height: 40px; border-radius: var(--r-plein); display: grid; place-items: center; color: var(--texte-2); transition: background var(--vite); flex: none; }
.icone-btn:hover, .icone-btn:active { background: var(--ivoire-2); }
.icone-btn.plein { background: var(--surface); border: 1px solid var(--ligne-2); box-shadow: var(--ombre-1); color: var(--marque-700); }

/* ---------- Cartes & sections ---------- */
.carte { background: var(--surface); border: 1px solid var(--ligne-2); border-radius: var(--r-l); box-shadow: var(--ombre-1); padding: var(--e-4); }
.carte + .carte, .carte + .section, .section + .carte { margin-top: var(--e-3); }
.carte-hero { padding: var(--e-5); background: linear-gradient(160deg, var(--surface) 0%, var(--marque-50) 140%); }
.section { margin-top: var(--e-6); }
.section-tete { display: flex; align-items: baseline; justify-content: space-between; gap: var(--e-2); margin: 0 2px var(--e-3); }
.section-titre { font: 600 var(--t-l)/1.2 var(--f-titre); margin: 0; }
.section-lien { font-size: var(--t-s); font-weight: 600; color: var(--marque-700); display: inline-flex; align-items: center; gap: 2px; }
.section-lien .ic { width: 16px; height: 16px; }
.muet { color: var(--texte-2); }
.petit { font-size: var(--t-s); }
.tres-petit { font-size: var(--t-xs); }

/* ---------- Puces ---------- */
.puce { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-plein); font-size: 11.5px; font-weight: 600; background: var(--ivoire-2); color: var(--texte-2); white-space: nowrap; }
.puce .ic { width: 13px; height: 13px; }
.puce-marque { background: var(--marque-50); color: var(--marque-700); }
.puce-ambre { background: var(--reporte-bg); color: var(--reporte); }
.puce-terre { background: var(--nonfait-bg); color: var(--nonfait); }
.puce-info { background: var(--info-bg); color: var(--info); }

/* ---------- Segmenté & filtres ---------- */
.seg { display: flex; padding: 4px; border-radius: var(--r-m); background: var(--ivoire-2); gap: 2px; }
.seg button { flex: 1; min-height: 38px; border-radius: 11px; font-size: var(--t-s); font-weight: 600; color: var(--texte-2); transition: background var(--vite), color var(--vite), box-shadow var(--vite); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--encre); box-shadow: 0 1px 3px rgba(31, 48, 39, .12), inset 0 0 0 1px var(--marque-300); }
.chips { display: flex; gap: var(--e-2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--e-4)); padding: 2px var(--e-4); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 34px; padding: 0 14px; border-radius: var(--r-plein); border: 1px solid var(--ligne); background: var(--surface); font-size: var(--t-s); font-weight: 600; color: var(--texte-2); }
.chip[aria-pressed="true"] { background: var(--marque-700); border-color: var(--marque-700); color: var(--sur-marque); }

/* ---------- Navigation par date ---------- */
.nav-date { display: flex; align-items: center; gap: var(--e-2); }
.nav-date .centre { flex: 1; text-align: center; min-width: 0; }
.nav-date .centre strong { display: block; font: 600 var(--t-l)/1.2 var(--f-titre); }
.nav-date .centre strong::first-letter { text-transform: uppercase; }
.nav-date .centre span { font-size: var(--t-xs); color: var(--texte-2); }
.nav-date .centre a { color: var(--marque-700); font-weight: 600; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- Anneau de progression ---------- */
.anneau { position: relative; width: 96px; height: 96px; flex: none; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau .fond { stroke: var(--marque-100); }
.anneau .val { stroke: var(--marque-600); transition: stroke-dashoffset 700ms var(--courbe); }
.anneau .chiffre { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font: 600 24px/1 var(--f-titre); }
.anneau .chiffre small { display: block; font: 600 10px/1.2 var(--f-texte); color: var(--texte-2); letter-spacing: .04em; margin-top: 3px; }
.hero { display: flex; gap: var(--e-5); align-items: center; }
.hero h2 { font: 600 var(--t-xl)/1.2 var(--f-titre); margin: 0 0 4px; }
.barre { height: 6px; border-radius: var(--r-plein); background: var(--marque-100); overflow: hidden; }
.barre > span { display: block; height: 100%; background: var(--marque-600); border-radius: inherit; transition: width 600ms var(--courbe); }

/* ---------- Tâche ---------- */
.liste-taches { display: flex; flex-direction: column; gap: var(--e-2); }
.tache { display: flex; align-items: center; gap: var(--e-3); background: var(--surface); border: 1px solid var(--ligne-2); border-radius: var(--r-l); padding: var(--e-3) var(--e-2) var(--e-3) var(--e-3); box-shadow: var(--ombre-1); transition: background var(--moyen), border-color var(--moyen), opacity var(--moyen); }
.tache.est-faite { background: var(--surface-2); }
.tache.est-faite .tache-titre { color: var(--texte-2); }
.coche { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--marque-300); display: grid; place-items: center; color: var(--sur-fait); flex: none; transition: background var(--moyen) var(--courbe), border-color var(--moyen), transform var(--vite) var(--courbe); }
.coche:active { transform: scale(.9); }
.coche .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.est-faite .coche { background: var(--fait); border-color: var(--fait); animation: pop 360ms var(--courbe); }
.est-reportee .coche { background: var(--reporte); border-color: var(--reporte); }
.est-non_faite .coche { background: var(--nonfait); border-color: var(--nonfait); }
@keyframes pop { 0% { transform: scale(.75); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.tache-corps { flex: 1; min-width: 0; cursor: pointer; text-align: left; }
.tache-titre { font-weight: 600; font-size: var(--t-m); line-height: 1.3; }
.tache-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.tache-etat { font-size: var(--t-xs); color: var(--texte-2); margin-top: 6px; }
.groupe-espace + .groupe-espace { margin-top: var(--e-5); }
.groupe-tete { display: flex; align-items: center; gap: var(--e-2); margin: 0 4px var(--e-2); color: var(--texte-2); font-size: var(--t-s); font-weight: 600; }
.groupe-tete .ic { width: 17px; height: 17px; color: var(--marque-600); }
.groupe-tete .compte { margin-left: auto; font-weight: 500; }

/* ---------- Tuiles ---------- */
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-3); }
.tuile { background: var(--surface); border: 1px solid var(--ligne-2); border-radius: var(--r-l); padding: var(--e-4); box-shadow: var(--ombre-1); text-align: left; display: flex; flex-direction: column; gap: var(--e-3); transition: transform var(--vite) var(--courbe); min-height: 104px; }
.tuile:active { transform: scale(.98); }
.tuile .pastille { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--marque-50); color: var(--marque-700); }
.tuile strong { font-size: var(--t-s); line-height: 1.3; }
.stat { background: var(--surface); border: 1px solid var(--ligne-2); border-radius: var(--r-l); padding: var(--e-4); box-shadow: var(--ombre-1); }
.stat b { display: block; font: 600 28px/1 var(--f-titre); margin-bottom: 6px; }
.stat span { font-size: var(--t-s); color: var(--texte-2); }
.stat.fait b { color: var(--fait); } .stat.reporte b { color: var(--reporte); } .stat.nonfait b { color: var(--nonfait); }

/* ---------- Semaine ---------- */
.jours { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.jour { border-radius: var(--r-m); padding: 10px 4px; text-align: center; background: var(--surface); border: 1px solid var(--ligne-2); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform var(--vite); }
.jour:active { transform: scale(.96); }
.jour .nom { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-2); }
.jour .num { font: 600 19px/1 var(--f-titre); }
.jour.actif { background: var(--marque-700); border-color: var(--marque-700); color: var(--sur-marque); }
.jour.actif .nom { color: var(--marque-100); }
.jour.repos { background: transparent; border-style: dashed; color: var(--texte-3); }
.mini-barre { width: 70%; height: 4px; border-radius: 9px; background: var(--marque-100); overflow: hidden; }
.mini-barre span { display: block; height: 100%; background: var(--marque-600); }
.jour.actif .mini-barre { background: rgba(255, 255, 255, .25); } .jour.actif .mini-barre span { background: #fff; }
.ligne-jour { display: flex; align-items: center; gap: var(--e-3); padding: var(--e-3) 0; border-bottom: 1px solid var(--ligne-2); width: 100%; text-align: left; }
.ligne-jour:last-child { border-bottom: 0; }
.ligne-jour .date { width: 52px; flex: none; text-align: center; }
.ligne-jour .date b { display: block; font: 600 20px/1 var(--f-titre); }
.ligne-jour .date span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); font-weight: 700; }
.gommettes { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.gommette { width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid var(--marque-300); display: grid; place-items: center; color: #fff; flex: none; }
.gommette .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.gommette.faite { background: var(--fait); border-color: var(--fait); }
.gommette.reportee { background: var(--reporte); border-color: var(--reporte); }
.gommette.non_faite { background: var(--nonfait); border-color: var(--nonfait); }
.legende { display: flex; flex-wrap: wrap; gap: var(--e-4); font-size: var(--t-xs); color: var(--texte-2); margin-top: var(--e-3); }
.legende span { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Listes de réglages ---------- */
.liste { background: var(--surface); border: 1px solid var(--ligne-2); border-radius: var(--r-l); box-shadow: var(--ombre-1); overflow: hidden; }
.ligne { display: flex; align-items: center; gap: var(--e-3); width: 100%; padding: 14px var(--e-4); text-align: left; border-bottom: 1px solid var(--ligne-2); min-height: 56px; transition: background var(--vite); }
.ligne:last-child { border-bottom: 0; }
button.ligne:active { background: var(--ivoire-2); }
.ligne .pastille { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--marque-50); color: var(--marque-700); flex: none; }
.ligne .pastille .ic { width: 19px; height: 19px; }
.ligne .txt { flex: 1; min-width: 0; }
.ligne .txt strong { display: block; font-weight: 600; font-size: var(--t-m); }
.ligne .txt span { display: block; font-size: var(--t-s); color: var(--texte-2); margin-top: 2px; }
.ligne > .ic:last-child { color: var(--texte-3); width: 18px; height: 18px; }

/* ---------- Bilans : barres empilées ---------- */
.repartition { display: flex; height: 10px; border-radius: var(--r-plein); overflow: hidden; background: var(--ivoire-2); margin-top: 8px; }
.repartition span { display: block; height: 100%; }
.repartition .f { background: var(--fait); } .repartition .r { background: var(--reporte); } .repartition .n { background: var(--nonfait); }
.ligne-bilan { padding: var(--e-3) 0; border-bottom: 1px solid var(--ligne-2); }
.ligne-bilan:last-child { border-bottom: 0; }
.ligne-bilan .haut { display: flex; justify-content: space-between; gap: var(--e-3); font-size: var(--t-s); }
.ligne-bilan .haut strong { font-weight: 600; }
.note-decl { display: flex; gap: var(--e-3); align-items: flex-start; padding: var(--e-4); border-radius: var(--r-l); background: var(--info-bg); color: var(--info); font-size: var(--t-s); }
.note-decl .ic { width: 20px; height: 20px; margin-top: 1px; }
.note-ambre { background: var(--reporte-bg); color: var(--reporte); }

/* ---------- Historique ---------- */
.journee { margin-top: var(--e-5); }
.journee-titre { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--texte-2); font-weight: 700; margin: 0 4px var(--e-2); }
.evt { display: flex; gap: var(--e-3); padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--ligne-2); }
.evt:last-child { border-bottom: 0; }
.evt .rond { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ivoire-2); color: var(--texte-2); }
.evt .rond .ic { width: 16px; height: 16px; stroke-width: 2.1; }
.evt.faite .rond { background: var(--fait-bg); color: var(--fait); }
.evt.reportee .rond { background: var(--reporte-bg); color: var(--reporte); }
.evt.non_faite .rond { background: var(--nonfait-bg); color: var(--nonfait); }
.evt.annulation .rond { background: var(--info-bg); color: var(--info); }
.evt .corps { flex: 1; min-width: 0; font-size: var(--t-s); }
.evt .corps strong { font-weight: 600; }
.evt .heure { font-size: var(--t-xs); color: var(--texte-2); flex: none; padding-top: 2px; }
.evt.annulee .corps > .quoi { text-decoration: line-through; text-decoration-color: var(--nonfait); text-decoration-thickness: 1.5px; color: var(--texte-2); }
.mention-corr { display: inline-flex; gap: 4px; align-items: center; margin-top: 4px; font-size: var(--t-xs); color: var(--info); font-weight: 600; }
.mention-corr .ic { width: 14px; height: 14px; }
.filtres { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-2); margin-top: var(--e-3); }

/* ---------- Formulaires ---------- */
.champ { display: block; margin-bottom: var(--e-4); }
.champ > span { display: block; font-size: var(--t-s); font-weight: 600; margin-bottom: 6px; color: var(--encre); }
.champ small { display: block; margin-top: 5px; color: var(--texte-2); font-size: var(--t-xs); }
.saisie { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-m); border: 1px solid var(--ligne); background-color: var(--surface-2); font-size: 16px; transition: border-color var(--vite), box-shadow var(--vite); -webkit-appearance: none; appearance: none; }
select.saisie { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737C76' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
textarea.saisie { min-height: 92px; resize: vertical; }
.saisie:focus { outline: none; border-color: var(--marque-500); box-shadow: 0 0 0 4px var(--marque-50); }
.saisie.compacte { min-height: 40px; padding: 8px 12px; font-size: 15px; border-radius: var(--r-s); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-2); }
.cases { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.case { position: relative; }
.case input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.case span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: var(--r-plein); border: 1px solid var(--ligne); background: var(--surface); font-size: var(--t-s); font-weight: 600; color: var(--texte-2); transition: all var(--vite); }
.case input:checked + span { background: var(--marque-700); border-color: var(--marque-700); color: var(--sur-marque); }
.case input:focus-visible + span { outline: 2.5px solid var(--marque-500); outline-offset: 2px; }
.rappel-prive { display: flex; gap: 8px; align-items: center; font-size: var(--t-xs); color: var(--reporte); background: var(--reporte-bg); border-radius: var(--r-s); padding: 8px 10px; margin: -6px 0 var(--e-4); }
.rappel-prive .ic { width: 16px; height: 16px; }
.periode { display: grid; grid-template-columns: 34px 1fr 1fr; gap: var(--e-2); align-items: center; padding: 6px 0; }
.periode b { font: 600 var(--t-l)/1 var(--f-titre); color: var(--marque-700); }

/* ---------- Feuilles (dialogues en bas d'écran) ---------- */
dialog.feuille { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: calc(100vh - 24px - env(safe-area-inset-top)); max-height: calc(100dvh - 24px - env(safe-area-inset-top)); overscroll-behavior: contain; background: var(--surface); color: var(--encre); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--ombre-3); overflow: auto; }
dialog.feuille[open] { animation: monte var(--moyen) var(--courbe); }
dialog.feuille::backdrop { background: rgba(20, 28, 23, .38); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@keyframes monte { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.feuille form { padding: 10px var(--e-5) calc(var(--e-5) + env(safe-area-inset-bottom)); }
.poignee { width: 40px; height: 5px; border-radius: 9px; background: var(--ligne); margin: 0 auto var(--e-4); }
.feuille h3 { font: 600 var(--t-xl)/1.2 var(--f-titre); margin: 0 0 var(--e-2); }
.feuille .chapeau { color: var(--texte-2); font-size: var(--t-s); margin: 0 0 var(--e-4); }
.feuille .actions { display: flex; gap: var(--e-2); margin-top: var(--e-4); position: sticky; bottom: 0; z-index: 1; padding: var(--e-3) 0 2px; background: var(--surface); box-shadow: 0 -10px 12px -10px rgba(0, 0, 0, .08); }
.feuille .chapeau, .feuille h3 { overflow-wrap: break-word; }
@media (max-width: 360px) { .feuille form { padding-left: var(--e-4); padding-right: var(--e-4); } .feuille .actions { flex-direction: column-reverse; } .seg button { font-size: 12.5px; } }
.feuille .actions .btn { flex: 1; }
.menu-actions { display: flex; flex-direction: column; gap: 2px; margin: 0 calc(-1 * var(--e-2)); }
.menu-actions button { display: flex; gap: var(--e-3); align-items: center; padding: 11px var(--e-3); border-radius: var(--r-m); font-weight: 600; text-align: left; }
.menu-actions button:active { background: var(--ivoire-2); }
.menu-actions .pastille { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--marque-50); color: var(--marque-700); flex: none; }
.menu-actions .pastille.ambre { background: var(--reporte-bg); color: var(--reporte); }
.menu-actions .pastille.terre { background: var(--nonfait-bg); color: var(--nonfait); }
.menu-actions .pastille.info { background: var(--info-bg); color: var(--info); }
@media (min-width: 620px) { dialog.feuille { margin: auto; border-radius: var(--r-xl); } }

/* ---------- Barre d'onglets ---------- */
.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(250, 247, 241, .86); background: color-mix(in srgb, var(--ivoire) 84%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-top: 1px solid var(--ligne-2); }
.onglets-int { max-width: 560px; margin: 0 auto; display: flex; }
.onglets button { flex: 1; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--texte-3); border-radius: var(--r-m); transition: color var(--vite); }
.onglets button .bulle { width: 52px; height: 30px; border-radius: var(--r-plein); display: grid; place-items: center; transition: background var(--moyen) var(--courbe); }
.onglets button[aria-current="page"] { color: var(--marque-700); }
.onglets button[aria-current="page"] .bulle { background: var(--marque-100); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--barre-h) + 24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--marque-900); color: var(--ivoire); padding: 11px 16px; border-radius: var(--r-plein); font-size: var(--t-s); font-weight: 600; display: flex; gap: 8px; align-items: center; box-shadow: var(--ombre-3); transition: all var(--moyen) var(--courbe); pointer-events: none; z-index: 30; white-space: nowrap; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast .ic { width: 18px; height: 18px; }

.vide { text-align: center; padding: var(--e-8) var(--e-4); }
.vide .pastille { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto var(--e-3); display: grid; place-items: center; background: var(--marque-50); color: var(--marque-700); }
.vide .pastille .ic { width: 28px; height: 28px; }
.vide h3 { font: 600 var(--t-xl)/1.2 var(--f-titre); margin: 0 0 6px; }
.vide p { margin: 0 0 var(--e-4); color: var(--texte-2); }

/* ---------- Compte rendu (aperçu + impression) ---------- */
#rapport { display: none; }
body.rapport-ouvert #app, body.rapport-ouvert .onglets { display: none; }
body.rapport-ouvert #rapport { display: block; background: var(--ivoire-2); min-height: 100vh; }
.rapport-barre { position: sticky; top: 0; z-index: 2; display: flex; gap: var(--e-2); align-items: center; padding: calc(10px + env(safe-area-inset-top)) var(--e-4) 10px; background: var(--ivoire); border-bottom: 1px solid var(--ligne-2); }
.rapport-barre .espace { flex: 1; }
.rapport-barre .btn { min-height: 40px; padding: 0 14px; font-size: var(--t-s); }
.rapport-defile { padding: var(--e-4) var(--e-3) var(--e-10); }

.papier { --p-encre: #1E2621; --p-gris: #5A635D; --p-ligne: #E4DED2; --p-sauge: #3B5747; --p-sauge-clair: #EDF2EA;
  background: #fff; color: var(--p-encre); width: 100%; max-width: 794px; margin: 0 auto; padding: 44px 46px; box-shadow: var(--ombre-2); border-radius: 6px; font: 400 12.5px/1.5 var(--f-texte); color-scheme: light; }
.papier h1, .papier h2 { font-family: var(--f-titre); color: var(--p-sauge); }
.papier .p-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--p-sauge); }
.papier .p-marque { display: flex; gap: 8px; align-items: center; color: var(--p-sauge); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 10.5px; margin-bottom: 10px; }
.papier .p-marque .ic { width: 18px; height: 18px; }
.papier h1 { font-size: 25px; line-height: 1.15; margin: 0 0 6px; font-weight: 600; }
.papier .p-qui { color: var(--p-gris); }
.papier .p-periode { text-align: right; flex: none; }
.papier .p-periode b { display: block; font: 600 15px/1.3 var(--f-titre); color: var(--p-encre); }
.papier h2 { font-size: 14.5px; margin: 26px 0 10px; font-weight: 600; }
.papier .p-kpi { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 8px; }
.papier .p-kpi div { border: 1px solid var(--p-ligne); border-radius: 10px; padding: 12px; }
.papier .p-kpi b { display: block; font: 600 22px/1 var(--f-titre); margin-bottom: 4px; }
.papier .p-kpi .principal { background: var(--p-sauge-clair); border-color: transparent; }
.papier .p-kpi .principal b { color: var(--p-sauge); font-size: 28px; }
.papier .p-kpi span { color: var(--p-gris); font-size: 11px; }
.papier table { width: 100%; border-collapse: collapse; }
.papier th { text-align: right; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--p-gris); font-weight: 700; padding: 0 6px 8px; border-bottom: 1px solid var(--p-ligne); }
.papier td { text-align: right; padding: 9px 6px; border-bottom: 1px solid var(--p-ligne); vertical-align: middle; }
.papier th:first-child, .papier td:first-child { text-align: left; padding-left: 0; }
.papier td small { color: var(--p-gris); display: block; }
.papier .p-mini { display: flex; height: 6px; width: 74px; border-radius: 9px; overflow: hidden; background: #F1EDE5; margin-left: auto; }
.papier .p-mini span { display: block; height: 100%; }
.papier .p-mini .f { background: #4C6B58; } .papier .p-mini .r { background: #B07A26; } .papier .p-mini .n { background: #A2442D; }
.papier .p-rem td { text-align: left; }
.papier .p-rem td:first-child { width: 86px; color: var(--p-gris); }
.papier .p-nature { margin-top: 24px; padding: 12px 14px; border-left: 3px solid var(--p-sauge); background: #F7F5F0; font-size: 11.5px; }
.papier .p-visas { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 26px; }
.papier .p-visas div { border-top: 1px solid var(--p-gris); padding-top: 6px; height: 64px; color: var(--p-gris); font-size: 11px; }
.papier .p-pied { margin-top: 22px; padding-top: 10px; border-top: 1px solid var(--p-ligne); color: var(--p-gris); font-size: 9.5px; word-break: break-all; }
@media (max-width: 600px) {
  .papier { padding: 26px 18px; }
  .papier .p-tete { flex-direction: column; gap: 10px; }
  .papier .p-periode { text-align: left; }
  .papier .p-kpi { grid-template-columns: repeat(2, 1fr); }
  .papier .p-kpi .principal { grid-column: span 2; }
  .papier .p-col-opt { display: none; }
}

@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { background: #fff !important; }
  #app, .onglets, .rapport-barre, dialog, .toast { display: none !important; }
  #rapport { display: block !important; background: #fff !important; min-height: 0 !important; }
  .rapport-defile { padding: 0; }
  .papier { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .papier .p-tete { flex-direction: row; } .papier .p-periode { text-align: right; }
  .papier .p-kpi { grid-template-columns: 1.4fr repeat(4, 1fr); } .papier .p-kpi .principal { grid-column: auto; }
  .papier .p-col-opt { display: table-cell; }
  .papier tr, .papier .p-nature, .papier .p-visas { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ==========================================================================
   V2 — Pages d'accès (connexion, inscription, mot de passe), administration, apparence
   ========================================================================== */
.page-acces { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 440px; margin: 0 auto; padding: calc(var(--e-8) + env(safe-area-inset-top)) var(--e-4) calc(var(--e-8) + env(safe-area-inset-bottom)); }
.marque-acces { display: flex; align-items: center; gap: 10px; margin-bottom: var(--e-6); color: var(--marque-700); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: var(--t-xs); }
.marque-acces .logo-app { width: 56px; height: 56px; border-radius: 15px; box-shadow: var(--ombre-2); flex: none; }
.note-securite { margin: 12px 0 0; text-align: center; }
.note-securite .ic { display: inline; width: 14px; height: 14px; vertical-align: -2px; }
.logo-diapo { display: block; margin: 0 auto var(--e-4); border-radius: 22px; box-shadow: var(--ombre-2); }
.page-acces .titre { margin-bottom: 6px; }
.page-acces .carte { padding: var(--e-5); margin-top: var(--e-5); }
.page-acces .lien { color: var(--marque-700); font-weight: 600; text-decoration: none; }
.page-acces .bas { text-align: center; margin-top: var(--e-5); font-size: var(--t-s); color: var(--texte-2); }
.champ-mdp { position: relative; }
.champ-mdp .saisie { padding-right: 52px; }
.oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: var(--r-m); display: grid; place-items: center; color: var(--texte-2); }
.oeil:hover { color: var(--marque-700); }
.oeil .ic { width: 21px; height: 21px; }
.exigences { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: var(--t-s); color: var(--texte-2); }
.exigences li { display: flex; gap: 8px; align-items: center; transition: color var(--vite); }
.exigences li .rond { width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid var(--ligne); display: grid; place-items: center; flex: none; transition: all var(--vite); }
.exigences li .rond .ic { width: 12px; height: 12px; stroke-width: 2.6; opacity: 0; }
.exigences li.ok { color: var(--fait); }
.exigences li.ok .rond { background: var(--fait); border-color: var(--fait); color: var(--sur-fait); }
.exigences li.ok .rond .ic { opacity: 1; }
.message { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-m); font-size: var(--t-s); margin-bottom: var(--e-4); }
.message .ic { width: 19px; height: 19px; margin-top: 1px; }
.message.erreur { background: var(--nonfait-bg); color: var(--nonfait); }
.message.succes { background: var(--fait-bg); color: var(--fait); }
.message.info { background: var(--info-bg); color: var(--info); }
.saisie[aria-invalid="true"] { border-color: var(--nonfait); }
.aide-champ.erreur { color: var(--nonfait) !important; font-weight: 600; }
.etapes { display: flex; gap: 6px; margin: 0 0 var(--e-4); }
.etapes span { flex: 1; height: 4px; border-radius: 9px; background: var(--ligne); }
.etapes span.fait { background: var(--marque-600); }
.btn .tourne { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Administration */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--marque-100); color: var(--marque-700); font-weight: 700; font-size: var(--t-s); flex: none; }
.avatar.grand { width: 64px; height: 64px; font: 600 24px/1 var(--f-titre); }
.statut { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; height: 22px; padding: 0 8px; border-radius: var(--r-plein); }
.statut::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.statut.actif, .statut.acceptee { background: var(--fait-bg); color: var(--fait); }
.statut.en_attente { background: var(--info-bg); color: var(--info); }
.statut.expiree, .statut.desactive { background: var(--reporte-bg); color: var(--reporte); }
.statut.revoquee, .statut.retire { background: var(--nonfait-bg); color: var(--nonfait); }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--e-2); }
.chiffres .stat { padding: var(--e-3); text-align: center; }
.chiffres .stat b { font-size: 24px; }
.partage-lien { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--e-2); margin-top: var(--e-3); }
.partage-lien button, .partage-lien a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--r-m); background: var(--marque-50); color: var(--marque-700); font-size: 11.5px; font-weight: 600; text-decoration: none; }
.partage-lien .ic { width: 22px; height: 22px; }
.interrupteur-ligne { display: flex; align-items: center; justify-content: space-between; gap: var(--e-3); }
.bascule { position: relative; width: 52px; height: 32px; flex: none; }
.bascule input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.bascule span { position: absolute; inset: 0; border-radius: 99px; background: var(--ligne); transition: background var(--moyen); }
.bascule span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform var(--moyen) var(--courbe); }
.bascule input:checked + span { background: var(--marque-600); }
.bascule input:checked + span::after { transform: translateX(20px); }
.bascule input:focus-visible + span { outline: 2.5px solid var(--marque-500); outline-offset: 2px; }

/* Apparence */
.nuancier { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--e-2); }
.nuance { position: relative; padding: 12px 8px 10px; border-radius: var(--r-m); border: 1.5px solid var(--ligne); background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--texte-2); }
.nuance .pastilles { display: flex; }
.nuance .pastilles i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; }
.nuance .pastilles i:first-child { margin-left: 0; }
.nuance[aria-pressed="true"] { border-color: var(--marque-600); color: var(--encre); box-shadow: 0 0 0 3px var(--marque-100); }
.nuance[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 6px; right: 8px; font-size: 12px; color: var(--marque-700); }
.pastille-espace { width: 10px; height: 10px; border-radius: 50%; background: var(--teinte, var(--marque-600)); flex: none; }
.apercu-theme { border-radius: var(--r-l); padding: var(--e-4); background: var(--ivoire); border: 1px solid var(--ligne-2); }

/* Bienvenue */
.diapo { text-align: center; padding: var(--e-4) 0 0; }
.diapo .pastille { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto var(--e-4); display: grid; place-items: center; background: var(--marque-50); color: var(--marque-700); }
.diapo .pastille .ic { width: 34px; height: 34px; }
.points-diapo { display: flex; gap: 6px; justify-content: center; margin-top: var(--e-4); }
.points-diapo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ligne); }
.points-diapo i.actif { width: 20px; border-radius: 9px; background: var(--marque-600); }
.etape-install { display: flex; gap: var(--e-3); align-items: flex-start; padding: 10px 0; }
.etape-install .num { width: 28px; height: 28px; border-radius: 50%; background: var(--marque-100); color: var(--marque-700); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.etape-install .texte { flex: 1; min-width: 0; padding-top: 3px; line-height: 1.45; overflow-wrap: break-word; }
.etape-install .texte b { font-weight: 700; color: var(--encre); }
.install-tete { display: flex; gap: var(--e-3); align-items: center; margin-bottom: var(--e-4); }
.install-tete img { border-radius: 14px; flex: none; box-shadow: var(--ombre-1); }
.install-tete b { display: block; font: 600 var(--t-l)/1.2 var(--f-titre); }
.install-tete span { display: block; font-size: var(--t-s); color: var(--texte-2); margin-top: 2px; }

/* Photo de profil */
.avatar.avec-photo { padding: 0; overflow: hidden; background: var(--marque-100); }
.avatar.avec-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.tres-grand { width: 112px; height: 112px; font: 600 38px/1 var(--f-titre); }
.photo-profil { display: flex; justify-content: center; margin-bottom: 12px; }
.photo-profil .avatar { box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--marque-100); }
.photo-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.photo-actions .btn { min-height: 40px; }
.bouton-avatar { border-radius: 50%; box-shadow: var(--ombre-1); }
.bouton-avatar .avatar { width: 40px; height: 40px; }

/* Message de bienvenue */
.carte-bienvenue { padding: var(--e-5); background: linear-gradient(165deg, var(--surface) 0%, var(--marque-50) 160%); margin-bottom: var(--e-3); }
.carte-bienvenue p { margin: 0 0 10px; color: var(--texte-2); font-size: var(--t-m); line-height: 1.55; }
.carte-bienvenue .bienvenue-tete { font: 600 var(--t-l)/1.3 var(--f-titre); color: var(--encre); }
.carte-bienvenue .bienvenue-fin { font: italic 500 var(--t-m)/1.4 var(--f-titre); color: var(--marque-700); margin-bottom: 14px; }
.carte-bienvenue .btn { min-height: 40px; }
.carte-bienvenue.dans-diapo { text-align: left; background: none; border: 0; box-shadow: none; padding: 4px 0 0; margin: 0; }
.carte-bienvenue.dans-diapo .bienvenue-fin { margin-bottom: 0; }
