/* ── Upload zone ── */
.upload {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  padding: 48px 32px;
  border: 1px dashed var(--stone-light);
  background: var(--ivory-deep);
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.upload::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.25s var(--ease);
}
.upload:hover,
.upload.active {
  background: var(--ivory-sunk);
  border-color: var(--ink);
}
.upload:hover::before,
.upload.active::before { border-color: var(--rule); }
.upload input[type="file"] { display: none; }
.upload-glyph {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.upload-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  color: var(--ink);
  text-align: center;
  letter-spacing: -0.01em;
}
.upload-sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--stone);
  font-style: italic;
}
.upload-filename {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--ivory);
  padding: 6px 12px;
  border: 1px solid var(--ink);
  margin-top: 6px;
}
.upload-filename:empty { display: none; }

/* ── Progress bar (upload) ── */
.upload-progress {
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--ivory);
}
.upload-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.upload-progress-bar-bg {
  height: 2px;
  background: rgba(250, 248, 244, 0.2);
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand-accent);
  transition: width 0.3s var(--ease);
}

/* ── Onglets ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.tab {
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab-count {
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  color: inherit;
  opacity: 0.6;
}

/* ── Sélecteur de lot ── */
.lot-picker { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.lot-picker .field-label { margin-bottom: 8px; }
.lot-summary {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.03em;
}
.lot-summary b { color: var(--ink); font-weight: 500; }

/* ── Légende collapsible (panel-action dans le header) ── */
.panel-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  background: var(--ivory);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.panel-action:hover { color: var(--ink); border-color: var(--ink); }
.panel-action.open { color: var(--ivory); background: var(--ink); border-color: var(--ink); }
.panel-action-glyph {
  font-size: 9px;
  transition: transform 0.25s var(--ease);
  display: inline-block;
}
.panel-action.open .panel-action-glyph { transform: rotate(45deg); }

.cctp-legend {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease);
}
.cctp-legend.open { max-height: 320px; }
.cctp-legend-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 16px 0 6px;
  border-bottom: 1px solid var(--rule);
}
.cctp-legend-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px;
  border-left: 1px solid var(--rule);
}
.cctp-legend-row:first-child { border-left: 0; padding-left: 0; }
.cctp-legend-row .badge-famille {
  cursor: default;
  align-self: flex-start;
}
.cctp-legend-row > span:last-child {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--stone);
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.cctp-legend-warn {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 10px 0 0;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-style: italic;
  color: var(--brand-accent);
  letter-spacing: -0.005em;
}
@media (max-width: 1100px) {
  .cctp-legend-inner { grid-template-columns: repeat(2, 1fr); gap: 12px 0; }
  .cctp-legend-row:nth-child(3) { border-left: 0; padding-left: 0; }
}

/* ── Grille des fichiers ── */
.files-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 4px;
  padding: 2px;
}
.files-grid::-webkit-scrollbar { width: 10px; }
.files-grid::-webkit-scrollbar-track { background: var(--ivory-deep); }
.files-grid::-webkit-scrollbar-thumb { background: var(--stone-light); border: 2px solid var(--ivory-deep); }

/* ── Dossier (accordéon) ── */
.folder-group { margin-bottom: 2px; }
.folder-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--stone);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s var(--ease);
}
.folder-header:hover { color: var(--ink); }
.folder-chevron {
  display: inline-block;
  width: 10px;
  font-size: 10px;
  color: var(--stone);
  transition: transform 0.2s var(--ease);
}
.folder-group.open > .folder-header .folder-chevron { transform: rotate(90deg); }
.folder-name {
  flex: 1;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--stone);
  font-weight: 400;
  letter-spacing: 0.08em;
}
.folder-children {
  display: none;
  padding: 6px 0 6px 18px;
  margin-left: 10px;
  border-left: 1px solid var(--rule);
  gap: 2px;
}
.folder-group.open > .folder-children { display: flex; flex-direction: column; }

