/* Planche Editeur-Dossier-BAT (préfixe bat-) : l'examen du BAT en tiroir, et les espaces de l'étape Fabrication (récapitulatif, repères, déroulé, prérequis)
   dont les valeurs viennent des planches Editeur-{Oceanos,Reves,Foret}-Fabrication. L'en-tête de dossier et la frise sont dans systeme.css (dh-). */

/* ---------- Page de l'étape ---------- */
/* Niveau 1 : dans le bloc graphite, l'échéance passe en ambre clair et les bulles de source restent des feuilles blanches */
.bat-due { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.bat-due-l { font-size: 13px; font-weight: 600; color: var(--clarify); }
.focus .bat-due-l { color: var(--z1-warn); }
.focus .src__pop .prov { color: var(--ink-3); }
.focus .src__pop .prov b { color: var(--ink); }
.focus .src__pop .prov[data-c="observe"]::before { background: var(--ink-2); }
.focus .src__pop .prov[data-c="estime"]::before { border-color: var(--ink-3); }
.bat-tile-warn { color: var(--z1-warn); }
.bat-line { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bat-line:last-child { border-bottom: 0; }
.bat-line > span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.bat-line a { color: var(--role-ink); text-decoration: none; }
.bat-line a:hover { text-decoration: underline; }
.bat-line .prov { white-space: normal; }
.bat-line__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bat-line__sub { font-size: 12.5px; line-height: 18px; color: var(--ink-3); }
.bat-line--late > span:last-child { color: var(--late); font-weight: 560; }
.bat-pad { padding-bottom: 8px; }

/* Espaces d'étape : récapitulatif, repères, déroulé, prérequis (mêmes valeurs que les planches d'étape) */
.bat-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line-strong); padding: 18px 20px 20px; }
.bat-chead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.bat-chead p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.bat-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.bat-fact { background: var(--z2-tile); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; min-height: 92px; animation: cg-rise 320ms var(--ease-out) both; }
.bat-fact:nth-child(2) { animation-delay: 50ms; } .bat-fact:nth-child(3) { animation-delay: 100ms; } .bat-fact:nth-child(4) { animation-delay: 150ms; }
.bat-fact small { font-size: 12px; color: var(--ink-3); }
.bat-fact b { font-size: 16px; line-height: 22px; font-weight: 620; color: var(--ink); overflow-wrap: anywhere; }
.bat-fact span { font-size: 12.5px; line-height: 17px; color: var(--ink-3); margin-top: auto; }
.bat-fin { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 560; color: var(--ink); margin-bottom: 2px; }
.bat-tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--done); color: #fff; flex-shrink: 0; }
.bat-tick .ico { width: 14px; height: 14px; }
.bat-tl { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.bat-tl li { position: relative; display: grid; grid-template-columns: 96px 14px minmax(0, 1fr); gap: 14px; align-items: start; padding: 9px 0; animation: cg-rise 320ms var(--ease-out) both; }
.bat-tl li:nth-child(2) { animation-delay: 60ms; } .bat-tl li:nth-child(3) { animation-delay: 120ms; } .bat-tl li:nth-child(4) { animation-delay: 180ms; } .bat-tl li:nth-child(5) { animation-delay: 240ms; }
.bat-tl li:not(:last-child)::before { content: ""; position: absolute; left: calc(96px + 14px + 6px); top: 26px; bottom: -9px; width: 1.5px; background: var(--line-strong); transform-origin: top center; animation: bat-line 420ms var(--ease-out) 200ms both; }
@keyframes bat-line { from { scale: 1 0; } }
.bat-tl time { font-size: 12.5px; line-height: 20px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.bat-tl i { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink-4); background: var(--surface); position: relative; z-index: 1; }
.bat-tl li[data-s="done"] i { background: var(--done); box-shadow: none; }
.bat-tl li[data-s="active"] i { background: var(--role); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px var(--role); }
.bat-tl li[data-s="clarify"] i { background: var(--clarify); box-shadow: none; border-radius: 2px; transform: rotate(45deg) scale(.85); }
.bat-tl b { display: block; font-size: 13.5px; line-height: 20px; font-weight: 600; }
.bat-tl span { display: block; font-size: 12.5px; line-height: 18px; color: var(--ink-3); }
.bat-tl li[data-s="todo"] b { color: var(--ink-2); }
.bat-wait { font-size: 14px; line-height: 21px; color: var(--ink); max-width: 62ch; }
.bat-req { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bat-req li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--z2-tile); font-size: 13.5px; color: var(--ink-2); animation: cg-rise 320ms var(--ease-out) both; }
.bat-req li:nth-child(2) { animation-delay: 60ms; } .bat-req li:nth-child(3) { animation-delay: 120ms; }
.bat-req b { color: var(--ink); font-weight: 600; }
.bat-req i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink-4); }
.bat-req li[data-s="done"] i { background: var(--done); box-shadow: none; }
.bat-req li[data-s="clarify"] i { background: var(--clarify); box-shadow: none; border-radius: 2px; transform: rotate(45deg) scale(.85); }
.bat-unlock { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .bat-fact, .bat-tl li, .bat-tl li::before, .bat-req li { animation: none !important; } }


