/* Relais PAC : application.
   Thème sombre par défaut, thème clair si l'appareil le demande. Couleurs par rôle. */
:root {
  color-scheme: dark;
  --fond: #0a0f1c;
  --lueur-1: rgba(57, 135, 229, 0.26);
  --lueur-2: rgba(20, 184, 166, 0.16);
  --verre: rgba(255, 255, 255, 0.055);
  --verre-bord: rgba(255, 255, 255, 0.10);
  --verre-fort: rgba(255, 255, 255, 0.10);
  --feuille: #131a2b;
  --barre-basse: rgba(13, 19, 33, 0.86);
  --champ: rgba(255, 255, 255, 0.07);
  --ombre: 0 12px 32px rgba(0, 0, 0, 0.35);
  --encre: #f1f5f9;
  --encre-2: #b6c2d6;
  --discret: #8a98ae;
  --grille: rgba(255, 255, 255, 0.08);
  --axe: rgba(255, 255, 255, 0.20);
  --serie: #3987e5;
  --serie-voile: rgba(57, 135, 229, 0.18);
  --action: #2563eb;
  --action-survol: #1d4ed8;
  --anneau: #141b2b;
  --selection: #f1f5f9;
  --sur-selection: #0a0f1c;
  --bon: #2fbf4a;
  --alerte: #fab219;
  --critique: #f26b6b;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --fond: #edf1f7;
    --lueur-1: rgba(42, 120, 214, 0.18);
    --lueur-2: rgba(20, 184, 166, 0.14);
    --verre: rgba(255, 255, 255, 0.82);
    --verre-bord: rgba(15, 23, 42, 0.08);
    --verre-fort: rgba(15, 23, 42, 0.06);
    --feuille: #ffffff;
    --barre-basse: rgba(255, 255, 255, 0.90);
    --champ: rgba(15, 23, 42, 0.05);
    --ombre: 0 10px 28px rgba(15, 23, 42, 0.08);
    --encre: #0f172a;
    --encre-2: #475569;
    --discret: #64748b;
    --grille: rgba(15, 23, 42, 0.08);
    --axe: rgba(15, 23, 42, 0.22);
    --serie: #2a78d6;
    --serie-voile: rgba(42, 120, 214, 0.12);
    --anneau: #ffffff;
    --selection: #0f172a;
    --sur-selection: #ffffff;
    --bon: #0a8a0a;
    --alerte: #a86a00;
    --critique: #c62f2f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.planche { position: absolute; width: 0; height: 0; overflow: hidden; }
.icone {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icone.petit { width: 15px; height: 15px; }
.icone.discret, .discret { color: var(--discret); }
.ton-bon { color: var(--bon); }
.ton-alerte { color: var(--alerte); }
.ton-critique { color: var(--critique); }
.ton-critique-texte { color: var(--critique); font-size: 13px; }
.aide { display: block; font-size: 13px; color: var(--discret); line-height: 1.4; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.vide { margin-top: 12px; font-size: 14px; color: var(--encre-2); }

.fond {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(70% 50% at 10% 0%, var(--lueur-1), transparent 70%),
    radial-gradient(60% 45% at 100% 25%, var(--lueur-2), transparent 70%),
    var(--fond);
}
.verre {
  background: var(--verre); border: 1px solid var(--verre-bord); box-shadow: var(--ombre);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}

/* ---------- Cadre de l'application ---------- */
.application {
  max-width: 1080px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
           calc(104px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.barre { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.marque { display: flex; align-items: center; gap: 12px; min-width: 0; border-radius: 14px; }
.logo {
  width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #ffffff;
  background: linear-gradient(135deg, #3987e5, #14b8a6); box-shadow: 0 8px 20px -6px rgba(57, 135, 229, 0.7);
}
.marque-nom { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.etat {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px 0 9px; flex: none;
  border-radius: 999px; font-size: 13.5px; color: var(--encre-2);
  background: var(--verre); border: 1px solid var(--verre-bord);
}
.etat .icone { width: 18px; height: 18px; color: var(--discret); }
.etat[data-etat="bon"] .icone { color: var(--bon); }
.etat[data-etat="alerte"] .icone { color: var(--alerte); }
.etat[data-etat="critique"] .icone { color: var(--critique); }

.onglets {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
  background: var(--barre-basse); border-top: 1px solid var(--verre-bord);
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
}
.onglets a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 54px; border-radius: 16px; font-size: 12px; font-weight: 550; color: var(--discret);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.onglets a .icone { width: 22px; height: 22px; }
.onglets a:hover { color: var(--encre-2); }
.onglets a[aria-current="page"] { color: var(--encre); background: var(--serie-voile); }
.onglets a[aria-current="page"] .icone { color: var(--serie); }

#ecran { outline: none; }
#ecran > h1, .titre-ecran h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
#ecran > h1 { margin-bottom: 14px; }
.titre-ecran { margin-bottom: 14px; }
.titre-ecran .aide { margin-top: 2px; }
.retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -8px 0 2px -6px; padding: 0 10px 0 4px; border-radius: 12px; font-size: 14.5px; color: var(--encre-2); }
.retour:hover { background: var(--verre-fort); }

a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, .courbe:focus-visible {
  outline: 2px solid var(--serie); outline-offset: 2px;
}

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--verre-bord); background: var(--verre-fort); color: var(--encre);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: background-color 0.18s ease, opacity 0.18s ease;
}
.bouton:hover { background: var(--grille); }
.bouton.principal { background: var(--action); border-color: transparent; color: #ffffff; }
.bouton.principal:hover { background: var(--action-survol); }
.bouton.petit { min-height: 40px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.bouton:disabled { opacity: 0.45; cursor: default; }
.bouton-rond {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--verre-bord); background: var(--verre-fort); cursor: pointer;
  transition: background-color 0.18s ease, transform 0.12s ease;
}
.bouton-rond:hover { background: var(--grille); }
.bouton-rond:active { transform: scale(0.94); }
.bouton-rond.grand { width: 56px; height: 56px; }
.bouton-rond.grand .icone { width: 24px; height: 24px; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.actions.gauche { justify-content: flex-start; }
.lien { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 14.5px; font-weight: 600; color: var(--serie); }

.bandeau {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px;
  font-size: 14px; color: var(--encre-2); background: var(--verre-fort); border: 1px solid var(--verre-bord);
}
.bandeau .icone { margin-top: 1px; }
.bandeau.ton-bon, .bandeau.ton-critique, .bandeau.ton-alerte { color: var(--encre); }
.bandeau.ton-bon .icone { color: var(--bon); }
.bandeau.ton-critique .icone { color: var(--critique); }
.bandeau.ton-alerte .icone { color: var(--alerte); }
.bandeau.discret { margin: 12px 0 0; padding: 10px 12px; font-size: 13px; }

.roue {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid var(--axe); border-top-color: var(--serie); animation: tourne 0.8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.attente-ligne { display: flex; align-items: center; gap: 10px; margin: 14px 2px; font-size: 14px; color: var(--encre-2); }

/* ---------- Accueil ---------- */
.accueil-haut { display: grid; gap: 12px; }
.accueil-cote { display: grid; gap: 12px; align-content: start; }

.vedette {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 28px; padding: 20px 20px 0; color: #ffffff;
  background: linear-gradient(135deg, var(--v1, #1e3a8a), var(--v2, #0e7490));
  box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.65);
}
.vedette::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(255, 255, 255, 0.24), transparent 60%),
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.18));
}
.vedette-tete { display: flex; align-items: center; gap: 8px; }
.vedette-tete h2 { flex: 1; font-size: 13px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; }
.vedette-lien {
  display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 8px 0 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; background: rgba(255, 255, 255, 0.18);
}
.vedette-lien:hover { background: rgba(255, 255, 255, 0.28); }
.vedette-lien:focus-visible { outline-color: #ffffff; }
.vedette-lien .icone { width: 18px; height: 18px; }
.vedette-valeur { margin: 4px 0 2px; font-size: clamp(68px, 21vw, 104px); font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.vedette-unite { position: relative; top: 0.35em; margin-left: 6px; font-size: 0.32em; font-weight: 600; letter-spacing: 0; vertical-align: top; }
.vedette-detail { min-height: 22px; font-size: 15px; }
.vedette-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vedette-stats li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 999px;
  font-size: 14px; font-weight: 550; background: rgba(255, 255, 255, 0.18);
}
.vedette-stats .icone { width: 16px; height: 16px; }
.vedette-stats .periode { padding-left: 4px; background: transparent; font-weight: 450; }
.vedette-trace { margin: 14px -20px 0; height: 76px; }
.vedette-trace svg { display: block; width: 100%; height: 100%; }
.trace-trait { fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trace-point { fill: #ffffff; }
.trace-haut { stop-color: #ffffff; stop-opacity: 0.34; }
.trace-bas { stop-color: #ffffff; stop-opacity: 0; }

.pastille-icone {
  width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center;
  color: var(--serie); background: var(--serie-voile);
}
.pastille-icone.petite { width: 34px; height: 34px; border-radius: 11px; }
.pastille-icone.petite .icone { width: 17px; height: 17px; }

.geste { border-radius: 24px; padding: 8px 16px 18px; transition: opacity 0.18s ease; }
.geste.occupe { opacity: 0.55; pointer-events: none; }
.geste-tete {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 6px 0;
  background: none; border: 0; border-radius: 14px; text-align: left; cursor: pointer;
}
.geste-nom { flex: 1; min-width: 0; }
.geste-nom strong { display: block; font-size: 15.5px; font-weight: 650; }
.pas-a-pas { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.pas-a-pas.seul { justify-content: center; }
.geste-valeur { flex: 1; text-align: center; font-size: 46px; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; transition: color 0.18s ease; }
.geste-valeur.en-attente { color: var(--serie); }
.geste-valeur .unite { margin-left: 5px; font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--encre-2); }
.geste-confirmation { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: var(--serie-voile); font-size: 14.5px; }
.geste-confirmation .actions { margin-top: 10px; }

.tuiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tuiles:empty { display: none; }
.tuile {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 72px; padding: 12px 14px; border-radius: 20px;
  text-align: left; cursor: pointer; transition: background-color 0.18s ease, transform 0.12s ease;
}
.tuile:hover { background: var(--verre-fort); }
.tuile:active { transform: scale(0.98); }
.tuile-texte { min-width: 0; }
.tuile-nom { display: block; font-size: 13px; color: var(--encre-2); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tuile-valeur { display: block; font-size: 21px; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.tuile-valeur.texte { font-size: 15.5px; }
.tuile-unite { margin-left: 3px; font-size: 14px; font-weight: 500; color: var(--encre-2); }

.activite { margin-top: 12px; border-radius: 22px; padding: 16px 16px 6px; }
.activite h2 { margin-bottom: 8px; font-size: 16px; font-weight: 650; }
.activite-ligne { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; font-size: 14.5px; }
.activite-ligne .icone { margin-top: 2px; }

/* ---------- Listes (réglages, journal) ---------- */
.pile { display: grid; gap: 18px; }
.groupe { margin-top: 4px; }
.groupe > h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 4px 8px; font-size: 17px; font-weight: 650; }
.groupe > h2 .aide { display: inline; }
details.groupe > summary { margin: 0 4px 8px; padding: 10px 0; font-size: 14.5px; color: var(--encre-2); cursor: pointer; }
.liste { border-radius: 20px; overflow: hidden; }
.ligne {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px 10px 16px;
  background: none; border: 0; border-bottom: 1px solid var(--grille); text-align: left; cursor: pointer;
  transition: background-color 0.15s ease;
}
.ligne:last-child { border-bottom: 0; }
.ligne:hover { background: var(--verre-fort); }
.ligne.statique { cursor: default; }
.ligne.statique:hover { background: none; }
.ligne.haute { align-items: flex-start; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.ligne.haute > .icone { margin-top: 2px; }
.ligne.haute .bouton { margin-left: 32px; }
.ligne-texte { flex: 1; min-width: 0; }
.ligne-nom { display: block; font-size: 15px; font-weight: 550; line-height: 1.35; }
.ligne-valeur { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 46%; font-size: 15px; font-weight: 600; text-align: right; }
.compte { flex: none; min-width: 28px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; text-align: center; color: var(--encre-2); background: var(--grille); }
.marque-suivi { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--serie); }
.changement { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 0; font-size: 14.5px; color: var(--encre-2); }
.changement strong { color: var(--encre); }

.recherche { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 18px; padding: 0 16px; border-radius: 18px; }
.recherche-champ { flex: 1; min-width: 0; height: 50px; border: 0; background: none; outline: none; font: inherit; color: var(--encre); }
.recherche-champ::placeholder { color: var(--discret); }
.recherche:focus-within { outline: 2px solid var(--serie); outline-offset: 2px; }

.fiche { display: grid; grid-template-columns: 1fr; gap: 2px; border-radius: 20px; padding: 6px 16px; }
.fiche dt { margin-top: 10px; font-size: 13px; color: var(--discret); }
.fiche dd { padding-bottom: 10px; font-size: 14.5px; border-bottom: 1px solid var(--grille); }
.fiche dd:last-child { border-bottom: 0; }

/* ---------- Données ---------- */
.barre-filtres { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.filtres { display: inline-flex; max-width: 100%; gap: 4px; padding: 4px; border-radius: 14px; background: var(--verre); border: 1px solid var(--verre-bord); overflow-x: auto; }
.filtres button {
  flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent;
  font-size: 14px; font-weight: 550; color: var(--encre-2); cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.filtres button:hover { background: var(--verre-fort); }
.filtres button[aria-pressed="true"] { background: var(--selection); color: var(--sur-selection); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 11px; border-radius: 999px;
  border: 1px solid var(--verre-bord); background: transparent; font-size: 13.5px; font-weight: 550; color: var(--discret); cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.puce[aria-pressed="true"] { background: var(--serie-voile); color: var(--encre); border-color: transparent; }
.puce[aria-pressed="true"] .icone { color: var(--serie); }

.cartes { display: grid; gap: 12px; align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); transition: opacity 0.18s ease; }
.cartes.attente { opacity: 0.5; }
.carte { min-width: 0; padding: 16px 16px 10px; border-radius: 22px; }
.carte-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.carte-nom { display: flex; align-items: center; gap: 10px; min-width: 0; }
.carte-nom .pastille-icone { width: 36px; height: 36px; border-radius: 12px; }
.carte-nom .icone { width: 18px; height: 18px; }
.carte-nom h2 { font-size: 15px; font-weight: 650; line-height: 1.3; }
.carte-source { font-size: 12px; color: var(--discret); line-height: 1.3; }
.carte-lecture { text-align: right; flex: none; }
.valeur { font-size: 24px; font-weight: 650; line-height: 1.2; letter-spacing: -0.01em; white-space: nowrap; }
.valeur .unite { margin-left: 3px; font-size: 14px; font-weight: 500; color: var(--encre-2); }
.quand { min-height: 18px; font-size: 12px; color: var(--discret); white-space: nowrap; }
.resume { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.resume li { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; color: var(--encre-2); background: var(--grille); }
.resume strong { font-weight: 650; color: var(--encre); }

.courbe { border-radius: 10px; touch-action: pan-y; cursor: crosshair; }
.courbe svg { display: block; width: 100%; height: auto; overflow: visible; }
.courbe .vide { margin: 0; padding: 18px 0; }
.grille { stroke: var(--grille); stroke-width: 1; }
.axe { stroke: var(--axe); stroke-width: 1; }
.graduation { fill: var(--discret); font-size: 11px; font-variant-numeric: tabular-nums; }
.trait { fill: none; stroke: var(--serie); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.degrade-haut { stop-color: var(--serie); stop-opacity: 0.26; }
.degrade-bas { stop-color: var(--serie); stop-opacity: 0; }
.point { fill: var(--serie); stroke: var(--anneau); stroke-width: 2; }
.reticule { stroke: var(--axe); stroke-width: 1; }
.cache { display: none; }
.stables { margin: 12px 4px 0; font-size: 14px; color: var(--encre-2); }
.cartes + .stables + .liste { margin-top: 12px; }

.tableau { margin-top: 20px; }
.tableau summary { cursor: pointer; padding: 11px 4px; font-size: 14px; color: var(--encre-2); }
.tableau-defilant { max-height: 420px; overflow: auto; border-radius: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grille); }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--feuille); font-weight: 650; color: var(--encre-2); white-space: normal; min-width: 96px; vertical-align: bottom; }
.pied { margin: 18px 4px 0; font-size: 13px; color: var(--discret); }

/* ---------- Fiche d'un réglage ---------- */
.feuille {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0; overflow: auto;
  border: 1px solid var(--verre-bord); border-bottom: 0; border-radius: 28px 28px 0 0;
  background: var(--feuille); color: var(--encre); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45);
}
.feuille[open] { animation: monte 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.feuille::backdrop { background: rgba(3, 7, 18, 0.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes monte { from { transform: translateY(28px); opacity: 0; } }
.feuille-tete { display: flex; align-items: center; gap: 12px; padding: 18px 18px 6px; }
.feuille-titres { flex: 1; min-width: 0; }
.feuille-titres h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.feuille-source { font-size: 12.5px; color: var(--discret); line-height: 1.35; }
.feuille-corps { padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); }
.etiquette { margin-top: 12px; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--discret); }
.feuille-valeur { margin: 2px 0 14px; font-size: 44px; font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; }
.feuille-valeur.texte { font-size: 24px; letter-spacing: -0.01em; }
.feuille-valeur .unite { margin-left: 6px; font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--encre-2); }
.editeur { margin: 4px 0 18px; padding: 4px 14px 14px; border-radius: 20px; background: var(--champ); }
.saisie-cadre { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; }
.saisie {
  width: 4.2em; min-height: 56px; padding: 0; border: 0; border-bottom: 2px solid var(--axe); border-radius: 0; background: none;
  font: inherit; font-size: 36px; font-weight: 700; letter-spacing: -0.02em; text-align: center; color: var(--encre);
}
.saisie:focus-visible { outline: none; border-bottom-color: var(--serie); }
.saisie-cadre .unite { font-size: 17px; font-weight: 600; color: var(--encre-2); }
.erreur-champ { min-height: 20px; margin-top: 6px; font-size: 13px; text-align: center; color: var(--critique); }
.choix { display: grid; gap: 6px; margin-top: 10px; }
.choix-ligne { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--verre-bord); cursor: pointer; }
.choix-ligne:has(input:checked) { border-color: var(--serie); background: var(--serie-voile); }
.choix-ligne input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--serie); }
.avant-apres { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 12px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.avant-apres .avant { color: var(--discret); font-weight: 550; }
.ligne-bascule { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 12px 0; border-top: 1px solid var(--grille); cursor: pointer; }
.ligne-bascule strong { display: block; font-size: 15px; font-weight: 600; }
.bascule { appearance: none; -webkit-appearance: none; position: relative; width: 52px; height: 32px; flex: none; margin: 0; border-radius: 999px; background: var(--axe); cursor: pointer; transition: background-color 0.2s ease; }
.bascule::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.bascule:checked { background: var(--action); }
.bascule:checked::after { transform: translateX(20px); }
.feuille-courbe:not(:empty) { padding-top: 4px; border-top: 1px solid var(--grille); }

/* ---------- Accès : création et connexion ---------- */
body[data-acces="ferme"] .onglets, body[data-acces="ferme"] .etat { display: none; }
.porte { max-width: 460px; margin: 6vh auto 0; padding: 28px 22px 24px; border-radius: 28px; }
.logo.grand { width: 56px; height: 56px; border-radius: 18px; }
.logo.grand .icone { width: 26px; height: 26px; }
.porte h1 { margin-top: 16px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.porte-texte { margin-top: 6px; font-size: 15px; color: var(--encre-2); }
.porte-formulaire { display: grid; gap: 14px; margin-top: 20px; }
.porte-formulaire.etroit { max-width: 420px; margin: 4px 4px 0; }
.porte-note { margin-top: 16px; }
.champ { display: grid; gap: 6px; }
.champ-nom { font-size: 14px; font-weight: 600; }
.champ-cadre { position: relative; display: flex; }
.champ-saisie {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--verre-bord);
  background: var(--champ); color: var(--encre); font: inherit; font-size: 16px;
}
.champ-saisie:focus-visible { outline: 2px solid var(--serie); outline-offset: 1px; }
.champ-saisie.code { font-size: 22px; font-weight: 650; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.champ-saisie.code::placeholder { color: var(--discret); opacity: 0.5; }
.champ-cadre .champ-saisie { padding-right: 96px; }
.champ-bouton {
  position: absolute; right: 6px; top: 6px; height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; font-size: 13.5px; font-weight: 600; color: var(--serie); cursor: pointer;
}
.champ-bouton:hover { background: var(--verre-fort); }
.bouton.large { width: 100%; min-height: 52px; font-size: 16px; }
.porte .erreur-champ { text-align: left; }
.etapes { display: grid; gap: 12px; margin-top: 18px; padding: 0; counter-reset: etape; }
.etapes li { display: grid; gap: 6px; padding: 14px; border-radius: 16px; background: var(--champ); }
.etapes .bouton { justify-self: start; margin-top: 4px; }
.cle {
  padding: 10px 12px; border-radius: 12px; background: var(--grille); font: 600 15px/1.6 ui-monospace, Consolas, monospace;
  letter-spacing: 0.06em; word-break: break-word; user-select: all;
}
.pile.serree { gap: 6px; }

/* ---------- Messages brefs ---------- */
.messages {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
.message {
  display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 14px 12px 14px; border-radius: 16px;
  font-size: 14.5px; color: var(--encre); background: var(--feuille); border: 1px solid var(--verre-bord);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4); pointer-events: auto; animation: monte 0.25s ease;
}
.message-action { min-height: 36px; margin-left: 6px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--serie-voile); font-size: 14px; font-weight: 650; color: var(--encre); cursor: pointer; }

/* ---------- Grand écran ---------- */
@media (min-width: 860px) {
  .application { padding-top: 22px; padding-bottom: 48px; }
  .barre { margin-bottom: 26px; }
  .onglets {
    position: static; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--verre-bord); border-radius: 16px;
    background: var(--verre);
  }
  .onglets a { flex-direction: row; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14.5px; }
  .onglets a .icone { width: 19px; height: 19px; }
  .accueil-haut { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .vedette { padding: 26px 28px 0; }
  .vedette-trace { margin: 18px -28px 0; height: 96px; }
  .vedette-valeur { font-size: 112px; }
  .feuille { margin: auto; border-bottom: 1px solid var(--verre-bord); border-radius: 28px; }
  .messages { bottom: 28px; }
  .fiche { grid-template-columns: 220px 1fr; gap: 0 16px; padding: 4px 18px; }
  .fiche dt { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--grille); }
  .fiche dd { padding: 12px 0; }
  .fiche dt:last-of-type { border-bottom: 0; }
}

/* ---------- Mouvement ---------- */
.entree { animation: entree 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--rang, 0) * 55ms); }
@keyframes entree { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  .entree, .feuille[open], .message { animation: none; }
  * { transition: none !important; }
  .roue { animation-duration: 2.4s; }
}