/* ── Ligne fichier ── */
.file-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  border-left-width: 3px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.file-row:hover { background: var(--ivory-deep); border-color: var(--ink); }
.file-row.cat-RC:hover,
.file-row.cat-CCTP:hover,
.file-row.cat-CCAP:hover,
.file-row.cat-RICT:hover,
.file-row.cat-PLANNING:hover,
.file-row.cat-NOTICE:hover { border-left-color: var(--brand-accent); }
.file-row.cat-RC       { border-left-color: #a83232; }
.file-row.cat-CCTP     { border-left-color: #3d4a7a; }
.file-row.cat-CCAP     { border-left-color: var(--brand-accent); }
.file-row.cat-RICT     { border-left-color: #7a2f5a; }
.file-row.cat-PLANNING { border-left-color: #2d6a5f; }
.file-row.cat-NOTICE   { border-left-color: #2a5d85; }
.file-row.dimmed       { border-left-color: var(--rule); opacity: 0.5; }
.file-row.other-lot               { opacity: 0.5; filter: grayscale(0.5); }
.file-row.other-lot .file-name,
.file-row.other-lot .file-cb,
.file-row.other-lot .file-justif  { pointer-events: none; }
.file-row.other-lot .badge-cat[data-fichier],
.file-row.other-lot .badge-famille[data-fichier],
.file-row.other-lot .badge-lot[data-fichier],
.file-row.other-lot .btn-include-hors-lot { pointer-events: auto; }

.file-row-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-row-bottom {
  display: flex;
  gap: 8px;
  padding-left: 32px;
  color: var(--stone);
}

.file-row-sheets {
  padding-left: 32px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--stone);
}
.file-row-sheets .sheet-info {
  font-family: var(--font-mono);
}
.file-row-sheets .sheet-info-ok {
  color: var(--text);
}
.file-row-sheets .sheet-info-ok em {
  color: var(--stone);
  font-style: normal;
  font-size: 10.5px;
}
.file-row-sheets .sheet-info-warn {
  color: var(--warn, #b45309);
}

.file-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  cursor: pointer;
  transition: color 0.15s var(--ease);
}
.file-name:hover { color: var(--brand-accent); text-decoration: underline; }
.file-justif {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-style: italic;
  color: var(--stone);
  line-height: 1.5;
}

.file-cb {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

/* ── Badges catégorie ── */
.badge-cat {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.badge-RC       { color: #a83232; }
.badge-CCTP     { color: #3d4a7a; }
.badge-CCAP     { color: var(--brand-accent); }
.badge-RICT     { color: #7a2f5a; }
.badge-PLANNING { color: #2d6a5f; }
.badge-NOTICE   { color: #2a5d85; }
.badge-ETUDE, .badge-DIAG, .badge-DPGF, .badge-PLAN, .badge-AAPC, .badge-AE { color: var(--stone); }
.badge-AUTRE    { color: var(--warning); }
.badge-cat[data-fichier] { cursor: pointer; }
.badge-cat[data-fichier]:hover { filter: brightness(0.95); }

/* Famille CCTP */
.badge-famille {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s var(--ease);
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
.badge-famille:hover { background: color-mix(in srgb, currentColor 22%, transparent); }
.badge-famille-ARCHITECTURE { color: #8f5a16; border-color: #e8d9b8; }
.badge-famille-TECHNIQUE    { color: #2a5d85; border-color: #c9ddea; }
.badge-famille-VRD          { color: #2d6a5f; border-color: #c2dfd5; }
.badge-famille-CC           { color: #6b21a8; border-color: #dcc8ee; }

/* Badge lot */
.badge-lot {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--rule);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-lot:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.badge-lot-override {
  border-color: var(--brand-accent, #2d6a5f);
  box-shadow: inset 0 -2px 0 var(--brand-accent, #2d6a5f);
}

/* Bouton + Inclure sur lignes hors-lot */
.btn-include-hors-lot {
  margin-left: auto;
  padding: 2px 8px;
  font: 500 11px/1.4 var(--font-mono);
  color: #2d6a5f;
  background: transparent;
  border: 1px solid #c2dfd5;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-include-hors-lot:hover { background: color-mix(in srgb, #2d6a5f 10%, transparent); }

/* Picker lot (popover) */
.lot-picker {
  position: absolute;
  z-index: 1000;
  min-width: 140px;
  padding: 4px;
  background: var(--paper, #fff);
  border: 1px solid var(--rule, #d0cec6);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lot-picker-item {
  padding: 6px 10px;
  font: 500 12px/1.2 var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.lot-picker-item:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.lot-picker-item:disabled { color: var(--stone); cursor: default; }

/* ── Steps ── */
.steps { display: grid; grid-template-columns: 1fr; gap: 0; }
.step {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  transition: background 0.25s var(--ease);
}
.step:last-child { border-bottom: 0; }
.step.running { background: var(--ivory-deep); }

.step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--stone);
  letter-spacing: 0.08em;
}
.step.running .step-num { color: var(--brand-accent); }
.step.done    .step-num { color: var(--success); }
.step.failed  .step-num { color: var(--danger); }

.step-body { min-width: 0; padding-right: 20px; }
.step-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 2px;
}
.step-message {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--stone);
  letter-spacing: 0.02em;
}
.step-marker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  color: var(--stone-light);
  min-width: 90px;
  text-align: center;
}
.step.running .step-marker { color: var(--brand-accent); }
.step.done    .step-marker { color: var(--success); }
.step.failed  .step-marker { color: var(--danger); }

/* ── Tableau critères ── */
.criteres-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}
.criteres-table th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stone);
  border-bottom: 1px solid var(--ink);
}
.criteres-table td {
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.criteres-table tr:last-child td { border-bottom: 0; }
.criteres-table td:first-child {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
}
.criteres-table .poids-cell {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}
.poids-bar {
  display: inline-block;
  height: 6px;
  background: var(--brand-primary);
  vertical-align: middle;
  margin-right: 8px;
}
.criteres-table td:last-child { color: var(--stone); font-size: 12px; line-height: 1.5; }

/* ── Checklist pièces obligatoires ── */
.checklist { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  transition: background 0.15s var(--ease);
}
.checklist-item:hover { background: var(--ivory-deep); }
.checklist-item input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--ink); cursor: pointer; flex-shrink: 0;
}
.checklist-item.checked { color: var(--stone-light); }
.checklist-item.checked label { text-decoration: line-through; }

/* ── Verification badge ── */
.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.badge-ok    { color: var(--success); }
.badge-alert { color: var(--warning); }
.badge-error { color: var(--danger); }

#verification-status { margin-bottom: 24px; font-family: var(--font-mono); font-size: 12px; color: var(--stone); letter-spacing: 0.03em; }

/* ── Éditeur mémoire ── */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 22px;
  background: var(--ivory-deep);
  border: 1px solid var(--rule);
}
.editor-toolbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
}
.editor-toolbar-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.section-editor {
  border: 1px solid var(--rule);
  margin-bottom: 4px;
  background: var(--ivory);
  transition: border-color 0.2s var(--ease);
}
.section-editor:hover { border-color: var(--stone-light); }
.section-editor.level-1 { border-left: 3px solid var(--ink); }
.section-editor.level-2 { margin-left: 20px; border-left: 2px solid var(--stone-light); }
.section-editor.level-3 { margin-left: 40px; border-left: 1px solid var(--stone-light); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s var(--ease);
}
.section-header:hover { background: var(--ivory-deep); }
.section-title {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.level-1 .section-title { font-family: var(--font-display); font-size: 17px; font-weight: 400; }
.level-2 .section-title { font-size: 13px; }
.level-3 .section-title { font-size: 12.5px; color: var(--ink-soft); }

.section-arrow { font-family: var(--font-mono); font-size: 10px; color: var(--stone); }

.section-body { display: none; padding: 8px 14px 14px; border-top: 1px solid var(--rule); }
.section-body.open { display: block; }
.section-textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--ivory);
  border: 1px solid var(--rule);
  resize: vertical;
}
.section-textarea:focus { outline: none; border-color: var(--ink); background: var(--ivory); }

/* ── Actions résultats ── */
.results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.results-actions .btn { flex: 1; min-width: 200px; }

/* ══════════════════════════════════════════════════════════
   ÉDITEUR MÉMOIRE — plan gauche + éditeur droit
   ══════════════════════════════════════════════════════════ */
.memoire-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 640px;
  border-top: 1px solid var(--rule);
  position: relative;
}
.memoire-layout.plan-collapsed { grid-template-columns: 0 1fr; }
.memoire-layout.plan-collapsed .toc-plan { padding: 0; border: 0; opacity: 0; pointer-events: none; }
.memoire-layout.plan-collapsed .plan-resize { display: none; }

.panel-flush > .panel-body { padding: 0; }
.panel-flush .memoire-layout { border-top: 0; }

/* Poignée de resize entre plan et éditeur */
.plan-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 3;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease);
}
.plan-resize::before {
  content: "";
  width: 2px;
  height: 28px;
  background: var(--rule);
  transition: background 0.2s var(--ease);
}
.plan-resize:hover { background: rgba(184, 92, 46, 0.08); }
.plan-resize:hover::before,
.plan-resize.dragging::before { background: var(--brand-accent); }
.plan-resize.dragging { background: rgba(184, 92, 46, 0.15); }

/* Bouton « replier / rouvrir le plan » — à sa place d'origine ; = quand replié, × quand ouvert */
.plan-toggle-btn {
  position: absolute;
  top: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ivory);
  color: var(--ink);
  border: 1px solid var(--rule);
  cursor: pointer;
  z-index: 4;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.plan-toggle-btn:hover { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

.plan-toggle-btn-icon {
  position: relative;
  width: 14px;
  height: 12px;
}
.plan-toggle-btn-bar {
  position: absolute;
  left: 0;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transition: top 0.25s var(--ease), transform 0.25s var(--ease);
  top: 5px;
}
/* Panneau ouvert (par défaut) → × : barres centrées et tournées */
.plan-toggle-btn-bar:nth-child(1) { transform: rotate(45deg); }
.plan-toggle-btn-bar:nth-child(2) { transform: rotate(-45deg); }
/* Panneau replié → = : barres parallèles */
.memoire-layout.plan-collapsed .plan-toggle-btn-bar:nth-child(1) {
  top: 2px; transform: rotate(0);
}
.memoire-layout.plan-collapsed .plan-toggle-btn-bar:nth-child(2) {
  top: 8px; transform: rotate(0);
}

.toc-column {
  background: var(--ivory-deep);
  border-right: 1px solid var(--rule);
  position: relative;
  min-width: 0;
  transition: opacity 0.2s var(--ease);
}
.memoire-layout.plan-collapsed .toc-column {
  opacity: 0;
  pointer-events: none;
}

.toc-plan {
  padding: 22px 24px;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  min-width: 0;
}
.toc-plan::-webkit-scrollbar { width: 8px; }
.toc-plan::-webkit-scrollbar-track { background: transparent; }
.toc-plan::-webkit-scrollbar-thumb { background: var(--stone-light); }

.toc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 12px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.toc-head-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
}
.toc-head-progress {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.toc-head-progress b { color: var(--brand-accent); font-weight: 500; }

.toc-list { display: flex; flex-direction: column; gap: 1px; padding-right: 12px; }

.toc-item {
  display: grid;
  grid-template-columns: 20px 28px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.2s var(--ease);
  margin-left: -2px;
}
.toc-item:hover { background: var(--ivory); }
.toc-item.active {
  background: var(--ivory);
  border-left-color: var(--brand-accent);
}
.toc-item.level-2 { padding-left: 26px; }
.toc-item.level-3 { padding-left: 40px; }

.toc-state {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  justify-self: center;
}
.toc-state.state-done    { background: var(--ink); }
.toc-state.state-empty   { background: transparent; border: 1px solid var(--stone-light); }
.toc-state.state-warn    { background: var(--brand-accent); }
.toc-state.state-active  { background: var(--ivory); border: 2px solid var(--brand-accent); }

.toc-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--stone);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.toc-item.active .toc-num { color: var(--brand-accent); }

.toc-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-item.level-1 .toc-title { font-size: 15px; font-weight: 500; color: var(--ink); }
.toc-item.level-2 .toc-title { font-size: 13.5px; }
.toc-item.level-3 .toc-title { font-size: 13px; color: var(--stone); }
.toc-item.active .toc-title { color: var(--ink); }

/* ── Panneau éditeur droit (scroll continu) ── */
.memoire-editor {
  padding: 30px 36px 60px;
  min-width: 0;
}

.memoire-section {
  scroll-margin-top: 80px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.memoire-section:last-child { border-bottom: 0; }

.memoire-section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}
.memoire-section-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--brand-accent);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.memoire-section-title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.memoire-section.level-1 .memoire-section-title { font-size: 28px; }
.memoire-section.level-2 .memoire-section-title { font-size: 22px; }
.memoire-section.level-3 .memoire-section-title { font-size: 18px; color: var(--ink-soft); }

.memoire-section.level-1 { padding-top: 16px; border-top: 2px solid var(--ink); margin-top: 24px; }
.memoire-section.level-1:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

.memoire-section-textarea {
  width: 100%;
  padding: 4px 0 4px 16px;
  margin-left: -16px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.78;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  resize: none;
  overflow: hidden;
  display: block;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.memoire-section-textarea:hover { border-left-color: var(--rule); }
.memoire-section-textarea:focus {
  outline: none;
  border-left-color: var(--brand-accent);
  background: var(--ivory-deep);
}
.memoire-section-textarea.is-droptarget {
  outline: 2px dashed #4a90e2;
  outline-offset: -2px;
  background: rgba(74, 144, 226, 0.05);
}

.memoire-section-empty {
  padding: 14px 0 14px 16px;
  margin-left: -16px;
  border-left: 2px solid var(--rule);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-style: italic;
  color: var(--stone-light);
}
.memoire-section-empty::before {
  content: "↳ ";
  font-family: var(--font-mono);
  font-style: normal;
  margin-right: 4px;
  color: var(--stone-light);
}

/* ── Toggle Édition / Aperçu par section ── */
.memoire-section-mode {
  margin-left: auto;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  background: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
  align-self: center;
}
.memoire-section-mode:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--ivory-deep);
}

/* ── Aperçu markdown rendu ── */
.memoire-section-preview {
  padding: 4px 0 4px 16px;
  margin-left: -16px;
  border-left: 2px solid var(--rule);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.78;
  color: var(--ink);
}
.memoire-section-preview > *:first-child { margin-top: 0; }
.memoire-section-preview > *:last-child { margin-bottom: 0; }
.memoire-section-preview p {
  margin: 0 0 1em;
}
.memoire-section-preview strong {
  font-weight: 600;
  color: var(--ink);
}
.memoire-section-preview em {
  font-style: italic;
  color: var(--ink-soft);
}
.memoire-section-preview a {
  color: var(--brand-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.memoire-section-preview a:hover {
  color: var(--brand-accent-deep);
}
.memoire-section-preview ul,
.memoire-section-preview ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}
.memoire-section-preview li {
  margin-bottom: 0.35em;
}
.memoire-section-preview ul li::marker {
  color: var(--brand-accent);
}
.memoire-section-preview ol li::marker {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--stone);
}
.memoire-section-preview h1,
.memoire-section-preview h2,
.memoire-section-preview h3,
.memoire-section-preview h4 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 1.4em 0 0.5em;
}
.memoire-section-preview h1 { font-size: 22px; }
.memoire-section-preview h2 { font-size: 19px; }
.memoire-section-preview h3 { font-size: 16px; color: var(--ink-soft); }
.memoire-section-preview h4 { font-size: 14px; color: var(--ink-soft); font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.memoire-section-preview blockquote {
  margin: 0 0 1em;
  padding: 8px 16px;
  border-left: 3px solid var(--brand-accent);
  color: var(--ink-soft);
  font-style: italic;
  background: var(--ivory-deep);
}
.memoire-section-preview code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1px 5px;
  background: var(--ivory-deep);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}
.memoire-section-preview pre {
  margin: 0 0 1em;
  padding: 12px 14px;
  background: var(--ivory-deep);
  border: 1px solid var(--rule);
  overflow-x: auto;
}
.memoire-section-preview pre code {
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 13px;
}
.memoire-section-preview table {
  width: 100%;
  margin: 0 0 1em;
  border-collapse: collapse;
  font-size: 14px;
}
.memoire-section-preview th,
.memoire-section-preview td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.memoire-section-preview th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  border-bottom: 1px solid var(--ink);
  background: var(--ivory-deep);
}
.memoire-section-preview hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.4em 0;
}

/* ══════════════════════════════════════════════════════════
   HOME — liste dossiers (repliable)
   ══════════════════════════════════════════════════════════ */

.dossier-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
}
.dossier-filters {
  display: flex;
  gap: 4px;
  padding-bottom: 8px;
}
.dossier-filter {
  padding: 9px 20px 9px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dossier-filter:hover { color: var(--ink); background: var(--ivory-deep); }
.dossier-filter.active {
  color: var(--ink);
  background: var(--ink);
  border-color: var(--ink);
}
.dossier-filter.active,
.dossier-filter.active .dossier-filter-count {
  color: var(--ivory);
}
.dossier-filter-count {
  color: var(--stone-light);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 0;
  font-size: 10px;
  line-height: 1.3;
}
.dossier-filter.active .dossier-filter-count {
  border-color: var(--ivory);
}

.dossier-toolbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 10px;
}

.dossier-sort {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
}
.dossier-sort-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 7px 28px 7px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background-color: var(--ivory);
  border: 1px solid var(--ink);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%231a1a1a' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}
.dossier-sort-select:hover { background-color: var(--ivory-deep); }
.dossier-sort-select:focus { outline: none; box-shadow: inset 0 0 0 1px var(--ink); }

.dossier-expand-all {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}
.dossier-expand-all:hover { color: var(--ink); }

.home-cta { display: flex; gap: 10px; }

/* ── Dossier : groupe repliable ── */
.dossier-list { display: flex; flex-direction: column; gap: 4px; }

.dossier-group { border-bottom: 1px solid var(--rule); transition: margin 0.2s var(--ease); }
.dossier-group:first-child { border-top: 1px solid var(--rule); }

.dossier-group.open { margin: 10px 0; }

.dossier-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 18px 18px;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
  background: none;
  border-left: 3px solid transparent;
  width: 100%;
  text-align: left;
}
.dossier-header:hover { background: var(--ivory-deep); }
.dossier-group.open > .dossier-header {
  background: var(--ivory-deep);
  border-left-color: var(--brand-accent);
}

