/* Styles complémentaires à Tailwind (CDN) : composants réutilisés dans index.html et les modules JS. */

.fade-in { animation: fade-in 0.25s ease-out; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cartes & formulaires ---------- */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 1.5rem;
}
@media (min-width: 768px) { .card { padding: 2rem; } }

.field-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
}
.input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
textarea.input { resize: vertical; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.6rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.15s, transform 0.1s, opacity 0.15s;
  cursor: pointer;
}
.btn.hidden { display: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary { background: #2563eb; color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn-primary:not(:disabled):hover { background: #1d4ed8; }
.btn-success { background: #059669; color: #fff; }
.btn-success:not(:disabled):hover { background: #047857; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn-secondary:not(:disabled):hover { background: #f8fafc; }
.btn-danger-ghost { color: #dc2626; }
.btn-danger-ghost:hover { background: #fef2f2; }

/* ---------- Navigation ---------- */
.nav-tab {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.nav-tab:hover { background: #1e293b; color: #fff; }
.nav-tab.is-active { background: #2563eb; color: #fff; }

/* Onglets de la fiche entreprise */
.subtab {
  min-width: 0;
  margin-bottom: -1px;
  padding: 0.8rem 0.5rem;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.subtab:hover { background: #eef2f7; color: #0f2942; }
.subtab:focus-visible { outline: 2px solid #0284c7; outline-offset: -2px; }
.subtab.is-active {
  border-bottom-color: #0284c7;
  background: #ffffff;
  color: #0f3a60;
  font-weight: 700;
  box-shadow: 0 -1px 0 #e2e8f0, -1px 0 0 #e2e8f0, 1px 0 0 #e2e8f0;
}
@media (max-width: 520px) {
  .subtab { white-space: normal; font-size: 0.72rem; line-height: 1.25; padding: 0.6rem 0.25rem; }
}

/* Barre de progression du diagnostic : 5 étapes discrètes. */
.diag-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 24px;
  padding: 0;
  list-style: none;
}
.diag-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 2px 0;
  border: 0;
  border-top: 3px solid #e2e8f0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.diag-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  font-size: 0.7rem;
  font-weight: 700;
  transition: background-color 0.2s, color 0.2s;
}
.diag-step-label { min-width: 0; line-height: 1.25; }
.diag-step:hover { color: #475569; }
.diag-step:focus-visible { outline: 2px solid #0284c7; outline-offset: 2px; border-radius: 4px; }
.diag-step.is-done { border-top-color: #7dd3fc; color: #475569; }
.diag-step.is-done .diag-step-num { background: #e0f2fe; color: #0369a1; }
.diag-step.is-active { border-top-color: #0284c7; color: #0f2942; font-weight: 700; }
.diag-step.is-active .diag-step-num { background: #0284c7; color: #fff; }
@media (max-width: 640px) {
  .diag-stepper { gap: 4px; }
  .diag-step { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 0.68rem; }
}

.diag-panel { animation: diag-panel-in 0.18s ease-out; }
@keyframes diag-panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .diag-panel { animation: none; } }

/* ---------- Étapes du tunnel ---------- */
.step-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.step-pill .step-num {
  width: 1.4rem; height: 1.4rem;
  border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; font-size: 0.7rem;
}
.step-pill.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
.step-pill.is-active .step-num { background: rgba(255, 255, 255, 0.25); }
.step-pill.is-done { background: #10b981; border-color: #10b981; color: #fff; }
.step-pill.is-done .step-num { background: rgba(255, 255, 255, 0.25); }

/* ---------- Zones de dépôt ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 11rem;
  padding: 1.5rem;
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: #2563eb; background: #eff6ff; outline: none; }
.dropzone.has-file { border-style: solid; border-color: #10b981; background: #ecfdf5; }

.cctp-file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.65rem 0 0;
  padding: 0;
}
.cctp-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  background: #f8fafc;
  font-size: 0.8rem;
  line-height: 1.35;
}
.cctp-file-meta { min-width: 0; }
.cctp-file-name { font-weight: 600; color: #0f172a; overflow-wrap: anywhere; }
.cctp-file-size { margin-left: 0.35rem; color: #64748b; white-space: nowrap; }
.cctp-file-remove {
  flex: none;
  border: 0;
  background: transparent;
  padding: 0.15rem 0.3rem;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.cctp-file-remove:hover, .cctp-file-remove:focus-visible { text-decoration: underline; outline: none; }

/* ---------- Import d'un ancien mémoire (fiche entreprise) ---------- */
.import-memoire {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #bfdbfe;
  border-radius: 1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.import-memoire-copy { flex: 1 1 18rem; min-width: 0; }
.import-memoire-copy h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.import-memoire-copy p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #475569;
}
.import-memoire-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.import-memoire-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.import-memoire-option input { accent-color: #2563eb; }
.import-memoire-status {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0.7rem;
  background: #fff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 0.875rem;
  font-weight: 600;
}
.import-memoire-status.hidden { display: none; }
.import-memoire.is-loading .import-memoire-actions { opacity: 0.5; pointer-events: none; }
.import-spinner {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: import-spin 0.7s linear infinite;
}
@keyframes import-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .import-spinner { animation: none; } }

/* ---------- Médias de la fiche entreprise ---------- */
.media-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 9rem;
  padding: 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 0.85rem;
}
.media-preview img { max-width: 100%; max-height: 14rem; object-fit: contain; border-radius: 0.4rem; }

.photo-card {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  overflow: hidden;
}
.photo-card img { display: block; width: 100%; height: 9rem; object-fit: cover; }
.photo-card .photo-caption { padding: 0.5rem 0.75rem; font-size: 0.8rem; font-style: italic; color: #475569; min-height: 2.2rem; }
.photo-card .photo-delete {
  position: absolute; top: 0.4rem; right: 0.4rem;
  width: 1.8rem; height: 1.8rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.75); color: #fff;
  font-size: 0.85rem; line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s;
}
.photo-card .photo-delete:hover { background: #dc2626; }

/* ---------- Personnalisation ---------- */
#personnalisation-panel { --couleur-primaire: #0F3A60; --couleur-secondaire: #0088CC; }
.perso-heading { font-size: 1rem; font-weight: 700; color: #0f172a; }
.perso-intro { margin: 0.15rem 0 1rem; font-size: 0.85rem; color: #64748b; }

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.template-card:hover { border-color: #94a3b8; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08); }
.template-card:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
.template-card.is-selected {
  border-color: var(--couleur-primaire);
  box-shadow: 0 0 0 2px var(--couleur-primaire), 0 6px 14px rgba(15, 23, 42, 0.1);
}
.template-thumb {
  display: block;
  padding: 0.6rem 0.5rem;
  border-radius: 0.55rem;
  background: #f1f5f9;
}

/* ---- Aperçus miniatures de la page de garde (feuille A4 réduite, échelle 136 px = 210 mm) ----
   Seuls les éléments colorés par la personnalisation dans le vrai document Word utilisent les variables ; le reste est fixe. */
.mp {
  display: block;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 136px;
  margin: 0 auto;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  background: #ffffff;
  border-radius: 1px;
  box-shadow: 0 0 0 1px #e2e8f0, 0 2px 8px rgba(15, 23, 42, 0.14);
  font: 4.6px/1.2 Arial, Helvetica, sans-serif;
  color: #222222;
  text-align: left;
  pointer-events: none;
}
.mp > * { position: absolute; box-sizing: border-box; }
.mp .p-bg { background: var(--couleur-primaire); }
.mp .s-bg { background: var(--couleur-secondaire); }
.mp .p-fg { color: var(--couleur-primaire); }
.mp .s-fg { color: var(--couleur-secondaire); }
.mp .bl { color: #fff; }
.mp .gris { color: #777777; }
.mp .b { font-weight: 700; }
.mp .ctr { text-align: center; }
.mp .ls { letter-spacing: 0.07em; }
.mp .sou { text-decoration: underline; }
.mp .maj { text-transform: uppercase; }
.mp .mid { display: flex; align-items: center; justify-content: center; text-align: center; }
.mp .ell { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mp .f35 { font-size: 3.6px; }
.mp .f4 { font-size: 4.1px; }
.mp .f46 { font-size: 4.6px; }
.mp .f5 { font-size: 5.1px; }
.mp .f6 { font-size: 6px; }
.mp .f7 { font-size: 7px; }
.mp svg { display: block; width: 100%; height: 100%; }
.mp .filet { background: #d0dce5; }
.mp .teinte { background: #f0f6fa; }
.mp .photo { overflow: hidden; background: #cfe0ee; }
.mp .cadre-p { border: 0.6px solid var(--couleur-primaire); padding: 0.8px; background: #fff; }
.mp .cadre-p .photo { position: relative; width: 100%; height: 100%; }
.mp .carte { padding: 3px 2px 2px 4px; }
.mp .carte .titre { font-size: 4.4px; font-weight: 700; letter-spacing: 0.06em; margin-bottom: 1.5px; }
.mp .carte .lib { margin-top: 2.4px; font-size: 3.6px; font-weight: 700; letter-spacing: 0.06em; color: #777; }
.mp .carte .val { font-size: 4.2px; font-weight: 700; }
.mp .col-top { border-top: 1px solid var(--couleur-primaire); padding-top: 2px; }
.mp .col-top .lib { font-size: 3.6px; font-weight: 700; letter-spacing: 0.07em; color: var(--couleur-secondaire); }
.mp .col-top .val { font-size: 4.2px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.2; }
.mp .col-top .lib:not(:first-child) { margin-top: 3px; }
.mp .info-l { margin-bottom: 2.6px; color: #fff; }
.mp .info-l .lib { font-size: 3.6px; font-weight: 700; letter-spacing: 0.08em; }
.mp .info-l .val { font-size: 4.2px; overflow-wrap: anywhere; }
.mp .plaque { background: #fff; }
.mp .ligne-c { display: flex; align-items: center; height: 8.2px; border-bottom: 0.5px solid #d0dce5; }
.mp .ligne-c .lib { flex: none; width: 19px; font-size: 3.4px; font-weight: 700; letter-spacing: 0.04em; color: #777; }
.mp .ligne-c .val { min-width: 0; font-size: 4.3px; font-weight: 700; line-height: 1.1; }
.template-name { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.template-desc { font-size: 0.75rem; line-height: 1.35; color: #64748b; }
.template-badge {
  display: none;
  position: absolute;
  z-index: 20;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: var(--couleur-primaire);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
}
.template-card.is-selected .template-badge { display: inline-block; }

.preset-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.7rem;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.preset-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.preset-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
.preset-btn.is-selected { border-color: #0f172a; background: #f8fafc; }
.preset-swatches { display: inline-flex; flex: none; }
.preset-swatches i {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.preset-swatches i + i { margin-left: -0.5rem; }
.preset-name { font-size: 0.8rem; font-weight: 600; line-height: 1.25; color: #1e293b; }

.color-field { display: flex; align-items: center; gap: 0.75rem; }
.color-picker {
  flex: none;
  width: 3rem;
  height: 2.6rem;
  padding: 0.15rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}
.color-hex { max-width: 9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.color-hex.is-invalid { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }

/* Cartes de contexte : profil candidat + modèle de couverture */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 720px) { .info-cards { grid-template-columns: 1fr; } }
.info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.info-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.06); }
.info-card-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.info-card-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.info-card-icon--profil { background: #eff6ff; color: #2563eb; }
.info-card-icon--modele { background: #f5f3ff; color: #7c3aed; }
.info-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.info-card-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.3; text-transform: uppercase; color: #64748b; }
.info-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.info-card-value { min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.3; color: #0f172a; overflow-wrap: anywhere; }
.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}
.info-badge--ok { background: #ecfdf5; color: #047857; }
.info-card-action {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.info-card-action:hover, .info-card-action:focus-visible { text-decoration: underline; }
.info-card-action--profil { color: #2563eb; }
.info-card-action--modele { color: #7c3aed; }
@media (max-width: 480px) { .info-card { flex-wrap: wrap; } }
.perso-swatch {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.info-swatches { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Infobulles d'aide (?) ---------- */
.help { position: relative; display: inline-flex; margin-left: 0.4rem; vertical-align: middle; }
.help-badge {
  width: 1.1rem; height: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  background: #e0e7ff; color: #3730a3;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
  cursor: help;
  transition: background-color 0.15s, color 0.15s;
}
.help:hover .help-badge, .help:focus .help-badge { background: #4f46e5; color: #fff; }
.help:focus { outline: none; }
.help-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 50;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 18rem;
  max-width: 80vw;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  transition: opacity 0.15s;
}
.help:hover .help-tip, .help:focus .help-tip, .help:focus-within .help-tip { visibility: visible; opacity: 1; }

.spinner {
  width: 1.1rem; height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 9999px;
  animation: spin 0.8s linear infinite;
}
.spinner-dark { border-color: #bfdbfe; border-top-color: #2563eb; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Étape 3 : suivi de génération ---------- */
.gen-main {
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid #bfdbfe; border-radius: 0.75rem;
  background: #eff6ff;
}
.gen-main-row { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.85rem; }
.gen-main-row .spinner { flex: none; width: 1.35rem; height: 1.35rem; }
.gen-main-text { min-width: 0; flex: 1; }
.gen-main-title { font-size: 0.95rem; font-weight: 700; line-height: 1.35; color: #1e3a8a; overflow-wrap: anywhere; }
.gen-main-sub { margin-top: 0.15rem; font-size: 0.8rem; line-height: 1.4; color: #475569; }
.gen-main-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.gen-percent { font-size: 1.35rem; font-weight: 800; line-height: 1.1; color: #1d4ed8; font-variant-numeric: tabular-nums; }
.gen-elapsed { font-size: 0.72rem; color: #64748b; font-variant-numeric: tabular-nums; }
.gen-log-block { margin-top: 1.25rem; }
.gen-log-title { margin-bottom: 0.5rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; }
.gen-log {
  list-style: none; margin: 0; padding: 0.35rem 0.75rem;
  max-height: 16rem; overflow-y: auto;
  border: 1px solid #e2e8f0; border-radius: 0.75rem; background: #fff;
}
.gen-log li {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.4rem 0; border-bottom: 1px solid #f1f5f9;
  font-size: 0.84rem; line-height: 1.4; color: #334155;
  animation: fade-in 0.25s ease-out;
}
.gen-log li:last-child { border-bottom: 0; }
.gen-log .tick { flex: none; width: 1rem; line-height: 1.4; text-align: center; }
.gen-log-step { flex: none; font-weight: 600; color: #059669; font-variant-numeric: tabular-nums; }
.gen-log-empty { color: #94a3b8 !important; font-style: italic; }
.gen-bar {
  position: relative; height: 0.75rem; overflow: hidden;
  border-radius: 9999px; background: #e2e8f0;
}
.gen-bar-fill {
  position: relative; height: 100%; width: 0;
  border-radius: 9999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.4s ease-out;
}
.gen-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: gen-shimmer 1.6s ease-in-out infinite;
}
.gen-bar.is-done .gen-bar-fill { background: #059669; }
.gen-bar.is-done .gen-bar-fill::after { display: none; }
@keyframes gen-shimmer { to { transform: translateX(100%); } }


/* ---------- Étape 1 : suivi en direct de l'analyse du DCE ---------- */
.analyse-progress {
  margin-top: 1.25rem; padding: 1.1rem 1.25rem;
  border: 1px solid #bfdbfe; border-radius: 0.75rem; background: #eff6ff;
  animation: fade-in 0.25s ease-out;
}
.analyse-progress.hidden { display: none; }
.analyse-title { font-size: 0.9rem; font-weight: 700; color: #1e3a8a; }
.analyse-bar { height: 0.35rem; margin: 0.75rem 0 0.9rem; overflow: hidden; border-radius: 9999px; background: #dbeafe; }
.analyse-bar-fill { height: 100%; width: 0; border-radius: 9999px; background: linear-gradient(90deg, #2563eb, #38bdf8); transition: width 0.6s ease-out; }
.analyse-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.analyse-steps li {
  display: flex; align-items: flex-start; gap: 0.6rem;
  font-size: 0.86rem; line-height: 1.4; color: #94a3b8;
  transition: color 0.3s ease;
}
.analyse-steps .analyse-icon { flex: none; display: grid; place-items: center; width: 1.1rem; height: 1.1rem; margin-top: 0.1rem; }
.analyse-steps .analyse-icon::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 9999px; background: #cbd5e1; }
.analyse-steps li.is-running { color: #1d4ed8; font-weight: 600; }
.analyse-steps li.is-running .analyse-icon::before {
  width: 1rem; height: 1rem; background: transparent;
  border: 2px solid #bfdbfe; border-top-color: #2563eb; animation: spin 0.8s linear infinite;
}
.analyse-steps li.is-done { color: #334155; }
.analyse-steps li.is-done .analyse-icon::before {
  content: '✓'; width: auto; height: auto; background: transparent;
  font-size: 0.9rem; font-weight: 800; line-height: 1; color: #059669;
}
.analyse-wait { margin: -0.35rem 0 0.9rem; font-size: 0.82rem; font-weight: 600; line-height: 1.4; color: #1d4ed8; }
.analyse-hint { margin-top: 0.85rem; font-size: 0.75rem; color: #64748b; }

.gen-success {
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  padding: 1.5rem 1rem; text-align: center;
  border: 1px solid #a7f3d0; border-radius: 0.75rem; background: #ecfdf5; color: #065f46;
  animation: fade-in 0.35s ease-out;
}
.gen-success svg { width: 4rem; height: 4rem; }
.gen-success-circle {
  fill: none; stroke: #059669; stroke-width: 3;
  stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: gen-draw 0.6s ease-out forwards;
}
.gen-success-check {
  fill: none; stroke: #059669; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: gen-draw 0.4s 0.5s ease-out forwards;
}
.gen-success svg { animation: gen-pop 0.5s 0.9s ease-out; }
@keyframes gen-draw { to { stroke-dashoffset: 0; } }
@keyframes gen-pop { 50% { transform: scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  .gen-bar-fill::after, .gen-success svg, .analyse-steps li.is-running .analyse-icon::before { animation: none; }
  .gen-success-circle, .gen-success-check { animation-duration: 0.01s; animation-delay: 0s; }
}

/* ---------- Diagnostic : palette calme (marine, ardoise, cobalt, émeraude ; ni rouge ni jaune) ---------- */
#step-2 { overflow-x: hidden; }
#step-2 .diag-title { color: #0f2942; }
#step-2 .diag-intro { color: #475569; }
#step-2 .btn-primary { background: #0284c7; box-shadow: 0 1px 2px rgba(2, 132, 199, 0.3); }
#step-2 .btn-primary:not(:disabled):hover { background: #0369a1; }
#step-2 .btn-danger-ghost { color: #475569; }
#step-2 .btn-danger-ghost:hover { background: #f1f5f9; }
#step-2 .field-label { margin-bottom: 0.4rem; font-size: 13px; font-weight: 700; color: #1e293b; }
#step-2 .input { border-color: #cbd5e1; background: #ffffff; font-size: 14px; color: #1e293b; }
#step-2 .input:focus { border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }

/* Badges d'information : fiches techniques légères */
.audit-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 900px) { .audit-badges { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .audit-badges { grid-template-columns: 1fr; } }
.audit-badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--badge-bg, #f8fafc);
  border: 1px solid var(--badge-border, #e2e8f0);
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.audit-badge span { font-size: 11px; line-height: 1.4; color: #6b7280; }
.audit-badge strong { font-size: 13px; line-height: 1.4; font-weight: 700; color: var(--badge-text, #0f172a); }
.audit-badge:nth-child(1) { --badge-bg: #f0f7ff; --badge-border: #dbeafe; --badge-text: #1e40af; }
.audit-badge:nth-child(2) { --badge-bg: #f0fdf4; --badge-border: #dcfce7; --badge-text: #166534; }
.audit-badge:nth-child(3) { --badge-bg: #fffbeb; --badge-border: #fef3c7; --badge-text: #92400e; }
.audit-badge:nth-child(4) { --badge-bg: #f5f3ff; --badge-border: #ede9fe; --badge-text: #5b21b6; }

/* Cartes de questions */
.diag-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 1.4rem 1.6rem;
}
.diag-card--site { border-left-color: #0284c7; }
.diag-card--fourniture { border-left-color: #059669; }
.diag-card--piece-obligatoire { border-left-color: #dc2626; }
.diag-card--piece-suggestion { border-left-color: #d97706; }
.diag-card--photo { border-left-color: #7c3aed; }

/* Pièces techniques : badges de statut et zones de dépôt */
.piece-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}
.piece-badge--obligatoire { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.piece-badge--suggestion { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.piece-meta { margin: 0 0 0.75rem; font-size: 0.85rem; line-height: 1.6; color: #475569; }
.piece-meta strong { color: #0f2942; }
.piece-drop {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1rem;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.82rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.piece-drop:hover, .piece-drop:focus-visible, .piece-drop.is-over { border-color: #2563eb; background: #eff6ff; outline: none; }
.piece-drop.has-file { border-style: solid; border-color: #10b981; background: #ecfdf5; color: #047857; }
.piece-drop-hint { font-size: 0.72rem; color: #94a3b8; }
.piece-drop.has-file .piece-drop-hint { color: #047857; }
.piece-remove { margin-top: 0.5rem; }
.piece-empty { padding: 1rem; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; font-size: 0.875rem; color: #64748b; }

/* Navigation du bas : Précédent à gauche, Suivant / Valider à droite */
.diag-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #f1f5f9; }
.diag-nav .hidden { display: none; }
#btn-audit-next, #btn-audit-validate { margin-left: auto; }
.diag-launch { padding: 0.7rem 1.75rem; font-size: 0.95rem; font-weight: 700; box-shadow: 0 4px 14px -2px rgba(5, 150, 105, 0.45); }
.diag-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.diag-card-title { min-width: 0; font-size: 1rem; font-weight: 700; color: #0f2942; overflow-wrap: anywhere; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-chip .status-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; }
.status-chip.is-ok { background: #ecfdf5; color: #059669; }
.status-chip.is-ok .status-dot { background: #059669; }
.status-chip.is-todo { background: #f0f7ff; color: #0369a1; }
.status-chip.is-todo .status-dot { background: #0284c7; }
.cctp-note {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 0;
  border-left: 3px solid #0284c7;
  border-radius: 0 8px 8px 0;
  background: #f0f7ff;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #475569;
}
.cctp-note strong { color: #0f2942; }
.answer-area { min-height: 9rem; font-size: 14px; line-height: 1.6; }

/* Bilan carbone : tableau à colonnes fixes, sans défilement horizontal */
.carbone-valeur { width: 9rem; }
.carbone-unite { width: 5.5rem; color: #475569; }
.carbone-detail { display: block; font-size: 0.72rem; color: #64748b; }
#audit-carbone td, #audit-carbone th { padding-top: 0.8rem; padding-bottom: 0.8rem; }

/* Totaux clés en tête de l'onglet carbone */
.carbone-kpis { display: grid; gap: 12px; }
@media (min-width: 640px) { .carbone-kpis { grid-template-columns: 1.3fr 1fr 1fr; } }
.carbone-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding: 1rem 1.2rem;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #0284c7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.carbone-kpi.is-total { border-color: #a7f3d0; border-top-color: #059669; background: #ecfdf5; }
.carbone-kpi.is-fabrication { border-top-color: #64748b; }
.carbone-kpi-label { font-size: 0.78rem; font-weight: 600; color: #475569; overflow-wrap: anywhere; }
.carbone-kpi-value { font-size: 0.8rem; color: #475569; }
.carbone-kpi-value strong { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: #0f2942; }
.carbone-kpi.is-total .carbone-kpi-value strong { font-size: 2.1rem; color: #047857; }
.carbone-kpi-detail { font-size: 0.72rem; color: #64748b; }
@media (max-width: 520px) {
  .carbone-valeur { width: 6.5rem; }
  .carbone-unite { width: 3.8rem; }
}

/* Carte principale du diagnostic */
#step-2.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  padding: 24px;
}

/* Visuels de couverture (logo de l'acheteur, photo du chantier) */
.cover-band-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cover-band-title { font-size: 1.05rem; font-weight: 700; line-height: 1.4; color: #0f2942; }
.cover-band-sub { margin-bottom: 20px; }
.cover-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 640px) { .cover-grid { grid-template-columns: 1fr; } }
.cover-grid.cover-grid--solo { grid-template-columns: minmax(0, 500px); justify-content: center; }
.cover-mod { display: flex; flex-direction: column; min-width: 0; }
.cover-mod-label { margin-bottom: 8px; font-size: 13px; font-weight: 600; line-height: 1.4; color: #1e293b; }
.badge-optional {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: #475569;
  white-space: nowrap;
}
.badge-optional.is-required { background: #fef3c7; color: #92400e; font-weight: 600; }
.cover-required { font-weight: 600; color: #b45309; }
.cover-required.hidden { display: none; }
.cover-alert {
  margin: -8px 0 16px; padding: 10px 14px;
  border: 1px solid #fcd34d; border-radius: 10px; background: #fffbeb;
  font-size: 13px; font-weight: 600; line-height: 1.4; color: #92400e;
}
.cover-alert.hidden { display: none; }
.cover-mod.is-missing .cover-photo-box { border-color: #f59e0b; background: #fffbeb; }
.diag-step.has-alert .diag-step-num { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.annexe-types { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.annexe-type {
  padding: 0.35rem 0.8rem; border: 1px solid #cbd5e1; border-radius: 9999px;
  background: #fff; font-size: 0.78rem; font-weight: 500; color: #334155; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.annexe-type:hover { border-color: #0284c7; color: #0369a1; }
.annexe-type.is-active { border-color: #0284c7; background: #e0f2fe; color: #0369a1; font-weight: 600; }
.annexe-type--prioritaire {
  order: -1; border-color: #d4a017; background: #fffbeb; color: #854d0e; font-weight: 600;
}
.annexe-type--prioritaire:hover { border-color: #b8860b; color: #713f12; }
.annexe-type--prioritaire.is-active { border-color: #b8860b; background: #fef3c7; color: #713f12; box-shadow: 0 0 0 2px #fde68a; }
.annexe-titre-aide { margin-top: 0.4rem; font-size: 0.75rem; line-height: 1.4; color: #92400e; }
.annexe-titre-aide.hidden { display: none; }
.annexe-group-title {
  margin: 0.9rem 0 0.25rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #64748b;
}
.annexe-group-title:first-child { margin-top: 0; }
.annexe-card {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0; border-radius: 0.75rem; background: #fff;
}
.annexe-card--attestation { border-color: #e6c15a; background: linear-gradient(90deg, #fffbeb, #fff 60%); }
.annexe-icon {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 2.6rem; height: 2.6rem; border-radius: 0.55rem;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; color: #fff;
}
.annexe-icon--pdf { background: #dc2626; }
.annexe-icon--image { background: #2563eb; }
.annexe-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 600; color: #334155; }
.annexe-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; margin-top: 0.2rem; font-size: 0.72rem; color: #64748b; }
.annexe-cat {
  padding: 0.1rem 0.5rem; border-radius: 9999px; background: #f1f5f9; font-weight: 600; color: #475569;
}
.annexe-cat--attestation_bonne_execution { background: #fef3c7; color: #854d0e; }
.annexe-cat--certificat_label { background: #dcfce7; color: #166534; }
.annexe-cat--fiche_technique { background: #e0f2fe; color: #0369a1; }
.annexe-ok { font-weight: 700; color: #15803d; }
.annexe-card-actions { display: flex; flex: none; align-items: center; gap: 0.4rem; }
.annexe-remove {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border: 1px solid #fecaca; border-radius: 0.5rem; background: #fff; font-size: 0.9rem; color: #dc2626; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.annexe-remove:hover:not(:disabled) { background: #fef2f2; border-color: #f87171; }
.annexe-remove:disabled { opacity: 0.5; cursor: not-allowed; }
#annexe-staging .annexe-card { border-style: dashed; border-color: #86efac; background: #f0fdf4; }
.cover-drop, .cover-photo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 16px;
  border-radius: 10px;
  text-align: center;
}
.cover-drop {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cover-drop-main { font-size: 13px; line-height: 1.4; color: #1e293b; }
.cover-drop-main strong { font-weight: 600; color: var(--couleur-primaire, #0284c7); }
.cover-drop-hint { font-size: 11px; line-height: 1.4; color: #64748b; }
.cover-drop:hover, .cover-drop:focus-visible, .cover-drop.is-over { border-color: var(--couleur-primaire, #0284c7); background: #fff; outline: none; }
.cover-photo-box { gap: 10px; border: 1px solid #e2e8f0; background: #f8fafc; }
.cover-photo-box.hidden { display: none; }
.cover-photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cover-btn { padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.cover-btn:not(.cover-btn--primary) { border-color: #cbd5e1; color: #1e293b; }
.cover-btn:not(.cover-btn--primary):not(:disabled):hover { background: #fff; border-color: #94a3b8; }
.cover-photo-hint { max-width: 40ch; font-size: 11px; line-height: 1.4; color: #64748b; }
.cover-picked { display: flex; align-items: center; gap: 0.75rem; min-height: 132px; padding: 0.75rem 1rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.cover-picked.hidden { display: none; }
.cover-thumb { width: 4.5rem; height: 4.5rem; flex: none; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; object-fit: contain; }
#cover-photo-picked .cover-thumb { object-fit: cover; }
.cover-library { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: 0.5rem; padding: 0.6rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }
.cover-library.hidden { display: none; }
.cover-library-item { padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 8px; background: #fff; cursor: pointer; }
.cover-library-item img { display: block; width: 100%; height: 4.5rem; object-fit: cover; }
.cover-library-item:hover, .cover-library-item:focus-visible { border-color: #2563eb; outline: none; }
.cover-library-empty { grid-column: 1 / -1; font-size: 0.8rem; color: #64748b; }
