/* MDLF Coach sur ordinateur (docs/COACH_WEB.md), d'après la maquette du 24/11.
   Règles de Maxence : SF Pro ou la pile système ; listes groupées façon iOS ; noir pur en sombre ; un seul orange en
   accent, l'« orange brique » de l'app (css/theme-sobre.css, js/data/design.js, publié le 25/11) : aplat #B8460F à
   texte blanc (5,4:1), liens et anneaux #F27A45 en sombre, #A04E00 en clair ; jamais de texte noir sur un aplat
   orange ; muscles en rouge ; aucun dégradé, aucune lueur, aucun verre,
   aucune ombre de carte, pas de majuscules espacées. Thème du système (prefers-color-scheme).
   Cibles de 44 px au moins, rien au survol seul (le survol ne fait qu'éclaircir), focus toujours visible. */

:root {
  color-scheme: light;
  --bg: #F2F2F7; --cell: #FFFFFF; --cell2: #F2F2F7; --cell3: #E5E5EA;
  --label: #000000; --label2: rgba(60,60,67,.78); --label3: rgba(60,60,67,.55);
  --sep: rgba(60,60,67,.2); --fill: rgba(120,120,128,.12); --fill2: rgba(120,120,128,.2); --seg-on: #FFFFFF;
  --accent: #B8460F; --accent-text: #A04E00; --accent-tint: rgba(184,70,15,.12); --accent-fill: #B8460F; --on-accent: #FFFFFF;
  --green: #34C759; --green-text: #1F7A35; --badge: #D70015; --gold: #A86F00;
  --heat: #FF453A;
  --font: "SF Pro Text", "SF Pro", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-d: "SF Pro Display", "SF Pro", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Pro Rounded", ui-rounded, "SF Pro", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --side: 236px; --gut: 24px; --rail: 340px; --tabbar: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000; --cell: #1C1C1E; --cell2: #2C2C2E; --cell3: #3A3A3C;
    --label: #FFFFFF; --label2: rgba(235,235,245,.66); --label3: rgba(235,235,245,.45);
    --sep: rgba(84,84,88,.6); --fill: rgba(120,120,128,.24); --fill2: rgba(120,120,128,.36); --seg-on: #636366;
    --accent: #F27A45; --accent-text: #F27A45; --accent-tint: rgba(242,122,69,.16);
    --green: #30D158; --green-text: #30D158; --gold: #FFD60A;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { background: var(--bg); color: var(--label); }
body { font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh; }
h1, h2 { font-weight: inherit; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; }
ul { list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.num, td, .stat b, .tnum { font-variant-numeric: tabular-nums; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 17px; height: 17px; }
svg.i.xs { width: 14px; height: 14px; }
.noscript { padding: 24px; }

/* ── Cadre ── */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; max-width: 1920px; margin: 0 auto; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: .5px solid var(--sep); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { font: 700 18px/1.2 var(--font-d); padding: 6px 12px 16px; }
.brand span { color: var(--label2); font-weight: 500; }
.brand.lg { font-size: 22px; padding: 0 0 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-i { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 8px 12px; border-radius: 10px; font-size: 15px; width: 100%; }
.nav-i svg { color: var(--label2); }
.nav-i.on { background: var(--fill); font-weight: 600; }
.nav-i.on svg { color: var(--accent); }
.nav-i .count { margin-left: auto; color: var(--label2); font-size: 13.5px; }
.nav-i .badge { margin-left: auto; }
.nav-i .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot { margin-top: auto; }
.tabbar { display: none; }
.main { padding: 24px var(--gut) 32px; min-width: 0; outline: none; max-width: 1680px; width: 100%; }
@media (hover: hover) { .nav-i:hover, a.row:hover, .btn:hover { filter: brightness(1.04); } a.row:hover { background: var(--fill); } }

/* ── En-têtes ── */
.title { font: 700 30px/1.15 var(--font-d); }
.sub { color: var(--label2); font-size: 15px; margin-top: 3px; }
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 220px; }
.head.tools { margin-bottom: 18px; }
.st-head h1 { font: 700 26px/1.15 var(--font-d); }
.crumb { margin-bottom: 8px; }
.crumb a { color: var(--accent-text); display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding-right: 10px; font-weight: 500; }

/* ── Boutons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 15px; background: var(--fill); white-space: nowrap; }
.btn.tint { background: var(--accent-tint); color: var(--accent-text); }
.btn.fill { background: var(--accent-fill); color: var(--on-accent); }
.btn.link { background: none; color: var(--accent-text); padding: 10px 14px; font-weight: 500; }
.btn.lg { min-height: 50px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ── Recherche et segments ── */
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 340px; min-width: 220px; min-height: 44px; background: var(--cell); border-radius: 10px; padding: 0 12px; color: var(--label2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--label); min-height: 44px; }
.search input::placeholder { color: var(--label3); }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--fill); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 14px; border-radius: 8px; font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--seg-on); font-weight: 600; box-shadow: 0 0 0 .5px var(--sep); }
.seg button em { font-style: normal; color: var(--label2); font-weight: 500; }
.seg button[aria-disabled="true"] { color: var(--label2); }
.tabs { margin: 0 0 18px; }
.tabs .seg { display: flex; width: 100%; }
.tabs .seg button { flex: 1; }

/* ── Listes groupées ── */
.gh { color: var(--label2); font-size: 13.5px; font-weight: 500; padding: 0 14px 7px; display: flex; align-items: baseline; gap: 8px; }
.gh.gap { margin-top: 22px; }
.gh .r { margin-left: auto; font-weight: 500; }
.group { background: var(--cell); border-radius: 12px; overflow: hidden; }
.gblock + .gblock { margin-top: 22px; }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 48px; width: 100%; }
.row + .row::before, li + li > .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 14px); border-top: .5px solid var(--sep); }
.row .grow, .grow { flex: 1; min-width: 0; }
.row .v { color: var(--label2); text-align: right; white-space: nowrap; }
.row .t2 { color: var(--label2); font-size: 13.5px; }
.row.act { color: var(--accent-text); font-weight: 500; }
.gfoot { color: var(--label2); font-size: 13px; padding: 7px 14px 0; line-height: 1.45; }
.empty { background: var(--cell); border-radius: 12px; padding: 28px 20px; text-align: center; color: var(--label2); line-height: 1.6; }
.empty b { color: var(--label); }
.empty .btn { margin-top: 12px; }
.narrow { max-width: 640px; }

