/* ==========================================================================
   Template V6 — Hybride : modules en onglets + liste/détail + document guidé
   Coquille :
     ┌ marque │ fil d'Ariane + titre de page ········ onglets modules ┐
     │ sous-menu  │ liste  │ détail (consultation OU document guidé)  │
     │ (repliable)│        │   contenu          │ aperçu PDF          │
     └ barre d'état ─────────────────────────────────────────────────┘
   Le mode « document » (data-mode="doc") rétrécit la liste pour laisser la
   place au formulaire et à l'aperçu en direct.
   ========================================================================== */

.h6 {
  --list-w: 21.25rem;
  --sub-w: 14.75rem;
  --preview-w: minmax(21.25rem, 40%);
  display: grid; height: 100vh;
  grid-template-columns: var(--sub-w) var(--list-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top top" "sub list detail" "status status status";
  transition: grid-template-columns .18s ease;
}
.h6.sub-collapsed { --sub-w: 3.25rem; }
.h6[data-mode="doc"] { --list-w: 15.5rem; }
.h6.list-hidden { --list-w: 0; }
.h6.list-hidden .h6-list { visibility: hidden; }

/* ---------- Barre haute : marque + fil d'Ariane/titre à gauche, onglets modules à droite ---------- */
.h6-top {
  grid-area: top; display: flex; align-items: center; gap: 1rem; padding: 0 var(--pad);
  background: var(--nav-bg); color: var(--nav-text); min-height: 3.625rem;
}
.h6-brand { align-self: center; display: flex; align-items: center; gap: 0.5rem; color: var(--nav-text-strong); font-weight: 700; letter-spacing: .02em; padding-right: 1rem; border-right: 1px solid color-mix(in srgb, var(--nav-text) 25%, transparent); }
.h6-brand i { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 0.375rem; background: var(--accent); color: var(--accent-contrast); font-style: normal; font-size: 0.75rem; }
.h6-heading { align-self: center; display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.h6-crumbs { display: flex; align-items: center; gap: 0.375rem; font-size: var(--fs-xs); color: var(--nav-text); white-space: nowrap; overflow: hidden; }
.h6-crumbs a { color: var(--nav-text); cursor: pointer; }
.h6-crumbs a:hover { color: var(--nav-text-strong); text-decoration: none; }
.h6-crumbs .sep { opacity: .5; }
.h6-crumbs .cur { color: var(--nav-text-strong); overflow: hidden; text-overflow: ellipsis; }
.h6-heading h1 { font-size: var(--fs-lg); color: var(--nav-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-heading h1 .count { font-size: var(--fs-sm); font-weight: 500; color: var(--nav-text); margin-left: 0.375rem; }
/* Onglets modules : vrais onglets de classeur. Le trait du bas de la barre délimite le haut de la
   page ; l'onglet actif prend la couleur de la page, recouvre ce trait et « déborde » sur elle. */
.h6 { --tab-line: color-mix(in srgb, var(--nav-text) 55%, var(--nav-bg)); --tab-page: var(--surface); }
.h6-top { box-shadow: inset 0 -1px 0 var(--tab-line); }
.h6-tabs { display: flex; gap: 0.125rem; align-self: flex-end; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; max-width: 60%; padding: 0.5rem 0.875rem 0; }
.h6-tab {
  position: relative; display: flex; align-items: center; gap: 0.4375rem; height: 2.5rem; padding: 0 1rem;
  border: 1px solid transparent; border-bottom: 0; border-radius: 0.625rem 0.625rem 0 0;
  background: transparent; color: var(--nav-text); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: color .15s, background .15s;
}
.h6-tab:hover { color: var(--nav-text-strong); background: color-mix(in srgb, var(--nav-text) 10%, transparent); }
/* Séparateurs fins entre onglets inactifs */
.h6-tab:not(.active) + .h6-tab:not(.active)::before {
  content: ""; position: absolute; left: -2px; top: 0.75rem; bottom: 0.75rem; width: 1px; background: color-mix(in srgb, var(--nav-text) 22%, transparent);
}
.h6-tab:hover::before, .h6-tab:hover + .h6-tab::before { opacity: 0; }
.h6-tab.active {
  z-index: 1; height: 2.75rem; margin-top: -4px; color: var(--text); font-weight: 600;
  border-color: var(--tab-line);
  /* Teinte d'accent très légère en haut, qui s'estompe vers la couleur de la page pour un raccord invisible */
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--tab-page)) 0%, var(--tab-page) 85%);
  box-shadow: 0 -6px 1.125rem color-mix(in srgb, var(--accent) 18%, transparent);
}
.h6-tab.active::before { display: none; }
/* Recouvre le trait de page sous l'onglet actif (raccord parfait) */
.h6-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 0.125rem; background: var(--tab-page); }
/* Congés arrondis à la base : l'onglet s'évase et se fond dans la page, le trait suit la courbe */
.h6-tab .foot { display: none; position: absolute; bottom: 0; width: 0.75rem; height: 0.75rem; pointer-events: none; }
.h6-tab.active .foot { display: block; }
.h6-tab .foot.l { left: -12px; background: radial-gradient(circle at 0 0, transparent 0.6875rem, var(--tab-line) 0.6875rem, var(--tab-line) 0.75rem, var(--tab-page) 0.75rem); }
.h6-tab .foot.r { right: -12px; background: radial-gradient(circle at 100% 0, transparent 0.6875rem, var(--tab-line) 0.6875rem, var(--tab-line) 0.75rem, var(--tab-page) 0.75rem); }
.h6-tab .ico { opacity: .7; }
.h6-tab.active .ico { opacity: 1; color: var(--accent); }
.h6-tab .count {
  min-width: 1.125rem; padding: 0 0.3125rem; border-radius: 62.4375rem; font-size: 0.6562rem; font-weight: 600; text-align: center;
  background: color-mix(in srgb, var(--nav-text) 20%, transparent); color: var(--nav-text-strong);
}
.h6-tab.active .count { background: var(--accent-soft); color: var(--accent); }
.h6-tab kbd { display: none; }
.h6-top.show-keys .h6-tab kbd { display: inline-block; }
/* Recherche à droite des onglets */
.h6-top-right { align-self: center; display: flex; align-items: center; gap: 0.625rem; }
.h6-top .search {
  width: clamp(15rem, 22vw, 23.75rem); height: calc(var(--control-h) + 0.375rem); padding: 0 0.625rem; gap: 0.5rem;
  background: color-mix(in srgb, var(--nav-text) 10%, transparent); border: 1px solid color-mix(in srgb, var(--nav-text) 22%, transparent);
  color: var(--nav-text); border-radius: var(--radius-sm); transition: width .2s ease, background .15s;
}
.h6-top .search:focus-within { background: var(--surface); border-color: var(--accent); color: var(--text-muted); }
.h6-top .search input { color: var(--nav-text-strong); }
.h6-top .search:focus-within input { color: var(--text); }
.h6-top .search input::placeholder { color: var(--nav-text); opacity: .8; }
.h6-top .search kbd { background: transparent; border-color: color-mix(in srgb, var(--nav-text) 35%, transparent); color: var(--nav-text); }