.dh-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: baseline;
  gap: 12px;
}
.dossier-header-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dh-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.04em;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dh-meta span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--stone-light);
}

.sb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}
.sbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1.2;
}
.sbl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.sbl-brouillon { color: var(--stone); background: color-mix(in srgb, var(--stone) 10%, var(--ivory)); }
.sbl-soumis    { color: var(--brand-primary); background: color-mix(in srgb, var(--brand-primary) 12%, var(--ivory)); }
.sbl-remporte  { color: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--ivory)); }
.sbl-perdu     { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--ivory)); }
.sbl-abandonne { color: var(--stone-light); background: var(--ivory-sunk); }
.sbl-abandonne .sbl-dot { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }

.dossier-header-toggle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 300;
  color: var(--stone);
  transition: transform 0.25s var(--ease), color 0.2s var(--ease);
}
.dossier-group.open .dossier-header-toggle { transform: rotate(45deg); color: var(--brand-accent); }

.dossier-header-delete {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--stone);
  opacity: 0;
  transition: opacity 0.15s var(--ease), color 0.15s var(--ease);
  padding: 0;
}
.dossier-group:hover .dossier-header-delete { opacity: 0.45; }
.dossier-header-delete:hover { opacity: 1 !important; color: var(--danger, #dc2626); }

@media (max-width: 700px) {
  .dh-meta { gap: 8px; font-size: 10.5px; }
}

/* ── Contenu déplié ── */
.dossier-body {
  display: none;
  padding: 8px 18px 20px 40px;
  margin-bottom: 0;
  background: var(--ivory-deep);
  border-left: 3px solid var(--brand-accent);
}
.dossier-group.open > .dossier-body { display: block; }

.dossier-new-lot {
  padding: 12px 20px;
  border-top: 1px solid var(--ink-soft, #f3f1ec);
}
.home-new-lot-btn {
  background: transparent;
  border: 1px dashed var(--stone, #8a867d);
  color: var(--ink, #1b1a17);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.home-new-lot-btn:hover {
  background: var(--ink-soft, #f3f1ec);
}

/* ── Ligne de lot (dans le dossier déplié) ── */
.lot-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  align-items: stretch;
  gap: 0;
  margin: 0 -4px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--stone-light);
  transition: all 0.15s var(--ease);
  width: calc(100% + 8px);
  position: relative;
}
.lot-row + .lot-row { margin-top: 4px; }
.lot-row:hover {
  background: var(--ivory-deep);
  border-color: var(--stone-light);
}
.lot-row.state-brouillon { border-left-color: var(--stone); }
.lot-row.state-soumis    { border-left-color: var(--brand-primary); }
.lot-row.state-remporte  { border-left-color: var(--success); }
.lot-row.state-perdu     { border-left-color: var(--danger); }
.lot-row.state-abandonne { border-left-color: var(--stone-light); opacity: 0.72; }

.lot-row-click {
  display: grid;
  grid-template-columns: 1fr 80px;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.lot-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.lot-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lot-row-head .badge-famille {
  font-size: 9px;
  padding: 2px 6px;
  letter-spacing: 0.14em;
  cursor: default;
}
.lot-row-label {
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lot-row-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--brand-accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lot-row-global .lot-row-code { color: var(--stone); }

.lot-row-state {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 16px;
  border-left: 1px dashed var(--rule);
}

.lot-state-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 0;
  padding: 7px 26px 7px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  grid-row: 1;
  justify-self: start;
  min-width: 112px;
}
.lot-state-select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--ink);
}

/* Chaque état : fond pastel + texte couleur état + chevron assorti */
.state-brouillon .lot-state-select {
  background-color: color-mix(in srgb, var(--stone) 14%, var(--ivory));
  color: var(--ink-soft);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%233c3c3a' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
}
.state-soumis .lot-state-select {
  background-color: color-mix(in srgb, var(--brand-primary) 14%, var(--ivory));
  color: var(--brand-primary);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%231F497D' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
}
.state-remporte .lot-state-select {
  background-color: color-mix(in srgb, var(--success) 16%, var(--ivory));
  color: var(--success);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%233d7a4e' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
}
.state-perdu .lot-state-select {
  background-color: color-mix(in srgb, var(--danger) 14%, var(--ivory));
  color: var(--danger);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23a83232' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
}
.state-abandonne .lot-state-select {
  background-color: var(--ivory-sunk);
  color: var(--stone-light);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%239e9a90' stroke-width='1.5'><path d='M1 1l4 4 4-4'/></svg>");
}
.lot-state-select:hover {
  filter: brightness(0.96);
}

.lot-state-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stone-light);
  letter-spacing: 0.03em;
  padding-left: 2px;
}

.lot-row-status {
  text-align: right;
}
.lot-status-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.lot-status-val.sc-step {
  color: var(--stone, #888);
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lot-status-val.sc-empty { color: var(--stone-light, #888); }
.lot-status-val.sc-error { color: var(--danger, #c0432a); }
.lot-status-val.sc-done  { color: var(--success, #2d7a3f); }
.lot-status-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--stone);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lot-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0;
  color: var(--stone);
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.lot-row:hover .lot-delete-btn { opacity: 0.45; }
.lot-delete-btn:hover { opacity: 1 !important; color: var(--danger, #dc2626); }

@media (max-width: 700px) {
  .lot-row { grid-template-columns: 1fr; }
  .lot-row-state { border-left: 0; border-top: 1px dashed var(--rule); }
}

/* ══════════════════════════════════════════════════════════
   01 DOCUMENTS — résumé catégoriel, toolbar compact, footer CTA
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   01 DOCUMENTS — Stage 2 colonnes : index lots + main
   ══════════════════════════════════════════════════════════ */
.docs-stage {
  display: grid;
  grid-template-columns: 240px 1fr;
  margin: 24px -32px -32px;
  border-top: 1px solid var(--ink);
}
.docs-stage.monolot { grid-template-columns: 1fr; }

/* ── Index lots (sidebar gauche) ── */
.lots-index {
  border-right: 1px solid var(--rule-strong);
  padding: 22px 0;
  background: var(--ivory);
  display: flex;
  flex-direction: column;
}
.lots-index-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 0 24px;
}
.lots-index-head {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding: 0 24px 14px;
  margin-top: 2px;
  border-bottom: 1px solid var(--rule);
}
.lots-index-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}
.lot-card {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 11px 24px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.15s var(--ease);
  position: relative;
  overflow: hidden;
}
.lot-card:hover { background: var(--ivory-deep); }
.lot-card.active {
  background: var(--ink);
  color: var(--ivory);
}
.lot-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand-accent);
}
.lot-card .lot-name {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.lot-card .lot-sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.lot-card.active .lot-sub { color: var(--ivory); }
/* ── Colonne principale ── */
.docs-main {
  padding: 24px 32px 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Hero compact du lot sélectionné */
.lot-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}
.lot-head-title {
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.lot-tag {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.view-title .lot-tag {
  display: inline-block;
  margin-left: 12px;
  font-family: var(--font-mono, monospace);
  font-size: 0.55em;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  background: var(--ink-soft, #f3f1ec);
  color: var(--ink, #1b1a17);
  vertical-align: 0.2em;
}
.view-title .lot-tag[hidden] {
  display: none;
}
.lot-tag-sub {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}
.lot-tag-sub:empty { display: none; }
.lot-head-stats {
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--stone);
}
.lot-head-stats b {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-right: 5px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.lot-head-stats .stat-accent b { color: var(--brand-accent); }

/* Toolbar : tabs gauche · actions droite */
.docs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--rule);
}
.docs-tabs {
  display: inline-flex;
  border: 1px solid var(--rule);
  background: var(--ivory);
}
.docs-tab {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 9px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.docs-tab + .docs-tab { border-left: 1px solid var(--rule); }
.docs-tab:hover { background: var(--ivory-deep); color: var(--ink); }
.docs-tab.active {
  background: var(--ink);
  color: var(--ivory);
}
.docs-tab.active + .docs-tab,
.docs-tab:has(+ .docs-tab.active) { border-color: var(--ink); }
.docs-tab-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 2px;
  line-height: 1;
}
.docs-tab.active .docs-tab-num { background: rgba(250, 248, 244, 0.18); }
.docs-toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
/* Bouton Légende CCTP (toolbar) */
.legend-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-toggle:hover { color: var(--ink); border-color: var(--ink); }
.legend-toggle.open { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.legend-toggle-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  position: relative;
}
.legend-toggle-mark::before,
.legend-toggle-mark::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.legend-toggle-mark::before { left: 4px; top: 0; bottom: 0; width: 2px; }
.legend-toggle-mark::after  { top: 4px; left: 0; right: 0; height: 2px; }
.legend-toggle.open .legend-toggle-mark::before { display: none; }

/* Section head dans la grille (LOT XX / Hors lot) */
.docs-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 0 8px;
}
.docs-section-mark {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--ink);
  color: var(--ivory);
  font-weight: 600;
}
.docs-section-head.muted .docs-section-mark {
  background: transparent;
  color: var(--stone);
  border: 1px solid var(--rule);
}
.docs-section-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.docs-section-head.muted .docs-section-title { color: var(--stone); }
.docs-section-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--stone);
}

/* CTA finale — encre + accent rouille */
.docs-cta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 24px;
  margin: 24px 0 0;
  background: var(--ink);
  color: var(--ivory);
  position: relative;
  border-top: 3px solid var(--brand-accent);
}
.docs-cta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--brand-accent);
}
.docs-cta-num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--ivory);
  padding-left: 8px;
  font-variant-numeric: tabular-nums;
}
.docs-cta-text { display: flex; flex-direction: column; gap: 2px; }
.docs-cta-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
  color: var(--ivory);
}
.docs-cta-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone-light);
}
.docs-cta-actions { display: flex; gap: 14px; align-items: center; }
.docs-cta-force {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone-light);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.docs-cta-force input { accent-color: var(--brand-accent); }

