/* Checklists d'entretien : mise en page locale, uniquement des tokens du design system AZMK.
   Rail à gauche (carte de l'arbre de décision), parcours guidé à droite qui se déplie au fil des choix.
   Couleurs de voie = catégories (--az-cat-*) : elles codent la voie, pas un état. */

[hidden] { display: none !important; }

.k-topbar { display: flex; align-items: center; gap: var(--az-space-5); min-height: 52px; flex-wrap: wrap; }

/* Voies : commun (neutre), tour de table, oui, non, après */
.c-y { --c: var(--az-amber); }
.c-b { --c: var(--az-cat-1); --az-cat: var(--az-cat-1); }
.c-g { --c: var(--az-cat-2); --az-cat: var(--az-cat-2); }
.c-o { --c: var(--az-cat-3); --az-cat: var(--az-cat-3); }
.c-p { --c: var(--az-cat-4); --az-cat: var(--az-cat-4); }

.k-head { display: flex; flex-wrap: wrap; gap: var(--az-space-4); align-items: flex-end; justify-content: space-between; margin-block: var(--az-space-6) var(--az-space-5); }
.k-head h1 { margin: 0; }
.k-head .az-lead { margin: var(--az-space-2) 0 0; max-width: 64ch; }

.k-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: var(--az-space-6); align-items: start; padding-bottom: var(--az-space-8); }

/* ---------- Rail ---------- */
.k-rail { position: sticky; top: var(--az-space-4); max-height: calc(100vh - 2 * var(--az-space-4)); overflow-y: auto; display: flex; flex-direction: column; gap: var(--az-space-4); }
.k-rail h2 { margin: 0 0 var(--az-space-1); font-size: var(--az-text-sm); font-weight: 600; color: var(--az-muted); }
.k-voie { font-weight: 700; font-size: var(--az-text-md); }
.k-pct { margin-top: var(--az-space-2); font-size: var(--az-text-sm); font-variant-numeric: tabular-nums; color: var(--az-muted); }

.k-tree { display: flex; flex-direction: column; }
.row { display: flex; gap: 6px; justify-content: center; position: relative; padding-top: 14px; }
.row:first-child { padding-top: 0; }
.row:not(:first-child)::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 14px; background: var(--az-line-strong); }
.row.fork::before { background: var(--az-amber); width: 2px; transform: translateX(-1px); }

.node { flex: 1; min-width: 0; position: relative; padding: 6px 8px; border: 1px solid var(--c, var(--az-line)); background: color-mix(in srgb, var(--c, transparent) 9%, var(--az-panel)); color: var(--az-ink); font-family: var(--az-font); font-weight: 600; font-size: var(--az-text-sm); line-height: 1.25; text-align: center; cursor: pointer; }
.node.off { opacity: .45; background: transparent; border-style: dashed; border-color: var(--az-line-strong); }
.node.pending { background: transparent; border-style: dashed; border-color: var(--az-line-strong); color: var(--az-muted); }
.node.done::after { content: ""; position: absolute; top: -5px; right: -5px; width: 10px; height: 10px; background: var(--az-amber); clip-path: polygon(0 55%, 16% 40%, 38% 62%, 84% 12%, 100% 27%, 38% 92%); }
.node.here { outline: 2px solid var(--az-amber); outline-offset: 1px; }
.dia { flex: none; width: 16px; height: 16px; margin: 3px auto; padding: 0; transform: rotate(45deg); border: 1px solid var(--az-line-strong); background: var(--az-panel); cursor: pointer; }
.dia.set { border-color: var(--az-amber); background: var(--az-amber); }
.dia.here { outline: 2px solid var(--az-amber); outline-offset: 2px; }

.k-legend { display: flex; flex-direction: column; gap: 6px; padding-top: var(--az-space-3); border-top: 1px solid var(--az-line); font-size: var(--az-text-sm); color: var(--az-ink-2); }
.k-legend span { display: flex; align-items: center; gap: 8px; }
.k-legend i { width: 10px; height: 10px; flex: none; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 18%, var(--az-panel)); }

/* ---------- Parcours ---------- */
.k-path { display: flex; flex-direction: column; max-width: 760px; min-width: 0; }
.step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--az-space-4); scroll-margin-top: var(--az-space-4); }
.num { display: flex; flex-direction: column; align-items: center; }
.num b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--az-line-strong); background: var(--az-panel); font-family: var(--az-font-mono); font-weight: 400; font-size: var(--az-text-sm); }
.num::after { content: ""; flex: 1; width: 1px; min-height: 18px; background: var(--az-line-strong); }
.step:last-child .num::after { display: none; }
.step.here .num b { border-color: var(--az-amber); background: var(--az-amber); color: var(--az-ink); }
.step.is-done .num b { border-color: var(--az-amber); color: var(--az-amber-text); }
.step.decision .num b { width: 20px; height: 20px; margin: 4px 0; transform: rotate(45deg); }
.step.decision .num b span { transform: rotate(-45deg); }
.step.decision.set .num b { border-color: var(--az-amber); background: var(--az-amber); color: var(--az-ink); }
.body { min-width: 0; padding-bottom: var(--az-space-5); }

