:root {
  --fond: #f4f6f9; --panneau: #ffffff; --bord: #d9dee5; --texte: #1d2530; --doux: #66717f;
  --accent: #c2410c; --accent-clair: #fff1e8; --alerte: #b42318;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--texte);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; background: var(--fond); }
header { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: #1d2530; color: #fff; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; color: #fb923c; }
.nom-projet { background: transparent; border: 1px solid transparent; color: #fff; font-size: 15px; padding: 4px 6px; border-radius: 4px; min-width: 200px; }
.nom-projet:hover, .nom-projet:focus { border-color: #4b5563; outline: none; }
.actions { margin-left: auto; display: flex; gap: 8px; }
button { font: inherit; padding: 6px 12px; border-radius: 5px; border: 1px solid var(--bord); background: #fff; color: var(--texte); cursor: pointer; }
header button { background: #2d3746; border-color: #4b5563; color: #fff; }
button.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
button:hover { filter: brightness(1.08); }
button.petit { padding: 2px 8px; font-size: 12px; }

main { flex: 1; display: grid; grid-template-columns: 210px 1fr 320px; min-height: 0; }
aside { background: var(--panneau); overflow-y: auto; padding: 12px; }
.gauche { border-right: 1px solid var(--bord); }
/* colonne gauche avec le « STEP proposé » : la liste défile au-dessus, la miniature reste en bas (CAD, Développés) */
.gauche.avec-step { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.gauche.avec-step .gauche-haut { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px; }
/* « STEP proposé » : voir css/step.css (feuille à part : elle sert aussi hors de CAD) */
.droite { border-left: 1px solid var(--bord); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--doux); margin: 4px 0 8px; }
h3 { font-size: 13px; margin: 14px 0 6px; }

.bibliotheque { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; }
.famille { border: 1px solid var(--bord); border-radius: 6px; padding: 8px 4px; text-align: center; font-size: 12px; background: #fff; cursor: pointer; }
.famille svg { width: 40px; height: 32px; display: block; margin: 0 auto 4px; }
.famille:hover { border-color: var(--accent); background: var(--accent-clair); }
.famille[disabled] { opacity: .45; cursor: not-allowed; background: #fafafa; }
.reperes { list-style: none; margin: 0; padding: 0; }
.reperes li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 5px; cursor: pointer; }
.reperes li.actif { background: var(--accent-clair); outline: 1px solid var(--accent); }
.reperes .rep { font-weight: 700; min-width: 28px; }
.reperes .suppr { margin-left: auto; border: none; background: none; color: var(--doux); padding: 0 4px; }

.centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.onglets { display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--bord); flex: none; min-width: 0; }
/* onglets des repères : zone qui défile seule (molette, flèches) ; « + Repère » et Nomenclature restent visibles */
.onglets-defile { display: flex; align-items: flex-end; gap: 2px; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: thin; scroll-behavior: auto; }
.onglets-defile::-webkit-scrollbar { height: 6px; }
.onglets-fleche { align-self: stretch; margin-bottom: 0; padding: 0 7px; font-size: 18px; line-height: 1; border: 1px solid var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: #fff; color: var(--texte); flex: none; }
.onglets-fleche:disabled { opacity: .3; cursor: default; }
.onglets-fleche[hidden] { display: none; }
.onglets > .onglet-plus, .onglets > .onglet-nomenclature, .onglets > .onglet-special, .onglets-defile > .onglet { flex: none; }
.onglet { display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 12px; border: 1px solid var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: #e9edf2; color: var(--doux); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.onglet:hover { background: #f3f5f8; }
.onglet.actif { background: var(--fond); color: var(--texte); border-color: var(--bord); border-top: 2px solid var(--accent); padding-top: 6px; }
.onglet .rep { font-weight: 700; color: var(--texte); }
.onglet .fermer { border: none; background: none; padding: 0 4px; color: var(--doux); line-height: 1; }
.onglet .fermer:hover { color: var(--alerte); }
.onglet-plus { position: relative; }
.onglet-plus > button { border: 1px dashed var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: transparent; padding: 6px 12px; color: var(--doux); margin-bottom: -1px; }
.menu { position: fixed; z-index: 10; background: #fff; border: 1px solid var(--bord); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 4px; min-width: 180px; }
.menu button { display: block; width: 100%; text-align: left; border: none; padding: 6px 10px; }
.menu button:hover:not([disabled]) { background: var(--accent-clair); }
.menu button[disabled] { color: #a0a8b3; cursor: not-allowed; }
.onglets .vide { padding: 8px; }
.vues { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; min-width: 0; min-height: 0; }
.vue { background: var(--panneau); border: 1px solid var(--bord); border-radius: 6px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.vue-titre { font-size: 12px; color: var(--doux); padding: 6px 10px; border-bottom: 1px solid var(--bord); }
.vue-corps { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.vue-corps canvas { position: absolute; inset: 0; }
.vue2d { background: #fff; display: flex; }
.vue2d svg { width: 100%; height: 100%; }
.vue2d .contour { fill: #eef2f6; stroke: #1d2530; stroke-width: var(--trait); vector-effect: non-scaling-stroke; stroke-width: 1.6px; }
.vue2d .trou { fill: #fff; stroke: #1d2530; stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.vue2d .axe { stroke: #c2410c; stroke-width: .8px; vector-effect: non-scaling-stroke; stroke-dasharray: 6 2 1 2; fill: none; }
.vue2d .ligne-cote { stroke: #2563eb; stroke-width: .8px; vector-effect: non-scaling-stroke; fill: none; }
.vue2d .cote { fill: #2563eb; font-family: system-ui, sans-serif; }
/* repère d'une cote à contrôler (C1-A…) : une étiquette à côté de la cote, la même que sur la fiche de contrôle */
.vue2d .repere-cote rect { fill: #fff7ed; stroke: #ea580c; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.vue2d .repere-cote text { fill: #c2410c; font-weight: 700; font-family: system-ui, sans-serif; }
.vue2d .titre { fill: var(--doux); font-family: system-ui, sans-serif; }

.champ { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 8px; margin: 5px 0; }
.champ label { color: var(--doux); }
.champ input, .champ select, .table input, .table select { font: inherit; padding: 4px 6px; border: 1px solid var(--bord); border-radius: 4px; width: 100%; background: #fff; }
.champ input:focus, .champ select:focus { outline: 2px solid #fdba74; border-color: var(--accent); }
.champ.case { grid-template-columns: 1fr auto; }
.champ.case input { width: auto; }
.bloc { border: 1px solid var(--bord); border-radius: 6px; padding: 6px 10px; margin: 8px 0; background: #fbfcfd; }
.bloc-tete { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { color: var(--doux); font-weight: 500; text-align: left; }
.table td { padding: 2px; }
.vide { color: var(--doux); }
#alertes .alerte { color: var(--alerte); background: #fef3f2; border: 1px solid #fecdca; padding: 6px 8px; border-radius: 5px; margin: 6px 0; font-size: 13px; }
#infos table { width: 100%; margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 6px; }
#infos td { padding: 2px 0; } #infos td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.note { color: var(--doux); font-size: 12px; margin: 6px 0; line-height: 1.4; }
.vue2d .note-plan { fill: var(--texte); font-family: system-ui, sans-serif; }
.vue2d.empile { flex-direction: column; }
.vue2d.empile .plan-section { flex: 2; min-height: 0; display: flex; border-bottom: 1px solid var(--bord); }
.vue2d.empile .plan-barre { flex: 3; min-height: 0; display: flex; }
.vue2d .cache { stroke: #1d2530; stroke-width: .8px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; fill: none; }
.vue2d .arete { stroke: #1d2530; stroke-width: 1.2px; vector-effect: non-scaling-stroke; fill: none; }
.vue2d .fond-barre { fill: #eef2f6; stroke: none; }
.vue2d .nom-vue { fill: var(--doux); font-family: system-ui, sans-serif; }
.vue2d .usinage { fill: #fff; stroke: #1d2530; stroke-width: 1.1px; vector-effect: non-scaling-stroke; }
.vue2d .usinage.cache { fill: none; stroke-dasharray: 5 3; stroke-width: .8px; }
.vue2d .masque { fill: #fff; stroke: none; }
.boutons { display: flex; gap: 6px; flex-wrap: wrap; }
.onglet-nomenclature { margin-left: auto; }
.nomenclature { flex: 1; overflow: auto; padding: 12px 16px; }
.nomenclature[hidden], .vues[hidden] { display: none; }
.nomen-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nomen-tete h2 { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--texte); margin: 0; }
table.nomen { width: 100%; border-collapse: collapse; background: var(--panneau); border: 1px solid var(--bord); font-variant-numeric: tabular-nums; }
.nomen th { text-align: left; font-weight: 600; font-size: 12px; color: var(--doux); padding: 8px; border-bottom: 2px solid var(--bord); background: #f8fafc; }
.nomen td { padding: 7px 8px; border-bottom: 1px solid var(--bord); }
.nomen tbody tr { cursor: pointer; }
.nomen tbody tr:hover { background: var(--accent-clair); }
.nomen .num { text-align: right; }
.nomen .rep { font-weight: 700; white-space: nowrap; }
/* repère et désignation modifiables dans la nomenclature (désignation écrite à la main : en bleu) */
.nomen td.rep, .nomen td.des { cursor: text; }
.nomen input.nomen-rep { width: 86px; box-sizing: border-box; font: inherit; font-weight: 700; color: inherit; padding: 4px 6px; border: 1px solid var(--bord); border-radius: 5px; background: #fff; }
.nomen input.nomen-rep:disabled { border-color: transparent; background: transparent; }
.nomen textarea.nomen-des { display: block; width: 100%; min-width: 150px; box-sizing: border-box; font: inherit; color: inherit; padding: 4px 6px; border: 1px solid var(--bord); border-radius: 5px; background: #fff; resize: none; overflow: hidden; line-height: 1.3; }
.nomen textarea.nomen-des.ecrite { color: #1d4ed8; }
.nomen input.nomen-rep:focus, .nomen textarea.nomen-des:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* noms modifiables dans la nomenclature : celui du projet (dans le titre) et celui de chaque repère (colonne « Nom ») */
.nomen-tete h2 input.nomen-projet { font: inherit; color: inherit; padding: 3px 7px; border: 1px solid var(--bord); border-radius: 6px; background: #fff; max-width: 46vw; }
.nomen td.nom { cursor: text; }
.nomen input.nomen-nom { width: 100%; min-width: 130px; box-sizing: border-box; font: inherit; color: inherit; padding: 4px 6px; border: 1px solid var(--bord); border-radius: 5px; background: #fff; }
.nomen input.nomen-nom:focus, .nomen-tete h2 input.nomen-projet:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* miniature 3D du repère, en tête de ligne */
.nomen td.vig { width: 66px; padding: 2px 4px 2px 8px; }
.nomen img.nomen-vig { display: block; width: 60px; height: 45px; object-fit: contain; }
.nomen tfoot td { font-weight: 700; border-top: 2px solid var(--bord); }
.pastille { display: inline-block; margin-left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--alerte); color: #fff; font-size: 11px; text-align: center; line-height: 16px; }
.onglet-special { margin-left: auto; }
.onglet-special + .onglet-nomenclature { margin-left: 0; }
.vues.ensemble { grid-template-columns: 3fr 2fr; }
.liste-ensemble { width: 100%; border-collapse: collapse; font-size: 13px; }
.liste-ensemble td { padding: 5px 4px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.liste-ensemble tr { cursor: pointer; } .liste-ensemble tr:hover { background: var(--accent-clair); }
.liste-ensemble .note { margin: 0; }
.puce { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid #0003; }
.note.lie { color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 5px; padding: 6px 8px; }
.schema-cadre { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; }
.schema-aide { font-size: 12px; color: var(--doux); margin: 0 0 8px; }
svg.schema { width: 100%; height: auto; max-height: 100%; font-family: system-ui, sans-serif; }
.schema .noeud { cursor: pointer; }
.schema .noeud-cadre { fill: #fff; stroke: #94a3b8; stroke-width: 1.2; }
.schema .noeud:hover .noeud-cadre { stroke: var(--accent); }
.schema .noeud.arme .noeud-cadre { stroke: var(--accent); stroke-width: 2.5; fill: var(--accent-clair); }
.schema .noeud.libre .noeud-cadre { stroke-dasharray: 5 3; }
.schema .noeud-rep { font-weight: 700; font-size: 14px; fill: #1d2530; }
.schema .noeud-nom { font-size: 13px; fill: #1d2530; }
.schema .noeud-info { font-size: 11px; fill: #66717f; }
.schema .lien { cursor: pointer; }
.schema .lien-trait { fill: none; stroke: #475569; stroke-width: 1.6; }
.schema .lien-zone { fill: none; stroke: transparent; stroke-width: 14; }
.schema .lien.actif .lien-trait, .schema .lien:hover .lien-trait { stroke: var(--accent); stroke-width: 2.4; }
.schema .lien-etiquette { fill: #f1f5f9; stroke: #cbd5e1; }
.schema .lien-etiquette.a-preciser { fill: #fff7ed; stroke: #fdba74; }
.schema .lien-texte { font-size: 11px; fill: #334155; }
.bandeau { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 2; background: rgba(29,37,48,.86); color: #fff; font-size: 13px; padding: 7px 10px; border-radius: 6px; pointer-events: none; white-space: pre-wrap; }
.croquis svg { width: 100%; height: 90px; display: block; margin: 4px 0; }
.croquis path { fill: #dbe3ec; stroke: #1d2530; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.croquis text { fill: #1d2530; font-family: system-ui, sans-serif; }
.vue2d .numero-morceau { fill: #c2410c; font-family: system-ui, sans-serif; font-weight: 700; }
.vue2d .joint { stroke: #dc2626; stroke-width: 1.2px; vector-effect: non-scaling-stroke; stroke-dasharray: 10 3 2 3; fill: none; }
.vue2d .pli { stroke: #2563eb; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 12 3 2 3; fill: none; }
.vue2d .pli-fin { stroke: #93b4f5; stroke-dasharray: 6 3; }
.etat-enregistrement { font-size: 12px; color: #9aa7b4; }
/* boutons du projet (« Nouveau projet », « Enregistrer ») : dans la barre supérieure commune des outils quand elle est
   là, sinon dans l'en-tête de CAD. « Enregistrer » clignote tant que le projet a changé depuis son dernier enregistrement. */
.actions-projet { display: inline-flex; gap: 8px; align-items: center; }
.rs-bar .actions-projet button { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); color: #fff; padding: 7px 13px; border-radius: 4px;
  font: inherit; font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.rs-bar .actions-projet button:hover { background: rgba(255,255,255,.22); }
@keyframes a-enregistrer { 0%, 100% { background: #ea580c; box-shadow: 0 0 0 0 rgba(249,115,22,.75); } 50% { background: #f59e0b; box-shadow: 0 0 0 7px rgba(249,115,22,0); } }
#btn-enregistrer.a-enregistrer, .rs-bar .actions-projet #btn-enregistrer.a-enregistrer { animation: a-enregistrer 1.1s ease-in-out infinite; background: #ea580c; border-color: #fdba74; color: #fff; }
@media (prefers-reduced-motion: reduce) { #btn-enregistrer.a-enregistrer, .rs-bar .actions-projet #btn-enregistrer.a-enregistrer { animation: none; } }
.choix-projet { margin: 4px 0 14px; }
.accueil .boutons { justify-content: center; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1d2530; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 80vw; }
.toast.erreur { background: var(--alerte); }
.fond-dialogue { position: fixed; inset: 0; background: rgba(15,23,32,.45); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.dialogue { background: #fff; border-radius: 10px; padding: 18px; width: min(520px, 92vw); max-height: 80vh; overflow: auto; }
.dialogue h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--texte); margin: 0 0 12px; }
.liste-projets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.liste-projets .projet { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 10px 12px; }
.liste-projets .projet span { color: var(--doux); font-size: 12px; }
.nomenclature .nomen + .nomen-tete { margin-top: 22px; }
.propositions { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.proposition { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 10px; border-radius: 6px; }
.proposition strong { font-weight: 600; }
.proposition span { font-size: 12px; color: var(--doux); }
.proposition.forte { border-color: #86efac; background: #f0fdf4; }
.proposition:hover { border-color: var(--accent); background: var(--accent-clair); }
.vue2d.empile .plan-section.gabarits { flex-direction: column; }
.vue2d.empile .plan-section.gabarits svg { height: 50%; }

/* ---------- arbre de montage ---------- */
.arbre-defile { overflow: auto; padding: 4px 0 12px; }
.arbre { position: relative; }
.arbre-traits { position: absolute; left: 0; top: 0; pointer-events: none; }
.arbre-traits .trait { stroke: #1d2530; stroke-width: 1.6; fill: none; }
.arbre-traits .trait.non-soude { stroke-dasharray: 6 4; }
.arbre-traits .trait.a-poser { stroke: #ea580c; stroke-dasharray: 2 3; stroke-width: 2; }
.arbre-tete, .arbre-ligne { display: grid; grid-template-columns: 22px 48px 1fr 40px 70px; align-items: center; gap: 6px; }
.arbre-tete { font-size: 12px; font-weight: 600; color: #475569; padding: 0 6px; margin-top: 8px; }
.arbre-ligne { position: absolute; left: 0; padding: 0 6px; background: #fff; border: 1px solid #d5dce4; border-radius: 6px; cursor: pointer; font-size: 13px; }
.arbre-ligne:hover { border-color: #2563eb; }
.arbre-ligne.choisi { outline: 2px solid #f97316; }
.arbre-rep { font-weight: 600; }
.arbre-des { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.25; }
.arbre-nb { text-align: center; }
.arbre-vig img, .arbre-vig svg { width: 66px; height: 50px; object-fit: contain; display: block; }
.arbre-ligne .rang, .arbre-noeud .rang { position: absolute; right: -8px; top: -8px; background: #2563eb; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; }
.arbre-noeud { position: absolute; background: #fff; border: 1px solid #d5dce4; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; padding: 3px; box-sizing: border-box; }
.arbre-noeud:hover { border-color: #2563eb; }
.arbre-noeud.choisi { outline: 2px solid #f97316; }
.arbre-noeud.incomplet { border-color: #ea580c; }
.arbre-noeud-img { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 0; }
.arbre-noeud-img img { max-width: 100%; max-height: 64px; }
.arbre-noeud-nom { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.case-vide { display: inline-block; width: 13px; }
.legende { margin-top: 6px; }

/* ---------- assistant IA ---------- */
header .assistant { background: #4c1d95; border-color: #6d28d9; color: #fff; }
.dialogue textarea, #params textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 6px; border: 1px solid #cbd5e1; border-radius: 6px; margin: 6px 0; }
.champ.question label { white-space: normal; }
.description-ia { margin: 4px 0 8px; padding: 6px 10px; border-left: 3px solid #6d28d9; background: #f5f3ff; white-space: pre-wrap; font-size: 13px; user-select: text; }
.description-ia.precision { border-left-color: #a78bfa; }
.champ.question { display: block; }
.champ.question label { display: block; margin-bottom: 3px; color: var(--texte); }
.champ.question input { width: 100%; box-sizing: border-box; }
.note.lie:empty { display: none; }
.exemplaires { display: block; font-size: 10px; font-weight: 400; color: #64748b; white-space: nowrap; }
.arbre-exemplaire { position: absolute; left: 24px; display: flex; gap: 10px; align-items: center; padding: 0 8px; font-size: 12px;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 5px; cursor: pointer; color: #334155; box-sizing: border-box; }
.arbre-exemplaire:hover { border-color: #2563eb; }
.arbre-exemplaire .arbre-rep { min-width: 42px; }
.arbre-exemplaire.manquant { border-color: #ea580c; color: #c2410c; background: #fff7ed; }
.arbre-info { display: block; font-size: 11px; color: #64748b; margin-top: 2px; }
.arbre-vig { cursor: zoom-in; }
.croquis { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.croquis-vignette { position: relative; }
.croquis-vignette img { width: 110px; height: 80px; object-fit: cover; border: 1px solid #cbd5e1; border-radius: 6px; display: block; }
.croquis-vignette button { position: absolute; top: 2px; right: 2px; padding: 0 6px; }
.champ-croquis { margin: 4px 0 8px; }
.manques { margin: 6px 0 10px; }
.alerte.manque { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* galerie des placements proposés */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 6px 0; }
.carte-prop { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; text-align: left; background: #fff; border: 1px solid #d5dce4; border-radius: 8px; cursor: pointer; font: inherit; }
.carte-prop:hover { border-color: #f97316; box-shadow: 0 0 0 2px #fed7aa; }
.carte-prop.forte { border-color: #86efac; }
.carte-prop img, .carte-prop .carte-vide { width: 100%; height: 80px; object-fit: contain; background: #f1f5f9; border-radius: 5px; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; }
.carte-prop strong { font-size: 12px; line-height: 1.2; }
.carte-prop span { font-size: 11px; color: #64748b; line-height: 1.2; }
/* cotes sur la 3D d'ensemble */
.cote3d { position: absolute; transform: translate(-50%, -50%); z-index: 3; font: 600 12px/1.2 inherit; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.92); border: 1px solid #94a3b8; color: #334155; pointer-events: none; white-space: nowrap; }
.cote3d.repere { border-color: #ea580c; color: #c2410c; background: #fff7ed; white-space: nowrap; }
.cote3d.modifiable { pointer-events: auto; border-color: #2563eb; color: #1d4ed8; width: auto; text-align: center; cursor: text; }
.cote3d.modifiable:focus { outline: 2px solid #f97316; background: #fff; }
.liste-reportes { width: 100%; font-size: 12px; border-collapse: collapse; }
.liste-reportes td { padding: 2px 4px; border-bottom: 1px solid #e2e8f0; }
.mode-cotes { position: absolute; right: 8px; bottom: 8px; z-index: 4; display: flex; gap: 4px; align-items: center; background: rgba(255,255,255,.9); padding: 4px 6px; border-radius: 6px; font-size: 12px; }
.mode-cotes .actif { background: #2563eb; color: #fff; border-color: #2563eb; }
.arbre-compact { overflow: auto; max-height: calc(100% - 40px); }
.contexte-perdu { position: absolute; inset: 40% 10% auto; z-index: 5; background: #fff7ed; border: 1px solid #ea580c; color: #9a3412; padding: 10px; border-radius: 8px; text-align: center; }
.vue-corps .recadrer { position: absolute; left: 8px; bottom: 8px; z-index: 4; }
.diag3d { position: absolute; left: 8px; top: 56px; z-index: 6; margin: 0; padding: 6px 8px; font: 11px/1.35 monospace; background: rgba(15,23,42,.85); color: #e2e8f0; border-radius: 6px; max-width: 95%; white-space: pre-wrap; pointer-events: none; }
header button.icone { font-size: 18px; padding: 2px 10px; }
header button.icone:disabled { opacity: .35; cursor: default; }
/* vue Squelette */
.sq-cadre { overflow: auto; height: 100%; padding: 8px 10px; box-sizing: border-box; }
.sq-table { border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
.sq-table th { text-align: left; color: #475569; font-weight: 600; padding: 2px 4px; }
.sq-table td { padding: 2px 4px; border-bottom: 1px solid #e2e8f0; }
.sq-table tr.choisi td { background: #eff6ff; }
.sq-table tr:hover td { background: #f8fafc; cursor: pointer; }
.sq-champ { width: 64px; font: inherit; padding: 2px 4px; }
.sq-table select { font: inherit; }

/* import STEP */
.dialogue.large { width: min(900px, 94vw); }
.dialogue .defile { max-height: 50vh; overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; margin: 8px 0; }
/* dialogue d'import : seul le tableau défile, les bandeaux et le bouton « Créer » restent visibles */
.dialogue.large:has(.defile) { display: flex; flex-direction: column; max-height: 92vh; }
.dialogue.large:has(.defile) > * { flex: 0 0 auto; }
.dialogue.large:has(.defile) > .defile { flex: 1 1 auto; min-height: 120px; max-height: none; }
.tableau-import { width: 100%; border-collapse: collapse; font-size: 13px; }
.tableau-import th, .tableau-import td { text-align: left; padding: 5px 8px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
.tableau-import th { position: sticky; top: 0; background: #f8fafc; }
.tableau-import tr.grise td { color: #94a3b8; }
.tableau-import td.achat, .tableau-import th:last-child { text-align: center; white-space: nowrap; }
.tableau-import .note { margin: 2px 0 0; font-size: 12px; }
.ligne-import { display: flex; gap: 8px; align-items: center; margin: 8px 0; }

.tableau-import tr.genre td { background: #eef2f6; font-weight: 600; position: sticky; top: 27px; }
.ligne-import { flex-wrap: wrap; gap: 8px 24px; }
.ligne-import label { display: flex; gap: 6px; align-items: center; }

/* sous la barre commune des outils Rocdacier (index.php) : la hauteur de la page comprend la barre */
body.rs-has-bar { box-sizing: border-box; }

/* destination à l'imbrication (panneau du repère, nomenclature) */
select.destination { font: inherit; padding: 3px 4px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; max-width: 100%; }
select.destination:disabled { color: #64748b; background: #f8fafc; }
.nomen td.dest { white-space: nowrap; }
.nomen select.destination { min-width: 130px; }
/* destination « Chute tôle » / « Chute tube » : le choix de la chute du stock, à côté (cad/js/stock/destination.js) */
.dest-choix { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.champ .dest-choix { display: flex; }
.chute-choix { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.chute-choix select.chute { max-width: 220px; }
.chute-choix select.a-choisir, .chute-choix select.absente { border-color: #f59e0b; background: #fffbeb; }
.chute-choix.vide { color: #b45309; }
a.chute-stock { font-size: 12px; white-space: nowrap; }
.nomen-boutons { display: flex; gap: 8px; }

/* import STEP : pièces hors catalogue */
.tableau-import select.choix-catalogue { font: inherit; font-size: 12px; padding: 2px 4px; max-width: 100%; margin-top: 2px; }

/* accueil d'un projet vide */
.accueil { max-width: 560px; margin: 12vh auto; text-align: center; color: var(--doux); }
.accueil h2 { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--texte); }

/* schéma d'assemblage */
.nomenclature:has(> .schema-corps) { display: flex; flex-direction: column; overflow: hidden; }
.nomenclature:has(> .schema-corps) > .nomen-tete { flex-wrap: wrap; gap: 8px; }
.nomenclature:has(> .schema-corps) .nomen-boutons { flex-wrap: wrap; justify-content: flex-end; }
.schema-corps { flex: 1; display: flex; min-height: 0; }
.schema-corps > .schema-zone { flex: 1; min-width: 0; }
.schema-corps.depot { outline: 3px dashed #ea580c; outline-offset: -3px; border-radius: 6px; }
/* plan d'ensemble importé (PDF, image), à gauche du schéma */
.plan-volet { flex: 0 0 auto; width: 440px; max-width: 75%; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--bord); border-radius: 6px; background: #fff; overflow: hidden; }
.plan-volet[hidden], .plan-separateur[hidden] { display: none; }
.plan-tete { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--bord); flex-wrap: wrap; }
.plan-tete select { flex: 1 1 110px; min-width: 0; }
.plan-tete button { padding: 2px 8px; }
.plan-fenetre { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #dfe5ec; cursor: grab; touch-action: none; }
.plan-fenetre.saisi { cursor: grabbing; }
.plan-image { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25); user-select: none; pointer-events: none; }
.plan-separateur { flex: 0 0 9px; cursor: col-resize; position: relative; touch-action: none; }
.plan-separateur::after { content: ''; position: absolute; left: 3px; top: 35%; bottom: 35%; width: 3px; border-radius: 2px; background: #c3ccd7; }
.plan-separateur:hover::after { background: #ea580c; }
.plan-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 10px; }
.plan-page { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; border: 2px solid #e2e8f0; border-radius: 8px; padding: 6px; cursor: pointer; font-size: 13px; }
.plan-page:has(input:checked) { border-color: #ea580c; background: #fff7ed; }
.plan-page canvas { max-width: 100%; height: auto; box-shadow: 0 0 0 1px #cbd5e1; background: #fff; }
.plan-attente { width: 150px; height: 106px; border-radius: 4px; background: linear-gradient(90deg, #eef2f6, #f8fafc, #eef2f6); }
.dialogue .note.erreur { color: var(--alerte); }
@media (max-width: 800px) {
  .schema-corps { flex-direction: column; }
  .plan-volet { width: auto !important; max-width: none; height: 42%; }
  .plan-separateur { display: none; }
}
.schema-zone { flex: 1; overflow: auto; background: #f4f6f9; border: 1px solid var(--bord); border-radius: 6px; min-height: 0; display: grid; }
/* surface du schéma : elle remplit toute la zone (aucune bande vide à côté du schéma) et s'étend avec lui s'il déborde ;
   le pointillé suit le zoom (--zoom). Le schéma lui-même (.schema-plan) y est posé en haut à gauche, à son échelle. */
.schema-fond { position: relative; background-image: radial-gradient(#d5dbe3 1px, transparent 1px); background-size: calc(20px * var(--zoom, 1)) calc(20px * var(--zoom, 1)); }
.schema-plan { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.schema-traits { position: absolute; left: 0; top: 0; overflow: visible; }
.schema-trait { fill: none; stroke: #334155; stroke-width: 2.2; }
.schema-segment { stroke-width: 3; }
.schema-milieu { fill: #ea580c; stroke: #fff; stroke-width: 1.5; }
.schema-trait-prise { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; pointer-events: stroke; }
.schema-trait-prise:hover { stroke: rgba(234, 88, 12, .35); }
.schema-lien { fill: none; stroke: #ea580c; stroke-width: 2.4; stroke-dasharray: 7 4; }
.schema-carte, .schema-se { position: absolute; background: #fff; border: 1px solid #c9d1db; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: default; user-select: none; }
.schema-carte { width: 150px; height: 156px; display: flex; flex-direction: column; align-items: center; padding: 4px 6px; box-sizing: border-box; }
.schema-carte.libre { border-style: dashed; }
/* une vignette (ou une bulle) se saisit et se déplace parmi les autres : le trait orange montre où elle ira */
.schema-carte, .schema-se { cursor: grab; }
.schema-carte.deplacee, .schema-se.deplacee { cursor: grabbing; z-index: 30; opacity: .88; box-shadow: 0 8px 22px rgba(0,0,0,.22); pointer-events: none; }
.schema-plan.deplacement { cursor: grabbing; }
.schema-insertion { position: absolute; height: 4px; border-radius: 2px; background: #ea580c; z-index: 25; pointer-events: none; }
.schema-insertion[hidden] { display: none; }
.schema-carte img { width: 132px; height: 99px; object-fit: contain; pointer-events: none; }
.schema-picto { width: 132px; height: 99px; display: grid; place-items: center; color: var(--doux); font-size: 40px; }
.schema-rep { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.schema-qte { color: var(--doux); font-size: 12px; }
.schema-nom { font-size: 11px; color: var(--doux); text-align: center; line-height: 1.2; max-height: 2.4em; overflow: hidden; }
.schema-se { width: 118px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid #ea580c; background: #fff7ed; box-sizing: border-box; font-size: 12px; }
.schema-se b { color: #c2410c; }
.schema-se-nom { max-width: 106px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schema-se small { color: var(--doux); }
.schema-defaire { position: absolute; top: -9px; left: -9px; width: 18px; height: 18px; padding: 0; border-radius: 50%; font-size: 12px; line-height: 1; display: none; }
.schema-se:hover .schema-defaire { display: block; }
.schema-poignee { position: absolute; right: -8px; top: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: #ea580c; border: 2px solid #fff; box-shadow: 0 0 0 1px #ea580c; cursor: crosshair; }
.schema-carte.saisi, .schema-se.saisi { cursor: grabbing; box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 2; }
.schema-carte.cible, .schema-se.cible { outline: 3px solid #ea580c; outline-offset: 2px; }
.schema-zoom { min-width: 48px; text-align: center; font-size: 13px; }
.schema-entier.actif { border-color: var(--accent); color: var(--accent); background: var(--accent-clair); }
.schema-liste-se { margin: 4px 0 6px; font-size: 13px; }
.schema-liste-se input { width: 150px; margin-left: 4px; }
.schema-carte img.attente { background: linear-gradient(90deg, #eef2f6, #f8fafc, #eef2f6); border-radius: 4px; }
/* import STEP : le nombre de pièces du modèle et son unité, en tête de la fenêtre */
.resume-import { margin: 0 0 8px; font-size: 14px; }
.resume-import b { font-size: 15px; }
.resume-import span { color: var(--doux); font-size: 13px; }
.tableau-import .choix-cat { margin-top: 4px; }
/* le menu de choix et le nom de la pièce ne doivent pas élargir le tableau au-delà de la fenêtre (« À acheter » reste
   visible) : menu limité en largeur (son libellé complet se lit en l'ouvrant), nom très long abrégé (info-bulle) */
.tableau-import .choix-cat select { max-width: 420px; }
.tableau-import td:nth-child(4) { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* « Machines de découpe » (passage de CAD à Développés) : une ligne par tôle, sa machine, sa saignée */
.tableau-machines td { vertical-align: middle; }
.tableau-machines select { font: inherit; font-size: 13px; padding: 4px 6px; }
.tableau-machines select.machine { width: 300px; max-width: 100%; }
.tableau-machines .reglage { color: var(--doux); white-space: nowrap; }
.tableau-machines .note.erreur:empty { display: none; }

/* fiche d'un repère : ligne « Dessin » (fait par l'outil, ou STEP de l'utilisateur à la place — dessin-ui.js) */
.champ.dessin-auto button { white-space: nowrap; }
.bloc-dessin { border: 1px solid var(--bord); border-radius: 6px; padding: 6px 8px; margin: 8px 0; background: #f8fafc; }
.bloc-dessin.ecart { border-color: #fecdca; background: #fef3f2; }
.bloc-dessin .dessin-titre { display: flex; align-items: center; justify-content: space-between; gap: 6px; overflow-wrap: anywhere; }
.bloc-dessin .note { margin: 4px 0 6px; }
.bloc-dessin.ecart .note { color: var(--alerte); }
.bloc-dessin .dessin-boutons { display: flex; flex-wrap: wrap; gap: 6px; }
.choix-dessin tbody tr { cursor: pointer; }
.ligne-dessin .controle-modele { margin: 2px 0 8px; }
.ligne-dessin p.controle-modele { color: #15803d; }
/* import STEP : contrôle de la lecture (pièce redessinée comparée au solide du modèle) */
.controle-lecture { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.controle-lecture.conforme { background: #dcfce7; color: #166534; }
.controle-lecture.verifier { background: #ffedd5; color: #9a3412; font-weight: 600; }
.controle-lecture.sans { background: #f1f5f9; color: #64748b; }
.tableau-import td.controle { min-width: 78px; max-width: 170px; }
/* avec la colonne « Contrôle », le tableau doit encore tenir dans la fenêtre : la colonne « À acheter » reste visible */
.tableau-import td:nth-child(4) { max-width: 140px; }
.tableau-import .choix-cat select { max-width: 340px; }
.tableau-import td.controle .note { color: #9a3412; white-space: normal; }
.resume-controle.ecart .a-verifier { color: #9a3412; }
