/* Lex Société : générateur d'annonces légales. Styles limités au bloc #gen. */
.gen {
  --nuit: #0F1C2E;
  --orange: #F26A1B;
  --orange-fonce: #B84A0E;
  --orange-clair: #FDEBDD;
  --sable: #FAF7F2;
  --papier: #FFFDF8;
  --filet: #E4DCCF;
  --encre: #1E2633;
  --gris: #5A6372;
  --vert: #1D6B45;
  --rouge: #A3261B;
  color: var(--encre);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-top: 40px;
  padding-bottom: 96px;
}
.gen *, .gen *::before, .gen *::after { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gen [hidden] { display: none !important; }

.gen-grille {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 48px;
  align-items: start;
}

/* ---- Étapes ---- */
.gen-etape { padding: 0 0 36px; margin: 0 0 36px; border-bottom: 1px solid var(--filet); }
.gen-etape:last-child { border-bottom: 0; margin-bottom: 0; }
.gen-etape h2 {
  display: flex; align-items: center; gap: 14px;
  font-size: 1.35rem; font-weight: 800; color: var(--nuit); margin: 0 0 16px; line-height: 1.25;
}
.gen-num {
  flex: none; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--nuit); color: #fff; font-size: .95rem; font-weight: 700;
}
.gen-intro { color: var(--gris); margin: 0 0 18px; max-width: 62ch; line-height: 1.6; }
.gen-label-principal { display: block; font-weight: 700; margin-bottom: 8px; }

/* ---- Champs ---- */
.gen select, .gen input[type="text"], .gen input[type="date"], .gen input[type="number"], .gen textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--encre);
  background: #fff; border: 1px solid #CFC6B8; border-radius: 8px; padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.gen textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.gen select:focus, .gen input:focus, .gen textarea:focus {
  outline: none; border-color: var(--nuit); box-shadow: 0 0 0 3px rgba(15, 28, 46, .15);
}
.gen-select-type { font-weight: 600; padding: 13px 14px; }

.gen-section { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
.gen-section > legend {
  font-size: 1.02rem; font-weight: 700; color: var(--nuit); padding: 0; margin-bottom: 14px;
}
.gen-champ { margin-bottom: 16px; position: relative; }
.gen-champ > label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.gen-fac { font-weight: 400; color: var(--gris); }
.gen-aide { font-size: .87rem; color: var(--gris); margin: 6px 0 0; line-height: 1.5; }
.gen-chk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.gen-chk input { width: 20px; height: 20px; accent-color: var(--nuit); margin: 0; }
.gen-chk > label { margin: 0; }
.gen-chk .gen-aide { flex-basis: 100%; margin-top: 0; }

.gen-detecte input, .gen-detecte textarea, .gen-detecte select { border-color: var(--orange); background: #FFFBF7; }
.gen-badge {
  display: inline-block; margin-top: 6px; font-size: .78rem; font-weight: 600;
  color: var(--orange-fonce); background: var(--orange-clair); padding: 2px 9px; border-radius: 20px;
}

.gen-ligne { border: 1px solid var(--filet); border-radius: 10px; padding: 14px 16px 2px; margin: 0 0 14px; background: var(--papier); min-width: 0; }
.gen-ligne legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }

/* ---- Information sur le type ---- */
.gen-info { margin-top: 16px; background: var(--sable); border-left: 3px solid var(--orange); border-radius: 0 10px 10px 0; padding: 14px 18px; }
.gen-info p { margin: 0 0 8px; line-height: 1.55; font-size: .95rem; }
.gen-info p:last-child { margin-bottom: 0; }
.gen-info a { color: var(--nuit); font-weight: 600; }

/* ---- Dépôt de fichier ---- */
.gen-depot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 6px; padding: 30px 20px; border: 2px dashed #CFC6B8; border-radius: 14px; background: var(--papier);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.gen-depot:hover, .gen-depot.survol { border-color: var(--orange); background: #FFF8F2; }
.gen-depot:focus-within { outline: 3px solid rgba(15, 28, 46, .25); outline-offset: 2px; }
.gen-depot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gen-depot-titre { font-weight: 700; color: var(--nuit); font-size: 1.05rem; }
.gen-depot-titre u { text-decoration-color: var(--orange); text-underline-offset: 3px; }
.gen-depot-sous { color: var(--gris); font-size: .88rem; }
.gen-coller { margin-top: 14px; }
.gen-coller summary { cursor: pointer; font-weight: 600; color: var(--nuit); padding: 6px 0; }
.gen-coller textarea { margin: 10px 0 12px; }

.gen-message { margin: 16px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--sable); line-height: 1.5; }
.gen-message.ok { background: #EAF4EE; color: var(--vert); }
.gen-message.erreur { background: #FBECEA; color: var(--rouge); }
.gen-suggestion { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--filet); border-radius: 10px; }
.gen-suggestion p { margin: 0; flex: 1 1 220px; }

/* ---- Boutons ---- */
.gen-btn {
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  border: 1px solid var(--orange); background: var(--orange); color: #fff;
  padding: 11px 18px; border-radius: 999px; transition: background .15s, color .15s;
}
.gen-btn:hover { background: var(--orange-fonce); border-color: var(--orange-fonce); }
.gen-btn-sec { background: transparent; color: var(--nuit); border-color: var(--nuit); }
.gen-btn-sec:hover { background: var(--nuit); color: #fff; border-color: var(--nuit); }
.gen-btn:focus-visible, .gen-lien:focus-visible, .gen a:focus-visible, .gen summary:focus-visible { outline: 3px solid var(--nuit); outline-offset: 2px; }
.gen-lien {
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--orange-fonce); background: none; border: 0;
  padding: 4px 0; margin-top: 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.gen-vider { color: var(--gris); }

/* ---- Colonne de droite : l'épreuve ---- */
.gen-droite { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 20px; }
.gen-epreuve {
  background: var(--papier);
  border: 1px solid var(--filet);
  border-top: 4px double var(--nuit);
  border-radius: 4px;
  box-shadow: 0 18px 40px -28px rgba(15, 28, 46, .45);
}
.gen-epreuve-tete { padding: 16px 22px 12px; border-bottom: 1px solid var(--filet); }
.gen-epreuve-tete h2 { font-size: 1rem; font-weight: 800; margin: 0; color: var(--nuit); }
.gen-statut { margin: 4px 0 0; font-size: .85rem; color: var(--orange-fonce); }
.gen-statut.complet { color: var(--vert); }
.gen-epreuve-texte {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: .98rem; line-height: 1.6; color: #1A1F28;
  padding: 18px 22px 8px; max-height: 62vh; overflow-y: auto;
}
.gen-avis { max-width: 46ch; margin: 0 auto 22px; }
.gen-avis + .gen-avis { border-top: 1px solid var(--filet); padding-top: 18px; }
.gen-avis h3 { font-family: inherit; text-align: center; font-weight: 600; font-size: 1.05rem; margin: 0 0 10px; color: var(--nuit); }
.gen-avis p { margin: 0 0 4px; hyphens: auto; overflow-wrap: anywhere; }
.gen-avis-note { font-family: Manrope, system-ui, sans-serif; font-size: .78rem !important; font-weight: 700; color: var(--orange-fonce); text-align: center; margin-bottom: 8px !important; }
.gen-avis mark { background: var(--orange-clair); color: var(--orange-fonce); border-radius: 3px; padding: 0 3px; font-style: italic; }
.gen-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--filet); }