/* ---------- Liste (maître) ---------- */
.h6-list { grid-area: list; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-right: 1px solid var(--border); }
.h6-list-head { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem var(--pad) 0.625rem; border-bottom: 1px solid var(--border); }
.h6-list-head .row1 { display: flex; align-items: center; gap: 0.5rem; }
.h6-list-head h2 { font-size: var(--fs-md); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-list-head .count { color: var(--text-faint); font-weight: 500; margin-left: 0.25rem; }
.h6-list-sum { display: flex; gap: 0.875rem; font-size: var(--fs-xs); color: var(--text-muted); }
.h6-list-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.h6-items { flex: 1; overflow: auto; }
.h6-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.125rem 0.5rem; padding: 0.5625rem var(--pad);
  border-bottom: 1px solid var(--border); cursor: pointer; position: relative;
}
.h6-item:hover { background: var(--surface-2); }
.h6-item.selected { background: var(--accent-soft); }
.h6-item.selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0.1875rem; background: var(--accent); }
.h6-item .t { font-weight: 600; display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.h6-item .s { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-item .m { color: var(--text-faint); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-item .r { text-align: right; font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.h6-item .r b { color: var(--text); }
.h6-item .dot { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--warn); flex-shrink: 0; }
.h6-item .dot.err { background: var(--err); }
.h6-item.new { animation: h6-flash 1.4s ease-out; }
@keyframes h6-flash { from { background: var(--ok-soft); } }
/* En mode document, la liste devient une colonne de repères compacte */
.h6[data-mode="doc"] .h6-item .m, .h6[data-mode="doc"] .h6-list-sum { display: none; }
.h6[data-mode="doc"] .h6-item { padding-top: 0.4375rem; padding-bottom: 0.4375rem; }

/* ---------- Détail ---------- */
.h6-detail { grid-area: detail; display: grid; grid-template-columns: minmax(0, 1fr) var(--preview-w); min-height: 0; min-width: 0; background: var(--bg); }
.h6-detail.no-preview { grid-template-columns: minmax(0, 1fr) 0; }
.h6-detail.no-preview .h6-preview { display: none; }
.h6-content { display: flex; flex-direction: column; min-height: 0; min-width: 0; container-type: inline-size; }
/* Le détail s'adapte à SA largeur (aperçu ouvert ou replié), pas à celle de l'écran */
@container (max-width: 40rem) {
  .h6-content .h6-dhead .acts kbd, .h6-content .h6-autosave { display: none; }
  .h6-content .h6-dhead h1 { white-space: nowrap; }
  .h6-content .h6-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h6-content .h6-steps li:not(.current) .l { display: none; }
  .h6-content .h6-steps { grid-template-columns: repeat(var(--n, 5), auto); grid-auto-columns: auto; }
  .h6-content .h6-steps li.current { min-width: 9.375rem; }
  .h6-content .h6-foot { gap: 0.5rem; }
  .h6-content .h6-progress span, .h6-content #h6-cancel, .h6-content .h6-foot kbd, .h6-content #h6-prev .t { display: none; }
  .h6-content #h6-prev { padding: 0 0.5rem; }
  .h6-content .h6-qhead { flex-wrap: wrap; }
}
.h6-dhead { display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap; padding: 0.75rem var(--pad); border-bottom: 1px solid var(--border); background: var(--surface); }
.h6-dhead .ttl { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.h6-dhead .ttl small { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-dhead h1 { font-size: var(--fs-lg); display: flex; align-items: center; gap: 0.5rem; }
.h6-dhead .acts { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.h6-scroll { flex: 1; overflow: auto; padding: var(--pad); display: flex; flex-direction: column; gap: var(--gap); }
.h6-preview { min-height: 0; border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.h6-preview > .pdf-viewer { flex: 1; }
.h6-preview .pdf-pages { overflow-x: hidden; }

/* Fiches de consultation */
.h6-kv { display: grid; grid-template-columns: repeat(var(--kv-cols, 2), minmax(0, 1fr)); gap: 0.625rem 1.125rem; }
.h6-kv div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.h6-kv span { font-size: var(--fs-xs); color: var(--text-muted); }
.h6-kv b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.h6-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.h6-kpis .card { padding: 0.625rem 0.875rem; }
.h6-kpis .kpi .v { font-size: var(--fs-xl); }
.h6-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--text-muted); padding: 2.5rem; }
.h6-empty .big { font-size: var(--fs-lg); color: var(--text); font-weight: 600; margin-bottom: 0.375rem; }

/* ---------- Mode document guidé ---------- */
/* Stepper en segments : pastille-icône, libellé + résumé, barre de progression sous chaque étape */
.h6-steps {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.375rem; list-style: none; margin: 0;
  padding: 0.625rem var(--pad) 0; background: var(--surface); border-bottom: 1px solid var(--border);
}
.h6-steps li { display: flex; flex-direction: column; min-width: 0; }
.h6-steps button {
  display: flex; align-items: center; gap: 0.5625rem; min-width: 0; padding: 0.375rem 0.5rem 0.5rem 0.25rem; border: 0; border-radius: var(--radius) var(--radius) 0 0;
  background: none; color: var(--text-muted); font: inherit; cursor: pointer; text-align: left; transition: background .15s;
}
.h6-steps button:hover { background: var(--surface-2); }
.h6-steps .n {
  flex-shrink: 0; display: inline-grid; place-items: center; width: 1.875rem; height: 1.875rem; border-radius: 0.625rem;
  background: var(--surface-3); color: var(--text-faint); transition: background .2s, color .2s, box-shadow .2s;
}
.h6-steps .l { display: flex; flex-direction: column; min-width: 0; }
.h6-steps .l b { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-steps .l small { font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h6-steps .seg { display: block; height: 0.1875rem; border-radius: 0.1875rem 0.1875rem 0 0; background: var(--surface-3); overflow: hidden; position: relative; }
.h6-steps .seg::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); transition: transform .35s ease; background: var(--accent); }
.h6-steps li.current button { color: var(--text); }
.h6-steps li.current .n { background: var(--accent); color: var(--accent-contrast); box-shadow: 0 0 0 0.25rem var(--accent-soft); }
.h6-steps li.current .seg::after { transform: scaleX(.5); background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent)); }
.h6-steps li.done .n { background: var(--ok-soft); color: var(--ok); }
.h6-steps li.done .seg::after, .h6-steps li.warn .seg::after { transform: scaleX(1); background: var(--ok); }
.h6-steps li.done.current .n { background: var(--ok); color: var(--surface); box-shadow: 0 0 0 0.25rem var(--ok-soft); }
.h6-steps li.done small { color: var(--ok); }
.h6-steps li.warn .n { background: var(--warn-soft); color: var(--warn); }
.h6-steps li.warn .seg::after { background: var(--warn); }
.h6-steps li.warn small { color: var(--warn); }
.h6-steps li.error .n { background: var(--err-soft); color: var(--err); }
.h6-steps li.error .seg::after { transform: scaleX(1); background: var(--err); }
.h6-steps li.error small { color: var(--err); }

/* Étape : en-tête illustré, astuce, carte de formulaire */
#h6-panes { background: linear-gradient(180deg, var(--surface-2), var(--bg) 13.75rem); }
.h6-pane { display: flex; flex-direction: column; gap: 0.875rem; max-width: 47.5rem; animation: h6-in .22s ease-out; }
.h6-pane[hidden] { display: none; }
@keyframes h6-in { from { opacity: 0; transform: translateY(0.375rem); } }
.h6-qhead { display: flex; align-items: center; gap: 0.875rem; }
.h6-qico {
  flex-shrink: 0; display: grid; place-items: center; width: 2.875rem; height: 2.875rem; border-radius: 0.875rem;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 22%, var(--surface)));
  color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.h6-pane[data-state="done"] .h6-qico { background: linear-gradient(135deg, var(--ok-soft), color-mix(in srgb, var(--ok) 20%, var(--surface))); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 25%, transparent); }
.h6-pane[data-state="warn"] .h6-qico { background: var(--warn-soft); color: var(--warn); }
.h6-qtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.h6-qstate .badge { padding: 0.1875rem 0.625rem; }
.h6-qstate .badge::before { display: none; }
.h6-eyebrow { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.h6-q { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.01em; }
.h6-tip {
  display: flex; gap: 0.625rem; align-items: flex-start; padding: 0.625rem 0.875rem; border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent); border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent);
}
.h6-tip p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.h6-pane-body {
  display: flex; flex-direction: column; gap: var(--gap); padding: calc(var(--pad) + 0.125rem);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.h6-pane-body .form-section { --form-cols: 2; }
.h6-pane-body .field > label { color: var(--text); }
.h6-pane-body .field:focus-within > label { color: var(--accent); }
.h6-pane-body:has(.h6-recap) { background: none; border: 0; box-shadow: none; padding: 0; }
.h6-callout { display: flex; gap: 0.625rem; align-items: flex-start; padding: 0.625rem 0.75rem; border-radius: var(--radius); background: var(--info-soft); color: var(--info); font-size: var(--fs-sm); }
.h6-callout.warn { background: var(--warn-soft); color: var(--warn); }
.h6-callout.ok { background: var(--ok-soft); color: var(--ok); }
.h6-callout b { color: inherit; }

/* Pied : anneau de progression, prochaine étape, totaux, actions */
.h6-foot {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem var(--pad);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 0.875rem color-mix(in srgb, var(--text) 6%, transparent);
}
.h6-ring { position: relative; width: 2.5rem; height: 2.5rem; flex-shrink: 0; }
.h6-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.h6-ring circle { fill: none; stroke-width: 3.5; }
.h6-ring .bg { stroke: var(--surface-3); }
.h6-ring .fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .35s ease; }
.h6-ring.complete .fg { stroke: var(--ok); }
.h6-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.625rem; font-variant-numeric: tabular-nums; }
.h6-progress { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-xs); color: var(--text-muted); }
.h6-progress b { color: var(--text); }
.h6-progress small { color: var(--text-faint); white-space: nowrap; }
.h6-sum { display: flex; flex-direction: column; font-size: var(--fs-xs); color: var(--text-muted); padding-left: 0.75rem; border-left: 1px solid var(--border); white-space: nowrap; }
.h6-sum b { font-size: var(--fs-md); color: var(--text); font-variant-numeric: tabular-nums; }
.h6-autosave { font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }
#h6-next { box-shadow: 0 0.125rem 0.5rem color-mix(in srgb, var(--accent) 35%, transparent); }
#h6-next.finish { background: var(--ok); border-color: var(--ok); color: var(--surface); box-shadow: 0 0.125rem 0.5rem color-mix(in srgb, var(--ok) 35%, transparent); }
#h6-next.finish:hover { filter: brightness(1.08); }

