/* SRM Analytics - feuille de style v2, conçue d'abord pour le téléphone.
   Thèmes (attribut data-theme posé par theme.js) : clair par défaut, "dark", "contrast" (mode terrain).
   Taille du texte : data-text="large" | "xlarge". Élargissements : tablette >= 720px, PC >= 1024px. */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --fs: 16px;
  --fs-scale: 1;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --ink: #0f1822;
  --ink-2: #44525f;
  --ink-3: #5f6d7e;      /* texte discret : contraste >= 4,5 sur blanc et sur le fond gris */
  --line: #e0e5eb;
  --line-strong: #c6ced8;
  --brand: #0f4c81;
  --on-brand: #ffffff;
  --brand-soft: #e6eff8;
  --link: #0e5aa7;
  --ok: #17794d;
  --ok-soft: #e3f4ea;
  --ok-fill: #17794d;
  --warn: #8a5b00;
  --warn-soft: #fff2cf;
  --bad: #b3261e;
  --bad-soft: #fdeae8;
  --bad-fill: #b3261e;
  --info: #2a59a8;
  --info-soft: #e8effb;
  --na-fill: #5b6675;
  --bar-bg: #ffffff;
  --bar-ink: #0f1822;
  --bar-accent: #0f4c81;
  --radius: 14px;
  --radius-s: 10px;
  --bw: 1px;
  --shadow: 0 1px 2px rgba(15, 24, 34, .05);
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar: 0px;          /* hauteur occupée en bas par la barre d'onglets */
  --pad-safe: var(--safe-b); /* marge de sécurité quand rien ne couvre le bas de l'écran */
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1015; --surface: #141a21; --surface-2: #1c242e; --ink: #e8edf3; --ink-2: #aab5c1; --ink-3: #8491a0;
  --line: #26303b; --line-strong: #394553;
  --brand: #6aa8f8; --on-brand: #06121f; --brand-soft: #132539; --link: #8cbcff;
  --ok: #58c895; --ok-soft: #10271d; --ok-fill: #1f7d54;
  --warn: #f1b53d; --warn-soft: #2b2209;
  --bad: #ff867b; --bad-soft: #311614; --bad-fill: #b93a31;
  --info: #94b7ff; --info-soft: #152136; --na-fill: #4a5563;
  --bar-bg: #10161c; --bar-ink: #e8edf3; --bar-accent: #6aa8f8;
  --shadow: none;
}
html[data-theme="contrast"] {
  --fs: 17.5px;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #efefef; --ink: #000000; --ink-2: #242424; --ink-3: #4a4a4a;
  --line: #1c1c1c; --line-strong: #000000;
  --brand: #00357a; --on-brand: #ffffff; --brand-soft: #d9e6ff; --link: #00357a;
  --ok: #0a5a34; --ok-soft: #dff3e6; --ok-fill: #0a5a34;
  --warn: #5f3d00; --warn-soft: #ffe9a8;
  --bad: #8c1710; --bad-soft: #ffe1dd; --bad-fill: #8c1710;
  --info: #00357a; --info-soft: #d9e6ff; --na-fill: #333333;
  --bar-bg: #000000; --bar-ink: #ffffff; --bar-accent: #ffd400;
  --radius: 8px; --radius-s: 6px; --bw: 2px; --shadow: none; --tap: 54px;
}
html[data-text="large"] { --fs-scale: 1.125; }
html[data-text="xlarge"] { --fs-scale: 1.25; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: calc(var(--fs) * var(--fs-scale)); }
body {
  margin: 0;
  font: 1rem/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body.has-nav { --tabbar: calc(56px + var(--safe-b)); --pad-safe: 0px; }
/* Mode concentration (évaluation en cours, visionneuse) : la barre d'onglets laisse la place à l'action. */
body.focus { --tabbar: 0px; --pad-safe: var(--safe-b); }
body.focus .tabbar { display: none; }

a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .45em; letter-spacing: -.01em; }
h1 { font-size: 1.42rem; font-weight: 700; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; }
small, .muted { color: var(--ink-2); }
code, .mono { font-family: var(--mono); font-size: .9em; font-variant-numeric: tabular-nums; }
pre { white-space: pre-wrap; word-break: break-all; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(62px + env(safe-area-inset-top, 0px)); }   /* ancres : sous le bandeau collant */
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }


/* ---------- barre d'onglets (téléphone) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--tabbar); padding-bottom: var(--safe-b);
  background: var(--bar-bg); border-top: var(--bw) solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--ink-3); text-decoration: none; font-size: .68rem; font-weight: 600;
}
html[data-theme="contrast"] .tabbar a { color: #cfcfcf; }
.tabbar svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--bar-accent); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--bar-accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 14px calc(28px + var(--tabbar) + var(--pad-safe)); }
.wrap.wide { max-width: 1400px; }
.demo-banner { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--warn); color: #000; font-size: .86rem; }
body.with-actionbar .wrap { padding-bottom: 130px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 10px; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.section-title { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 18px 2px 8px; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: var(--tap); padding: 10px 18px; border-radius: var(--radius-s); border: var(--bw) solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background-color .12s ease;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.big { min-height: 54px; font-size: 1.04rem; }
.btn.adl { background: var(--ok-fill); border-color: var(--ok-fill); color: #ffffff; }
.btn.repair { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
form.inline { display: inline; }

/* Barre d'action fixe, en bas à droite : Retour et Continuer restent visibles à chaque étape. */
.actionbar {
  position: fixed; right: 12px; bottom: calc(var(--tabbar) + 12px + var(--pad-safe)); z-index: 30;
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px;
  max-width: calc(100vw - 24px);
}
.actionbar .btn { min-height: 52px; box-shadow: 0 4px 14px rgba(15, 24, 34, .18); }
.actionbar .btn.side { background: var(--surface); }
.actionbar form { display: contents; }
.actionbar .chosen {
  flex: 1 1 100%; text-align: right; font-size: .85rem; font-weight: 600; color: var(--ink);
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 999px; padding: 6px 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 2px 8px rgba(15, 24, 34, .10);
}

/* ---------- étapes ---------- */
.stepper { display: none; }
.step-mini { margin-bottom: 12px; }
.step-mini .txt { display: flex; align-items: baseline; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.step-mini .txt small { font-weight: 500; color: var(--ink-3); }
.step-mini .txt a { margin-left: auto; font-weight: 600; font-size: .88rem; text-decoration: none; }
.step-mini .bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.step-mini .bar i { height: 4px; border-radius: 2px; background: var(--line-strong); }
.step-mini .bar i.on { background: var(--brand); }

details.context { background: var(--surface-2); border-radius: var(--radius-s); margin-bottom: 14px; font-size: .88rem; }
html[data-theme="contrast"] details.context { border: var(--bw) solid var(--line); }
details.context > summary { list-style: none; cursor: pointer; padding: 9px 12px; display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink-2); }
details.context > summary::-webkit-details-marker { display: none; }
details.context > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg) translateY(-2px); flex: none; }
details.context[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.context > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
details.context dl { margin: 0; padding: 0 12px 10px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
details.context dt { color: var(--ink-3); font-weight: 600; }
details.context dd { margin: 0; min-width: 0; }

/* ---------- onglets de partie ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 14px 10px; margin: 0 -14px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: var(--bw) solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap;
}
.chip.selected { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }

/* ---------- choix : cartes et listes groupées ---------- */
.choice, .pick {
  display: block; position: relative; width: 100%; text-align: left; font: inherit; color: var(--ink);
  padding: 14px; border: var(--bw) solid var(--line); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; cursor: pointer;
}
.choice.selected, .choice.is-checked, .pick.is-checked { border-color: var(--brand); background: var(--brand-soft); }
.choice input[type=radio], .pick input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.choice .title, .pick .title { font-weight: 650; display: block; line-height: 1.3; }
.choice .sub, .pick .sub { color: var(--ink-2); font-size: .86rem; display: block; margin-top: 2px; }
.choice .icon { width: 30px; height: 30px; float: right; margin-left: 8px; color: var(--brand); }

/* Liste groupée : lignes séparées par un filet ; chevron pour naviguer, pastille pour choisir. */
.glist {
  display: block; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: 12px;
}
.glist > * + * { border-top: var(--bw) solid var(--line); }
.glist .choice, .glist .pick { border: 0; border-radius: 0; background: transparent; padding: 14px 44px 14px 16px; }
.glist a.choice::after, .glist form .choice::after, .glist > button.choice::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); transform: translateY(-50%) rotate(45deg);
}
.glist label.choice::after, .glist label.pick::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); transform: translateY(-50%); background: var(--surface);
}
.glist label.choice.is-checked::after, .glist label.pick.is-checked::after {
  border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 45%, var(--surface) 50%);
}
.glist .choice.is-checked, .glist .pick.is-checked { background: var(--brand-soft); }
.pick { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; }
.pick .num {
  grid-row: span 2; min-width: 42px; height: 42px; padding: 0 8px; border-radius: var(--radius-s); display: grid; place-items: center;
  background: var(--surface-2); font-weight: 750; font-size: 1.02rem; font-variant-numeric: tabular-nums;
}
.pick.is-checked .num { background: var(--brand); color: var(--on-brand); }
.pick .body { min-width: 0; }
.pick > .badge { justify-self: start; grid-column: 2; }