.gen-panneau { background: #fff; border: 1px solid var(--filet); border-radius: 12px; padding: 18px 22px; }
.gen-panneau h2 { font-size: 1rem; font-weight: 800; margin: 0 0 6px; color: var(--nuit); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.gen-prix { font-size: 1.6rem; font-weight: 800; color: var(--nuit); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.gen-panneau a { color: var(--nuit); font-weight: 600; }
.gen-score { font-size: .85rem; font-weight: 700; color: var(--orange-fonce); white-space: nowrap; }
.gen-score.complet { color: var(--vert); }
.gen-mentions { list-style: none; margin: 12px 0 0; padding: 0; }
.gen-mentions li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--filet); font-size: .92rem; }
.gen-mentions li:last-child { border-bottom: 0; }
.gen-puce { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #C9BFB1; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 800; transform: translateY(3px); }
.gen-mentions li.ok .gen-puce { background: var(--vert); border-color: var(--vert); color: #fff; }
.gen-mentions li.ok .gen-mention { color: var(--gris); }
.gen-ref { font-size: .78rem; color: var(--gris); white-space: nowrap; }
.gen-usage { font-style: italic; }

.gen-avert { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--filet); max-width: 78ch; color: var(--gris); font-size: .92rem; line-height: 1.6; }
.gen-avert p { margin: 0 0 10px; }
.gen-avert strong { color: var(--encre); }

/* ---- Écrans étroits ---- */
@media (max-width: 980px) {
  .gen-grille { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .gen-droite { position: static; }
  .gen-epreuve-texte { max-height: none; }
}
@media (max-width: 520px) {
  .gen { padding-top: 24px; }
  .gen-etape h2 { font-size: 1.15rem; }
  .gen-epreuve-texte, .gen-epreuve-tete, .gen-actions, .gen-panneau { padding-left: 16px; padding-right: 16px; }
  .gen-actions .gen-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .gen * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Impression : seule l'épreuve est imprimée ---- */
@media print {
  body * { visibility: hidden; }
  .gen-epreuve-texte, .gen-epreuve-texte * { visibility: visible; }
  .gen-epreuve-texte { position: absolute; left: 0; top: 0; width: 100%; max-height: none; overflow: visible; padding: 0; }
  .gen-avis mark { background: none; color: inherit; border-bottom: 1px dotted #000; }
}