/* Récapitulatif (étape Vérification) */
.h6-recap { display: flex; flex-direction: column; gap: 0.5rem; }
.h6-recap .card-h h3 { font-size: var(--fs-base); }
.h6-recap .card-h .btn { margin-left: auto; }
.h6-recap .card-b { padding: 0.625rem var(--pad); }
.h6-recap .h6-kv { --kv-cols: 3; }

/* Lignes de facture éditables (mode document) */
table.h6-lines { width: 100%; border-collapse: collapse; }
.h6-lines th { text-align: left; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; padding: 0.25rem 0.375rem; border-bottom: 1px solid var(--border); }
.h6-lines td { padding: 0.25rem 0.375rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.h6-lines td.num, .h6-lines th.num { text-align: right; }
.h6-lines .input { height: calc(var(--control-h) - 0.25rem); }
.h6-lines .input.num { text-align: right; }
.h6-lines .lib b { display: block; font-weight: 500; }
.h6-lines .lib small { color: var(--text-faint); }
.h6-addline { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }

/* ---------- Sous-menu latéral gauche ---------- */
.h6-sub { grid-area: sub; display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-right: 1px solid var(--border); overflow: hidden; }
.h6-sub-head { display: flex; align-items: center; gap: 0.375rem; padding: 0.625rem 0.625rem 0.5rem 0.875rem; border-bottom: 1px solid var(--border); min-height: 2.875rem; }
.h6-sub-head b { flex: 1; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; }
.h6-sub-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.h6-sub-group { display: flex; flex-direction: column; gap: 1px; }
.h6-sub-group > span { padding: 0.25rem 0.5rem; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); white-space: nowrap; }
.h6-sub a {
  display: flex; align-items: center; gap: 0.5625rem; padding: 0.375rem 0.5rem; border-radius: var(--radius); color: var(--text-muted);
  cursor: pointer; white-space: nowrap; text-decoration: none; position: relative;
}
.h6-sub a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.h6-sub a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.h6-sub a .ico { flex-shrink: 0; }
.h6-sub a .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.h6-sub a .count { font-size: var(--fs-xs); padding: 0 0.375rem; border-radius: 62.4375rem; background: var(--surface-3); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.h6-sub a .count.warn { background: var(--warn-soft); color: var(--warn); }
.h6-sub a .count.err { background: var(--err-soft); color: var(--err); }
.h6-sub a kbd { margin-left: auto; }
.h6-sub a.primary { background: var(--accent); color: var(--accent-contrast); font-weight: 600; margin-bottom: 0.25rem; }
.h6-sub a.primary:hover { background: var(--accent-hover); }
.h6-sub a.primary kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--accent-contrast) 50%, transparent); }
.h6-sub-foot { padding: 0.5rem; border-top: 1px solid var(--border); }
/* Replié : rail d'icônes, libellés en info-bulle (attribut title) */
.sub-collapsed .h6-sub-head b, .sub-collapsed .h6-sub-group > span, .sub-collapsed .h6-sub a .lbl,
.sub-collapsed .h6-sub a kbd, .sub-collapsed .h6-sub-foot .lbl { display: none; }
.sub-collapsed .h6-sub-head { justify-content: center; padding: 0.625rem 0 0.5rem; }
.sub-collapsed .h6-sub a { justify-content: center; padding: 0.5rem 0; }
.sub-collapsed .h6-sub a .count { position: absolute; top: 1px; right: 0.125rem; padding: 0 0.25rem; font-size: 0.5625rem; }
.sub-collapsed .h6-sub-group + .h6-sub-group { border-top: 1px solid var(--border); padding-top: 0.5rem; }
.h6-collapse svg { transition: transform .18s ease; }
.sub-collapsed .h6-collapse svg { transform: rotate(180deg); }

