.status { font-size: 12px; color: var(--jd-muted); display: flex; gap: 7px; align-items: center; margin-right: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jd-ok); box-shadow: 0 0 0 3px rgba(15, 125, 95, .14); }
/* Boutons calques sur ceux de l'Assistant Pliage : fond blanc casse, filet
   discret, et c'est la BORDURE qui vire a l'orange au survol — pas le fond. */
.btn { border: 1px solid var(--jd-line-strong); background: var(--jd-panel-2); color: var(--jd-ink); padding: 9px 12px; border-radius: var(--jd-radius-sm); cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--jd-orange); color: var(--jd-orange); }
.btn.primary { background: var(--jd-orange); color: var(--jd-on-accent); border-color: var(--jd-orange); font-weight: 700; }
.btn.primary:hover { background: var(--jd-orange-2); border-color: var(--jd-orange-2); color: var(--jd-on-accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Surtitre : majuscules, orange, interlettrage large — le repere visuel de
   l'Assistant Pliage au-dessus de chaque bloc. */
.preset-title { font-size: .7rem; color: var(--jd-orange); margin: 2px 2px 8px; letter-spacing: var(--jd-tracking-eyebrow); text-transform: uppercase; font-weight: 600; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 3px 0 14px; }
.preset { background: var(--jd-panel-2); border: 1px solid var(--jd-line-strong); color: var(--jd-ink); border-radius: var(--jd-radius-sm); padding: 10px 9px; text-align: left; cursor: pointer; transition: .15s; }
.preset:hover { border-color: var(--jd-orange); color: var(--jd-orange); }

/* Intertitre de famille : il regroupe les accordeons par sujet, pour qu'on
   sache ou chercher sans dérouler dix sections. Le numero reprend la pastille
   ronde des etapes de l'Assistant Pliage. */
.famille-titre {
  display: flex; align-items: center; gap: 9px;
  margin: 18px 2px 8px; padding: 0;
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--jd-tracking-eyebrow); color: var(--jd-slate);
}
.famille-titre span {
  display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--jd-orange); color: var(--jd-on-accent);
  font: 700 11px/1 var(--jd-sans); letter-spacing: 0;
}
.famille-preglages > summary { font: 600 .7rem/1 var(--jd-sans); text-transform: uppercase; letter-spacing: var(--jd-tracking-eyebrow); color: var(--jd-orange); padding: 11px 14px; }
.famille-preglages .section { padding-top: 0; }

details { border: 1px solid var(--jd-line); border-radius: var(--jd-radius); background: var(--jd-panel); margin-bottom: 8px; overflow: clip; }
/* Titres en Georgia, comme les h2 de l'Assistant Pliage. */
summary { cursor: pointer; padding: 12px 14px; font: 400 17px/1.1 var(--jd-serif); list-style: none; display: flex; align-items: center; justify-content: space-between; background: var(--jd-panel); color: var(--jd-ink); }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; color: var(--jd-slate); font-family: var(--jd-sans); font-size: 15px; }
details[open] summary { border-bottom: 1px solid var(--jd-line-soft); }
details[open] summary::after { content: '–'; }
.section { padding: 12px 14px 14px; display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr 112px; gap: 9px; align-items: center; }
.row label { font-size: 12px; color: var(--jd-slate); }
.row small { display: block; color: var(--jd-muted); font-size: 10px; margin-top: 2px; letter-spacing: .04em; }
/* Champs de l'Assistant Pliage : 42 px de haut, rayon 6, halo orange au focus. */
input[type=number], select, input[type=color] { width: 100%; min-height: 38px; background: var(--jd-input); color: var(--jd-ink); border: 1px solid var(--jd-line); border-radius: 6px; padding: 7px 9px; outline: none; }
input[type=number]:focus, select:focus { border-color: var(--jd-orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--jd-accent) 22%, transparent); }
input[type=checkbox] { accent-color: var(--jd-accent); width: 17px; height: 17px; }
.checkrow { display: flex; align-items: center; gap: 9px; color: var(--jd-text-2); font-size: 12px; }
.hint { font-size: 10px; color: var(--jd-muted); line-height: 1.45; }