.dmg-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dmg-grid .choice { padding: 12px 8px; text-align: center; }
.dmg-grid .choice .icon { float: none; margin: 0 auto 4px; display: block; }
.dmg-grid .choice .title { font-size: .88rem; font-weight: 600; }
.dmg-grid .choice.is-checked { box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- formulaires ---------- */
label.field, span.field { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; }
.field-hint { font-weight: 400; color: var(--ink-2); font-size: .84rem; }
input[type=text], input[type=number], input[type=search], input[type=password], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: var(--bw) solid var(--line-strong); border-radius: var(--radius-s);
  font: inherit; font-size: max(16px, 1rem); background: var(--surface); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type=file] { width: 100%; font: inherit; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.form-grid .full { grid-column: 1 / -1; }
/* Carte repliable (photos et observations de l'étape dommage). */
details.card.fold > summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; list-style-position: inside; }
.unit { position: relative; }
.unit input { padding-right: 44px; }
.unit::after { content: attr(data-unit); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: .86rem; pointer-events: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: var(--bw) solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.seg label, .seg button {
  padding: 8px 6px; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem; min-height: var(--tap); color: var(--ink);
  display: flex; align-items: center; justify-content: center; text-align: center; background: transparent; border: 0;
}
.seg label + label, .seg button + button { border-left: var(--bw) solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.is-checked, .seg button.is-active { background: var(--brand); color: var(--on-brand); }
.otp { font-size: 1.7rem !important; letter-spacing: .35em; text-align: center; font-family: var(--mono); }

/* ---------- étiquettes et messages ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px;
  font-size: .74rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); text-decoration: none; line-height: 1.5;
}
.badge.adl, .badge.good, .badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.repair, .badge.temp, .badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.sri { background: var(--info-soft); color: var(--info); }
.badge.cat { background: var(--ink); color: var(--surface); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
html[data-theme="contrast"] .badge { border: 1.5px solid currentColor; }
.alert { padding: 12px 14px; border-radius: var(--radius-s); margin-bottom: 12px; font-size: .93rem; border-left: 4px solid; }
.alert.info { background: var(--info-soft); border-color: var(--info); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); }
.alert.danger { background: var(--bad-soft); border-color: var(--bad); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); }
details.alert > summary { cursor: pointer; }

/* ---------- tâches proposées ---------- */
.task-card { position: relative; padding-left: 20px; overflow: hidden; }
.task-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-strong); }
.task-card.adl::before { background: var(--ok); }
.task-card.repair::before { background: var(--warn); }
.task-card.dim { opacity: .6; }
.task-card .no { font-family: var(--mono); font-weight: 600; font-size: .8rem; color: var(--ink-3); display: block; letter-spacing: .01em; }
.task-card .ttl { font-weight: 700; font-size: 1.02rem; line-height: 1.3; display: block; margin: 2px 0 8px; }
.task-card .meta { display: flex; gap: 5px; flex-wrap: wrap; margin: 0 0 8px; }
.task-card .appl { color: var(--ink-2); font-size: .86rem; margin-top: 2px; }
.task-card .actions { margin-top: 12px; display: grid; gap: 8px; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--link); padding: 6px 0; }
/* « Plus de tâches » : autres tâches liées et tâches inactives, repliées sous un seul lien. */
details.more-tasks { margin: 4px 0 8px; }
details.more-tasks > summary { cursor: pointer; font-weight: 600; color: var(--link); padding: 10px 0; }
details.more-tasks h3 { margin: 10px 0 8px; font-size: .95rem; color: var(--ink-2); }
.inactive-list { padding-left: 32px; font-size: .9rem; }
.inactive-list li + li { margin-top: 6px; }
/* Ligne discrète sous une liste filtrée : zones ou pièces sans tâche SRM masquées. */
.hide-note { margin: 0 0 14px; font-size: .86rem; color: var(--ink-2); }
.hide-note a { font-weight: 600; }

