/* Linette — feuille de style.
   Idée : du papier blanc posé sur un drap gris-bleu, une encre bleu nuit, un seul accent « bleu de lessive ».
   Chaque ticket est un coupon à talon perforé : le numéro frappé dans le talon est la seule fantaisie,
   tout le reste se tait. Texte aligné à gauche, une seule famille de caractères. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(fonts/bricolage-grotesque.woff2) format("woff2");
}

:root {
  color-scheme: light;
  --fond: #E9EDF0;
  --papier: #FDFEFE;
  --papier-2: #F1F4F6;
  --leve: #FDFEFE; /* élément choisi dans un groupe de segments */
  --encre: #17202B;
  --encre-2: #525D6C;
  --encre-3: #8590A0;
  --trait: #D3D9E0;
  --azur: #2F4C9F;
  --azur-fort: #243C82;
  --azur-doux: #E1E7F6;
  --sur-azur: #FFFFFF;
  --fait: #2B6E50;
  --fait-doux: #DCEEE4;
  --ocre: #8A5F0B;
  --ocre-doux: #F5EAD2;
  --rouge: #AD372E;
  --rouge-doux: #F8E2DF;
  --voile: rgba(23, 32, 43, .38);
  --ombre: 0 1px 0 rgba(23, 32, 43, .05), 0 8px 22px -14px rgba(23, 32, 43, .35);
  --ombre-haute: 0 18px 50px -18px rgba(23, 32, 43, .45);
  /* Une couleur par habitant (validées pour rester distinctes, y compris en vision daltonienne). */
  --m0: #3D62B8; --m1: #C2603A; --m2: #16917A; --m3: #B5830A; --m4: #C76B93; --m5: #4E8B3A; --m6: #7559B8; --m7: #B8474A;
  --serie-faits: #2F4C9F;
  --serie-crees: #8590A0;
  --sur-m: #FFFFFF; /* texte posé sur la couleur d'un habitant */
  --police: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rayon: 12px;
  --talon: 62px;
  --bas: env(safe-area-inset-bottom, 0px);
  --haut: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #0F1319; --papier: #19202A; --papier-2: #121820; --leve: #2D3847; --encre: #E9EDF2; --encre-2: #A6B0BE; --encre-3: #6F7B8B; --trait: #2C3542;
    --azur: #93A9EC; --azur-fort: #B3C3F4; --azur-doux: #222C48; --sur-azur: #0E1530;
    --fait: #6FC29A; --fait-doux: #17332A; --ocre: #DDB25A; --ocre-doux: #3A2E14; --rouge: #EC8A80; --rouge-doux: #43201D;
    --voile: rgba(0, 0, 0, .6); --ombre: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 22px -14px rgba(0, 0, 0, .8); --ombre-haute: 0 18px 50px -18px rgba(0, 0, 0, .9);
    --m0: #6F8FE0; --m1: #D27348; --m2: #2FA88D; --m3: #B98A1F; --m4: #CF7199; --m5: #62A04C; --m6: #937CDB; --m7: #DB6B6C;
    --serie-faits: #6F8FE0; --serie-crees: #6F7B8B; --sur-m: #0E1319;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #0F1319; --papier: #19202A; --papier-2: #121820; --leve: #2D3847; --encre: #E9EDF2; --encre-2: #A6B0BE; --encre-3: #6F7B8B; --trait: #2C3542;
  --azur: #93A9EC; --azur-fort: #B3C3F4; --azur-doux: #222C48; --sur-azur: #0E1530;
  --fait: #6FC29A; --fait-doux: #17332A; --ocre: #DDB25A; --ocre-doux: #3A2E14; --rouge: #EC8A80; --rouge-doux: #43201D;
  --voile: rgba(0, 0, 0, .6); --ombre: 0 1px 0 rgba(255, 255, 255, .03), 0 8px 22px -14px rgba(0, 0, 0, .8); --ombre-haute: 0 18px 50px -18px rgba(0, 0, 0, .9);
  --m0: #6F8FE0; --m1: #D27348; --m2: #2FA88D; --m3: #B98A1F; --m4: #CF7199; --m5: #62A04C; --m6: #937CDB; --m7: #DB6B6C;
  --serie-faits: #6F8FE0; --serie-crees: #6F7B8B; --sur-m: #0E1319;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--fond); color: var(--encre);
  font-family: var(--police); font-size: 16px; line-height: 1.45; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-wrap: anywhere;
}
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--azur); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Coque : barre du bas au téléphone, rail à gauche sur grand écran ---------- */
.coque { min-height: 100%; }
.rail { display: contents; }
.marque {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--haut)) 18px 10px; background: color-mix(in srgb, var(--fond) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-weight: 750; font-size: 1.32rem; font-stretch: 88%; letter-spacing: -.02em; line-height: 1; }
.logo svg { width: 26px; height: 26px; }
.logo small { font-size: .78rem; font-weight: 500; font-stretch: 100%; letter-spacing: 0; color: var(--encre-2); padding: 3px 8px; border-radius: 99px; background: var(--papier); }
.moi { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 99px; }
.moi .nom { display: none; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 6px calc(6px + var(--bas)); background: color-mix(in srgb, var(--papier) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--trait);
}
.nav button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 4px; border-radius: 10px; color: var(--encre-2); font-size: .72rem; font-weight: 500; position: relative; }
.nav button[aria-current="page"] { color: var(--azur); font-weight: 650; }
.nav button[aria-current="page"] .ico { stroke-width: 2.2; }
.nav .pastille { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--rouge); color: var(--papier); font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center; }
.rail .nouveau, .rail .pied { display: none; }
#vue { display: block; padding: 6px 18px calc(150px + var(--bas)); max-width: 780px; margin: 0 auto; }
.fab {
  position: fixed; right: 18px; bottom: calc(76px + var(--bas)); z-index: 25; display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 16px;
  border-radius: 99px; background: var(--azur); color: var(--sur-azur); font-weight: 650; box-shadow: var(--ombre-haute);
}
.fab:active { background: var(--azur-fort); }
.bandeau { margin: 0 0 14px; padding: 9px 14px; border-radius: 10px; background: var(--azur-doux); color: var(--encre); font-size: .88rem; }
.bandeau.hors { background: var(--ocre-doux); }