.av { width: 38px; height: 38px; border-radius: 50%; background: var(--cell3); color: var(--label2); display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; }
.av.lg { width: 50px; height: 50px; font-size: 19px; }
.badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--badge); color: #fff; font-size: 12.5px; font-weight: 600; }
.green { color: var(--green-text); }
.warn { color: var(--accent-text); }
.muted { color: var(--label2); }
.faint { color: var(--label3); }   /* signes sans texte seulement (« — ») : tout texte qui dit quelque chose est en --label2 (contraste AA) */
.strong { color: var(--label); }
.gold, .gold-t svg { color: var(--gold); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--label2); vertical-align: 1px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; margin-right: 6px; }
.big { font: 600 23px/1.2 var(--font-num); letter-spacing: .02em; }

/* Pastilles des 7 derniers jours : séances (pleine = séance ce jour-là), diète (pleine suivie, anneau partielle,
   grise pas suivie, pointillée rien de noté, anneau gris aujourd'hui) */
.ses, .dp { display: inline-flex; gap: 4px; align-items: center; }
.ses i { width: 10px; height: 10px; border-radius: 50%; background: var(--fill2); }
.ses i.d { background: var(--green); }
.ses b { margin-left: 6px; font-weight: 500; font-size: 14px; }
.dp i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dp i.s { background: var(--green); }
.dp i.p { border: 2px solid var(--green); }
.dp i.n { background: var(--label3); }
.dp i.z { border: 1.5px dotted var(--label3); }
.dp i.c { border: 1.5px solid var(--label2); }

/* ── Ligne de chiffres ── */
.stats { display: flex; flex-wrap: wrap; background: var(--cell); border-radius: 12px; padding: 12px 4px; margin-bottom: 22px; row-gap: 12px; }
.stat { flex: 1 1 140px; padding: 0 14px; min-width: 0; }
.stat + .stat { border-left: .5px solid var(--sep); }
.stat .l { color: var(--label2); font-size: 13px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.stat b { display: block; font: 600 22px/1.25 var(--font-num); margin-top: 2px; white-space: nowrap; }
.stat b small { font: 500 13.5px var(--font); color: var(--label2); margin-left: 3px; }
.stat .d { font-size: 13px; display: block; }
.summary-inline { display: none; }

/* ── Tableau de bord ── */
.cols { display: grid; gap: var(--gut); align-items: start; }
.cols.dash { grid-template-columns: minmax(0, 1fr) var(--rail); }
.list-col, .tbl-col { min-width: 0; }
.lst .row { display: grid; grid-template-columns: minmax(190px, 1.3fr) 118px 118px minmax(180px, 1.5fr) 118px 16px; gap: 12px; --inset: 64px; min-height: 64px; }
.lst .hdr { min-height: 0; padding: 9px 14px; color: var(--label2); font-size: 12.5px; font-weight: 500; }
.lst .hdr .r { text-align: right; white-space: nowrap; }
.lst .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-t { min-width: 0; }
.who-t b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t small { color: var(--label2); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t .when-n { display: none; }
.todo { display: flex; flex-direction: column; gap: 3px; font-size: 14px; min-width: 0; }
.todo > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo .badge { margin-right: 6px; }
.when { color: var(--label2); font-size: 13.5px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--label3); display: flex; }
dialog { margin: auto; border: 0; border-radius: 14px; padding: 20px; background: var(--bg); color: var(--label); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dlg-t { font: 700 20px/1.2 var(--font-d); margin-bottom: 14px; }
.dlg-f { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ── Fiche Semaines ── */
.cols.wkc { grid-template-columns: minmax(0, 1fr) 300px; }
.tscroll { overflow-x: auto; position: relative; }   /* position : les textes .sr (absolus) restent dans le cadre qui défile, jamais la page */
table.wk { width: 100%; border-collapse: collapse; font-size: 14px; }
table.wk th[scope="col"] { text-align: right; color: var(--label2); font-weight: 500; font-size: 12.5px; padding: 11px 9px 9px; white-space: nowrap; border-bottom: .5px solid var(--sep); }
table.wk td, table.wk th[scope="row"] { text-align: right; padding: 9px 9px; border-bottom: .5px solid var(--sep); white-space: nowrap; font-weight: 400; vertical-align: top; }
table.wk tr:last-child td, table.wk tr:last-child th { border-bottom: 0; }
table.wk th:first-child { text-align: left; padding-left: 14px; }
table.wk td small, table.wk th small { display: block; color: var(--label2); font-size: 12px; }
table.wk tr.cur td, table.wk tr.cur th { background: var(--fill); }
table.wk tr.cur .wn { color: var(--accent-text); }
table.wk .wn { font-weight: 600; }
.more { margin-top: 4px; }
.chart { padding: 12px 14px 10px; margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ax { fill: var(--label2); font-size: 10.5px; font-family: var(--font); }
.chart .gl { stroke: var(--sep); stroke-width: .6; }
.chart .ln { fill: none; stroke: var(--label); stroke-width: 1.6; stroke-linejoin: round; }
.chart .pt { fill: var(--label); }
.chart .pt.last { fill: var(--accent); }

/* ── Connexion ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; outline: none; }
.login-card { width: min(440px, 100%); }
.login-card .title { margin-bottom: 6px; }
.login-card .sub { margin-bottom: 22px; }
.login-f { display: flex; flex-direction: column; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--label2); }
.fld input { min-height: 50px; border-radius: 12px; border: 1px solid var(--sep); background: var(--cell); padding: 0 14px; font-size: 17px; color: var(--label); }
.fld input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.fld input[aria-invalid="true"] { border-color: var(--badge); }
.err { color: var(--badge); font-size: 14px; min-height: 1.4em; }
.note { color: var(--label2); font-size: 13.5px; margin-top: 16px; line-height: 1.45; }
/* Information neutre en haut du formulaire (session fermée pour inactivité) : ni rouge ni bordure sur le champ */
.login-card .info { background: var(--cell); color: var(--label); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; margin-bottom: 14px; }
/* Vide : aucune place prise, mais la zone reste dans l'arbre d'accessibilité (annoncée quand le texte arrive) */
.login-card .info:empty { padding: 0; margin: 0; background: none; }
/* « Rester connecté sur cet ordinateur » sous le formulaire */
.login-keep { margin-top: 16px; }
/* Bandeau « Toujours là ? » (28 min sans geste) : en haut, hors de #app, au-dessus du contenu */
.idle { position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 16px; width: min(560px, calc(100vw - 32px)); background: var(--cell); color: var(--label); border: .5px solid var(--sep); border-radius: 14px; padding: 14px 16px; }
.idle .t2 { color: var(--label2); font-size: 13.5px; margin-top: 2px; }
@media (max-width: 520px) { .idle { flex-direction: column; align-items: stretch; } }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--tabbar) + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--cell3); color: var(--label); border-radius: 12px; padding: 12px 18px; font-weight: 500; z-index: 20; max-width: calc(100vw - 32px); }

/* ── Tablette paysage (iPad 1180 × 820) et petits ordinateurs ── */
@media (max-width: 1239px) {
  :root { --side: 212px; --gut: 18px; }
  .cols.dash { grid-template-columns: minmax(0, 1fr); }
  .cols.dash > .rail { display: none; }
  .summary-inline { display: flex; }
  .lst .row { grid-template-columns: minmax(160px, 1.2fr) 122px 108px minmax(150px, 1.4fr) 104px 14px; gap: 10px; }
  .cols.wkc { grid-template-columns: minmax(0, 1fr); }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gut); align-items: start; }
  .side-panel .gblock + .gblock { margin-top: 0; }
  .stat { padding: 0 11px; }
  .stat b { font-size: 19px; }
  table.wk td, table.wk th[scope="row"], table.wk th[scope="col"] { padding-left: 7px; padding-right: 7px; }
}