/* Écran large (primitive .cg-cols) : décision et récapitulatif à gauche ; déroulé, repères et replis à droite, où les chiffres se placent deux par ligne
   et le déroulé resserre sa colonne de dates. Tant que la colonne de travail est étroite (1320 à 1599 px d'écran), les actions du bloc de décision passent sous son texte. */
@media (min-width: 1320px) {
  .cg-cols__side .bat-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cg-cols__side .bat-tl li { grid-template-columns: 80px 14px minmax(0, 1fr); gap: 10px; }
  .cg-cols__side .bat-tl li:not(:last-child)::before { left: calc(80px + 10px + 6px); }
}
/* Récapitulatif dans la colonne de travail : quatre chiffres se placent deux par ligne tant que la colonne est étroite, jamais trois puis un. */
@media (min-width: 768px) and (max-width: 1099px), (min-width: 1320px) and (max-width: 1599px) {
  .cg-cols__main .bat-facts:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1320px) and (max-width: 1599px) {
  .fab-page .cg-cols__main .focus { grid-template-columns: auto minmax(0, 1fr); }
  .fab-page .cg-cols__main .focus > :is(.bat-due, .bat-unlock) { grid-column: 1 / -1; align-items: flex-start; }
}

/* ---------- Examen du BAT (tiroir) ---------- */
dialog.bat-layer { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; color: var(--ink); }
dialog.bat-layer:not([open]) { display: none; }
dialog.bat-layer::backdrop { background: transparent; }
body:has(dialog.bat-layer[open]) { overflow: hidden; }
.bat-drawer { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(960px, calc(100% - 32px)); padding: 0; gap: 0; overflow: visible; }
.bat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.bat-ttl { font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -.018em; }
.bat-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
.bat-viewer { background: var(--surface-3); display: flex; flex-direction: column; min-height: 0; }
.bat-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.bat-tools * { white-space: nowrap; }
.bat-tools p { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.bat-stage { flex: 1; display: grid; place-items: center; padding: 16px; min-height: 0; }
.bat-frame { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 4px; background: #fff; box-shadow: 0 12px 32px -8px rgb(14 20 32 / 35%); }
.bat-page { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 12px 32px -8px rgb(14 20 32 / 35%); }
.bat-nofile { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--ink-2); font-size: 13.5px; }
/* Colonne de contrôle : panneau gris (niveau 2) posé dans la feuille blanche, éléments en tuiles blanches */
.bat-side { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; margin: 12px; padding: 10px; background: var(--z2); border-radius: 18px; }
.bat-verif { border: 0; margin: 0; padding: 0 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; background: var(--z2-tile); border-radius: 14px; }
.bat-verif legend { padding: 16px 0 0; margin-bottom: 12px; }
.bat-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 19px; }
.bat-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--role); flex-shrink: 0; }
.bat-folds { display: flex; flex-direction: column; gap: 8px; border-top: 0; border-radius: 0; background: transparent; }
.bat-folds .fold { background: var(--z2-tile); border-radius: 14px; border-bottom: 0; padding: 0 14px; }
.bat-folds .fold:last-child { border-bottom: 0; }
.bat-folds .fold__body { display: flex; flex-direction: column; gap: 12px; }
.bat-foot-wrap { position: static; margin: 0; }
.bat-foot-wrap > .bat-correct { display: flex; flex-direction: column; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.bat-foot-wrap > .bat-correct .hstack { justify-content: flex-end; }
.bat-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.bat-foot-wrap > .bat-correct + .bat-foot { border-radius: 0 0 var(--r-xl) var(--r-xl); }
.bat-foot-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bat-foot-l p { margin: 0; }
.bat-foot-l .gate { flex-shrink: 0; white-space: nowrap; }
.bat-validate:disabled { opacity: .4; cursor: not-allowed; }
#bat-why[data-ready] { color: var(--done); }
.bat-head, .bat-body, .bat-foot, .bat-correct { transition: opacity var(--dur-base) ease, filter var(--dur-base) ease, transform var(--dur-panel) var(--ease-out); }
/* Confirmation : la décision prise, le contenu s'efface derrière elle. */
.bat-drawer:has(.bat-done[data-open]) :is(.bat-head, .bat-body, .bat-foot, .bat-correct) { opacity: 0; filter: blur(4px); transform: scale(.985); pointer-events: none; }
.bat-done { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; border-radius: inherit; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 140ms ease, visibility 0s linear 140ms; }
.bat-done[data-open] { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-base) ease 120ms, visibility 0s; }
.bat-done-in { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; max-width: 420px; padding: 0 16px; }
.bat-done-in > * { animation: cg-rise var(--dur-panel) var(--ease-out) both; }
.bat-done-t { animation-delay: 380ms; } .bat-done-s { animation-delay: 440ms; } .bat-done-m { animation-delay: 500ms; } .bat-done-a { animation-delay: 560ms; }
.bat-mark { width: 72px; height: 72px; margin-bottom: 6px; animation: bat-pop var(--dur-moment) var(--ease-spring) 520ms both; }
.bat-mark-c { fill: none; stroke: var(--done); stroke-width: 2.5; stroke-dasharray: 208; stroke-dashoffset: 208; transform: rotate(-90deg); transform-origin: center; animation: bat-draw 560ms var(--ease-out) 160ms forwards; }
.bat-mark-k { fill: none; stroke: var(--done); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: bat-draw 320ms var(--ease-out) 560ms forwards; }
@keyframes bat-draw { to { stroke-dashoffset: 0; } }
@keyframes bat-pop { from { transform: scale(.92); } }
.bat-done-t { font-size: 24px; line-height: 30px; font-weight: 620; letter-spacing: -.02em; }
.bat-done-s { color: var(--ink-2); font-size: 14px; text-wrap: balance; margin: 0; }
.bat-done-m { margin: 0; }
.bat-done-a { margin-top: 10px; flex-wrap: wrap; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .bat-done-in > *, .bat-mark { animation: cg-fade 120ms ease forwards !important; }
  .bat-mark-c, .bat-mark-k { animation: none; stroke-dashoffset: 0; }
  .bat-head, .bat-body, .bat-foot, .bat-correct { filter: none !important; transform: none !important; }
}