.btn-launch {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--brand-accent);
  color: var(--ivory);
  padding: 12px 22px;
  border: 0;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}
.btn-launch:hover { background: var(--brand-accent-deep); }

@media (max-width: 1100px) {
  .docs-stage:not(.monolot) { grid-template-columns: 200px 1fr; }
}

/* ══════════════════════════════════════════════════════════
   02 EXTRACTIONS — layout liste + contenu
   ══════════════════════════════════════════════════════════ */
.extractions-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 640px;
  border-top: 1px solid var(--rule);
  margin: -28px -32px -32px;
}
.extractions-list {
  background: var(--ivory-deep);
  border-right: 1px solid var(--rule);
  padding: 22px 12px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}
.extractions-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone-light);
  padding: 10px 10px 6px;
}
.extraction-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  width: 100%;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s var(--ease);
}
.extraction-item:hover { background: var(--ivory); }
.extraction-item.active {
  background: var(--ivory);
  border-left-color: var(--brand-accent);
}
.extraction-item-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-accent);
  padding: 3px 6px;
  border: 1px solid var(--brand-accent);
  text-align: center;
}
.extraction-item-name {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.extraction-item-analyse .extraction-item-cat { color: var(--ink); border-color: var(--ink); }

.extraction-content {
  padding: 30px 36px 36px;
  min-width: 0;
  overflow-x: auto;
}
.extraction-content-head {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.extraction-content-crumb {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--stone);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.extraction-content-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}

.extraction-block { margin-bottom: 32px; }
.extraction-block-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand-accent);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

/* Liste clé-valeur */
.kv-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
}
.kv-list > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--rule);
}
.kv-list > div:last-child { border-bottom: 0; }
.kv-list dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--stone);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.kv-list dd {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  margin: 0;
}