.here-tag { display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--az-space-2); padding: 1px var(--az-space-2); border: 1px solid var(--az-amber); background: var(--az-amber-tint); color: var(--az-ink); font-weight: 600; font-size: var(--az-text-sm); }
.here-tag::before { content: ""; width: 6px; height: 8px; background: var(--az-amber); clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* Carte d'étape teintée par sa voie (fond, trait, liseré) ; les étapes communes gardent le fond neutre et un liseré ambre */
.note { --az-panel-stroke: color-mix(in srgb, var(--c) 45%, var(--az-line)); }
.note:not(.c-y) { --az-panel-fill: color-mix(in srgb, var(--c) 10%, var(--az-panel)); }
.k-stripe { position: absolute; top: 1px; left: 14px; right: 1px; height: 4px; background: var(--c); }
.node.c-y { background: var(--az-amber-tint); }
.note > .az-badge { margin-bottom: var(--az-space-2); }
.note h3 { display: flex; justify-content: space-between; gap: var(--az-space-3); align-items: baseline; margin: 0 0 var(--az-space-2); font-size: var(--az-text-xl); }
.count { flex: none; font-family: var(--az-font-mono); font-weight: 400; font-size: var(--az-text-sm); color: var(--az-muted); font-variant-numeric: tabular-nums; }
.goal { margin: 0 0 var(--az-space-3); font-size: var(--az-text-md); color: var(--az-ink-2); max-width: 62ch; }
.sub { margin: var(--az-space-4) 0 var(--az-space-1); font-weight: 600; font-size: var(--az-text-sm); color: var(--az-muted); }

ul.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.items ul.items { margin: 4px 0 2px 14px; padding-left: 12px; border-left: 1px dashed var(--az-line-strong); }
.chk { display: flex; gap: 10px; align-items: flex-start; padding: 5px 6px; font-weight: 600; font-size: var(--az-text-md); cursor: pointer; }
.chk:hover { background: var(--az-hover); }
.chk.plain { font-weight: 500; }
.chk input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--az-amber); cursor: pointer; }
.chk input:checked + span { text-decoration: line-through; color: var(--az-muted); }
.q { list-style: none; margin: 0 0 4px 34px; padding: 0; display: flex; flex-direction: column; gap: 3px; font-weight: 500; font-size: var(--az-text-md); color: var(--az-ink-2); }
.q li { position: relative; padding-left: 12px; }
.q li::before { content: ""; position: absolute; left: 0; top: .62em; width: 4px; height: 4px; background: var(--az-muted); }
.q li.if { color: var(--az-muted); }

.note .az-notice { margin: var(--az-space-4) 0 0; font-size: var(--az-text-md); }
.note .az-notice b { font-weight: 700; }
.next { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-top: var(--az-space-4); padding-top: var(--az-space-3); border-top: 1px solid var(--az-line-soft); font-size: var(--az-text-md); }
.next .lbl { font-family: var(--az-font-mono); font-size: var(--az-text-xs); color: var(--az-muted); }
.next b { font-weight: 700; }

/* Carrefour */
.cross.open { outline: 2px solid var(--az-amber); outline-offset: 2px; }
.cross h3 { margin: 0 0 var(--az-space-1); font-size: var(--az-text-xl); }
.cross p { margin: 0 0 var(--az-space-3); font-size: var(--az-text-md); color: var(--az-ink-2); }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--az-space-3); }
.opt { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--az-line-strong); border-left: 4px solid var(--c); background: var(--az-panel); color: var(--az-ink); font-family: var(--az-font); font-weight: 500; font-size: var(--az-text-md); text-align: left; cursor: pointer; }
.opt strong { font-weight: 700; }
.opt small { font-size: var(--az-text-sm); color: var(--az-ink-2); }
.opt:hover { background: var(--az-hover); }
.opt[aria-pressed="true"] { border-color: var(--az-ink); border-left-color: var(--c); background: var(--az-amber-tint); }
.opt.dim { opacity: .55; }

.ghost { padding: var(--az-space-4); border: 1px dashed var(--az-line-strong); background: var(--az-panel-2); color: var(--az-ink-2); font-size: var(--az-text-md); }
.ghost ol { margin: var(--az-space-2) 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }

.final h3 { margin: 0 0 var(--az-space-2); font-size: var(--az-text-2xl); display: flex; justify-content: space-between; gap: var(--az-space-3); align-items: baseline; }
.final .az-notice { margin-top: var(--az-space-4); }
.final .az-notice .lbl { font-weight: 700; }
.final .az-notice p { margin: 4px 0 0; }

/* Accueil */
.k-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--az-space-4); padding-bottom: var(--az-space-8); }
.k-choices .az-card__body h2 { margin: var(--az-space-2) 0; }
.k-choices .az-card__body p { margin: 0 0 var(--az-space-4); color: var(--az-ink-2); font-size: var(--az-text-md); }

@media (max-width: 820px) {
  .k-layout { grid-template-columns: minmax(0, 1fr); }
  .k-rail { position: static; max-height: none; overflow: visible; }
  .opts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .az-progress__bar { transition: none; } }