/* Les surfaces posees sur la scene 3D : voile clair et ombre portee, pour se
   detacher du degrade sans le masquer. */
.hud { position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.card { pointer-events: auto; background: var(--jd-voile); border: 1px solid var(--jd-line); border-radius: var(--jd-radius); backdrop-filter: blur(8px); padding: 10px 12px; box-shadow: var(--jd-ombre); }
.model-title { font: 400 19px/1.1 var(--jd-serif); color: var(--jd-ink); }
.model-sub { font-size: 11px; color: var(--jd-slate); margin-top: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 10px; padding: 4px 6px; border: 1px solid var(--jd-line); border-radius: 999px; color: var(--jd-text-2); }
.viewbar { position: absolute; right: 14px; top: 14px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 440px; }
.viewbar .btn { padding: 7px 9px; font-size: 11px; background: var(--jd-voile); box-shadow: var(--jd-ombre); }
/* Colonne de droite : legende des reperes puis controle geometrique, empiles
   et cales en bas. Les deux partagent la meme largeur et le meme bord, et la
   legende ne vient plus buter dans la barre de vue en haut a droite. */
.right-stack {
  position: absolute; right: 14px; bottom: 14px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  width: min(320px, calc(100% - 28px));
  pointer-events: none;
}
.stats { width: 100%; }
.stats .card { pointer-events: auto; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.stat { background: var(--jd-panel-2); border: 1px solid var(--jd-line); border-radius: 7px; padding: 7px; }
.stat b { display: block; font-size: 13px; color: var(--jd-text); }
.stat span { font-size: 9px; color: var(--jd-muted); text-transform: uppercase; letter-spacing: .5px; }
.warning { margin-top: 8px; padding: 8px; border-radius: 7px; background: var(--jd-warn-bg); border: 1px solid var(--jd-warn-line); color: var(--jd-warn); font-size: 10px; }
.bottom-actions { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 7px; flex-wrap: wrap; max-width: calc(100% - 370px); }
.bottom-actions .btn { font-size: 11px; background: var(--jd-voile); box-shadow: var(--jd-ombre); }
/* « Exporter GLB » est un bouton primaire : le fond voile de la barre ecrasait
   son orange sans toucher a sa couleur de texte, et il s'affichait blanc sur
   blanc — bouton invisible. */
.bottom-actions .btn.primary { color: var(--jd-on-accent); background: var(--jd-orange); }
.toast { position: absolute; left: 50%; bottom: 74px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: var(--jd-navy); border: 1px solid var(--jd-navy); border-radius: var(--jd-radius-sm); padding: 9px 12px; font-size: 11px; color: var(--jd-on-accent); transition: .22s; box-shadow: var(--jd-ombre-forte); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.orientation-gizmo { position: absolute; left: 14px; bottom: 72px; width: 96px; height: 96px; background: transparent; border: 0; box-shadow: none; overflow: visible; z-index: 4; filter: drop-shadow(0 7px 10px rgba(15, 18, 36, .22)); }
.orientation-gizmo > div { width: 100%; height: 100%; }
.orientation-gizmo canvas { display: block; width: 100%; height: 100%; cursor: pointer; }

.curve-assistant { margin-top: 3px; padding: 10px; border: 1px solid var(--jd-line); border-radius: 9px; background: var(--jd-panel-2); }
.curve-assistant-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 11px; font-weight: 900; color: var(--jd-navy); text-transform: uppercase; letter-spacing: .04em; }
.curve-assistant-title span { font-size: 9px; font-weight: 700; color: var(--jd-muted); text-transform: none; letter-spacing: 0; }
.curve-calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.curve-calc-field { min-width: 0; }
.curve-calc-field label { display: block; font-size: 9px; color: var(--jd-muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }
.unitbox { display: flex; align-items: stretch; }
.curve-calc-field input { min-width: 0; width: 100%; padding: 7px; border-radius: 6px 0 0 6px !important; }
.unit { display: flex; align-items: center; padding: 0 7px; border: 1px solid var(--jd-line); border-left: 0; border-radius: 0 6px 6px 0; color: var(--jd-muted); background: var(--jd-panel-2); font-size: 9px; }
.curve-calc-field.src input { border-color: var(--jd-blue) !important; box-shadow: inset 0 0 0 1px rgba(23, 70, 216, .18); }
.curve-calc-field.out input { border-color: var(--jd-accent) !important; color: var(--jd-accent-2); background: var(--jd-accent-soft); }
.curve-calc-result { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.curve-calc-result div { border: 1px solid var(--jd-line); border-radius: 6px; background: var(--jd-panel); padding: 6px; }
.curve-calc-result span { display: block; font-size: 8px; color: var(--jd-muted); text-transform: uppercase; }
.curve-calc-result b { font-size: 11px; color: var(--jd-text); }
.curve-calc-message { margin-top: 7px; font-size: 9px; line-height: 1.35; color: var(--jd-muted); min-height: 12px; }
.curve-calc-message.err { color: var(--jd-err); }
.curve-calc-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 8px; }
.curve-calc-actions .btn { font-size: 10px; padding: 7px 8px; }

.commerce-card { position: absolute; left: 130px; bottom: 68px; z-index: 4; width: min(350px, calc(100% - 500px)); min-width: 270px; padding: 10px 12px; border-radius: var(--jd-radius); border: 1px solid var(--jd-line); background: var(--jd-voile); backdrop-filter: blur(10px); box-shadow: var(--jd-ombre); }
.commerce-row { display: flex; align-items: center; gap: 10px; }
.commerce-copy { min-width: 0; flex: 1; }
.commerce-copy small { display: block; color: var(--jd-muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.commerce-copy b { display: block; margin-top: 2px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commerce-status { margin-top: 4px; font-size: 9px; color: var(--jd-muted); }
.commerce-card .btn { font-size: 10px; padding: 8px 10px; }

/* Sous 1100 px, la carte panier n'avait plus la place de cohabiter avec les
   sorties techniques — elle etait donc masquee, et le bouton « Utiliser cette
   configuration » disparaissait avec elle. Sur une tablette, le client se
   retrouvait sans aucun moyen de valider sa configuration. Elle devient une
   barre pleine largeur en pied de scene, et les blocs techniques remontent. */
@media (max-width: 1100px) {
  .commerce-card { left: 14px; right: 14px; bottom: 12px; width: auto; min-width: 0; }
  .bottom-actions { bottom: 84px; max-width: calc(100% - 28px); }
  .right-stack { bottom: 84px; }
  .orientation-gizmo { bottom: 140px; }
  .toast { bottom: 150px; }
}

@media (max-width: 920px) {
  .orientation-gizmo { width: 82px; height: 82px; left: 10px; }
  .right-stack { width: min(270px, calc(100% - 20px)); right: 10px; }
  .viewbar { top: 10px; right: 10px; max-width: 52%; }
  .hud { left: 10px; top: 10px; }
}

/* Telephone : les surfaces posees sur la scene cessent de se disputer les coins
   et s'empilent en bandes pleine largeur, du haut vers le bas. Celles qui
   defilent horizontalement gardent tous leurs boutons sans rogner la vue 3D. */
@media (max-width: 620px) {
  .viewbar {
    left: 8px; right: 8px; top: 8px; max-width: none;
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  }
  .viewbar::-webkit-scrollbar { display: none; }
  .hud { left: 8px; right: 8px; top: 58px; }
  .hud .card { padding: 8px 10px; }
  .model-title { font-size: 15px; }
  .orientation-gizmo { display: none; }

  .bottom-actions {
    left: 8px; right: 8px; bottom: 74px; max-width: none;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  }
  .bottom-actions::-webkit-scrollbar { display: none; }

  .right-stack { left: 8px; right: 8px; width: auto; bottom: 130px; }
  /* Sur un telephone, les six cotes de controle ne se lisent pas : seul
     l'avertissement compte vraiment, et la carte s'efface s'il n'y en a pas. */
  .stats .statgrid, .stats .card > div:first-child { display: none; }
  .stats .warning { margin-top: 0; }
  .stats .card:has(#warning[hidden]) { display: none; }

  .commerce-card { left: 8px; right: 8px; bottom: 8px; padding: 9px 10px; }
  .commerce-row { gap: 8px; }
  .toast { bottom: 190px; }
}

/* Rives / joints : les champs non applicables restent visibles pour expliquer la géométrie,
   mais sont désactivés plutôt que masqués afin d'éviter les surprises en e-commerce. */
[data-joint-param].is-disabled { opacity: .42; }
[data-joint-param].is-disabled input { pointer-events: none; }


/* Coupe du joint : fond clair et trait net, comme un croquis d'atelier. */
.seam-etape { margin-top: 2px; }
.seam-etape b { font-size: 12px; color: var(--jd-ink); }
.seam-etape p { margin: 4px 0 0; font-size: 10px; line-height: 1.5; color: var(--jd-text-2); }
.seam-canvas { display: block; width: 100%; height: 150px; border: 1px solid var(--jd-line); border-radius: var(--jd-radius-sm); background: var(--jd-panel); }
input[type=range] { width: 100%; accent-color: var(--jd-accent); }

/* Référentiels : une carte par source, le statut de vérification portant la
   seule couleur du bloc — c'est lui qui dit si on peut s'appuyer sur la valeur. */
.reference { border: 1px solid var(--jd-line); border-radius: var(--jd-radius-sm); background: var(--jd-panel); padding: 10px 11px; margin-top: 8px; }
.reference-entete { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.reference-entete b { font-size: 12px; color: var(--jd-ink); }
.reference-badge { flex: none; font-size: 8px; text-transform: uppercase; letter-spacing: .06em; padding: 3px 6px; border-radius: 999px; border: 1px solid var(--jd-line); color: var(--jd-muted); }
.reference-badge.is-norme { border-color: var(--jd-navy); color: var(--jd-navy); }
.reference-badge.is-avis-technique { border-color: var(--jd-blue); color: var(--jd-blue); }
.reference-badge.is-atelier { border-color: var(--jd-accent); color: var(--jd-accent-2); }
.reference-sous { margin: 5px 0 0; font-size: 10px; line-height: 1.45; color: var(--jd-text-2); }
.reference-editeur { margin: 2px 0 0; font-size: 9px; color: var(--jd-muted); }
.reference-valeurs { margin: 7px 0 0; padding-left: 15px; font-size: 10px; line-height: 1.55; color: var(--jd-text-2); }
.reference-valeurs li { margin-bottom: 2px; }
.reference-statut { margin: 8px 0 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.reference-statut.is-lu { color: var(--jd-ok); }
.reference-statut.is-a-verifier { color: var(--jd-warn); }
.reference-note { margin: 4px 0 0; font-size: 9px; line-height: 1.5; color: var(--jd-muted); }
.reference-lien { display: inline-block; margin-top: 7px; font-size: 9px; color: var(--jd-blue); }

/* Repères de pose : guide visuel non inclus dans le GLB de la pièce. */
.pose-note { padding: 8px 9px; border: 1px solid var(--jd-line); border-radius: 7px; background: var(--jd-panel-2); color: var(--jd-text-2); font-size: 9px; line-height: 1.45; }
.pose-note b { color: var(--jd-navy); }
.pose-legend { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; pointer-events: none; }
.pose-legend span { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--jd-line); border-radius: 999px; background: var(--jd-voile); color: var(--jd-text-2); font-size: 9px; backdrop-filter: blur(7px); box-shadow: var(--jd-ombre); }
.pose-dot { width: 8px; height: 3px; border-radius: 3px; display: inline-block; }
.pose-dot--pose { background: var(--jd-ok); }
.pose-dot--water { background: var(--jd-blue); }
.pose-dot--material { background: var(--jd-accent); }
.pose-dot--parement { background: var(--jd-navy); }
/* En colonne unique, la legende passe sous la barre d'actions : la place
   verticale y est comptee, et les fleches restent lisibles sans elle. */
@media (max-width: 920px) { .pose-legend { display: none; } }

/* Calepinage : un tableau dense, lisible d'un coup d'oeil sur un chantier. */
.calepinage-resume { font-size: 11px; font-weight: 700; color: var(--jd-ink); padding: 7px 0 2px; }
.calepinage-tableau { max-height: 260px; overflow: auto; border: 1px solid var(--jd-line); border-radius: var(--jd-radius-sm); background: var(--jd-panel); }
.calepinage-tableau table { width: 100%; border-collapse: collapse; font-size: 10px; }
.calepinage-tableau th { position: sticky; top: 0; background: var(--jd-panel-2); text-align: left; padding: 6px 7px; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: var(--jd-muted); border-bottom: 1px solid var(--jd-line); }
.calepinage-tableau td { padding: 5px 7px; border-bottom: 1px solid var(--jd-line-soft); color: var(--jd-text-2); }
.calepinage-tableau tr.is-alerte td { background: var(--jd-warn-bg); color: var(--jd-warn); }
.calepinage-tableau .marque { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--jd-accent-2); }

/* --- Traçage du pan -----------------------------------------------------
 *
 * La toile porte une hauteur en unites de vue plutot qu'en pixels : sur un
 * telephone tenu debout, une hauteur fixe en pixels mange l'ecran ou rend le
 * trace illisible selon l'appareil. */
.tracage-outils { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.btn-mini { padding: 5px 9px; font-size: 10px; min-height: 30px; }
.btn-mini.is-actif { background: var(--jd-accent); border-color: var(--jd-accent); color: var(--jd-on-accent); }

.tracage-toile {
  position: relative;
  height: min(46vh, 340px);
  min-height: 210px;
  border: 1px solid var(--jd-line);
  border-radius: var(--jd-radius-sm);
  background: var(--jd-panel);
  overflow: hidden;
}
.tracage-toile canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Sans cela, tracer un contour au doigt fait defiler la page. */
  touch-action: none;
}

/* Surimpressions sur telephone : cette feuille est chargee APRES layout.css,
   c'est donc ici que les largeurs des blocs poses sur la scene se corrigent. */
@media (max-width: 920px) {
  /* La colonne de droite reprend le haut de la scene, la bande du bas lui est
     interdite. */
  .jd-viewer .right-stack { top: 52px; bottom: auto; right: 10px; width: min(230px, calc(100% - 20px)); }
  .jd-viewer .stats .card { padding: 8px; font-size: 10px; }
}

@media (max-width: 620px) {
  /* 300 px de scene ne peuvent pas porter en plus un tableau de controle ni un
     rappel de cotes : les deux restent sur tablette et sur poste, et les cotes
     se lisent de toute facon dans les reglages, juste dessous. */
  .jd-viewer .right-stack,
  .jd-viewer .hud { display: none; }

  /* Les vues sur une seule ligne qui defile : enroulees, elles mangeaient un
     tiers de la scene. */
  .jd-viewer .viewbar { left: 10px; right: 10px; max-width: none; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .jd-viewer .viewbar::-webkit-scrollbar { display: none; }
  .jd-viewer .viewbar .btn { flex: 0 0 auto; }
}