/* Tableau de données */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stone);
  border-bottom: 1px solid var(--ink);
  background: var(--ivory-deep);
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.5;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* Liste simple */
.simple-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.simple-list li {
  padding: 8px 0 8px 20px;
  position: relative;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.55;
  border-bottom: 1px dotted var(--rule);
}
.simple-list li:last-child { border-bottom: 0; }
.simple-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--brand-accent);
  font-family: var(--font-mono);
}

/* Anomalie card */
.anomaly-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: var(--ivory-deep);
  border-left: 3px solid var(--warning);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
}
.anomaly-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--warning);
  padding: 3px 8px;
  border: 1px solid var(--warning);
}

/* Status dot */
.status-dot {
  font-size: 14px;
  line-height: 1;
}
.status-dot.s-ok    { color: var(--success); }
.status-dot.s-warn  { color: var(--warning); }
.status-dot.s-error { color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   03 RÉFÉRENCES — cards scorées
   ══════════════════════════════════════════════════════════ */
.reference-card {
  padding: 22px 24px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  margin-bottom: 14px;
  transition: all 0.2s var(--ease);
}
.reference-card:hover {
  background: var(--ivory-deep);
  border-color: var(--stone-light);
}
.reference-primary {
  border-left: 3px solid var(--brand-accent);
  background: linear-gradient(to right, rgba(184, 92, 46, 0.04), transparent 120px);
}

.reference-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}
.reference-reco {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand-accent);
  margin-bottom: 6px;
}
.reference-reco-secondary { color: var(--stone); }
.reference-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  line-height: 1.2;
}
.reference-meta {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--stone);
  line-height: 1.5;
}
.reference-meta b { color: var(--ink); font-weight: 500; font-family: var(--font-mono); font-size: 12px; }

.reference-score {
  text-align: right;
  flex-shrink: 0;
}
.reference-score-val {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  color: var(--brand-accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.reference-score-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stone);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-top: 4px;
}

/* ── Vue Extractions ── */
/* ── Vue Extractions — atelier éditorial ── */

.ext-head { align-items: flex-end; }
.ext-stats {
  display: flex;
  gap: 0;
  border-left: 1px solid var(--rule);
}
.ext-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 18px;
  border-right: 1px solid var(--rule);
  min-width: 84px;
}
.ext-stat:last-child { border-right: none; padding-right: 4px; }
.ext-stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ext-stat-num.mono { font-family: var(--font-mono); font-size: 18px; padding: 4px 0; letter-spacing: 0.02em; }
.ext-stat-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  margin-top: 6px;
}
.ext-stat-accent .ext-stat-num { color: var(--brand-accent); }

.ext-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  min-height: 600px;
  position: relative;
  background: var(--ivory);
}

/* Rail gauche — fichiers groupés par catégorie */
.ext-rail {
  border-right: 1px solid var(--rule);
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
}
.ext-rail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--rule);
}
.ext-rail-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}
.ext-rail-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-accent);
  font-variant-numeric: tabular-nums;
}
.ext-rail-body {
  flex: 1;
  overflow-y: auto;
  max-height: 720px;
  padding: 4px 0 16px;
}
.ext-rail-empty {
  padding: 32px 20px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--stone);
  text-align: center;
}

.ext-group {
  padding: 8px 0;
}
.ext-group + .ext-group { border-top: 1px solid var(--rule); }
.ext-group-head {
  padding: 8px 20px 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ext-group-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}
.ext-group-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

.ext-file-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 9px 20px 9px 12px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  position: relative;
  border-left: 2px solid transparent;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.ext-file-row:hover { background: var(--ivory-deep); color: var(--ink); }
.ext-file-cat {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  text-align: center;
  padding: 2px 4px;
  border: 1px solid var(--rule);
  background: var(--ivory);
  align-self: center;
  font-variant-numeric: tabular-nums;
}
.ext-file-label {
  font-family: var(--font-body);
  line-height: 1.35;
  word-break: break-word;
  align-self: center;
}
.ext-file-row.active {
  background: var(--ivory-deep);
  border-left-color: var(--brand-accent);
  color: var(--ink);
}
.ext-file-row.active .ext-file-cat {
  color: var(--ivory);
  background: var(--brand-accent);
  border-color: var(--brand-accent);
}
.ext-file-row.active .ext-file-label { font-weight: 500; }

/* Tab dossier-wide : rail masquée, pane pleine largeur */
.ext-shell[data-scope="dossier"] {
  grid-template-columns: 1fr;
}
.ext-shell[data-scope="dossier"] .ext-rail {
  display: none;
}

/* Pane droit */
.ext-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--ivory);
}
.ext-tabs {
  display: flex;
  border-bottom: 1px solid var(--rule);
  background: var(--ivory);
  padding: 0 4px;
}
.ext-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 22px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
  text-align: left;
}
.ext-tab-scope {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone-light);
  font-weight: 500;
}
.ext-tab-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--stone);
  line-height: 1.1;
}
.ext-tab:hover .ext-tab-label { color: var(--ink); }
.ext-tab:hover .ext-tab-scope { color: var(--stone); }
.ext-tab.active {
  border-bottom-color: var(--brand-accent);
}
.ext-tab.active .ext-tab-label { color: var(--ink); }
.ext-tab.active .ext-tab-scope { color: var(--brand-accent); }

.ext-content {
  padding: 28px 36px 36px;
  overflow-y: auto;
  max-height: 760px;
  min-height: 0;
}
.ext-pane-empty {
  padding: 64px 32px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--stone);
  text-align: center;
}

/* File head — éditorial */
.ext-file-head {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}
.ext-file-meta {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ext-file-cat-tag {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ivory);
  background: var(--ink);
  padding: 3px 9px;
}
.ext-file-path {
  font-size: 11px;
  color: var(--stone);
  word-break: break-all;
  letter-spacing: 0.02em;
}
.ext-file-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

@media (max-width: 1024px) {
  .ext-stats { display: none; }
  .ext-shell { grid-template-columns: 1fr; }
  .ext-rail { border-right: 0; border-bottom: 1px solid var(--rule); max-height: 320px; }
  .ext-content { padding: 24px 18px 28px; max-height: none; }
  .ext-tab { padding: 12px 14px 10px; }
  .ext-tab-label { font-size: 13px; }
  .ext-file-name { font-size: 22px; }
}
.ext-json {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ivory-deep);
  padding: 14px 16px;
  border: 1px solid var(--rule);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.ext-analyse h3 { font-family: var(--font-display, var(--font-body)); font-size: 20px; margin: 0 0 4px; color: var(--ink); }
.ext-analyse h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  margin: 24px 0 10px;
}
.ext-analyse p.muted { color: var(--stone); margin: 0 0 16px; }
.ext-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ext-table th, .ext-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ext-table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--stone);
  font-weight: 400;
}
.ext-raw { margin-top: 24px; }
.ext-raw summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  padding: 8px 0;
}

/* ── Rendu CCAP ── */
.ccap { font-size: 13px; color: var(--ink); line-height: 1.55; }
.ccap-hero {
  background: var(--ivory-deep);
  padding: 16px 18px;
  border-left: 3px solid var(--brand-accent);
  margin-bottom: 28px;
}
.ccap-hero h3 {
  font-family: var(--font-display, var(--font-body));
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--ink);
}
.ccap-hero p { color: var(--stone); margin: 0 0 12px; font-size: 13px; }
.ccap-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ccap-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}
.ccap-chip-label { color: var(--stone); margin-right: 6px; }

.ccap-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2.4fr;
  gap: 6px 20px;
  margin: 0 0 12px;
}
.ccap-meta dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone);
  padding-top: 2px;
}
.ccap-meta dd { margin: 0; color: var(--ink); }

.ccap-subhead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
  text-transform: none;
  margin: 28px 0 12px;
  padding: 10px 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-wrap: balance;
}
.ccap-subhead::before {
  content: '§';
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--brand-accent);
  flex-shrink: 0;
}
.ccap-subhead:first-child,
.ccap > .ccap-subhead:first-of-type,
.sec-collapse-body > .ccap-subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.ccap-subsec { margin-bottom: 16px; }
.ccap-subsec:last-child { margin-bottom: 0; }

.ccap-bool-true  { color: var(--success); font-weight: 600; }
.ccap-bool-false { color: var(--danger);  font-weight: 600; }
.ccap-bool-null  { color: var(--stone-light); }
.ccap-src { font-size: 10.5px; color: var(--stone); }