/* ── Tablette portrait (moins de 900 px) : barre d'onglets en bas, contenu sur toute la largeur ── */
@media (max-width: 899px) {
  :root { --gut: 16px; --tabbar: 64px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 18px var(--gut) calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: .5px solid var(--sep);
    padding: 4px 8px env(safe-area-inset-bottom); justify-content: space-around; }
  .tabbar .nav-i { flex-direction: column; gap: 2px; width: auto; flex: 1; min-height: 56px; padding: 6px 4px; font-size: 11.5px; justify-content: center; text-align: center; }
  .tabbar .nav-i.on { background: none; color: var(--accent-text); }
  .tabbar .nav-i .count, .tabbar .nav-i .badge { margin: 0; font-size: 10px; padding: 0 5px; }
  .tabbar .nav-i .count { display: none; }
  .lst .row { grid-template-columns: minmax(0, 1fr) 106px 104px minmax(0, 1.1fr) 12px; gap: 10px; --inset: 62px; }
  .ses, .dp { gap: 3px; }
  .ses i { width: 9px; height: 9px; }
  .dp i { width: 10px; height: 10px; }
  .ses b { margin-left: 4px; }
  .lst .row > .when, .lst .hdr > .r { display: none; }
  .who-t .when-n { display: block; }
  .head.tools { flex-direction: column; align-items: stretch; }
  .search { flex: 1 1 auto; }
  .seg { width: 100%; }
  .head.tools .seg button { flex: 1 1 auto; }
  .tabs .seg button { padding: 6px 8px; flex-direction: column; gap: 0; }
  /* Chiffres de la fiche sur 3 colonnes, ceux du tableau de bord sur 4 : jamais une case seule sur sa ligne */
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats.summary-inline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats:not(.summary-inline) .stat:nth-child(3n + 1) { border-left: 0; }
}