@media (max-width: 767px) {
  .bat-drawer { inset: 0; width: auto; border-radius: 0; overflow: auto; }
  .bat-head { padding: 16px; position: sticky; top: 0; z-index: 2; background: var(--surface); }
  .bat-body { grid-template-columns: minmax(0, 1fr); flex: none; }
  .bat-tools { flex-wrap: wrap; }
  .bat-tools p { white-space: normal; }
  .bat-stage { min-height: 56vh; }
  .bat-side { overflow: visible; margin: 8px; }
  .bat-foot { flex-direction: column; align-items: stretch; padding: 12px 16px 20px; position: sticky; bottom: 0; }
  .bat-foot .hstack { justify-content: flex-end; flex-wrap: wrap; }
  .bat-foot .btn, .bat-correct .btn, .bat-check { min-height: 44px; }
  .bat-foot-wrap > .bat-correct { padding: 12px 16px; }
  .bat-tl li { grid-template-columns: 64px 14px minmax(0, 1fr); gap: 10px; }
  .bat-tl li:not(:last-child)::before { left: calc(64px + 10px + 6px); }
  .bat-req li { grid-template-columns: 14px minmax(0, 1fr); }
  .bat-req li > :last-child:not(span) { grid-column: 2; }
  .bat-due { align-items: stretch; grid-column: 1 / -1; }
  .bat-due .hstack { flex-direction: column-reverse; align-items: stretch; gap: 4px; }
  .bat-unlock { align-items: stretch; grid-column: 1 / -1; }
  .fab-page .focus { grid-template-columns: auto minmax(0, 1fr); }
  .fab-page .focus .btn, .fab-page .focus .cta { min-height: 44px; justify-content: center; }
  .fab-page .focus .cta { height: 48px; }
}