/* ---------- Barre d'état ---------- */
.h6-status { grid-area: status; display: flex; align-items: center; gap: 0.875rem; padding: 0.25rem var(--pad) 0.3125rem; background: var(--surface-2); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; }

/* ---------- Contenu des pages PDF simulées (papier : couleurs d'impression) ---------- */
.pdf-page [data-zone] { transition: outline-color .2s, background .2s; outline: 0.125rem solid transparent; outline-offset: 0.1875rem; border-radius: 0.125rem; }
.pdf-page [data-zone].zone-active { outline-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pdf-page .todo { color: #9aa1ad; font-style: italic; }
.pdf-page .bc { height: 2.125rem; width: 10.625rem; color: #000; display: block; margin-left: auto; }
.pdf-page .resv { color: #9a5b00; }
.pdf-page .chipsP { display: flex; flex-wrap: wrap; gap: 0.1875rem 0.25rem; }
.pdf-page .chipsP span { border: 1px solid #cfd5df; border-radius: 0.1875rem; padding: 0 0.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1600px) {
  .h6-tab > .ico { display: none; }   /* priorité au fil d'Ariane et au titre */
}
@media (max-width: 1280px) {
  .h6 { --list-w: 18.75rem; }
  .h6:not(.sub-pinned) { --sub-w: 3.25rem; }
  .h6:not(.sub-pinned) .h6-sub-head b, .h6:not(.sub-pinned) .h6-sub-group > span, .h6:not(.sub-pinned) .h6-sub a .lbl,
  .h6:not(.sub-pinned) .h6-sub a kbd, .h6:not(.sub-pinned) .h6-sub-foot .lbl { display: none; }
  .h6:not(.sub-pinned) .h6-sub a { justify-content: center; padding: 0.5rem 0; }
  .h6:not(.sub-pinned) .h6-sub a .count { position: absolute; top: 1px; right: 0.125rem; padding: 0 0.25rem; font-size: 0.5625rem; }
  .h6:not(.sub-pinned) .h6-sub-head { justify-content: center; }
  .h6-tab { padding: 0 0.5625rem; }
  .h6 .h6-top .search { width: 13.125rem; }
}
@media (max-width: 1100px) {
  .h6-detail, .h6-detail.no-preview { grid-template-columns: minmax(0, 1fr); position: relative; }
  .h6-preview { display: none; }
  .h6-detail.show-preview .h6-preview { display: flex; position: absolute; inset: 0 0 0 auto; width: min(32.5rem, 92%); z-index: 20; box-shadow: var(--shadow-lg); }
  .h6[data-mode="doc"] { --list-w: 0; }
  .h6[data-mode="doc"] .h6-list { visibility: hidden; }
  .h6-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h6-tab .lbl { display: none; }
  .h6 .h6-top .search { width: 2.5rem; padding: 0 0.75rem; overflow: hidden; }
  .h6 .h6-top .search:focus-within { width: 13.75rem; }
}
@media (max-width: 760px) {
  .h6, .h6[data-mode="doc"] { grid-template-columns: 3.25rem minmax(0, 1fr); grid-template-rows: auto 38vh minmax(0, 1fr); grid-template-areas: "top top" "sub list" "sub detail"; }
  .h6[data-mode="doc"] .h6-list { visibility: visible; }
  .h6-list { border-right: 0; border-bottom: 1px solid var(--border); }
  .h6-pane .form-section { --form-cols: 1; }
  .h6-recap .h6-kv, .h6-kv { --kv-cols: 1; }
  .h6-status, .h6-brand, .h6-tab .lbl { display: none; }
  .h6-top { flex-wrap: wrap; }
  .h6-tabs { max-width: 100%; }
}

/* ---------- Curseur de taille de l'interface (barre d'état, en bas à droite) ---------- */
.h6-keys { display: flex; align-items: center; gap: 0.875rem; min-width: 0; overflow: hidden; }
/* Exception voulue aux tailles en rem : le curseur de taille garde une taille et une place fixes (px), sinon il
   grandirait et se déplacerait sous le pointeur pendant qu'on le fait glisser. La barre d'état garde aussi
   une marge droite fixe pour que le curseur reste ancré au même endroit. */
.h6-status { padding-right: 16px; }
.h6-scale { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding-left: 10px; border-left: 1px solid var(--border); font-size: 12px; }
.h6-scale .h6-sc { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text-muted); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.h6-scale .h6-sc:hover { color: var(--text); border-color: var(--border-strong); }
.h6-scale input[type="range"] { width: 120px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; touch-action: none; }
.h6-scale .h6-scv { width: 46px; padding: 0 4px; border: 0; border-radius: 4px; background: none; color: var(--text); font: inherit; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; cursor: pointer; }
.h6-scale .h6-scv:hover { background: var(--surface-3); }