/* ── Se connecter avec Apple (règles d'Apple : logo et libellé, noir sur fond clair, blanc sur fond sombre) ── */
.apple-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 12px; background: #000; color: #fff; font: 600 17px/1 var(--font); letter-spacing: -.02em; }
.apple-btn .apple-logo { width: 15px; height: 19px; flex: none; margin-top: -3px; }
.apple-btn[disabled] { opacity: .55; cursor: default; }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; color: var(--label2); font-size: 13.5px; }
.or::before, .or::after { content: ""; flex: 1; border-top: .5px solid var(--sep); }
@media (prefers-color-scheme: dark) { .apple-btn { background: #fff; color: #000; } }

/* ══ Vague 2 : bilans configurables (Mes bilans, onglet Bilans, Bilans reçus ; maquettes 7-mes-bilans et 3-bilan) ══ */
.seg a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 14px; border-radius: 8px; font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.seg a.on { background: var(--seg-on); font-weight: 600; box-shadow: 0 0 0 .5px var(--sep); }
.tabs .seg a { flex: 1; }
.seg .badge { font-size: 11.5px; min-width: 19px; height: 19px; }
.head-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.danger { background: rgba(215,0,21,.12); color: var(--badge); }
.danger-t, .row.act.danger-t { color: var(--badge); }
.t2.blk, .blk { display: block; }
.gap-t { margin-top: 16px; }
.group.pad { padding: 12px 14px; }
.gh .r.btn { margin-left: auto; min-height: 44px; padding: 0 2px 0 12px; }
.gh.sm-h { font-size: 13px; }
.dlg-p { color: var(--label2); line-height: 1.45; }
.dlg-f { gap: 10px; flex-wrap: wrap; }
.row.flat { padding: 0; min-height: 44px; }
.gfoot.flat { padding: 0; }
.av.sm-av { width: 34px; height: 34px; font-size: 14px; }

/* Mise en page de Mes bilans : modèles | éditeur | envoi (3 colonnes), puis 2, puis 1 */
.cols.bl { grid-template-columns: 220px minmax(0, 1fr) 320px; }
.cols.bl.noside { grid-template-columns: 220px minmax(0, 1fr); }
.bl-ed { min-width: 0; container-type: inline-size; }
.bl-toggle { display: none; margin-bottom: 12px; }
.row.tpl { text-align: left; align-items: center; }
.row.tpl b { font-weight: 600; display: block; }
.row.tpl.on { background: var(--fill); }
.row.tpl svg { color: var(--label3); }
.ed-name input { width: 100%; min-height: 44px; border: 0; background: none; font: 700 24px/1.2 var(--font-d); color: var(--label); padding: 0; border-radius: 6px; }
.ed-name input::placeholder { color: var(--label3); }
.ed-name input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ed-t { font: 700 24px/1.2 var(--font-d); }
.ed-help { color: var(--label2); font-size: 14px; line-height: 1.45; margin: 6px 0 16px; max-width: 760px; }
.ed-cols { display: grid; gap: 0 18px; }
.ed-col { min-width: 0; }
.ck-g { margin-bottom: 20px; }
@container (min-width: 560px) { .ed-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.ck-errs { color: var(--badge); font-size: 14px; margin-bottom: 12px; }
.ck-err { color: var(--badge); font-size: 13px; padding: 0 14px 8px 92px; }

.ck-list > li { position: relative; }
.ck-list > li + li::before { content: ""; position: absolute; top: 0; right: 0; left: 92px; border-top: .5px solid var(--sep); }
.ck-line { display: flex; align-items: center; min-height: 52px; padding-right: 8px; }
.ck-box { width: 44px; height: 44px; display: grid; place-items: center; flex: none; margin-left: 2px; }
.circ { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--label3); display: grid; place-items: center; color: transparent; }
.ck-box[aria-checked="true"] .circ { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.ck-grip { width: 44px; height: 44px; display: grid; place-items: center; flex: none; color: var(--label3); touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; }
.ck-main { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 0; }
.ck-main .grow { min-width: 0; }
.ck-main b { font-weight: 400; display: block; }
.ck-main small { display: block; color: var(--label2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-ic { color: var(--label2); display: flex; }
@container (max-width: 640px) { .ed-cols .ck-ic { display: none; } }
.ck-row.off .ck-main b { color: var(--label2); }
.pill { min-width: 44px; min-height: 44px; display: grid; place-items: center; flex: none; }
.pill span { background: var(--fill); color: var(--label2); border-radius: 7px; padding: 2px 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.ck-row.drag { background: var(--cell3); z-index: 2; position: relative; }
/* Trait orange : là où la ligne glissée va tomber */
.ck-list > li.drop-before::after, .ck-list > li.drop-after::after { content: ""; position: absolute; left: 14px; right: 14px; height: 3px; border-radius: 2px; background: var(--accent); z-index: 3; }
.ck-list > li.drop-before::after { top: -1.5px; }
.ck-list > li.drop-after::after { bottom: -1.5px; }
.ck-row.drag .ck-grip { cursor: grabbing; }
.ck-row.open { background: var(--cell); }
.ck-set { display: grid; gap: 12px; padding: 4px 14px 16px 58px; min-width: 0; }
.ck-set > * { min-width: 0; }
@container (max-width: 640px) { .ed-cols .ck-set { padding-left: 14px; } .ed-cols .two { grid-template-columns: minmax(0, 1fr); } }
.fld.sm { font-size: 13px; gap: 6px; }
.fld.sm input { width: 100%; min-width: 0; min-height: 44px; border-radius: 10px; font-size: 16px; padding: 0 12px; background: var(--cell2); }
.fld .seg { align-self: flex-start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; background: var(--fill); font-size: 14.5px; color: var(--label); }
.chip[aria-checked="true"] { background: var(--accent-tint); color: var(--accent-text); font-weight: 600; }
.ck-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ck-acts .btn[aria-disabled="true"] { opacity: .45; }
.addq { padding: 4px 0 0; }
.addq .btn.link { padding-left: 4px; }

/* Interrupteur façon iOS (role="switch") : vert allumé */
.switch { width: 56px; height: 44px; display: grid; place-items: center; flex: none; }
.switch span { width: 51px; height: 31px; border-radius: 16px; background: var(--fill2); position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] span { background: var(--green); }
.switch[aria-checked="true"] span::after { transform: translateX(20px); }

/* Envoi : fréquence, jour, rappel, date limite, destinataires */
.seg.grid2 { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.seg.grid2 button { justify-content: center; }
.sel { position: relative; display: inline-flex; align-items: center; flex: none; }
.sel select { appearance: none; -webkit-appearance: none; min-height: 44px; font: inherit; font-size: 16px; color: var(--label); background: var(--fill); border: 0; border-radius: 10px; padding: 0 30px 0 12px; max-width: 100%; }
.sel svg { position: absolute; right: 9px; pointer-events: none; color: var(--label2); }
.sel select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bl-side .row { flex-wrap: wrap; }
.bl-side .row > .grow { min-width: 96px; }
.bl-side .row.nowrap { flex-wrap: nowrap; }
.bl-side .row.nowrap > .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sels { display: flex; gap: 6px; flex-wrap: wrap; }
.bl-side .row .sel + .sel { margin-left: -4px; }
.sub-row { padding-top: 0; }
.bl-side .btn.link { padding: 10px 6px; }
.savebar.stick { position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 5; }
.savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 0; background: var(--bg); border-top: .5px solid var(--sep); }
.savebar .grow { display: flex; align-items: center; gap: 6px; }

/* Aperçu élève : lecture seule, aucun champ actif */
.pv-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pv { max-width: 440px; background: var(--cell2); border-radius: 18px; padding: 18px 14px; }
.pv-t { font: 700 22px/1.2 var(--font-d); }
.pv .gh { margin-top: 16px; }
.pv-g { padding: 0; }
.pv-i { padding: 12px 14px; display: grid; gap: 8px; }
.pv-i + .pv-i { border-top: .5px solid var(--sep); }
.pv-i b { font-weight: 500; }
.pv-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.pv-scale span { width: 34px; height: 34px; border-radius: 9px; background: var(--fill); display: grid; place-items: center; font-weight: 500; }
.pv-bounds { display: flex; justify-content: space-between; color: var(--label2); font-size: 12.5px; }
.pv-yn { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-yn span, .pv-ms span { background: var(--fill); border-radius: 9px; padding: 7px 12px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.pv-ms { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pv-ms i { font-style: normal; color: var(--label3); display: flex; }
.pv-box { background: var(--fill); border-radius: 9px; padding: 9px 12px; color: var(--label3); font-size: 14px; }
.pv-box.tall { min-height: 72px; }

/* Onglet Bilans de la fiche élève */
.rv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.rv-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 360px; min-width: 0; padding: 0 4px; }
.rv-cur { min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.ic { padding: 10px; min-width: 44px; }
.btn[aria-disabled="true"] { opacity: .4; cursor: default; }
.rv-bar .sel { flex: 0 1 280px; min-width: 0; }
.rv-bar .sel select { width: 100%; background: var(--cell); }
.cols.rvc { grid-template-columns: minmax(0, 1fr) 340px; }
.rv-figs .stat { flex: 1 1 130px; }
.rv-a { align-items: baseline; flex-wrap: wrap; }
.rv-l { flex: 0 0 150px; color: var(--label2); }
.rv-t { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 160px; }
textarea#rv-reply { display: block; width: 100%; min-height: 128px; border: 0; background: none; font: inherit; font-size: 16px; line-height: 1.45; color: var(--label); resize: vertical; border-radius: 6px; }
textarea#rv-reply:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.rv-sent { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.scores { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scores button { min-height: 44px; border-radius: 10px; background: var(--cell); font-weight: 600; text-align: center; border: 2px solid transparent; }
.scores button.on { border-color: var(--accent); color: var(--accent-text); }
.ck-acts .btn.grow { flex: 1; }
table.wk th.ckh { white-space: normal; min-width: 84px; max-width: 120px; }

@media (max-width: 1239px) {
  .cols.bl, .cols.bl.noside { grid-template-columns: minmax(0, 1fr) 320px; }
  .cols.bl.noside { grid-template-columns: minmax(0, 1fr); }
  .bl-list { display: none; grid-column: 1 / -1; }
  .bl-list.show { display: block; }
  .bl-toggle { display: inline-flex; }
  .cols.rvc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .cols.bl, .cols.bl.noside { grid-template-columns: minmax(0, 1fr); }
  .head-btns { width: 100%; }
  .head-btns .btn { flex: 1 1 auto; }
  .rv-l { flex-basis: 120px; }
}

/* ══ Vague 4 : Messages, Programme, Nutrition (maquettes 6-messages, 4-programme, 5-nutrition) ══ */
/* Choix dans une liste (Signaler, Envoyer un programme, plusieurs élèves) */
.choose .ch-list { max-height: min(52vh, 460px); overflow-y: auto; margin-top: 12px; }
.ch-o { text-align: left; --inset: 52px; }
.ch-o .t2 { color: var(--label2); font-size: 13px; }
.ch-o[aria-checked="true"] .circ { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.dlg-f .grow { flex: 1; }

/* Messages : conversations | fil | en bref (3 colonnes), puis 2, puis 1 */
.msg-back { display: none; }
.msg-page { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: var(--gut); align-items: start; }
.msg-page:not(.has-sel) { grid-template-columns: 320px minmax(0, 1fr); }
.msg-list { min-width: 0; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding: 2px; }
.msg-list .title { margin-bottom: 12px; }
.msg-search { flex: none; width: 100%; margin-bottom: 12px; }
.msg-row { align-items: flex-start; --inset: 64px; text-align: left; }
.msg-row.on { background: var(--fill); }
.mr-top { display: flex; gap: 8px; align-items: baseline; }
.mr-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mr-top b.unr { font-weight: 700; }
.msg-row .prev { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .badge { margin-top: 12px; }
.chat { background: var(--cell); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  height: calc(100vh - 48px); height: calc(100dvh - 48px); position: sticky; top: 24px; }
.chat > .empty { margin: auto; background: none; }
.chat.in-fiche { position: static; height: max(460px, calc(100vh - 300px)); height: max(460px, calc(100dvh - 300px)); }
.chat-h { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: .5px solid var(--sep); }
.chat-h b { font-weight: 600; }
.chat-h .t2 { color: var(--label2); font-size: 13.5px; }
.chat-b { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; outline: none; overscroll-behavior: contain; }
.chat-b:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 0; }
.chat-intro { color: var(--label2); font-size: 13px; text-align: center; max-width: 520px; margin: 0 auto 6px; line-height: 1.45; }
.chat-empty { color: var(--label2); text-align: center; margin: auto; }
.chat-more { align-self: center; }
.day { align-self: center; color: var(--label2); font-size: 13px; font-weight: 500; margin: 10px 0 2px; }
.bub { max-width: min(560px, 80%); padding: 9px 13px 7px; border-radius: 16px; background: var(--cell2); }
.bub p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.bub small { display: block; text-align: right; color: var(--label2); font-size: 11.5px; margin-top: 2px; }
.bub.rx { align-self: flex-start; }
.bub.tx { align-self: flex-end; background: var(--cell3); }
.ref { display: flex; align-items: center; gap: 4px 10px; color: var(--label2); font-size: 14px; flex-wrap: wrap; padding: 0 2px; }
.ref > svg { flex: none; }
.ref .grow { min-width: 200px; }
.ref .btn.link { padding: 10px 8px; }
.ref-note { display: block; color: var(--label); font-style: italic; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-ed { display: grid; gap: 10px; background: var(--cell2); }
.note-ed textarea, .pg-cons textarea { display: block; width: 100%; min-height: 72px; border: 0; border-radius: 10px; background: var(--cell); font: inherit; font-size: 16px;
  line-height: 1.4; color: var(--label); padding: 10px 12px; resize: vertical; }
.pg-cons textarea { background: var(--cell2); }
.chat-off { color: var(--label2); font-size: 13px; padding: 6px 16px 0; }
.chat-in { display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px 2px 16px; border-top: .5px solid var(--sep); }
.chat-in textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 180px; border: 0; border-radius: 22px; background: var(--cell2); font: inherit; font-size: 16px;
  line-height: 1.4; color: var(--label); padding: 11px 16px; resize: none; }
.chat-in textarea[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--badge); }
.send { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.send[disabled] { opacity: .45; cursor: default; }
.chat-cnt { min-height: 20px; font-size: 12.5px; color: var(--label2); padding: 0 16px 6px; text-align: right; }
.chat-cnt.over { color: var(--badge); }
.msg-side { position: sticky; top: 24px; min-width: 0; }
.cols.msgc { grid-template-columns: minmax(0, 1fr) 300px; }
.msg-brief { display: block; }

/* Programme : une ligne par exercice (colonnes à partir de 1240 px, sinon libellés au-dessus des champs) */
.pg-head { align-items: center; margin-bottom: 12px; }
.pg-info { text-align: right; min-width: 240px; margin: 0; }
.pg-note { padding: 0 2px 12px; }
.pg-row { position: relative; display: grid; grid-template-columns: minmax(180px, 1.6fr) 66px 156px 150px 128px minmax(160px, 1.2fr) 96px; gap: 10px; align-items: center; padding: 10px 14px; }
.pg-list > li + li::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid var(--sep); }
.pg-hdr { color: var(--label2); font-size: 12.5px; font-weight: 500; padding-top: 11px; padding-bottom: 9px; min-height: 0; }
.pg-ex { min-width: 0; }
.pg-ex b { font-weight: 600; }
.pg-ex small { display: block; color: var(--label2); font-size: 13px; }
.cons { display: block; color: var(--label2); font-style: italic; font-size: 13.5px; overflow-wrap: anywhere; }
.pg-c { min-width: 0; }
.pg-v { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pg-v.blk { display: block; font-size: 14px; }
.pg-l { display: none; }
.pg-act { justify-self: end; }
.pg-act .btn { padding: 10px 8px; }
.in { min-height: 44px; width: 56px; border: 1.5px solid transparent; border-radius: 9px; background: var(--fill); font: inherit; font-size: 16px; color: var(--label);
  text-align: center; padding: 0 6px; font-variant-numeric: tabular-nums; }
.in.w { width: 76px; }
.in.wide { flex: 1; width: auto; min-width: 0; text-align: left; padding: 0 12px; }
.in.on { border-color: var(--accent); }
.in:focus { border-color: var(--accent); }
.loads { display: flex; flex-direction: column; gap: 4px; }
.ld { display: flex; align-items: center; gap: 6px; }
.ld small { color: var(--label2); font-size: 12.5px; white-space: nowrap; }
.pg-row.open { background: var(--cell); }
.pg-set { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; padding: 10px 0 6px; border-top: .5px dashed var(--sep); margin-top: 4px; }
.pg-set .ck-acts, .pg-cons { grid-column: 1 / -1; }
.pg-set .fld .t2 { color: var(--label2); font-size: 13px; }
.pg-add { display: flex; gap: 8px; margin-top: 12px; align-items: center; max-width: 560px; }

/* Nutrition : plan, semaine cochée, détail du jour | chiffres du jour et de la semaine */
.cols.nut { grid-template-columns: minmax(0, 1fr) 360px; }
.nt-head { margin: 4px 0 10px; }
.nt-tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.wksel { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.wksel .lab { padding: 0 8px; white-space: nowrap; }
.nt-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.nt-day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; min-height: 44px; text-align: center; }
.nt-day + .nt-day { border-left: .5px solid var(--sep); }
.nt-day.on { background: var(--fill); }
.nt-day b { font-weight: 600; }
.nt-day[aria-disabled="true"] { color: var(--label3); cursor: default; }
.dp.big i { width: 18px; height: 18px; }
.dp.big i.p { border-width: 2.5px; }
.dp i.f { border: 0; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--label2); font-size: 13px; padding: 8px 14px 0; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.nt-meal { align-items: flex-start; }
.nt-ck { width: 24px; display: grid; place-items: center; flex: none; padding-top: 1px; }
.nt-meal b { font-weight: 600; }
.nt-st { width: 92px; font-size: 13px; }
.mac .blk-row { display: block; }
.mac-l { display: flex; gap: 8px; align-items: baseline; }
.sm-t { font-size: 12.5px; }
svg.bar { display: block; width: 100%; height: 6px; margin-top: 7px; }
.bar-b { fill: var(--fill); }
.bar-f { fill: var(--label2); }
.nt-side .btn.wide { display: flex; }

@media (max-width: 1239px) {
  .msg-page, .msg-page:not(.has-sel) { grid-template-columns: 300px minmax(0, 1fr); }
  .msg-side { display: none; }
  .cols.msgc { grid-template-columns: minmax(0, 1fr); }
  .pg-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; }
  .pg-hdr { display: none; }
  .pg-ex { flex: 1 1 calc(100% - 140px); }
  .pg-act { order: 1; margin-left: auto; }
  .pg-c { order: 2; display: flex; flex-direction: column; gap: 4px; }
  .pg-l { display: block; color: var(--label2); font-size: 12.5px; }
  .pg-last { flex: 1 1 200px; }
  .pg-set { order: 3; flex: 1 1 100%; }
  .pg-info { text-align: left; }
  .cols.nut { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .msg-page, .msg-page:not(.has-sel) { grid-template-columns: minmax(0, 1fr); }
  .msg-page.has-sel .msg-list, .msg-page:not(.has-sel) .chat { display: none; }
  .msg-back.on { display: block; }
  .msg-list { position: static; max-height: none; }
  .chat { top: 12px; height: calc(100vh - var(--tabbar) - 96px); height: calc(100dvh - var(--tabbar) - 96px); }
  .nt-st { width: auto; }
}

/* Zones sûres (app embarquée sur iPad, Safari plein écran : encoche, barre d'accueil, coins arrondis) */
.side { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); padding-left: max(12px, env(safe-area-inset-left)); }
.main { padding-top: max(24px, env(safe-area-inset-top)); padding-right: max(var(--gut), env(safe-area-inset-right)); }
@media (max-width: 899px) {
  .main { padding-left: max(var(--gut), env(safe-area-inset-left)); }
  .tabbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
}
.row .v.green { color: var(--green-text); }
.row .v.warn { color: var(--accent-text); }
.pg-set { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.pg-set .seg { flex-wrap: nowrap; }
.pg-set .sel, .pg-set .sel select { width: 100%; }
/* Envoi refusé (limite, réseau) : la phrase et « Réessayer » sur une ligne */
.chat-fail, .rv-fail { display: flex; align-items: center; gap: 8px; color: var(--badge); font-size: 13.5px; }
.chat-fail { padding: 4px 16px 0; }

/* ── Plans diète : liste, éditeur (repas | bilan et objectifs), dialogues de recherche et d'équivalents ── */
.cols.dtl { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.dt-pl { gap: 6px; }
.dt-pl-a { display: block; min-height: 44px; padding: 2px 0; }
.dt-pl-a b, .dt-foods b { font-weight: 600; }
.dt-note { display: flex; gap: 8px; align-items: flex-start; background: var(--cell); border-radius: 12px; padding: 12px 14px; color: var(--label2); font-size: 14px; line-height: 1.45; margin: 0 0 16px; }
.dt-note svg { margin-top: 1px; color: var(--label2); }
.gblock .dt-note { margin: 10px 0 0; }
.dt-src { margin-top: 22px; max-width: 980px; }
.dt-head { margin-bottom: 10px; }
.dt-name { font: 700 24px/1.2 var(--font-d); min-height: 48px; max-width: 640px; width: 100%; background: transparent; border-color: transparent; padding: 0 10px; margin-left: -10px; }
@media (hover: hover) { .dt-name:hover { background: var(--fill); } }
.dt-name:focus { background: var(--cell); }
.dt-modes { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.dt-lab { color: var(--label2); font-size: 14px; }
.dt-days { display: flex; width: 100%; margin-bottom: 10px; flex-wrap: nowrap; overflow-x: auto; }
.dt-days button { flex: 1 1 0; flex-direction: column; gap: 0; min-width: 72px; padding: 6px 8px; line-height: 1.25; }
.dt-days button em { font-style: normal; color: var(--label2); font-size: 12.5px; font-weight: 500; }
.dt-days .tag { margin-top: 2px; font-size: 11px; }
.dt-daytools { margin-bottom: 14px; }
.cols.dt { grid-template-columns: minmax(0, 1fr) 340px; }
.dt-meals { display: flex; flex-direction: column; gap: 18px; }
.dt-meal { position: relative; }
.dt-meal.drag { z-index: 2; opacity: .92; }
.dt-meal.drag .dt-mh { background: var(--cell3); border-radius: 12px; }
.dt-meals > li.drop-before::after, .dt-meals > li.drop-after::after { content: ""; position: absolute; left: 14px; right: 14px; height: 3px; border-radius: 2px; background: var(--accent); z-index: 3; }
.dt-meals > li.drop-before::after { top: -10px; }
.dt-meals > li.drop-after::after { bottom: -10px; }
.dt-mh { display: flex; align-items: center; gap: 6px; padding: 0 0 6px; }
.dt-grip { margin-left: -10px; }
.dt-meal.drag .dt-grip { cursor: grabbing; }
.dt-mt { font: 600 17px/1.25 var(--font-d); }
.dt-mh .t2 { color: var(--label2); font-size: 13.5px; }
.dt-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 18px; background: var(--cell); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.dt-opts .ck-acts { grid-column: 1 / -1; }
.dt-ta, .fld.sm textarea { width: 100%; min-height: 64px; border: 1.5px solid transparent; border-radius: 10px; background: var(--fill); font: inherit; font-size: 16px; color: var(--label); padding: 10px 12px; resize: vertical; }
.dt-ta:focus, .fld.sm textarea:focus { border-color: var(--accent); outline: none; }
.dt-side .dt-ta { background: var(--cell); }
.dt-it { position: relative; display: grid; grid-template-columns: minmax(150px, 1fr) 156px 104px 262px; gap: 8px 14px; align-items: center; padding: 8px 14px; min-height: 56px; }
li + li > .dt-it::before, .dt-items > li + li::before { content: ""; position: absolute; top: 0; right: 0; left: 14px; border-top: .5px solid var(--sep); }
.dt-items > li { position: relative; }
.dt-in { min-width: 0; }
.dt-in b { font-weight: 600; overflow-wrap: anywhere; }
.dt-in small, .dt-k small { display: block; color: var(--label2); font-size: 12.5px; }
.dt-q { display: flex; align-items: center; gap: 6px; }
.dt-k { text-align: right; }
.dt-k b { font-weight: 600; }
.dt-a { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.dt-a .btn.link { padding: 10px 8px; }
.dt-a .sel select { width: 128px; text-overflow: ellipsis; background: transparent; color: var(--accent-text); font-size: 15px; padding-right: 26px; }
.dt-a .sel svg { color: var(--accent-text); }
.btn.link.danger { background: none; color: var(--badge); }
.dt-add { min-height: 48px; }
.dt-addmeal { margin-top: 18px; }
.dt-tg { padding: 4px 0; }
.dt-tf { display: flex; align-items: center; gap: 8px; padding: 6px 14px; min-height: 52px; position: relative; }
.dt-tf + .dt-tf::before { content: ""; position: absolute; top: 0; right: 0; left: 14px; border-top: .5px solid var(--sep); }
.dt-tf > span:first-child { flex: 1; color: var(--label); }
.dt-tf .in { width: 84px; }
.dt-range .in { width: 64px; }
.dt-tf .muted { min-width: 26px; }
.dt-side .gblock .btn.link { margin-top: 4px; padding-left: 14px; }
.in[aria-invalid="true"] { border-color: var(--badge); }

/* Dialogues de l'éditeur : plus larges, liste qui défile seule */
dialog.dt-dlg { width: min(640px, calc(100vw - 32px)); }
.dt-dlg .search { width: 100%; max-width: none; flex: none; margin-bottom: 10px; }
.dt-dlg .dlg-p { margin-bottom: 10px; }
.dt-res .dt-list, .dt-dlg > .dt-list { max-height: min(46vh, 440px); overflow-y: auto; }
.dt-list { list-style: none; }
.dt-cand { cursor: pointer; --inset: 14px; min-height: 52px; }
.dt-cand b { font-weight: 600; }
.dt-cand.on, .dt-cand[aria-selected="true"] { background: var(--fill); }
.dt-cand .v { flex: none; }
.dt-pick-alt { margin-top: 6px; }
.dt-qrow { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.dt-qin { width: 96px; font-size: 20px; }
.dt-dlg .seg { margin-bottom: 4px; }
.dt-dlg .fld.sm { margin-bottom: 10px; }
.dt-dlg .fld.sm input { background: var(--cell); }
.dt-dlg .dt-tg { margin-bottom: 10px; }

@media (max-width: 1239px) {
  .cols.dt { grid-template-columns: minmax(0, 1fr); }
  .dt-side { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gut); align-items: start; }
  .dt-side .gblock + .gblock { margin-top: 0; }
  .cols.dtl { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .dt-side { grid-template-columns: minmax(0, 1fr); }
  .dt-it { grid-template-columns: minmax(0, 1fr) auto; }
  .dt-q, .dt-a { justify-content: flex-start; }
  .dt-q { grid-column: 1; }
  .dt-k { grid-column: 2; grid-row: 1; }
  .dt-a { grid-column: 2; grid-row: 2; }
  .dt-modes .seg { width: 100%; }
  .dt-modes .seg button { flex: 1 1 auto; }
}
/* ── Connexion avec Google (js/desk/google.js) : règles de Google (fond blanc et bord gris en clair, #131314 et bord
   #8E918F en sombre, logo « G » en couleurs, Roboto ou la police du système) ── */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; margin-top: 10px; border-radius: 12px;
  background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; font: 500 16px/1 var(--font); }
.google-btn .google-logo { width: 20px; height: 20px; flex: none; }
.google-btn[disabled] { opacity: .55; cursor: default; }
@media (prefers-color-scheme: dark) { .google-btn { background: #131314; color: #E3E3E3; border-color: #8E918F; } }

/* ── Photos de bilan (vague 5, js/desk/photos.js) ── */
.ph-sec { margin-bottom: 18px; }
.group.pad-s { padding: 4px 0; }
.ph-intro { gap: 12px; flex-wrap: wrap; }
.ph-intro .btn { margin-left: auto; }
.ph-grid { display: grid; gap: 10px; padding: 12px; }
.ph-grid .ph-h, .ph-grid .ph-r { display: grid; gap: 10px; align-items: center; grid-template-columns: 64px repeat(var(--n, 1), minmax(0, 200px)); }
.ph-grid.c1 { --n: 1; } .ph-grid.c2 { --n: 2; }
.ph-h { color: var(--label2); font-size: 13.5px; font-weight: 600; }
.ph-pose { color: var(--label2); font-size: 13.5px; }
.ph-cell { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; background: var(--cell2); overflow: hidden; min-height: 44px; }
.ph-cell img { width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.ph-cell.none { font-size: 13.5px; text-align: center; padding: 8px; }
.ph-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ph-foot .grow { flex: 1 1 260px; }

/* Relier cet ordinateur : QR code toujours noir sur blanc (lisible en sombre), code de vérification en grand */
dialog.phl { width: min(460px, calc(100vw - 32px)); }
.phl-qr { display: flex; justify-content: center; margin: 14px 0; }
svg.qr { width: min(300px, 70vw); height: auto; border-radius: 10px; }
.qr-bg { fill: #FFFFFF; }
.qr-fg { fill: #000000; }
.phl-steps { margin: 0 0 8px 20px; list-style: decimal; color: var(--label2); line-height: 1.6; }
.phl-sas { font: 700 44px/1.1 var(--font-num); letter-spacing: .04em; text-align: center; margin: 18px 0; font-variant-numeric: tabular-nums; }

/* Agrandir : plein écran, deux bilans côte à côte, zoom commun */
dialog.phz { width: calc(100vw - 24px); max-width: none; height: calc(100vh - 24px); max-height: none; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
dialog.phz:not([open]) { display: none; }
.phz-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phz-head .dlg-t { margin: 0 8px 0 4px; }
.phz-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.phz-z { min-width: 56px; text-align: center; color: var(--label2); font-variant-numeric: tabular-nums; }
.phz-panes { flex: 1; display: grid; gap: 10px; min-height: 0; }
.phz-panes.c2 { grid-template-columns: 1fr 1fr; }
.phz-pane { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.phz-pane figcaption { color: var(--label2); font-size: 13.5px; font-weight: 600; }
.phz-view { flex: 1; min-height: 0; overflow: hidden; border-radius: 10px; background: var(--cell2); display: flex; align-items: center; justify-content: center; touch-action: none; cursor: zoom-in; }
dialog.phz.zoomed .phz-view { cursor: grab; }
.phz-view img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
@media (max-width: 899px) { .phz-panes.c2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