.ccap-alert {
  border-left: 3px solid var(--stone-light);
  background: var(--ivory-deep);
  padding: 10px 14px;
  margin: 0 0 8px;
}
.ccap-alert.g-CRITIQUE  { border-left-color: var(--danger); }
.ccap-alert.g-ATTENTION { border-left-color: var(--warning); }
.ccap-alert.g-INFO      { border-left-color: var(--stone-light); }
.ccap-alert-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--stone);
  margin-bottom: 4px;
}
.ccap-alert-grav {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ccap-alert.g-CRITIQUE  .ccap-alert-grav { color: var(--danger); }
.ccap-alert.g-ATTENTION .ccap-alert-grav { color: var(--warning); }

.ccap-imp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  color: var(--stone);
}
.ccap-imp.i-HAUTE { color: var(--brand-accent); border-color: var(--brand-accent); }

.ccap-clause { border-top: 1px solid var(--rule); padding: 10px 0; }
.ccap-clause:first-child { border-top: none; padding-top: 0; }
.ccap-clause-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.ccap-clause-art { font-size: 11px; color: var(--stone); font-weight: 400; }
.ccap-sub { color: var(--ink-soft); margin: 4px 0 0; }

.ccap-poste { margin-bottom: 16px; }
.ccap-poste-nom {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.ccap-formule {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--ivory-deep);
  padding: 10px 14px;
  border-left: 2px solid var(--stone-light);
  margin: 6px 0 10px;
  white-space: pre-wrap;
}

.ccap-list { margin: 4px 0 12px; padding-left: 20px; }
.ccap-list li { margin: 3px 0; }

.ccap-flags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
  margin: 0 0 12px;
}
.ccap-flag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  font-size: 12.5px;
}

.ccap-fold { margin: 6px 0 10px; }
.ccap-fold summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--stone);
  padding: 6px 0;
}
.ccap-fold[open] summary { color: var(--ink); }

/* ── Vue Références — fiches éditoriales ── */

.ref-empty {
  padding: 64px 32px;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--stone);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Header avec stats compactes */
.ref-head { align-items: flex-end; }
.ref-headstats {
  display: flex;
  gap: 0;
  border-left: 1px solid var(--rule);
}
.ref-headstat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 18px;
  border-right: 1px solid var(--rule);
  min-width: 84px;
}
.ref-headstat:last-child { border-right: none; padding-right: 4px; }
.ref-headstat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ref-headstat-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  margin-top: 6px;
}
.ref-headstat-accent .ref-headstat-num { color: var(--brand-accent); }

/* Pile de fiches (1 colonne) */
.ref-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
  border-top: 1px solid var(--ink);
}
.ref-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  background: var(--ivory);
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background 0.25s var(--ease);
}
.ref-card:hover { background: var(--ivory-deep); }
.ref-card::before {
  content: '';
  position: absolute;
  left: 88px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

/* Rail gauche : rang + kind + priorité, vertical */
.ref-rail {
  padding: 28px 0 28px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.ref-rail-rank {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ref-rail-kind {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
}
.ref-rail-prio {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px 3px 0;
  color: var(--stone);
  border-top: 1px solid var(--rule);
  width: 100%;
  margin-top: auto;
}
.ref-prio-HAUTE  { color: var(--brand-accent); }
.ref-prio-MOYENNE { color: var(--ink-soft); }
.ref-prio-BASSE  { color: var(--stone-light); }

/* Corps de fiche */
.ref-body {
  padding: 28px 32px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.ref-head-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-start;
  gap: 32px;
}
.ref-head-text { min-width: 0; }
.ref-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin-bottom: 8px;
  text-wrap: balance;
}
.ref-file {
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.02em;
  word-break: break-all;
}

/* Score : monument typographique */
.ref-score {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: baseline;
  gap: 0 4px;
  text-align: right;
  position: relative;
  padding-left: 18px;
}
.ref-score::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 18px;
  width: 1px;
  background: var(--rule);
}
.ref-score-num {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 56px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  grid-row: 1;
  grid-column: 1;
}
.ref-card.sc-good .ref-score-num { color: var(--ink); }
.ref-card.sc-medium .ref-score-num { color: var(--brand-accent); }
.ref-card.sc-low .ref-score-num { color: var(--stone); }
.ref-score-of {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--stone);
  align-self: flex-end;
  padding-bottom: 6px;
  grid-row: 1;
  grid-column: 2;
}
.ref-score-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
  margin-top: 6px;
  grid-row: 2;
  grid-column: 1 / -1;
}

/* Scoring : 6 dimensions sur 2 colonnes */
.ref-scoring {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 36px;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}
.ref-dim {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ref-dim-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.ref-dim-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.ref-dim-points {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ref-dim-pts {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.ref-dim-sep {
  color: var(--stone-light);
  margin: 0 1px;
}
.ref-dim-max {
  font-size: 11px;
  color: var(--stone);
}
.ref-bar {
  height: 3px;
  background: var(--ivory-sunk);
  position: relative;
  overflow: hidden;
}
.ref-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  transform-origin: left center;
  animation: ref-bar-grow 0.6s var(--ease) both;
  animation-delay: 0.15s;
}
.ref-bar-fill.bar-mid { background: var(--brand-accent); }
.ref-bar-fill.bar-low { background: var(--stone-light); }
@keyframes ref-bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.ref-dim-just {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0;
  text-wrap: pretty;
}

/* Stratégie repliable */
.ref-strat {
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}
.ref-strat-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  transition: color 0.2s var(--ease);
}
.ref-strat-head::-webkit-details-marker { display: none; }
.ref-strat-head::marker { content: ''; }
.ref-strat-head:hover { color: var(--brand-accent); }
.ref-strat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  transition: color 0.2s var(--ease);
}
.ref-strat-head:hover .ref-strat-label { color: var(--ink); }
.ref-strat-toggle {
  position: relative;
  width: 12px;
  height: 12px;
}
.ref-strat-toggle::before,
.ref-strat-toggle::after {
  content: '';
  position: absolute;
  background: var(--stone);
  transition: transform 0.25s var(--ease), background 0.2s var(--ease);
}
.ref-strat-toggle::before {
  left: 0; right: 0;
  top: 50%; height: 1px;
  transform: translateY(-50%);
}
.ref-strat-toggle::after {
  top: 0; bottom: 0;
  left: 50%; width: 1px;
  transform: translateX(-50%);
}
.ref-strat[open] .ref-strat-toggle::after { transform: translateX(-50%) scaleY(0); }
.ref-strat-head:hover .ref-strat-toggle::before,
.ref-strat-head:hover .ref-strat-toggle::after { background: var(--ink); }

.ref-strat-body {
  padding: 12px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ref-strat-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink);
}
.ref-strat-tag,
.ref-angle-tag,
.ref-erreur-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
}
.ref-strat-meta-val { line-height: 1.5; }

.ref-angles {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ref-angle {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px dotted var(--rule);
}
.ref-angle:first-child { border-top: none; padding-top: 0; }
.ref-angle-head {
  display: contents;
}
.ref-angle-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  line-height: 1;
  color: var(--brand-accent);
  font-variant-numeric: tabular-nums;
}
.ref-angle-title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 6px;
  align-self: baseline;
}
.ref-angle-lien {
  grid-column: 2;
  font-size: 12.5px;
  color: var(--stone);
  line-height: 1.5;
  margin-bottom: 8px;
}
.ref-angle-tag { margin-right: 6px; color: var(--brand-accent); }
.ref-angle-formul {
  grid-column: 2;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  border-left: 2px solid var(--ink);
  padding: 4px 0 4px 14px;
  margin: 0;
  text-wrap: pretty;
  quotes: '«\\00a0' '\\00a0»';
}
.ref-angle-formul::before { content: open-quote; color: var(--stone-light); }
.ref-angle-formul::after { content: close-quote; color: var(--stone-light); }

/* Annexe : notes de méthode */
.ref-meta {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--ink);
}
.ref-meta-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 28px;
}
.ref-meta-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-accent);
}
.ref-meta-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.018em;
  line-height: 1;
  color: var(--ink);
}
.ref-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  border-top: 1px solid var(--rule);
}
.ref-meta-block {
  padding: 24px 28px 28px 0;
  border-right: 1px solid var(--rule);
}
.ref-meta-block:last-child { border-right: none; padding-right: 0; }
.ref-meta-block-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.ref-meta-block-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--brand-accent);
  width: 18px;
  text-align: center;
  border: 1px solid var(--brand-accent);
  border-radius: 50%;
  padding: 2px 0;
  line-height: 1;
}
.ref-meta-block-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.2;
}
.ref-meta-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stone);
  font-weight: 400;
  margin-left: 4px;
}
.ref-meta-block-body { font-size: 13px; line-height: 1.55; color: var(--ink-soft); }