/* Tâche repliée : seul le titre est visible, le reste se déplie au toucher. */
.task-card.foldable { padding-top: 12px; padding-bottom: 12px; }
.task-card details > summary { list-style: none; cursor: pointer; position: relative; padding-left: 22px; }
.task-card details > summary::-webkit-details-marker { display: none; }
.task-card details > summary::before {
  content: ""; position: absolute; left: 2px; top: calc(1.86rem - 5px); width: 7px; height: 7px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s ease;
}
.task-card details[open] > summary::before { transform: rotate(45deg); }
.task-card details > summary .ttl { margin-bottom: 0; font-size: .98rem; }
.task-card details > summary .badge { margin: 6px 4px 0 0; }
.task-card details[open] > summary { margin-bottom: 8px; }
/* « Voir plus » : le bouton disparaît une fois la liste dépliée. */
details.more-group > summary { list-style: none; margin-bottom: 12px; }
details.more-group > summary::-webkit-details-marker { display: none; }
details.more-group[open] > summary { display: none; }

/* Coche de décision portée par chaque solution : la carte cochée passe en vert. */
.task-card { transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.task-card.has-tick > .no, .task-card.has-tick > .ttl, .task-card.has-tick > details > summary { padding-right: 46px; }
.tick { position: absolute; top: 4px; right: 4px; width: 52px; height: 52px; display: grid; place-items: center; cursor: pointer; z-index: 1; }
.tick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tick-box {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.tick-box::after { content: ""; width: 13px; height: 7px; margin-top: -3px; border-left: 3px solid transparent; border-bottom: 3px solid transparent; transform: rotate(-45deg); }
.tick input:focus-visible + .tick-box { outline: 3px solid var(--brand); outline-offset: 2px; }
.task-card.is-checked { background: var(--ok-soft); border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.task-card.is-checked::before { background: var(--ok); }
.task-card.is-checked .tick-box { background: var(--ok-fill); border-color: var(--ok-fill); transform: scale(1.08); }
.task-card.is-checked .tick-box::after { border-color: #ffffff; }
.task-card.is-checked .badge.good { background: var(--surface); }
/* « Hors SRM » n'est pas une solution du manuel : cochée, la carte passe en rouge. */
.task-card.beyond::before { background: var(--bad); }
.task-card.beyond .ttl { margin-bottom: 4px; }
.task-card.beyond.is-checked { background: var(--bad-soft); border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.task-card.beyond.is-checked .tick-box { background: var(--bad-fill); border-color: var(--bad-fill); }
.pick-summary { display: grid; gap: 2px; padding: 10px 12px; margin: 0 0 14px; border-radius: var(--radius-s); background: var(--surface-2); }
.pick-summary .muted { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mat-list { margin: 4px 0 0; padding-left: 18px; font-size: .88rem; }

/* Vérification des limites par règle de tolérances : questions, résultat proposé, confirmation. */
.badge.calc { background: var(--brand-soft); color: var(--brand); }
.limit-check { margin: 12px 0 0; padding: 12px; border-radius: var(--radius-s); background: var(--surface-2); }
html[data-theme="contrast"] .limit-check { border: var(--bw) solid var(--line); }
.limit-check h3 { margin: 0 0 4px; font-size: .95rem; }
.lc-scope, .lc-off { margin: 0 0 10px; font-size: .86rem; color: var(--ink-2); }
.lc-result { padding: 12px; border-radius: var(--radius-s); border-left: 5px solid; background: var(--surface); margin-bottom: 10px; }
.lc-result > b { display: block; font-size: 1.02rem; }
.lc-result p { margin: 4px 0 0; font-size: .9rem; }
.lc-result .lc-recap { color: var(--ink-2); font-size: .84rem; }
.lc-result form { margin-top: 10px; }
.lc-result.r-in, .lc-result.r-in_cond { border-color: var(--ok); }
.lc-result.r-in > b, .lc-result.r-in_cond > b { color: var(--ok); }
.lc-result.r-out, .lc-result.r-airbus { border-color: var(--bad); }
.lc-result.r-out > b, .lc-result.r-airbus > b { color: var(--bad); }
.lc-result.r-other { border-color: var(--warn); }
.lc-result.r-other > b { color: var(--warn); }
.lc-done { font-weight: 700; color: var(--ok); }
.btn.ok { background: var(--ok-fill); border-color: var(--ok-fill); color: #ffffff; }
.btn.bad { background: var(--bad-fill); border-color: var(--bad-fill); color: #ffffff; }
.limit-check details { margin-top: 6px; }
.task-card .limit-check details > summary { padding: 8px 0 8px 22px; font-weight: 600; color: var(--link); }
.task-card .limit-check details > summary::before { top: calc(50% - 6px); }
.lc-q { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.lc-q legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.lc-opts { display: grid; gap: 6px; }
.opt {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 8px 12px; cursor: pointer;
  border: var(--bw) solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); font-size: .92rem;
}
.opt input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brand); }
.opt.is-checked { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.lc-foot { margin: 8px 0 0; font-size: .8rem; color: var(--ink-2); }
.lc-flag textarea { min-height: 70px; margin-bottom: 8px; }

/* ---------- tableaux : fiches sur téléphone, tableau au-delà ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 10px; border-bottom: var(--bw) solid var(--line); text-align: left; vertical-align: top; }
table.list tr:last-child > * { border-bottom: 0; }
table.list th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; }
table.rt thead { display: none; }
table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
table.rt tr { padding: 12px 0; border-bottom: var(--bw) solid var(--line); }
table.rt tr:last-child { border-bottom: 0; }
table.rt td { padding: 1px 0; border: 0; }
table.rt td[data-label]::before { content: attr(data-label) " : "; color: var(--ink-3); font-size: .82rem; font-weight: 600; }
table.rt td:empty { display: none; }
table.kv th { width: 36%; padding-left: 0; }
table.kv td { padding-right: 0; }

/* ---------- figures : légende, figure, commandes sous le pouce ---------- */
.fig-box { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 12px; }
.fig-cap { padding: 10px 14px; font-weight: 600; font-size: .84rem; color: var(--ink-2); border-bottom: var(--bw) solid var(--line); }
.fig-tools { display: flex; border-top: var(--bw) solid var(--line); }
.fig-tools .btn {
  flex: 1 1 0; border: 0; border-radius: 0; min-height: 46px; background: var(--surface); font-size: .88rem; padding: 6px 4px; white-space: nowrap;
}
.fig-tools .btn + .btn { border-left: var(--bw) solid var(--line); }
.fig-tools .btn[data-zoom=in], .fig-tools .btn[data-zoom=out] { flex: 0 0 54px; font-size: 1.3rem; line-height: 1; }
.zoomable { position: relative; overflow: hidden; height: 46vh; min-height: 220px; touch-action: pan-y; cursor: grab; background: #ffffff; }
.zoomable[data-free] { touch-action: none; }
.zoomable.grabbing { cursor: grabbing; }
.zoomable > .zoom-inner { transform-origin: 0 0; position: absolute; left: 0; top: 0; width: 100%; }
.zoomable svg, .zoomable img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.zoomable .empty { color: #5b6675; }
.svg-inline text.callout { cursor: pointer; fill: #c2410c; font-weight: 700; }
.svg-inline text.callout.active { fill: #d00000; }
.loading { display: grid; place-items: center; gap: 10px; padding: 46px 12px; color: #5b6675; font-size: .9rem; }
.loading::before { content: ""; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #d5dbe3; border-top-color: #0f4c81; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading::before { animation-duration: 2.4s; } .btn { transition: none; } }
.viewer-page .wrap { padding: 0; max-width: none; }
.viewer-page .fig-box { border: 0; border-radius: 0; margin: 0; }
.viewer-page .zoomable { height: calc(100vh - 50px - 47px - var(--pad-safe)); height: calc(100dvh - 50px - 47px - var(--pad-safe)); }
.viewer-page .fig-tools .btn { padding-bottom: calc(6px + var(--pad-safe)); min-height: calc(46px + var(--pad-safe)); }

/* ---------- contenu SRM ---------- */
.srm-content { font-size: .96rem; line-height: 1.55; }
.srm-content h2 { margin-top: 1.3em; padding-bottom: 6px; border-bottom: var(--bw) solid var(--line-strong); font-size: 1.05rem; }
.srm-content h2:first-child { margin-top: 0; }
.srm-content h3 { margin-top: 1em; }
.srm-content ol.srm-list { list-style: none; padding-left: 0; margin: 0; }
.srm-content ol.srm-list ol.srm-list { padding-left: 14px; }
.srm-content .item { margin: .4em 0; }
.srm-content .lab { font-weight: 700; margin-right: 5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.srm-content ul.unlist { margin: .2em 0 .6em; padding-left: 20px; }
.srm-box { border-radius: var(--radius-s); padding: 10px 12px; margin: .7em 0; border-left: 4px solid; }
.srm-box .box-label { font-weight: 800; font-size: .72rem; letter-spacing: .09em; margin-bottom: 3px; }
.srm-warning { background: var(--bad-soft); border-color: var(--bad); }
.srm-warning .box-label { color: var(--bad); }
.srm-caution { background: var(--warn-soft); border-color: var(--warn); }
.srm-caution .box-label { color: var(--warn); }
.srm-note { background: var(--surface-2); border-color: var(--line-strong); }
.srm-note .box-label { color: var(--ink-2); }
.diamnote { font-size: .88rem; margin: .4em 0; }
.diamond, sup.diam a { color: var(--info); font-weight: 700; text-decoration: none; }
.cml { font-family: var(--mono); background: var(--surface-2); padding: 0 5px; border-radius: 4px; font-size: .9em; }
.taskref, .subjref { font-weight: 600; }
.taskref.missing { color: var(--ink-3); }
.extref { color: var(--ink-2); font-style: italic; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .6em -16px 1em; padding: 0 16px; }
.table-wrap table { border-collapse: collapse; min-width: 60%; background: var(--surface); font-size: .86rem; }
.table-wrap caption { text-align: left; font-weight: 700; padding: 4px 0 6px; }
.table-wrap th, .table-wrap td { border: 1px solid var(--line-strong); padding: 5px 7px; vertical-align: top; }
.table-wrap th { background: var(--surface-2); }
.table-wrap td p, .table-wrap th p { margin: 0 0 .2em; }
.table-wrap .al-center { text-align: center; }
.table-wrap .al-right { text-align: right; }
figure.srm-fig { margin: .9em 0 1.2em; }
.sheet { border: var(--bw) solid var(--line); border-radius: var(--radius-s); background: #ffffff; margin: 0 -8px 10px; overflow: hidden; }
.sheet-cap { padding: 8px 12px; background: var(--surface-2); color: var(--ink); border-bottom: var(--bw) solid var(--line); font-size: .84rem; }
.sheet-link { display: block; position: relative; }
.sheet-link::after {
  content: "Agrandir"; position: absolute; right: 8px; bottom: 8px; padding: 5px 10px; border-radius: 999px;
  background: rgba(15, 24, 34, .82); color: #ffffff; font: 600 .76rem var(--font);
}
.sheet img { display: block; width: 100%; height: auto; cursor: zoom-in; }

/* ---------- connexion ---------- */
.auth { max-width: 430px; margin: 5vh auto 0; }
.auth .card { padding: 24px 20px; }
.auth h1 { text-align: center; }
.auth .sub { text-align: center; color: var(--ink-2); margin-bottom: 18px; }
.auth .stack > * + * { margin-top: 14px; }
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg { width: 210px; height: 210px; background: #ffffff; border-radius: 8px; }
.secret { font-family: var(--mono); font-size: 1rem; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; text-align: center; word-spacing: .2em; }
ol.steps { padding-left: 20px; margin: 0 0 10px; }
ol.steps li { margin-bottom: 8px; }

/* ---------- divers ---------- */
.aircraft-line { margin: -2px 0 12px; font-size: .92rem; }
.aircraft-line b { font-size: 1.12rem; margin-right: 6px; font-variant-numeric: tabular-nums; }
.empty { padding: 22px 12px; text-align: center; color: var(--ink-3); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 104px; height: 84px; object-fit: cover; border-radius: 8px; border: var(--bw) solid var(--line); }
.icon-dmg { width: 30px; height: 30px; }
.toc a { display: inline-block; margin: 0 10px 6px 0; }
.decision-card { border-width: 2px; }
.decision-card.is-adl { border-color: var(--ok); }
.decision-card.is-repair { border-color: var(--warn); }
.decision-card.is-beyond { border-color: var(--bad); }

/* ---------- tablette et PC ---------- */
@media (min-width: 720px) {
  body.has-nav, body.focus { --tabbar: 0px; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }
  .tabbar { display: none; }
  .wrap, body.with-actionbar .wrap { padding: 22px 22px 50px; }
  .card { padding: 20px 22px; margin-bottom: 16px; }
  .stepper { display: flex; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
  .stepper li { flex: 1; padding: 9px 12px; border-radius: var(--radius-s); background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: center; }
  .stepper li .n { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface); color: var(--ink-3); font-size: .8rem; flex: none; }
  .stepper li.done { color: var(--brand); background: var(--brand-soft); }
  .stepper li.done .n { background: var(--brand); color: var(--on-brand); }
  .stepper li.current { background: var(--brand); color: var(--on-brand); }
  .stepper li.current .n { background: var(--on-brand); color: var(--brand); }
  .stepper a { color: inherit; text-decoration: none; display: contents; }
  .step-mini { display: none; }
  .chips { margin: 0 0 8px; padding: 0 0 8px; }
  .actionbar { right: 22px; bottom: 22px; }
  .actionbar .btn { min-width: 200px; }
  .actionbar .btn.side { min-width: 0; }
  .actionbar .chosen { max-width: 520px; }
  body.with-actionbar .wrap { padding-bottom: 130px; }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .dmg-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .zoomable { height: 60vh; min-height: 340px; }
  .task-card .actions { display: flex; flex-wrap: wrap; align-items: center; }
  .task-card .actions .open { width: auto; }
  /* Les listes de navigation redeviennent des grilles de cartes quand la place le permet. */
  .glist.as-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); background: transparent; border: 0; box-shadow: none; overflow: visible; border-radius: 0; }
  .glist.as-grid > * + * { border-top: 0; }
  .glist.as-grid > a.choice, .glist.as-grid > form > .choice, .glist.as-grid > button.choice { border: var(--bw) solid var(--line); border-radius: var(--radius); background: var(--surface); height: 100%; }
  table.rt thead { display: table-header-group; }
  table.rt { display: table; }
  table.rt tbody { display: table-row-group; }
  table.rt tr { display: table-row; padding: 0; }
  table.rt td { display: table-cell; width: auto; padding: 10px; border-bottom: var(--bw) solid var(--line); }
  table.rt td[data-label]::before { content: none; }
  table.rt td:empty { display: table-cell; }
  .srm-content { font-size: .98rem; }
  .srm-content ol.srm-list ol.srm-list { padding-left: 26px; }
  .sheet { margin: 0 0 10px; }
  .table-wrap { margin: .6em 0 1em; padding: 0; }
  .photos img { width: 150px; height: 110px; }
  .piece-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
  .piece-layout .glist { max-height: 72vh; overflow: auto; }
  .viewer-page .wrap { padding: 12px 22px; }
  .viewer-page .fig-box { border: var(--bw) solid var(--line); border-radius: var(--radius); }
  .viewer-page .zoomable { height: calc(100vh - 160px); }
  .viewer-page .fig-tools .btn { padding-bottom: 6px; min-height: 46px; }
}

/* ---------- téléphone à l'horizontale ----------
   Placé après les règles tablette : un téléphone couché dépasse 720 px de large.
   Le bandeau ne reste pas collé (l'écran est bas) ; dans la visionneuse, la figure prend tout
   l'écran et les commandes passent sur le côté. */
@media (orientation: landscape) and (max-height: 520px) {
  .viewer-page .wrap { padding: 0; }
  .viewer-page .fig-box { display: flex; border: 0; border-radius: 0; padding-left: env(safe-area-inset-left, 0px); }
  .viewer-page .zoomable { flex: 1; height: 100vh; height: 100dvh; min-height: 0; }
  .viewer-page .fig-tools { flex-direction: column; flex: 0 0 calc(64px + env(safe-area-inset-right, 0px)); border-top: 0; border-left: var(--bw) solid var(--line); padding-right: env(safe-area-inset-right, 0px); }
  .viewer-page .fig-tools .btn { flex: 1 1 0; padding: 4px; min-height: 0; font-size: .78rem; white-space: normal; }
  .viewer-page .fig-tools .btn + .btn { border-left: 0; border-top: var(--bw) solid var(--line); }
  .viewer-page .fig-tools .btn[data-zoom=in], .viewer-page .fig-tools .btn[data-zoom=out] { flex: 1 1 0; }
}

/* ---------- impression : toujours noir sur blanc ---------- */
@media print {
  :root, html[data-theme] {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --ink: #000; --ink-2: #333; --ink-3: #555; --line: #999; --line-strong: #666;
    --brand: #0f4c81; --on-brand: #fff; --brand-soft: #f2f2f2; --link: #000;
    --ok: #17794d; --ok-soft: #e3f4ea; --warn: #8a5b00; --warn-soft: #fff2cf; --bad: #b3261e; --bad-soft: #fdeae8;
    --info: #2a59a8; --info-soft: #e8effb; --bw: 1px; --fs-scale: 1;
  }
  html { font-size: 11pt; }
  .tabbar, .stepper, .step-mini, .no-print, .actionbar, .chips { display: none !important; }
  .wrap, body.with-actionbar .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  table.rt thead { display: table-header-group; }
  table.rt { display: table; }
  table.rt tbody { display: table-row-group; }
  table.rt tr { display: table-row; padding: 0; }
  table.rt td { display: table-cell; width: auto; padding: 6px 8px; border-bottom: 1px solid #bbb; }
  table.rt td[data-label]::before { content: none; }
  .report-sign td { height: 62px; }
}