@media (min-width: 900px) {
  .coque { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 26px 16px 18px; border-right: 1px solid var(--trait); }
  .marque { position: static; padding: 0 8px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .marque .moi, .marque .logo small { display: none; }
  .logo { font-size: 1.6rem; }
  .logo svg { width: 30px; height: 30px; }
  .nav { position: static; display: flex; flex-direction: column; gap: 2px; padding: 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav button { display: flex; align-items: center; justify-items: start; gap: 12px; padding: 10px 12px; font-size: .98rem; }
  .nav button[aria-current="page"] { background: var(--papier); box-shadow: var(--ombre); color: var(--encre); }
  .nav button[aria-current="page"] .ico { color: var(--azur); }
  .nav .pastille { position: static; margin-left: auto; }
  .rail .nouveau { display: flex; }
  .rail .pied { display: flex; margin-top: auto; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
  .rail .pied:hover { background: var(--papier); }
  .rail .pied .nom { display: grid; font-weight: 600; line-height: 1.2; }
  .rail .pied .nom small { font-weight: 400; color: var(--encre-2); font-size: .8rem; }
  .fab { display: none; }
  #vue { padding: 34px 40px 80px; margin: 0; max-width: 900px; }
}

/* ---------- Titres de page ---------- */
.entete { display: grid; gap: 6px; margin: 8px 0 20px; }
.entete .date { color: var(--encre-2); font-size: .92rem; }
.entete .date::first-letter { text-transform: uppercase; }
.geant { font-size: clamp(2.1rem, 9.2vw, 3.3rem); font-weight: 750; font-stretch: 78%; line-height: .98; letter-spacing: -.025em; text-wrap: balance; }
.resume { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 8px; }
h2.section { font-size: 1.02rem; font-weight: 650; margin: 26px 0 10px; display: flex; align-items: baseline; gap: 8px; }
h2.section small { font-weight: 400; color: var(--encre-2); font-size: .86rem; }
.aide { color: var(--encre-2); font-size: .9rem; }
.vide { margin-top: 14px; padding: 34px 22px; border: 1.5px dashed var(--trait); border-radius: var(--rayon); display: grid; gap: 6px; justify-items: start; }
.vide strong { font-size: 1.05rem; }
.vide .btn { margin-top: 8px; }

/* ---------- Boutons, puces, segments, champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 11px;
  font-weight: 600; background: var(--papier); box-shadow: inset 0 0 0 1px var(--trait); white-space: nowrap;
}
.btn:hover { box-shadow: inset 0 0 0 1px var(--encre-3); }
.btn.plein { background: var(--azur); color: var(--sur-azur); box-shadow: none; }
.btn.plein:hover { background: var(--azur-fort); }
.btn.vert { background: var(--fait); color: var(--papier); box-shadow: none; }
.btn.doux { background: var(--azur-doux); color: var(--azur-fort); box-shadow: none; }
.btn.nu { background: none; box-shadow: none; color: var(--encre-2); padding: 0 10px; }
.btn.nu:hover { color: var(--encre); background: var(--papier-2); }
.btn.danger { color: var(--rouge); }
.btn.petit { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 9px; }
.btn.rond { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.btn.large { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.puce { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 550; background: var(--papier-2); color: var(--encre-2); white-space: nowrap; }
.puce .ico { width: 13px; height: 13px; stroke-width: 2.2; }
.puce.retard, .puce.urgente { background: var(--rouge-doux); color: var(--rouge); }
.puce.jour, .puce.encours { background: var(--azur-doux); color: var(--azur-fort); }
.puce.haute { background: var(--ocre-doux); color: var(--ocre); }
.puce.fait { background: var(--fait-doux); color: var(--fait); }
.puce.sur-fond { background: var(--papier); }
.segments { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: color-mix(in srgb, var(--encre) 7%, transparent); overflow-x: auto; scrollbar-width: none; }
.segments::-webkit-scrollbar { display: none; }
.segments > button, .segments > label > span { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 9px; border-radius: 9px; font-size: .9rem; font-weight: 550; color: var(--encre-2); white-space: nowrap; }
.segments > label > span:has(small) { flex-direction: column; gap: 0; padding-block: 6px; line-height: 1.2; }
.segments small { font-size: .76rem; font-weight: 500; color: var(--encre-3); }
.segments > label { flex: 1; display: flex; position: relative; cursor: pointer; }
.segments > label > input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segments > button[aria-pressed="true"], .segments > label > input:checked + span { background: var(--leve); color: var(--encre); box-shadow: 0 1px 2px rgba(23, 32, 43, .14); font-weight: 650; }
.segments > label > input:focus-visible + span { outline: 2px solid var(--azur); outline-offset: 1px; }
.segments .n { font-weight: 500; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.champ { display: grid; gap: 6px; }
.champ > label, .champ > .libelle, fieldset.champ > legend { font-size: .86rem; font-weight: 600; color: var(--encre-2); padding: 0; }
fieldset.champ { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.champ > legend { margin-bottom: 6px; }
.champ small { color: var(--encre-2); font-size: .82rem; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--trait); background: var(--papier); color: var(--encre); font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--encre-2) 50%), linear-gradient(135deg, var(--encre-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--azur); outline-offset: 0; border-color: transparent; border-radius: 11px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choix { display: flex; flex-wrap: wrap; gap: 8px; }
.choix > label { position: relative; cursor: pointer; }
.choix > label > input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choix > label > span { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 13px 0 9px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--trait); background: var(--papier); font-size: .93rem; font-weight: 550; }
.choix > label > span.sans { padding-left: 13px; }
.choix > label > input:checked + span { box-shadow: inset 0 0 0 2px var(--azur); background: var(--azur-doux); }
.choix > label > input:focus-visible + span { outline: 2px solid var(--azur); outline-offset: 2px; }
.choix.jours > label > span { width: 42px; padding: 0; justify-content: center; }
.erreur { padding: 10px 12px; border-radius: 10px; background: var(--rouge-doux); color: var(--rouge); font-size: .92rem; font-weight: 550; }

/* ---------- Habitants : pastille à l'initiale, cerclée de leur couleur ---------- */
.av { --c: var(--encre-3); display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, var(--papier)); box-shadow: inset 0 0 0 1.6px var(--c); color: var(--encre); font-size: .72rem; font-weight: 700; line-height: 1; text-transform: uppercase; }
.av.g { width: 38px; height: 38px; font-size: .95rem; }
.av.tg { width: 52px; height: 52px; font-size: 1.25rem; }
.av.libre { background: none; box-shadow: none; border: 1.6px dashed var(--encre-3); color: var(--encre-3); }
.av.linette { --c: var(--azur); }
.c0 { --c: var(--m0); } .c1 { --c: var(--m1); } .c2 { --c: var(--m2); } .c3 { --c: var(--m3); } .c4 { --c: var(--m4); } .c5 { --c: var(--m5); } .c6 { --c: var(--m6); } .c7 { --c: var(--m7); }

/* ---------- Le ticket : talon numéroté, perforation, encoches ---------- */
.outils { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 12px 0 4px; }
.outils input, .outils select { min-height: 42px; background-color: color-mix(in srgb, var(--papier) 70%, transparent); font-size: 16px; }
@media (max-width: 480px) { .outils { grid-template-columns: 1fr 1fr; } .outils .cherche { grid-column: 1 / -1; } }
.groupe { display: grid; gap: 10px; }
.groupe + .groupe { margin-top: 4px; }
.groupe > h2 { font-size: .86rem; font-weight: 650; color: var(--encre-2); margin: 18px 0 0; display: flex; gap: 8px; align-items: center; }
.groupe > h2.retard { color: var(--rouge); }
.ticket {
  position: relative; display: grid; grid-template-columns: var(--talon) minmax(0, 1fr) auto; align-items: stretch; min-height: 74px;
  background: var(--papier); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.ticket::before, .ticket::after { content: ""; position: absolute; left: calc(var(--talon) - 7px); width: 14px; height: 14px; border-radius: 50%; background: var(--fond); z-index: 1; }
.ticket::before { top: -7px; }
.ticket::after { bottom: -7px; }
.ticket > .zone { position: absolute; inset: 0; border-radius: var(--rayon); z-index: 2; }
.ticket > .zone:hover { box-shadow: inset 0 0 0 1px var(--encre-3); }
.talon { position: relative; display: grid; align-content: center; justify-items: center; gap: 0; padding: 8px 0; border-radius: var(--rayon) 0 0 var(--rayon); }
.talon::after { content: ""; position: absolute; right: -1px; top: 11px; bottom: 11px; border-right: 2px dotted var(--trait); }
.talon .no { font-size: .66rem; font-weight: 600; color: var(--encre-3); line-height: 1; }
.talon .num { font-size: 1.62rem; font-weight: 750; font-stretch: 75%; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.talon .num.long { font-size: 1.2rem; }
.ticket[data-statut="encours"] .talon { background: var(--azur-doux); }
.ticket[data-statut="encours"] .talon .num, .ticket[data-statut="encours"] .talon .no { color: var(--azur-fort); }
.ticket[data-statut="fait"] .talon .num, .ticket[data-statut="annule"] .talon .num { color: var(--encre-3); }
.ticket[data-statut="annule"] .talon .num { text-decoration: line-through; }
.ticket[data-prio="urgente"] .talon { box-shadow: inset 4px 0 0 var(--rouge); }
.ticket[data-prio="haute"] .talon { box-shadow: inset 4px 0 0 var(--ocre); }
/* Ticket fait : le talon est poinçonné. */
.poincon { position: absolute; top: 7px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--fond); box-shadow: inset 0 1px 1.5px rgba(23, 32, 43, .28); }
.ticket.vient .poincon { animation: poincon .42s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes poincon { from { transform: scale(2.6); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); } }
.ticket[data-statut="fait"] .talon { padding-top: 18px; }
.corps { display: grid; align-content: center; gap: 6px; padding: 11px 6px 11px 14px; min-width: 0; }
.corps h3 { font-size: 1.02rem; font-weight: 620; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket[data-statut="fait"] .corps h3, .ticket[data-statut="annule"] .corps h3 { color: var(--encre-2); font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; font-size: .84rem; color: var(--encre-2); }
.meta .qui { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; color: var(--encre); }
.meta .qui .av { width: 20px; height: 20px; font-size: .6rem; }
.meta .qui.libre { color: var(--encre-2); font-weight: 500; }
.meta .ech { font-weight: 600; }
.meta .ech.retard { color: var(--rouge); }
.meta .ech.jour { color: var(--azur-fort); }
.meta .plus { display: inline-flex; align-items: center; gap: 3px; }
.meta .plus .ico { width: 14px; height: 14px; }
.cote { position: relative; z-index: 3; display: grid; align-content: center; justify-items: center; gap: 3px; padding: 8px 12px 8px 4px; }
.cote .pts { font-size: .74rem; font-weight: 600; color: var(--encre-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.coche { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1.6px var(--trait); color: var(--encre-3); background: var(--papier); }
.coche:hover { box-shadow: inset 0 0 0 1.6px var(--fait); color: var(--fait); background: var(--fait-doux); }
.coche.ok { box-shadow: none; background: var(--fait-doux); color: var(--fait); }
.encore { justify-self: center; margin-top: 8px; }

/* ---------- Tiroir du ticket et feuilles de saisie ---------- */
.couche { position: fixed; inset: 0; z-index: 50; display: grid; }
.couche > .voile { position: absolute; inset: 0; background: var(--voile); animation: fondu .18s ease both; }
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(28px); opacity: 0; } }
@keyframes glisse { from { transform: translateX(36px); opacity: 0; } }
.panneau { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--fond); box-shadow: var(--ombre-haute); min-height: 0; max-height: 100%; animation: monte .22s cubic-bezier(.2, .8, .2, 1) both; }
.panneau > header { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--haut)) 12px 8px 18px; }
.panneau > header h2 { flex: 1; font-size: 1.08rem; font-weight: 650; min-width: 0; }
.panneau > .contenu { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 22px; display: grid; gap: 16px; align-content: start; }
.panneau > footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px calc(12px + var(--bas)); border-top: 1px solid var(--trait); background: var(--papier); }
.panneau > footer .btn { flex: 1; }
.panneau > footer .ligne { flex-basis: 100%; display: flex; justify-content: center; }
.couche.tiroir { align-items: end; }
.couche.tiroir .panneau { height: 100%; }
.couche.feuille { align-items: end; z-index: 60; }
.couche.feuille .panneau { border-radius: 20px 20px 0 0; max-height: 94%; }
.couche.feuille .panneau > header { padding-top: 14px; }
.couche.feuille.dialogue .panneau { grid-template-rows: auto auto auto; }
@media (min-width: 700px) {
  .couche.tiroir { justify-items: end; }
  .couche.tiroir .panneau { width: min(520px, 100%); animation-name: glisse; }
  .couche.feuille { align-items: center; justify-items: center; padding: 24px; }
  .couche.feuille .panneau { width: min(580px, 100%); border-radius: 18px; max-height: min(880px, 100%); }
  .couche.feuille.dialogue .panneau { width: min(440px, 100%); }
}
.fiche-tete { display: grid; gap: 8px; }
.fiche-tete .numero { font-size: 2.5rem; font-weight: 750; font-stretch: 75%; line-height: .95; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--encre-3); }
.fiche-tete h3 { font-size: 1.42rem; font-weight: 700; font-stretch: 90%; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.fiche-tete .puces { display: flex; flex-wrap: wrap; gap: 6px; }
.carte { background: var(--papier); border-radius: var(--rayon); box-shadow: var(--ombre); }
dl.infos { display: grid; }
dl.infos > div { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 14px; min-height: 48px; }
dl.infos > div + div { border-top: 1px solid var(--trait); }
dl.infos dt { color: var(--encre-2); font-size: .88rem; }
dl.infos dd { display: flex; align-items: center; gap: 8px; font-weight: 550; min-width: 0; }
dl.infos dd small { font-weight: 400; color: var(--encre-2); }
dl.infos dd .pile { display: grid; line-height: 1.25; }
dl.infos dd small.retard { color: var(--rouge); font-weight: 600; }
dl.infos dd small.jour { color: var(--azur-fort); font-weight: 600; }
.description { white-space: pre-wrap; padding: 13px 14px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photos .vignette, .photos .ajout { aspect-ratio: 1; border-radius: 10px; overflow: hidden; position: relative; background: var(--papier-2); }
.photos .vignette > button:not(.retire) { display: block; width: 100%; height: 100%; }
.photos .vignette img { width: 100%; height: 100%; object-fit: cover; }
.photos .ajout { display: grid; place-content: center; justify-items: center; gap: 4px; padding: 0 6px; text-align: center; line-height: 1.15; border: 1.5px dashed var(--encre-3); color: var(--encre-2); font-size: .78rem; font-weight: 600; cursor: pointer; background: none; }
.photos .ajout input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.photos .retire { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(23, 32, 43, .72); color: #fff; display: grid; place-items: center; }
.photos .retire .ico { width: 14px; height: 14px; }
.fil { display: grid; gap: 12px; }
.fil li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.fil .trace { color: var(--encre-2); font-size: .88rem; padding-top: 3px; }
.fil .trace b { color: var(--encre); font-weight: 600; }
.fil time { color: var(--encre-3); font-size: .78rem; white-space: nowrap; }
.fil .point { width: 8px; height: 8px; border-radius: 50%; background: var(--trait); justify-self: center; margin-top: 9px; }
.fil .bulle { background: var(--papier); border-radius: 4px 14px 14px 14px; padding: 9px 12px; box-shadow: var(--ombre); display: grid; gap: 2px; }
.fil .bulle .entete-bulle { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: .84rem; font-weight: 650; }
.fil .bulle p { white-space: pre-wrap; }
.ecrire { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.ecrire textarea { min-height: 46px; height: 46px; max-height: 140px; }
.discret { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.visionneuse { position: fixed; inset: 0; z-index: 80; background: rgba(8, 11, 15, .93); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.visionneuse header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(10px + var(--haut)) 12px 10px; color: #fff; }
.visionneuse header .btn { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.visionneuse img { width: 100%; height: 100%; object-fit: contain; padding: 0 0 calc(12px + var(--bas)); }

/* ---------- Routines ---------- */
.routine { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px; align-items: start; }
.routine h3 { font-size: 1.04rem; font-weight: 640; line-height: 1.25; }
.routine .rythme { display: flex; align-items: center; gap: 7px; color: var(--azur-fort); font-weight: 600; font-size: .92rem; }
.routine .rythme .ico { width: 16px; height: 16px; }
.routine .meta { grid-column: 1 / -1; }
.routine .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.routine.pause h3, .routine.pause .rythme { color: var(--encre-2); }
.tour { display: inline-flex; align-items: center; }
.tour .av { width: 20px; height: 20px; font-size: .6rem; margin-left: -5px; box-shadow: inset 0 0 0 1.6px var(--c), 0 0 0 2px var(--papier); }
.tour .av:first-child { margin-left: 0; }

/* ---------- Classement ---------- */
.rangs { display: grid; gap: 10px; }
.rang { display: grid; grid-template-columns: 42px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px 14px 8px; }
.rang .place { font-size: 2rem; font-weight: 750; font-stretch: 75%; text-align: center; color: var(--encre-3); line-height: 1; font-variant-numeric: tabular-nums; }
.rang.premier .place { color: var(--azur); }
.rang .qui { display: grid; gap: 6px; min-width: 0; }
.rang .qui strong { font-weight: 640; }
.rang .jauge { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, var(--papier-2)); overflow: hidden; }
.rang .jauge i { display: block; height: 100%; border-radius: 99px; background: var(--c); min-width: 0; }
.rang .score { text-align: right; line-height: 1.1; }
.rang .score b { font-size: 1.5rem; font-weight: 750; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.rang .score small { display: block; color: var(--encre-2); font-size: .8rem; }

/* ---------- Statistiques ---------- */
.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 620px) { .tuiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tuile { padding: 13px 14px; display: grid; gap: 2px; align-content: start; }
.tuile .valeur { font-size: 1.9rem; font-weight: 750; font-stretch: 80%; line-height: 1.05; letter-spacing: -.01em; }
.tuile .valeur small { font-size: .95rem; font-weight: 600; font-stretch: 100%; color: var(--encre-2); margin-left: 2px; }
.tuile .libelle { color: var(--encre-2); font-size: .86rem; }
.tuile .note { font-size: .8rem; font-weight: 600; }
.tuile .note.alerte { color: var(--rouge); }
.graphe { padding: 14px 14px 12px; display: grid; gap: 10px; position: relative; }
.graphe h3 { font-size: .98rem; font-weight: 650; }
.graphe h3 small { display: block; font-weight: 400; color: var(--encre-2); font-size: .84rem; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; color: var(--encre-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.colonnes svg { width: 100%; height: auto; overflow: visible; }
.colonnes text { font-family: var(--police); font-size: 11px; fill: var(--encre-2); font-variant-numeric: tabular-nums; }
.colonnes .grille { stroke: var(--trait); stroke-width: 1; }
.colonnes .base { stroke: var(--encre-3); stroke-width: 1; }
.colonnes .bande { fill: transparent; }
.colonnes g.b:hover .bande, .colonnes g.b:focus .bande { fill: color-mix(in srgb, var(--encre) 6%, transparent); }
.colonnes g.b { outline: none; }
.bulle-info { position: absolute; z-index: 5; pointer-events: none; padding: 7px 10px; border-radius: 9px; background: var(--encre); color: var(--fond); font-size: .82rem; line-height: 1.35; box-shadow: var(--ombre-haute); white-space: nowrap; }
.bulle-info b { display: block; }
.barres { display: grid; gap: 9px; }
.barres .ligne { display: grid; grid-template-columns: minmax(84px, 32%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .9rem; }
.barres .nom { display: flex; align-items: center; gap: 7px; min-width: 0; }
.barres .nom span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres .piste { min-width: 0; }
.barres .barre { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--c, var(--serie-faits)); min-width: 2px; }
.barres .barre.zero { visibility: hidden; }
.barres .val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.barres .val small { font-weight: 400; color: var(--encre-2); }
.partage { display: flex; gap: 2px; height: 28px; }
.partage > div { background: var(--c); border-radius: 4px; min-width: 3px; display: flex; align-items: center; padding: 0 7px; font-size: .8rem; font-weight: 700; color: var(--sur-m); overflow: hidden; white-space: nowrap; }
.partage > div.c3 { color: #0E1319; }
details.chiffres summary { cursor: pointer; color: var(--encre-2); font-size: .86rem; font-weight: 550; padding: 4px 0; width: fit-content; }
details.chiffres .defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--trait); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--encre-2); }

/* ---------- Logement ---------- */
.rangee { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; }
.rangee + .rangee { border-top: 1px solid var(--trait); }
.rangee .txt { display: grid; line-height: 1.25; min-width: 0; }
.rangee .txt strong { font-weight: 620; }
.rangee .txt small { color: var(--encre-2); font-size: .84rem; }
.rangee .txt .code-logement { font-size: 1.7rem; font-weight: 750; font-stretch: 80%; letter-spacing: .06em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rangee.clic { width: 100%; }
.rangee.clic:hover { background: var(--papier-2); }
.rangee:first-child { border-radius: var(--rayon) var(--rayon) 0 0; }
.rangee:last-child { border-radius: 0 0 var(--rayon) var(--rayon); }
.rangee:only-child { border-radius: var(--rayon); }
.etiquettes { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px; }
.etiquettes .puce { font-size: .9rem; padding: 5px 6px 5px 12px; gap: 4px; }
.etiquettes .puce.fixe { padding-right: 12px; }
.etiquettes .puce button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--encre-2); }
.etiquettes .puce button:hover { background: var(--trait); color: var(--encre); }
.etiquettes .puce button .ico { width: 13px; height: 13px; }
.ajout-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 0 14px 14px; }
.couleurs { display: flex; flex-wrap: wrap; gap: 10px; }
.couleurs label { position: relative; cursor: pointer; }
.couleurs input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.couleurs span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--c); }
.couleurs input:checked + span { box-shadow: 0 0 0 3px var(--fond), 0 0 0 5px var(--c); }
.couleurs input:focus-visible + span { outline: 2px solid var(--azur); outline-offset: 6px; }
.lien-copie { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.lien-copie input { font-size: 14px; color: var(--encre-2); }
.pied-page { margin-top: 26px; color: var(--encre-3); font-size: .82rem; }

/* ---------- Écrans d'accès ---------- */
.acces { min-height: 100%; display: grid; align-content: center; justify-items: center; padding: calc(28px + var(--haut)) 20px calc(28px + var(--bas)); }
.acces .cadre { width: min(420px, 100%); display: grid; gap: 22px; }
.acces .logo { font-size: 2.6rem; }
.acces .logo svg { width: 46px; height: 46px; }
.acces .accroche { font-size: 1.5rem; font-weight: 700; font-stretch: 82%; line-height: 1.1; letter-spacing: -.015em; text-wrap: balance; }
.acces form { display: grid; gap: 14px; padding: 20px; }
.acces .aide a { color: var(--azur-fort); }

/* ---------- Messages brefs ---------- */
#messages { position: fixed; left: 0; right: 0; bottom: calc(142px + var(--bas)); z-index: 90; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.message { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; padding: 11px 12px 11px 16px; border-radius: 13px; background: var(--encre); color: var(--fond); box-shadow: var(--ombre-haute); font-size: .93rem; font-weight: 550; animation: monte .22s cubic-bezier(.2, .8, .2, 1) both; }
.message.alerte { background: var(--rouge); color: var(--papier); }
.message button { font-weight: 700; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--fond) 16%, transparent); white-space: nowrap; }
@media (min-width: 900px) { #messages { bottom: 26px; padding-left: 236px; } }

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