.ref-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: ref-li;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ref-list-num li {
  counter-increment: ref-li;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: baseline;
}
.ref-list-num li::before {
  content: counter(ref-li, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--brand-accent);
  font-weight: 500;
  padding-top: 2px;
}

.ref-bareme {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ref-bareme-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 12px;
  align-items: center;
}
.ref-bareme-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.ref-bareme-bar {
  height: 6px;
  background: var(--ivory-sunk);
  position: relative;
  overflow: hidden;
}
.ref-bareme-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  animation: ref-bar-grow 0.6s var(--ease) both;
  animation-delay: 0.2s;
  transform-origin: left center;
}
.ref-bareme-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ref-bareme-note {
  margin-top: 18px;
  padding: 14px 16px 14px 18px;
  background: var(--ivory-deep);
  border-left: 2px solid var(--brand-accent);
}
.ref-bareme-note-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-accent);
  margin-bottom: 6px;
}
.ref-bareme-note p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
}

.ref-erreur {
  padding: 14px 0;
  border-top: 1px dotted var(--rule);
}
.ref-erreur:first-child { border-top: none; padding-top: 0; }
.ref-erreur-title {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 8px;
}
.ref-erreur-aos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ref-erreur-ao {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  background: var(--ivory-deep);
  border: 1px solid var(--rule);
  color: var(--stone);
}
.ref-erreur-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 4px 0;
}
.ref-erreur-tag.accent { color: var(--brand-accent); }

.ref-json {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--ivory-deep);
  padding: 14px;
  border: 1px solid var(--rule);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1024px) {
  .ref-headstats { display: none; }
  .ref-card { grid-template-columns: 64px 1fr; }
  .ref-card::before { left: 64px; }
  .ref-rail { padding: 22px 0 22px 4px; }
  .ref-rail-rank { font-size: 28px; }
  .ref-body { padding: 22px 20px 24px; gap: 20px; }
  .ref-head-card { grid-template-columns: 1fr; gap: 18px; }
  .ref-score { padding-left: 0; text-align: left; }
  .ref-score::before { display: none; }
  .ref-score-num { font-size: 44px; }
  .ref-scoring { grid-template-columns: 1fr; gap: 18px; padding-top: 18px; }
  .ref-meta-grid { grid-template-columns: 1fr; gap: 0; }
  .ref-meta-block { border-right: none; border-bottom: 1px solid var(--rule); padding: 22px 0; }
  .ref-meta-block:last-child { border-bottom: none; }
}

/* ── Sections collapsibles (extractions fichier + analyse DCE) ── */

.ana-analyse,
.ana-dossier,
.ccap,
.ana-analyse .ana-critere,
.ana-dossier .ana-critere {
  counter-reset: section;
}
.sec-collapse {
  border-top: 1px solid var(--rule);
  counter-increment: section;
  position: relative;
  transition: background 0.18s var(--ease);
}
.ana-analyse .sec-collapse:last-of-type,
.ana-dossier .sec-collapse:last-of-type,
.ccap > .sec-collapse:last-of-type { border-bottom: 1px solid var(--rule); }

.sec-collapse[open] {
  background: linear-gradient(90deg, rgba(184, 92, 46, 0.04) 0%, rgba(184, 92, 46, 0) 60%);
}

.sec-collapse-head {
  list-style: none;
  cursor: pointer;
  padding: 16px 6px 14px 8px;
  user-select: none;
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: center;
  gap: 16px;
  transition: color 0.15s var(--ease);
  position: sticky;
  top: 0;
  background: var(--ivory);
  z-index: 2;
}
.sec-collapse[open] > .sec-collapse-head {
  background: var(--ivory);
  border-bottom: 1px solid var(--ink);
}
.sec-collapse-head::-webkit-details-marker { display: none; }
.sec-collapse-head::marker { content: ''; }

/* Numéro chapitré (01, 02, 03…) */
.sec-collapse-head::before {
  content: counter(section, decimal-leading-zero);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--stone-light);
  font-variant-numeric: tabular-nums;
  transition: color 0.18s var(--ease);
}
.sec-collapse[open] > .sec-collapse-head::before { color: var(--brand-accent); }
.sec-collapse-head:hover::before { color: var(--ink); }
.sec-collapse[open] > .sec-collapse-head:hover::before { color: var(--brand-accent-deep); }

/* Titre */
.sec-collapse-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
  transition: color 0.15s var(--ease);
}
.sec-collapse[open] > .sec-collapse-head .sec-collapse-title { color: var(--ink); }
.sec-collapse-head:hover .sec-collapse-title { color: var(--ink); }

/* Chip count */
.sec-collapse-count {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--brand-accent);
  padding: 3px 9px;
  border: 1px solid var(--rule);
  background: var(--ivory);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: center;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.sec-collapse-count.is-empty {
  color: var(--stone-light);
  background: var(--ivory-deep);
}
.sec-collapse[open] > .sec-collapse-head .sec-collapse-count {
  border-color: var(--brand-accent);
}
.sec-collapse-head:hover .sec-collapse-count {
  border-color: var(--ink);
  color: var(--ink);
}
.sec-collapse[open] > .sec-collapse-head:hover .sec-collapse-count {
  border-color: var(--brand-accent-deep);
  color: var(--brand-accent-deep);
}

/* Toggle +/− à droite */
.sec-collapse-head::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--stone);
  width: 14px;
  text-align: center;
  line-height: 1;
  transition: color 0.15s var(--ease), transform 0.25s var(--ease);
}
.sec-collapse[open] > .sec-collapse-head::after {
  content: '−';
  color: var(--brand-accent);
}
.sec-collapse-head:hover::after { color: var(--ink); }
.sec-collapse[open] > .sec-collapse-head:hover::after { color: var(--brand-accent-deep); }

.sec-collapse-body { padding: 16px 6px 28px 46px; }

.ana-note-totale {
  font-size: 13px;
  color: var(--stone);
  margin-bottom: 14px;
}
.ana-critere {
  border: 1px solid var(--rule);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--ivory-deep);
}
.ana-critere-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 8px;
}
.ana-critere-titre { font-weight: 600; font-size: 14px; color: var(--ink); }
.ana-critere-pond {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--brand-primary);
  white-space: nowrap;
}
.ana-critere-methode { font-size: 12px; color: var(--stone); margin-bottom: 8px; }

.ana-score {
  font-size: 14px;
  padding: 10px 14px;
  background: var(--ivory-deep);
  border-left: 2px solid var(--brand-primary);
  margin-bottom: 14px;
}
.ana-att-row { font-size: 13px; margin-top: 6px; color: var(--ink-soft); }
.ana-att-row strong { color: var(--ink); }
.ana-reco li { margin: 8px 0; }

.ana-impact {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.ana-impact-ok      { background: #e6efe7; color: #2a6b34; }
.ana-impact-ko      { background: #f4e3e3; color: #8f2e2e; }
.ana-impact-neutral { background: var(--ivory-sunk); color: var(--stone); }

.ana-lot { margin-top: 14px; }
.ana-muted { color: var(--stone); font-size: 12px; margin-top: 6px; }
.ana-total-row { background: var(--ivory-deep); }
.ana-total-row td { font-weight: 600; }

/* ── Nav pipeline : état disabled (aucune sortie générée) ── */
.sidebar-nav .nav-item.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.sidebar-nav .nav-item.disabled .nav-item-marker {
  color: var(--stone, #8a867d);
}

/* ─────────────────────────────────────────────────────────────
   Tableau de bord (home)
   ───────────────────────────────────────────────────────────── */

.home-dashboard {
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--ivory-deep);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.hd-row {
  display: flex;
  gap: 12px;
}

.hd-row + .hd-row {
  margin-top: 12px;
}

.hd-row-kpis .hd-kpi {
  flex: 1;
  min-width: 0;
}

.hd-row-detail {
  align-items: stretch;
}

.hd-row-detail .hd-chart { flex: 2; }
.hd-row-detail .hd-table { flex: 1; }
.hd-row-detail .hd-bars  { flex: 1; }

.hd-period {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  background: var(--ivory);
}

.hd-period-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  background: transparent;
  color: var(--stone);
  border: none;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  transition: background 120ms var(--ease), color 120ms var(--ease);
}

.hd-period-btn:last-child {
  border-right: none;
}

.hd-period-btn:hover {
  color: var(--ink);
}

.hd-period-btn.active {
  background: var(--ink);
  color: var(--ivory);
}

.hd-kpi {
  padding: 16px 18px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  border-radius: 2px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hd-k-lbl {
  font-family: var(--font-body);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin-bottom: 4px;
}

.hd-k-val {
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}

.hd-k-val-empty {
  color: var(--stone-light);
}

.hd-k-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stone);
  margin-top: 2px;
}

.hd-k-sub-hint {
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────*/
/* Widget — Évolution remporté / perdu (SVG barres empilées)   */
/* ─────────────────────────────────────────────────────────────*/

.hd-chart,
.hd-table,
.hd-bars {
  padding: 14px 16px;
  background: var(--ivory);
  border: 1px solid var(--rule);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.hd-w-title {
  font-family: var(--font-body);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin-bottom: 8px;
}

.hd-w-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--stone-light);
  font-style: italic;
  padding: 0 16px;
  line-height: 1.4;
}

.hd-chart-svg {
  flex: 1;
  min-height: 80px;
}

.hd-evo-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hd-bar-rem {
  fill: var(--brand-primary);
}

.hd-bar-perd {
  fill: var(--stone-light);
}

.hd-chart-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stone-light);
  margin-top: 6px;
}

.hd-tc-list {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hd-tc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  gap: 8px;
}

.hd-tc-row:last-child {
  border-bottom: none;
}

.hd-tc-name {
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hd-tc-val {
  font-family: var(--font-mono);
  color: var(--stone);
  flex-shrink: 0;
}

.hd-fb-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hd-fb-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.hd-fb-name {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hd-fb-track {
  height: 8px;
  background: var(--ivory-deep);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.hd-fb-bar {
  display: block;
  height: 100%;
  background: var(--brand-accent);
  border-radius: 1px;
}

.hd-fb-val {
  font-family: var(--font-mono);
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────────
   Widget usage / quotas (sidebar)
   ───────────────────────────────────────────────────────────── */

.sidebar-usage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2px;
}

.sidebar-usage .su-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone-light);
  margin-bottom: 2px;
}

.sidebar-usage .su-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-usage .su-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.sidebar-usage .su-key {
  color: var(--stone);
  text-transform: none;
}

.sidebar-usage .su-val {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.sidebar-usage .su-track {
  display: block;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar-usage .su-bar {
  display: block;
  height: 100%;
  background: var(--stone);
  border-radius: 2px;
  transition: width 220ms var(--ease), background-color 220ms var(--ease);
}

.sidebar-usage .su-bar-warn { background: var(--warning); }
.sidebar-usage .su-bar-crit { background: var(--danger); }

/* ═══════════════════════════════════════════════
   PAGE LOGIN — direction éditoriale, fond bicolore
   ═══════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--ivory-sunk);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(380px, 480px);
  width: 100%;
  max-width: 1000px;
  border: 1px solid var(--rule-strong);
  background: var(--ivory);
  position: relative;
}

.login-identity {
  background: var(--ink);
  color: var(--ivory);
  padding: 56px 48px 48px;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 560px;
}

.login-identity .login-eyebrow { color: var(--brand-accent); }

.login-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brand-accent);
  margin-bottom: 32px;
}

.login-wordmark {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.95;
  color: var(--ivory);
  margin: 0 0 18px;
}

.login-baseline {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--ivory-deep);
  max-width: 360px;
  margin: 0 0 36px;
  opacity: 0.9;
}

.login-meta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 36px;
  border-top: 1px solid rgba(250, 248, 244, 0.15);
}

.login-meta-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.login-meta-row dt {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone-light);
  font-weight: 400;
}

.login-meta-row dd {
  margin: 0;
  color: var(--ivory);
  font-weight: 500;
}

.login-form-col {
  padding: 56px 48px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--ivory);
}

.login-form-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
  margin-bottom: 8px;
}

.login-form-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 36px;
}

.login-form .field { margin-bottom: 22px; }

.login-form .input {
  padding: 13px 16px;
  font-size: 15px;
}

.login-form .btn-primary {
  width: 100%;
  margin-top: 10px;
  padding: 15px 24px;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.login-error {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--danger);
  margin-top: 16px;
  min-height: 1.4em;
  line-height: 1.4;
}

.login-help {
  font-size: 13px;
  color: var(--ink-600, #4b5563);
  line-height: 1.5;
  margin: 12px 0 16px;
}

.login-info {
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

.login-link-back {
  margin-top: 24px;
  font-size: 12px;
}

.login-link-back a {
  color: var(--brand-primary, #1F497D);
  text-decoration: none;
}

@media (max-width: 880px) {
  .login-page { padding: 0; }
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 560px;
    border: 0;
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
  }
  .login-identity {
    min-height: 0;
    padding: 48px 32px;
  }
  .login-wordmark { font-size: 52px; }
  .login-form-col { padding: 40px 32px 48px; }
}

@media (max-width: 480px) {
  .login-identity { padding: 36px 24px; }
  .login-form-col { padding: 32px 24px 40px; }
  .login-wordmark { font-size: 42px; }
  .login-form-title { font-size: 24px; }
}

/* ── Organigramme preview (markdown :::organigramme) ── */
.organigramme-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
  padding: 16px 0;
}
.org-level {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}
.org-box {
  border: 2px solid #1F4E79;
  background: #fff;
  padding: 10px 14px;
  border-radius: 3px;
  text-align: center;
  min-width: 140px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
}
.org-box strong { font-weight: 600; }
.org-box em { font-style: italic; color: var(--ink-soft); }
.org-connector {
  width: 2px;
  height: 22px;
  background: #1F4E79;
}

/* ── Conformité : bandeau "audit périmé" ─────────────────────────────────── */

.conf-stale-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(240, 200, 107, 0.12);
  border: 1px solid rgba(240, 200, 107, 0.45);
  border-radius: 6px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 14px;
}

.conf-stale-text {
  color: #7a5a10;
  flex: 1;
}

/* ── Conformité : actions requises et pistes d'optimisation ────────────────── */

.conf-actions, .conf-pistes {
  display: grid;
  gap: 16px;
}

.conf-action-card, .conf-piste-card {
  background: var(--cream, #faf8f4);
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 8px;
  padding: 16px 20px;
}

.conf-action-header, .conf-piste-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

.conf-action-num, .conf-piste-num {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: var(--stone, #888);
  min-width: 24px;
}

.conf-action-prio, .conf-piste-prio {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.conf-action-prio.prio-haute, .conf-piste-prio.prio-haute {
  background: rgba(235, 143, 122, 0.15);
  color: #c0432a;
}

.conf-action-prio.prio-moyenne, .conf-piste-prio.prio-moyenne {
  background: rgba(240, 200, 107, 0.18);
  color: #a07210;
}

.conf-action-prio.prio-basse, .conf-piste-prio.prio-basse {
  background: rgba(141, 224, 163, 0.15);
  color: #2d7a3f;
}

.conf-action-section, .conf-piste-critere {
  font-size: 12px;
  color: var(--stone, #888);
  font-style: italic;
}

.conf-action-desc, .conf-piste-action {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink, #2a2a2a);
  margin-bottom: 6px;
}

.conf-piste-action {
  font-weight: 600;
}

.conf-action-todo, .conf-piste-detail, .conf-piste-exemple {
  font-size: 13px;
  line-height: 1.5;
  color: var(--graphite, #555);
  margin-top: 6px;
}

.conf-action-tag, .conf-piste-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--ink, #2a2a2a);
  color: var(--ivory, #faf8f4);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.conf-piste-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
  font-size: 12px;
}

.conf-piste-effort {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--cream-dark, rgba(0,0,0,0.05));
  color: var(--graphite, #555);
}

.conf-piste-effort.effort-faible { background: rgba(141, 224, 163, 0.15); color: #2d7a3f; }
.conf-piste-effort.effort-moyen { background: rgba(240, 200, 107, 0.18); color: #a07210; }
.conf-piste-effort.effort-eleve { background: rgba(235, 143, 122, 0.15); color: #c0432a; }

.field-inline { margin-top: -8px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-600, #4b5563);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] { margin: 0; }

.login-link-forgot {
  margin-top: 8px;
  font-size: 12px;
}

.login-link-forgot a {
  color: var(--brand-primary, #1F497D);
  text-decoration: none;
}

/* ── Bibliothèque AO passés (data-view="library") ── */
.lib-icon-btn {
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.lib-icon-btn:hover {
  border-color: var(--ink) !important;
  color: var(--ink) !important;
  background: var(--ivory-deep) !important;
}

@keyframes libFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Équipe (data-view="team") ── */
.team-row-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-body);
  border: 1px solid var(--rule);
  background: var(--ivory);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.team-row-btn:hover {
  border-color: var(--ink);
  background: var(--ivory-deep);
}
.team-row-btn-danger {
  color: var(--danger);
  border-color: var(--rule);
}
.team-row-btn-danger:hover {
  background: var(--danger);
  color: var(--ivory);
  border-color: var(--danger);
}
