/* HB3D maquette 03 — feuille autonome, sans surcharge de l’ancienne page. */
:root{--ink:#142c48;--muted:#64748b;--line:#dce4ed;--navy:#062344;--accent:#d90056;font-family:Arial,Helvetica,sans-serif;color:var(--ink);background:#edf2f7}*{box-sizing:border-box}html{height:100%}body{height:100vh;height:100dvh;margin:0;padding:22px;display:grid;grid-template-rows:76px minmax(0,1fr);max-width:1600px;margin-inline:auto}button,input,select,textarea{font:inherit}button,select{cursor:pointer}button{color:inherit}button:disabled{opacity:.4;cursor:default}[hidden]{display:none!important}:focus-visible{outline:3px solid #d9005670;outline-offset:2px}.topbar{display:flex;align-items:center;gap:36px;padding:16px 24px;background:linear-gradient(110deg,#082747,#001b36);color:white;border-radius:18px 18px 0 0;min-width:0}.brand{font-size:30px;font-weight:800}.topbar h1{font-size:21px;margin:0}.prototype{margin-left:auto;font-size:10px;white-space:nowrap}.workspace{min-height:0;display:grid;grid-template-columns:350px minmax(0,1fr) 200px;border:1px solid var(--line);border-top:0;border-radius:0 0 18px 18px;background:#f8fafc}.navigation{min-height:0;min-width:0;display:flex;flex-direction:column;border-right:1px solid var(--line);background:linear-gradient(90deg,#f7fafc,#f0f5fa);border-bottom-left-radius:18px}.panel{flex:0 0 auto;min-height:0;border-bottom:1px solid var(--line);display:flex;flex-direction:column}.panel:has(.panel-toggle[aria-expanded=true]){flex:1 1 0}.panel h2{margin:0;flex:0 0 auto;font-size:13px}.panel-toggle{width:100%;height:56px;padding:12px 16px;border:0;background:transparent;display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left;font-weight:700}.panel-toggle:hover{background:#eaf0f7}.panel-toggle[aria-expanded=true]{background:#fff;color:var(--accent)}.panel-body{min-height:0;flex:1;padding:10px 14px 14px;background:#fff;font-size:12px;display:flex;flex-direction:column;gap:9px}.panel-body p,.panel-body h3{margin:0}.panel-body h3{font-size:13px}.panel-body label{display:grid;gap:5px;font-size:12px;font-weight:600}.panel-body input,.panel-body select,.panel-body textarea{width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:7px;font-size:12px;background:#fff;color:var(--ink)}.panel-body textarea{height:74px;resize:none}.hint,small{color:var(--muted);font-size:10px;line-height:1.45}.hint:empty{display:none}.upload{border:1px dashed #a0b5cb;border-radius:9px;padding:10px}.upload input{padding:3px;font-size:10px}.file-list{display:grid;gap:6px}.file-list button{padding:9px;text-align:left;border:1px solid var(--line);border-radius:8px;background:#f7f9fc;font-size:12px;overflow-wrap:anywhere;line-height:1.3}.file-list button[aria-pressed=true]{border-color:var(--accent);background:#fff3f8}.active-copy{font-weight:700;overflow-wrap:anywhere}.view{display:flex;flex-direction:column;gap:10px;min-height:0}.view-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.view-heading h3{min-width:0;overflow-wrap:anywhere;line-height:1.25}.view-heading>span{flex:0 0 auto;color:var(--muted);font-size:10px}.cart-row{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid var(--line)}.cart-row>span{flex:1;min-width:0;overflow-wrap:anywhere;line-height:1.25;font-size:12px}.cart-row button,.back,.pager button,.actions button,#notes-add,#send-restart{border:1px solid var(--line);background:#f8fafc;border-radius:7px;padding:7px 9px;font-size:11px}.back{align-self:flex-start}.pager{display:flex;align-items:center;justify-content:space-between;gap:6px}.pager span{font-size:10px;color:var(--muted);white-space:nowrap}.total{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px;background:#eff4f9;border-radius:8px}.total strong{font-size:14px}.actions{display:grid;gap:7px}.actions .primary{background:var(--navy);color:white;border-color:var(--navy)}.details{display:grid;gap:0;margin:0}.details>div{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--line);font-size:11px}.details dt{color:var(--muted)}.details dd{margin:0;text-align:right;font-weight:600;max-width:60%;overflow-wrap:anywhere}.send-view{display:grid;gap:12px}#demo-form{display:flex;flex-direction:column;gap:14px;min-height:0}.send-actions{grid-template-columns:1fr 1fr}#send-done{display:grid;gap:14px}
.stage{display:grid;grid-template-rows:minmax(0,1fr) 76px 26px;min-width:0;min-height:0}.viewer{display:flex;flex-direction:column;min-height:0;background:radial-gradient(ellipse at center,#fff,#f1f5f9);border:1px solid #cad8e7;border-top:0;border-radius:0 0 9px 9px}.viewer-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:16px 12px;flex:0 0 auto}.active-piece{font-size:10px;border:1px solid #d6e0eb;padding:6px 10px;border-radius:18px;background:#ffffffa8;max-width:100%;overflow-wrap:anywhere}.modes{display:flex;gap:4px}.modes button{border:1px solid #bccddd;border-radius:16px;background:#f8fafc;padding:6px 9px;font-size:10px}.modes button[aria-pressed=true]{background:var(--navy);color:#fff;border-color:var(--navy)}.scene{position:relative;min-height:0;flex:1;display:grid;grid-template-rows:minmax(0,1fr) 88px;padding:16px 12px 0}.scene-note{position:absolute;top:0;left:14px;font-size:9px;color:#7b8797}.parts{width:100%;height:100%;min-height:0;display:block}.scene[data-color=Bleu] .support{filter:hue-rotate(95deg)}.scene[data-color=Rose] .support{filter:hue-rotate(200deg)}.scene[data-mode=flat] .support{filter:contrast(1.3)}.scene[data-mode=wire] .support path,.scene[data-mode=wire] .support ellipse,.scene[data-mode=wire] .gear circle{fill:transparent;stroke:#42617e;stroke-width:2}.capsule{align-self:center;justify-self:center;display:grid;grid-template-columns:1fr 1fr 1fr 1.1fr;gap:10px;width:min(530px,100%);padding:12px 16px;border:1px solid #edf0f4;border-radius:28px;background:#fffffff0;box-shadow:0 8px 22px #233d581c}.capsule label,.quantity{display:grid;gap:5px;min-width:0;color:var(--muted);font-size:9px;font-weight:600}.capsule select{border:0;width:100%;min-width:0;background:transparent;font-size:12px;font-weight:700;color:var(--ink)}.quantity>div{display:flex;align-items:center;justify-content:space-between;gap:5px}.quantity button{width:25px;height:25px;border:0;border-radius:50%;background:#f0f4f9;font-size:18px}.quantity output{font-size:12px;color:var(--ink)}.metrics{display:grid;grid-template-columns:1fr 1.2fr 1fr 1.3fr;align-items:center;gap:8px;padding:10px 12px}.metrics>div{display:grid;gap:5px}.metrics span{color:var(--muted);font-size:9px}.metrics strong{font-size:12px}.assistant-link{padding:4px 0 4px 12px;border:0;border-left:1px solid var(--line);background:transparent;text-align:left;font-size:12px}.assistant-link span{display:block;margin-top:5px}.demo-caption{margin:0;padding:0 12px;color:var(--muted);font-size:9px;line-height:1.3}

.progress {
  padding: 28px 9px;
  min-width: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  --step-gap: clamp(70px, 14vh, 130px);
}
.progress ol {
  list-style: none;
  margin: 0;
  padding: 0;

  display: flex;
  flex-direction: column;
  gap: var(--step-gap);
}
.progress li {
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  min-height: 24px;
  font-size: 10px;
}
.progress li>span{
  display:grid;
  place-items:center;
  flex:0 0 24px;
  height:24px;
  border-radius:50%;
  position:relative;
  z-index:1;
  background:#e2e8f0;
  color:#64748b;
}
.progress li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: calc(0px - var(--step-gap));
  width: 2px;
  background: #e4e7eb;
}
/* Étape terminée : pastille verte, coche blanche. */
.progress .done > span {
  background: #36a578;
  color: #fff;
}

/* Étape active : pastille magenta. */
.progress .current > span {
  background: var(--accent);
  color: #fff;
}
.progress small{
  display:block;
  margin-top:12px;
  font-size:9px
}

.assistant{position:fixed;z-index:1000;width:min(390px,calc(100vw - 24px));padding:15px;border:1px solid #ccd8e6;border-radius:15px;background:white;box-shadow:0 12px 38px #102e4c35}.assistant-head{display:flex;align-items:center;gap:8px;cursor:move;touch-action:none}.assistant-head h2{font-size:14px;margin:0 auto 0 0}.assistant-head button{flex:0 0 auto;height:30px;border:0;background:#eef3f8;color:var(--ink);border-radius:7px;padding:0 9px;font-size:11px;white-space:nowrap}#assistant-close{width:30px;flex-basis:30px;padding:0;border-radius:50%;font-size:22px}.assistant p{font-size:11px;color:var(--muted);line-height:1.5}.assistant form{display:flex;gap:7px}.assistant input{min-width:0;flex:1;width:0;padding:9px;border:1px solid var(--line);border-radius:8px;font-size:12px}.assistant form button{padding:9px;border:0;border-radius:8px;background:var(--navy);color:white;font-size:11px}#chat-feedback{height:62px;padding:8px;background:#f3f7fb;border-radius:8px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-height:760px) and (min-width:761px)
{body{padding:10px;grid-template-rows:62px minmax(0,1fr)}.panel-toggle{height:45px}.panel-body{padding:8px 12px;gap:7px}.view{gap:7px}.cart-row{padding:6px 0}.details>div{padding:6px 0}.viewer-header{padding:10px}.stage{grid-template-rows:minmax(0,1fr) 65px 24px}.scene{grid-template-rows:minmax(0,1fr) 76px}.capsule{padding:10px 14px}.progress{padding-top:12px}.progress li:not(:last-child):after{top:35px;bottom:-15px}}
@media(max-width:1150px) and (min-width:761px){.workspace{grid-template-columns:350px minmax(0,1fr) 95px}
.topbar{gap:20px}.topbar h1{font-size:18px}
.progress{padding-inline:5px}
.progress li{font-size:9px}
.metrics{grid-template-columns:1fr 1fr 1fr}
.assistant-link{font-size:10px;grid-column:1/-1;border-left:0;padding:0}
.assistant-link span{display:none}
.stage{grid-template-rows:minmax(0,1fr) 82px 26px}}
.capsule {
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 14px;
  max-width:350px;
  padding:10px 14px;
  border-radius:18px;
}

.scene {
  grid-template-rows:minmax(0,1fr) 110px;
}
@media(max-width:760px){body{padding:0;grid-template-rows:52px minmax(0,1fr)}
.topbar{padding:10px 14px;border-radius:0;gap:10px}
.topbar h1{display:none}.brand{font-size:25px}
.workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) minmax(290px,44%);border-radius:0}
.stage{grid-row:1;grid-template-rows:minmax(0,1fr) 45px 0}
.navigation{grid-row:2;border-top:1px solid var(--line);border-right:0;border-radius:0}
.progress{display:none}
.panel-toggle{height:34px;padding:6px 13px}
.panel-body{padding:6px 12px;gap:5px}
.panel-body .hint,.panel-body small{font-size:9px}
.panel-body input,.panel-body select{padding:5px}
.view{gap:5px}.cart-row{padding:3px 0}
.cart-row>span{font-size:10px}
.pager button,.actions button,.back,#notes-add,#send-restart{padding:4px 7px;font-size:10px}
.actions{grid-template-columns:1fr 1fr;gap:5px}
.total{padding:5px}.details>div{padding:3px 0;font-size:10px}
.view-heading h3{font-size:11px}
.upload{padding:5px}.file-list{gap:3px}
.file-list button{padding:4px;font-size:10px}
.viewer-header{padding:6px 8px;gap:4px}
.active-piece{padding:4px 6px;font-size:9px}
.modes button{font-size:8px;padding:4px 6px}
.scene{padding:12px 8px 0;grid-template-rows:minmax(0,1fr) 72px}
.scene-note{font-size:8px}
.capsule{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 14px;padding:6px 12px;border-radius:15px;max-width:350px}
.capsule label,.quantity{gap:2px;font-size:8px}.capsule select{font-size:11px}
.quantity button{height:21px;width:23px;font-size:16px}
.metrics{grid-template-columns:repeat(4,minmax(0,1fr));padding:5px 8px;gap:5px}
.metrics span{font-size:7px}.metrics strong{font-size:10px}
.assistant-link{font-size:9px;padding-left:5px}
.assistant-link span{display:none}
.demo-caption{display:none}#demo-form{gap:7px}
.send-view{gap:5px}
.send-view label{grid-template-columns:95px minmax(0,1fr);align-items:center}#send-done{gap:7px}
.panel-body textarea{height:45px}
.assistant{padding:12px}}

/* HB3D — deux boîtes d’outils compactes de 70 px. */

.scene {
  grid-template-rows:minmax(0,1fr) auto;
}

.toolbox {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  width:100%;
  max-width:1040px;
  justify-self:center;
  padding:8px 0 10px;
}

.toolbox-card {
  height:70px;
  min-width:0;
  display:flex;
  align-items:stretch;
  gap:10px;
  padding:7px 10px;
  border:1px solid #dce4ed;
  border-radius:11px;
  background:#fff;
  box-shadow:0 4px 14px #142c4810;
}

.toolbox-label {
  display:block;
  font-size:9px;
  font-weight:700;
  line-height:12px;
  color:var(--muted);
  white-space:nowrap;
}

.technology-group,
.colors-group {
  min-width:0;
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.technology-options {
  display:flex;
  align-items:center;
  gap:4px;
}

.machine-choice {
  width:43px;
  height:39px;
  flex:0 0 43px;
  padding:2px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  border:1px solid #e0e7ef;
  border-radius:6px;
  background:#fff;
}

.machine-choice img {
  display:block;
  width:100%;
  height:23px;
  object-fit:contain;
}

.machine-choice span {
  font-size:8px;
  line-height:9px;
  white-space:nowrap;
}

.machine-choice[aria-pressed="true"] {
  border-color:var(--accent);
  background:#fff3f8;
  box-shadow:0 0 0 1px var(--accent);
}

.machine-soon {
  width:58px;
  flex-basis:58px;
}

.machine-soon:disabled {
  opacity:.5;
}

.material-group,
.quantity-group {
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  flex:0 0 auto;
  padding-left:10px;
  border-left:1px solid var(--line);
}

.material-group {
  width:94px;
  min-width:0;
}

.material-group select {
  width:100%;
  min-width:0;
  height:32px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#f8fafc;
  color:var(--ink);
  font-size:11px;
}

.color-options {
  display:flex;
  align-items:center;
  gap:5px;
  height:32px;
  padding:0 2px;
}

.color-dot {
  display:grid;
  place-items:center;
  width:16px;
  height:16px;
  flex:0 0 16px;
  padding:0;
  border:2px solid #fff;
  border-radius:50%;
  background:var(--dot);
  box-shadow:0 0 0 1px #cbd5e1;
}

.color-dot span {
  visibility:hidden;
  font-size:9px;
  line-height:1;
  color:#fff;
  text-shadow:0 1px 2px #000;
}

.color-dot[aria-pressed="true"] {
  box-shadow:0 0 0 2px var(--navy);
}

.color-dot[aria-pressed="true"] span {
  visibility:visible;
}

.color-dot[data-color="Blanc"] span,
.color-dot[data-color="Jaune"] span {
  color:var(--navy);
  text-shadow:none;
}

#selected-color-name {
  margin-left:4px;
  color:var(--ink);
  font-weight:400;
}

.quantity-group {
  width:91px;
}

.quantity-control {
  height:32px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border:1px solid var(--line);
  border-radius:6px;
  background:#f8fafc;
}

.quantity-control button {
  flex:0 0 23px;
  width:23px;
  height:28px;
  padding:0;
  border:0;
  border-radius:5px;
  background:transparent;
  font-size:18px;
}

.quantity-control output {
  min-width:20px;
  text-align:center;
  font-size:12px;
  font-weight:700;
}

/* Si la zone centrale devient étroite :
   chaque boîte reste à 70 px, mais elles passent sur deux lignes. */
@media(min-width:761px) and (max-width:1050px) {
  .toolbox {
    grid-template-columns:minmax(0,1fr);
    gap:6px;
  }
}

@media(max-width:760px) {
  .toolbox {
    grid-template-columns:minmax(0,1fr);
    gap:6px;
    padding:5px 0;
  }
}

/* Cadre général : bandeau, espace de travail, footer. */
body {
  grid-template-rows:76px minmax(0,1fr) 48px;
}

.workspace {
  border-bottom:0;
  border-radius:0;
}

.navigation {
  border-bottom-left-radius:0;
}

/* La zone centrale occupe la hauteur disponible. */
.stage {
  align-self:stretch;
  min-height:0;
  grid-template-rows:minmax(0,1fr) 76px 26px;
}

.viewer {
  min-height:0;
}

.scene {
  min-height:0;
  grid-template-rows:minmax(0,1fr) auto;
}

/* Les outils restent à leur hauteur validée. */
.toolbox-card {
  height:70px;
}

/* Footer général, dans le flux : aucune superposition. */
.site-footer {
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:0 20px;
  border:1px solid var(--line);
  border-top:1px solid #cbd7e4;
  border-radius:0 0 18px 18px;
  background:var(--navy);
  color:#fff;
}

.footer-identity {
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.footer-identity strong {
  font-size:16px;
  letter-spacing:.3px;
}

.footer-divider {
  color:#8da7bf;
}

.footer-identity > span:last-child {
  font-size:10px;
  letter-spacing:.6px;
}

.site-footer small {
  color:#d5dfeb;
  font-size:10px;
  white-space:nowrap;
}

/* Écrans desktop peu hauts. */
@media(max-height:760px) and (min-width:761px) {
  body {
    grid-template-rows:62px minmax(0,1fr) 40px;
  }

  .stage {
    grid-template-rows:minmax(0,1fr) 65px 24px;
  }
}

/* Fenêtres intermédiaires : conserver la place des métriques. */
@media(max-width:1150px) and (min-width:761px) {
  .stage {
    grid-template-rows:minmax(0,1fr) 82px 26px;
  }
}

/* Mobile : footer sur deux lignes. */
@media(max-width:760px) {
  body {
    grid-template-rows:52px minmax(0,1fr) 58px;
  }

  .stage {
    grid-template-rows:minmax(0,1fr) 45px 0;
  }

  .site-footer {
    flex-direction:column;
    justify-content:center;
    gap:5px;
    padding:7px 10px;
    border-radius:0;
  }

  .footer-identity {
    gap:8px;
  }

  .footer-identity strong {
    font-size:13px;
  }

  .footer-identity > span:last-child {
    font-size:8px;
    letter-spacing:.2px;
  }

  .site-footer small {
    font-size:9px;
  }
}

/* Illustration, barre d’affichage, puis boîtes d’outils. */
.scene {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

/* Repère + navigation à gauche, affichage centré, vues à droite. */
.viewer-toolbar {
  position: relative;
  display: grid;

  grid-template-columns:
    66px
    minmax(max-content, 1fr)
    auto
    minmax(max-content, 1fr)
    66px;

  align-items: center;
  column-gap: 8px;
  row-gap: 8px;

  min-width: 0;
  min-height: 44px;
  padding: 5px 0;
  box-sizing: border-box;
}

.viewer-navigation,
.viewer-modes,
.viewer-views {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.viewer-navigation {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
}

.viewer-modes {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
}

.viewer-views {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
}

/* Apparence commune aux trois groupes. */
.viewer-navigation button,
.viewer-modes button,
.viewer-views button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  height: 32px;
  padding: 0 9px;

  border: 1px solid #e3e9f0;
  border-radius: 7px;
  background: #fff;
  color: #526173;
  box-shadow: 0 3px 9px #142c480b;

  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.viewer-modes button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.viewer-navigation button[aria-pressed="true"],
.viewer-modes button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.viewer-navigation button:not(:disabled):hover,
.viewer-modes button:not(:disabled):hover,
.viewer-views button:not(:disabled):hover {
  border-color: var(--accent);
}

.viewer-navigation button:focus-visible,
.viewer-modes button:focus-visible,
.viewer-views button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.viewer-navigation button:disabled,
.viewer-modes button:disabled,
.viewer-views button:disabled {
  opacity: .45;
  box-shadow: none;
  cursor: default;
}

/* Repère dans sa propre colonne, avant la navigation. */
.viewer-axis {
  display: block;

  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;

  width: 66px;
  height: 44px;

  pointer-events: none;
}

/* Tablette et mobile : affichage centré sur la première ligne. */
@media (max-width: 760px) {
  .viewer-toolbar {
    grid-template-columns:
      54px
      minmax(0, 1fr)
      auto;

    column-gap: 6px;
    row-gap: 6px;
  }

  .viewer-modes {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .viewer-axis {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;

    width: 54px;
    height: 44px;
  }

  .viewer-navigation {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .viewer-views {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }

  .viewer-navigation,
  .viewer-modes,
  .viewer-views {
    gap: 4px;
  }

  .viewer-navigation button,
  .viewer-modes button,
  .viewer-views button {
    gap: 4px;
    height: 29px;
    padding: 0 7px;
    font-size: 10px;
  }

  .viewer-modes button svg {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
  }
}

/* Petit mobile : les vues passent sous la navigation. */
@media (max-width: 380px) {
  .viewer-toolbar {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .viewer-navigation {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .viewer-views {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: center;
  }
}

@media (max-width: 380px) {
  .viewer-navigation,
  .viewer-views {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .viewer-views {
    grid-row: 3;
  }

  .viewer-axis {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: end;
  }
}

/* Fiche de configuration de la pièce active. */
#panel-config {
  gap:14px;
}

.config-piece {
  display:grid;
  gap:6px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f5f8fc;
}

.config-label {
  color:var(--muted);
  font-size:10px;
  font-weight:700;
  letter-spacing:.5px;
  text-transform:uppercase;
}

.config-piece .active-copy {
  font-size:14px;
  line-height:1.35;
}

.config-summary {
  padding:0 2px;
}

.config-summary h3 {
  margin-bottom:7px;
}

.config-values {
  margin:0;
}

.config-values > div {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 0;
  border-bottom:1px solid var(--line);
  font-size:12px;
}

.config-values dt {
  color:var(--muted);
}

.config-values dd {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  min-width:0;
  max-width:65%;
  margin:0;
  text-align:right;
  font-weight:700;
  overflow-wrap:anywhere;
}

.config-color-dot {
  width:12px;
  height:12px;
  flex:0 0 12px;
  border:1px solid #b8c5d4;
  border-radius:50%;
}

.config-notice {
  padding-top:8px;
  border-top:1px solid var(--line);
}

@media(max-height:760px), (max-width:760px) {
  #panel-config {
    gap:7px;
  }

  .config-piece {
    padding:7px 10px;
    gap:3px;
  }

  .config-values > div {
    padding:5px 0;
    font-size:11px;
  }
}

/* Panier : cartes compactes et prix distincts. */
.cart-overview {
  display:grid;
  gap:9px;
}

.cart-piece {
  min-width:0;
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f8fafc;
}

.cart-piece-name {
  margin:0 0 7px;
  font-size:12px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

.cart-piece-config {
  display:flex;
  align-items:center;
  flex-wrap:nowrap;
  gap:4px;

  min-width:0;
  min-height:26px;
  height:auto;
  margin:0;

  color:var(--muted);
  font-size:10px;
  line-height:1.4;

  white-space:nowrap;
  overflow-wrap:normal;
}

.cart-piece-prices {
  display:block;
  clear:both;

  margin-top:8px;
  padding-top:7px;
  border-top:1px solid var(--line);

  font-size:11px;
  text-align:right;
}

.cart-piece-prices > span {
  color:var(--muted);
}

.cart-piece-prices > strong {
  display:block;
  margin:0;

  color:var(--ink);
  font-size:12px;
  line-height:1.4;
  text-align:right;
  white-space:nowrap;
}

@media(max-height:760px), (max-width:760px) {
  .cart-overview {
    gap:6px;
  }

  .cart-piece {
    padding:7px 9px;
  }

  .cart-piece-name {
    margin-bottom:4px;
  }

  .cart-piece-prices {
    margin-top:5px;
    padding-top:5px;
  }
}

/* Panier : contenir la liste dans la hauteur disponible. */
#panel-cart {
  min-height:0;
  overflow:hidden;
}

#cart-summary {
  flex:1 1 0;
  min-height:0;
  overflow:hidden;
}

/* Le titre, le total et les actions ne se compriment pas. */
#cart-summary > * {
  flex-shrink:0;
}

/* Seule la liste des pièces peut défiler. */
#cart-summary > #cart-list {
  flex:1 1 0;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:2px 5px 2px 1px;
  scrollbar-gutter:stable;
  overscroll-behavior-y:contain;
}

/* Les cartes gardent leur hauteur naturelle. */
#cart-list.cart-overview {
  grid-auto-rows:max-content;
  align-content:start;
}

#cart-list .cart-piece {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:0;

  min-width:0;
}

/* ==========================================================
   HB3D — Palettes verticales gauche / droite
   À placer à la toute fin de maquette-v3.css
   ========================================================== */

/* Le cadre général et les colonnes existantes sont conservés. */
.stage .viewer {
  min-width: 0;
  min-height: 0;
}

/* Viewer :
   ligne 1 : illustration et palettes ;
   ligne 2 : modes d'affichage et repère XYZ. */
.stage .scene {
  --palette-width: 100px;
  --palette-gap: 10px;

  display: grid;
  grid-template-columns:
    var(--palette-width)
    minmax(0, 1fr)
    var(--palette-width);
  grid-template-rows: minmax(390px, 1fr) 44px;
  gap: 10px var(--palette-gap);

  min-width: 0;
  min-height: 0;
  padding: 24px 10px 10px;

  overflow: auto;
  overscroll-behavior: contain;
}

/* Mention illustrative déjà présente dans le HTML. */
.stage .scene > .scene-note {
  top: 5px;
  left: 10px;
  right: 10px;

  font-size: 9px;
  line-height: 1.35;
  text-align: center;
}

/* La pièce reste dans l'espace entre les palettes. */
.stage .scene > .parts {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  justify-self: stretch;

  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  margin: 0;
}

/* Le conteneur reste dans le HTML, mais ses deux cartes
   prennent directement place dans la grille du viewer. */
.stage .scene > .toolbox {
  display: contents;
}

/* Base commune aux deux palettes :
   largeur extérieure de 100 px maximum. */
.stage .scene .toolbox > .toolbox-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;

  grid-row: 1;
  align-self: stretch;

  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100px;
  height: auto;
  min-height: 0;

  margin: 0;
  padding: 10px 8px;

  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 4px 14px #142c4810;
}

.stage .scene .toolbox > .toolbox-card:first-child {
  grid-column: 1;
}

.stage .scene .toolbox > .toolbox-card:last-child {
  grid-column: 3;
}

/* Groupes internes :
   neutralisation de l'ancienne disposition horizontale. */
.stage .toolbox .technology-group,
.stage .toolbox .colors-group,
.stage .toolbox .material-group,
.stage .toolbox .quantity-group {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;

  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.stage .toolbox .toolbox-label {
  display: block;
  margin: 0;

  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
}

/* ---------- Palette gauche : technologie ---------- */

.stage .toolbox .technology-options {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;

  width: 100%;
  min-width: 0;
}

.stage .toolbox .machine-choice {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;

  width: 100%;
  min-width: 0;
  height: 76px;
  margin: 0;
  padding: 5px 3px;

  border: 1px solid #e0e7ef;
  border-radius: 7px;
  background: #fff;
}

.stage .toolbox .machine-choice img {
  display: block;
  width: 56px;
  max-width: 100%;
  height: 46px;
  object-fit: contain;
}

.stage .toolbox .machine-choice span {
  max-width: 100%;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.stage .toolbox .machine-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: #fff3f8;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.stage .toolbox .machine-soon {
  width: 100%;
  flex-basis: auto;
}

.stage .toolbox .machine-soon:disabled {
  opacity: 0.5;
}

/* Matériau fixé au bas de la palette gauche. */
.stage .toolbox .material-group {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.stage .toolbox .material-group select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 34px;
  padding: 4px 2px;

  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 11px;
}

/* ---------- Palette droite : couleur ---------- */

.stage .toolbox #selected-color-name {
  display: block;
  margin: 3px 0 0;

  color: var(--ink);
  font-size: 10px;
  font-weight: 400;
}

.stage .toolbox .color-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  width: 100%;
  height: auto;
  margin: 0;
  padding: 4px 0;
}

.stage .toolbox .color-dot {
  display: grid;
  place-items: center;
  flex: 0 0 28px;

  width: 28px;
  min-width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;

  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 1px #cbd5e1;
}

.stage .toolbox .color-dot span {
  visibility: hidden;
  font-size: 13px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.stage .toolbox .color-dot[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--navy);
}

.stage .toolbox .color-dot[aria-pressed="true"] span {
  visibility: visible;
}

.stage .toolbox .color-dot[data-color="Blanc"] span,
.stage .toolbox .color-dot[data-color="Jaune"] span {
  color: var(--navy);
  text-shadow: none;
}

/* Quantité fixée au bas de la palette droite. */
.stage .toolbox .quantity-group {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.stage .toolbox .quantity-control {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;

  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0;

  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.stage .toolbox .quantity-control button {
  display: grid;
  place-items: center;

  width: 24px;
  min-width: 0;
  height: 30px;
  margin: 0;
  padding: 0;

  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
}

.stage .toolbox .quantity-control output {
  min-width: 0;
  padding: 0;

  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ---------- Modes d'affichage / repère ---------- */

.stage .scene > .viewer-toolbar {
  grid-column: 1 / -1;
  grid-row: 2;

  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 66px;
  align-items: center;
  gap: 6px;

  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.stage .viewer-toolbar .viewer-modes {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-width: 0;
}

.stage .viewer-toolbar .viewer-axis {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;

  width: 66px;
  height: 44px;
}

/* Zone centrale resserrée :
   conserver les palettes latérales sans agrandir la page. */
@media (min-width: 761px) and (max-width: 1150px) {
  .stage .scene {
    --palette-width: 86px;
    --palette-gap: 6px;

    padding-right: 6px;
    padding-left: 6px;
  }

  .stage .scene .toolbox > .toolbox-card {
    padding-right: 5px;
    padding-left: 5px;
  }

  .stage .scene > .viewer-toolbar {
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 4px;
  }

  .stage .viewer-toolbar .viewer-modes {
    grid-column: 2;
    gap: 4px;
  }

  .stage .viewer-toolbar .viewer-modes button {
    gap: 4px;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 10px;
  }

  .stage .viewer-toolbar .viewer-axis {
    grid-column: 1;
    width: 54px;
  }
}

/* Mobile :
   même organisation gauche / droite, palettes de 76 px.
   La scène peut défiler verticalement si nécessaire. */
@media (max-width: 760px) {
  .stage .scene {
    --palette-width: 76px;
    --palette-gap: 5px;

    grid-template-rows: minmax(338px, 1fr) 40px;
    gap: 8px var(--palette-gap);
    padding: 22px 6px 6px;
  }

  .stage .scene > .scene-note {
    top: 4px;
    left: 6px;
    right: 6px;
    font-size: 8px;
  }

  .stage .scene .toolbox > .toolbox-card {
    gap: 10px;
    padding: 8px 4px;
    border-radius: 9px;
  }

  .stage .toolbox .toolbox-label {
    font-size: 9px;
  }

  .stage .toolbox .technology-options {
    gap: 6px;
  }

  .stage .toolbox .machine-choice {
    height: 65px;
    gap: 3px;
    padding: 4px 2px;
  }

  .stage .toolbox .machine-choice img {
    width: 46px;
    height: 38px;
  }

  .stage .toolbox .machine-choice span {
    font-size: 8px;
  }

  .stage .toolbox .material-group,
  .stage .toolbox .quantity-group {
    padding-top: 8px;
  }

  .stage .toolbox .material-group select {
    height: 30px;
    font-size: 10px;
  }

  .stage .toolbox .color-options {
    gap: 8px;
    padding: 3px 0;
  }

  .stage .toolbox .color-dot {
    flex-basis: 24px;
    width: 24px;
    min-width: 24px;
    height: 24px;
  }

  .stage .toolbox .quantity-control {
    grid-template-columns: 21px minmax(0, 1fr) 21px;
    height: 30px;
  }

  .stage .toolbox .quantity-control button {
    width: 21px;
    height: 26px;
    font-size: 16px;
  }

  .stage .toolbox .quantity-control output {
    font-size: 11px;
  }

    .stage .scene > .viewer-toolbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 4px;
  }

  .stage .viewer-toolbar .viewer-modes {
    grid-column: 1;
    gap: 4px;
  }

  .stage .viewer-toolbar .viewer-modes button {
    gap: 3px;
    height: 28px;
    padding: 0 5px;
    font-size: 9px;
  }

  .stage .viewer-toolbar .viewer-modes button svg {
    width: 12px;
    height: 12px;
    flex-basis: 12px;
  }

  .stage .viewer-toolbar .viewer-axis {
    grid-column: 1;
    width: 44px;
    height: 36px;
  }
}

/* ==========================================================
   HB3D — Barre d'assistance sous le viewer
   Présentation uniquement, sans raccordement au chatbot.
   ========================================================== */

/* Viewer / métriques / barre d'assistance / mention de maquette. */
.stage {
  grid-template-rows:
    minmax(0, 1fr)
    76px
    72px
    26px;
}

/* Les métriques ne contiennent plus le bouton d'assistance. */
.stage > .metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Barre alignée sur la largeur de la zone centrale. */
.stage > .hb3d-ai-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;

  min-width: 0;
  min-height: 0;
  margin: 4px 0 8px;
  padding: 10px 16px;

  border: 1px solid #d2dfec;
  border-radius: 11px;
  background: linear-gradient(110deg, #edf4fb, #f4f8fc);
  box-shadow: 0 3px 12px #142c4808;
}

.hb3d-ai-identity {
  display: flex;
  align-items: center;
  gap: 10px;

  min-width: 0;
  color: var(--navy);
}

.hb3d-ai-icon {
  display: block;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}

.hb3d-ai-identity > span {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.hb3d-ai-field {
  min-width: 0;
}

.hb3d-ai-field input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 16px;

  border: 1px solid #d7e3ef;
  border-radius: 24px;
  background: #ffffffd9;
  color: var(--ink);

  font: inherit;
  font-size: 11px;
  box-shadow: 0 2px 6px #142c4805;
}

.hb3d-ai-field input::placeholder {
  color: #728399;
  opacity: 1;
}

/* Aspect lisible, mais aucune saisie disponible. */
.hb3d-ai-field input:disabled {
  opacity: 1;
  -webkit-text-fill-color: #728399;
  cursor: not-allowed;
}

.hb3d-ai-status {
  max-width: 180px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  text-align: right;
}

/* Desktop peu haut. */
@media (max-height: 760px) and (min-width: 761px) {
  .stage {
    grid-template-rows:
      minmax(0, 1fr)
      65px
      62px
      24px;
  }

  .stage > .hb3d-ai-bar {
    gap: 10px;
    margin-top: 2px;
    margin-bottom: 6px;
    padding: 7px 10px;
  }

  .hb3d-ai-field input {
    height: 36px;
  }
}

/* Zone centrale étroite :
   identité et champ en première ligne, statut en seconde. */
@media (min-width: 761px) and (max-width: 1300px) {
  .stage > .hb3d-ai-bar {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 3px;
    padding: 6px 10px;
  }

  .hb3d-ai-icon {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
  }

  .hb3d-ai-identity {
    gap: 6px;
  }

  .hb3d-ai-identity > span {
    font-size: 10px;
  }

  .hb3d-ai-field input {
    height: 30px;
    padding-inline: 10px;
    font-size: 10px;
  }

  .hb3d-ai-status {
    grid-column: 1 / -1;
    max-width: none;
    font-size: 8px;
    text-align: right;
  }
}

/* Mobile : même emplacement sous les métriques. */
@media (max-width: 760px) {
  .stage {
    grid-template-rows:
      minmax(0, 1fr)
      45px
      66px
      0;
  }

  .stage > .hb3d-ai-bar {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 3px;

    margin: 2px 6px 6px;
    padding: 6px 8px;
    border-radius: 9px;
  }

  .hb3d-ai-identity {
    gap: 5px;
  }

  .hb3d-ai-icon {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }

  .hb3d-ai-identity > span {
    font-size: 9px;
  }

  .hb3d-ai-field input {
    height: 30px;
    padding-inline: 9px;
    font-size: 9px;
  }

  .hb3d-ai-status {
    grid-column: 1 / -1;
    max-width: none;
    font-size: 8px;
    text-align: right;
  }
}

/* HB3D — gommettes de couleur compactes */
.toolbox .color-options .color-dot {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex: 0 0 20px;
  padding: 0;
}

.toolbox .color-options .color-dot span {
  font-size: 9px;
  line-height: 1;
}

/* Progression visuelle du volet 4 uniquement. */
.hb3d-send-progress {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 8px;
  text-align: center;
}

.hb3d-send-progress[hidden] {
  display: none;
}

.hb3d-send-disc {
  --send-progress: 0%;
  --send-color: #e5192a;

  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(
    var(--send-color) var(--send-progress),
    #e5e7eb 0
  );
  transition: background-color 0.25s ease;
}

.hb3d-send-disc::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fff;
}

.hb3d-send-disc > span {
  position: relative;
  color: var(--send-color);
  font-size: 20px;
  font-weight: 700;
}

.hb3d-send-disc.is-success {
  --send-color: #249b63;
}

.hb3d-send-disc.is-error {
  --send-color: #c93636;
}

.hb3d-send-progress p {
  margin: 0;
  font-size: 13px;
}

.hb3d-send-progress small {
  color: #6b7280;
  font-size: 11px;
}

/* Chat intégré sous le viewer : aucune fenêtre flottante. */
.hb3d-ai-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hb3d-ai-field #hb3d-ai-question {
  flex: 1;
  min-width: 0;
}

.hb3d-chat-send {
  flex-shrink: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: #c90042;
  color: #fff;
  cursor: pointer;
}

.hb3d-chat-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hb3d-chat-conversation {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;

  /* Ne pas laisser le parent comprimer la conversation. */
  flex: 0 0 auto;

  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 260px;
  max-height: none;

  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #d8dfeb;
  border-radius: 12px;
  background: #fff;
}

.hb3d-chat-conversation[hidden] {
  display: none;
}

.hb3d-chat-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.hb3d-chat-heading h2 {
  margin: 0;
  font-size: 14px;
}

.hb3d-chat-heading button {
  padding: 6px 10px;
  border: 1px solid #d8dfeb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.hb3d-chat-messages {
  box-sizing: border-box;
  flex: 0 0 auto;

  min-width: 0;
  height: 240px;
  min-height: 0;
  max-height: 280px;

  overflow-y: auto;
  padding: 12px;
  background: #f6f8fc;
}

.hb3d-chat-message {
  width: fit-content;
  max-width: 90%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e1e6ef;
  overflow-wrap: anywhere;
}

.hb3d-chat-message.user {
  margin-left: auto;
  background: #fff0f5;
}

.hb3d-chat-message.error {
  background: #fff6e8;
}

.hb3d-chat-message strong {
  font-size: 11px;
}

.hb3d-chat-message p {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hb3d-chat-notice {
  margin: 0;
  padding: 8px 12px;
  font-size: 10px;
  color: #64748b;
}

@media (max-width: 760px) {
  .hb3d-chat-message {
    max-width: 100%;
  }

  .hb3d-chat-send {
    padding: 9px;
  }
}

/* Garder le titre, le bouton et la notice lisibles. */
.hb3d-chat-heading,
.hb3d-chat-notice {
  flex: 0 0 auto;
}

/* Le bouton « Réduire » doit toujours masquer le panneau. */
.hb3d-chat-conversation[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .hb3d-chat-messages {
    height: 200px;
    max-height: 240px;
  }
}

/* Centrage du groupe de commandes dans le viewer. */
.viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;

  container-type: inline-size;
}

/* L'indication de pièce active reste à gauche. */
.viewer-header > .active-piece {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
}

/* Le groupe est centré dans toute la largeur du header. */
.viewer-header > .hb3d-view-switch {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  margin-inline: 0;
}

/* Viewer étroit : deux lignes pour éviter les chevauchements. */
@container (max-width: 680px) {
  .viewer-header > .active-piece {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .viewer-header > .hb3d-view-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Colonne gauche : volets séparés. */
.navigation {
  gap: 8px;
  padding: 8px;
  border-bottom-left-radius: 0;
  background: #e9eff6;
}

/* Chaque volet devient un bloc indépendant. */
.navigation > .panel {
  border: 1px solid #ccd7e5;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 2px 5px rgba(6, 35, 68, 0.07);
}

/* En-têtes : retour au fond clair d'origine. */
.navigation .panel-toggle {
  position: relative;
  border-radius: 0;
  background: linear-gradient(90deg, #f7fafc, #f0f5fa);
  color: var(--ink);
  font-weight: 700;
  transition: background-color 150ms ease;
}

.navigation .panel-toggle:hover {
  background: #eaf0f7;
}

/* En-tête du volet ouvert. */
.navigation .panel-toggle[aria-expanded="true"] {
  background: #fff;
  color: var(--accent);
}

/* Repère magenta à gauche du volet ouvert. */
.navigation .panel-toggle[aria-expanded="true"]::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--accent);
}

.navigation .panel-toggle[aria-expanded="true"]:hover {
  background: #fff5f9;
}

/* Contenu du volet ouvert. */
.navigation .panel-body {
  border-radius: 0;
  background: #fff;
}

/* =========================================
   HEADER : identité centrée et angles droits
   ========================================= */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;

  /* Réserve le même espace de chaque côté pour la version. */
  padding: 12px 190px;
  border-radius: 0;
  min-width: 0;
}

.header-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
  text-align: center;
}

.header-logo {
  display: block;
  width: auto;
  height: 30px;
  max-width: 100px;
  object-fit: contain;
}

.header-identity .brand {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.topbar .header-identity h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

/* La mention de version ne décale pas le titre. */
.topbar .prototype {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);

  margin: 0;
  font-size: 10px;
  white-space: nowrap;
}


/* =========================================
   FOOTER : deux lignes centrées, angles droits
   ========================================= */

.site-footer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 3px;
  padding: 6px 20px;
  text-align: center;

  border-radius: 0;
}

.footer-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

  gap: 6px 10px;
  min-width: 0;
}

.footer-identity strong {
  font-size: 16px;
  letter-spacing: 0.3px;
}

.footer-divider {
  color: #8da7bf;
}

.footer-identity > span:last-child {
  font-size: 10px;
  letter-spacing: 0.6px;
}

.site-footer small {
  margin: 0;
  color: #d5dfeb;
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
}


/* Suppression des arrondis extérieurs restants. */
.workspace,
.navigation {
  border-radius: 0;
}


/* =========================================
   TABLETTE / MOBILE : éviter les chevauchements
   ========================================= */

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
  }

  .topbar .prototype {
    position: static;
    transform: none;
    white-space: normal;
    text-align: center;
  }

  .header-identity {
    gap: 6px 10px;
  }

  .header-logo {
    height: 25px;
  }

  .header-identity .brand {
    font-size: 22px;
  }

  .topbar .header-identity h1 {
    font-size: 18px;
  }
}

/* Orbitron uniquement dans le header et le footer. */
.topbar,
.site-footer {
  font-family: "Orbitron", Arial, sans-serif;
}

/* Panier : action de suppression par pièce */
#cart-list .cart-piece-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-top: 0;
  margin-left: auto;
}

/* Poubelles : centrage et apparence commune aux deux volets */
#cart-list .cart-remove-button,
#file-list .cart-remove-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;

  box-sizing: border-box;
  width: 26px;
  min-width: 26px;
  height: 26px;

  margin: 0;
  padding: 0;

  border: 1px solid #d9dfe8;
  border-radius: 7px;
  background: #fff;
  color: #6b7280;

  line-height: 1;
  cursor: pointer;

  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

/* Surbrillance au survol */
#cart-list .cart-remove-button:hover,
#file-list .cart-remove-button:hover {
  color: #c8004b;
  background: #fff2f7;
  border-color: #c8004b;
  box-shadow: 0 0 0 3px rgba(200, 0, 75, 0.12);
}

/* Repère visible pour la navigation au clavier */
#cart-list .cart-remove-button:focus-visible,
#file-list .cart-remove-button:focus-visible {
  outline: 2px solid #c8004b;
  outline-offset: 2px;
}

/* Icône centrée, sans marge ni décalage */
#cart-list .cart-remove-button svg,
#file-list .cart-remove-button svg {
  display: block;
  flex: 0 0 14px;

  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;

  pointer-events: none;
}

#cart-list .cart-unit-price {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ==========================================================
   HB3D — Barre harmonisée sous la surface du viewer
   Desktop : navigation | affichage | vues
   ========================================================== */

@media (min-width: 761px) {

  /*
   * La ligne de commandes adapte sa hauteur si des boutons
   * doivent revenir à la ligne dans une zone centrale étroite.
   */
  .stage .scene {
    grid-template-rows: minmax(390px, 1fr) auto;
  }

  /*
   * Même colonne que la surface du viewer.
   * Trois zones de largeur identique.
   */
  .stage .scene .viewer-toolbar {
    position: relative;

    grid-column: 2;
    grid-row: 2;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;

    align-items: stretch;
    justify-self: stretch;
    gap: 0;

    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 44px;

    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  /* Base commune : chaque groupe occupe toute sa zone. */
  .stage .scene .viewer-toolbar > .viewer-navigation,
  .stage .scene .viewer-toolbar > .viewer-modes,
  .stage .scene .viewer-toolbar > .viewer-views {
    position: relative;

    grid-row: 1;
    justify-self: stretch;
    align-self: stretch;

    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: center;

    gap: 5px;

    width: auto;
    min-width: 0;
    max-width: 100%;

    margin: 0;
    padding: 5px 8px;

    border: 0;
    box-sizing: border-box;

    transform: none;
  }

  /* Zone 1 : navigation. */
  .stage .scene .viewer-toolbar > .viewer-navigation {
    grid-column: 1;
  }

  /* Zone 2 : affichage. */
  .stage .scene .viewer-toolbar > .viewer-modes {
    grid-column: 2;
  }

  /* Zone 3 : vues prédéfinies. */
  .stage .scene .viewer-toolbar > .viewer-views {
    grid-column: 3;
  }

  /* Deux séparations discrètes entre les trois zones. */
  .stage .scene .viewer-toolbar > .viewer-modes::before,
  .stage .scene .viewer-toolbar > .viewer-views::before {
    content: "";

    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;

    width: 1px;
    background: var(--line);

    pointer-events: none;
  }

  /*
   * Repère indépendant, centré sous la palette gauche.
   * Il ne prend aucune place dans les trois zones.
   */
  .stage .scene .viewer-toolbar > .viewer-axis {
    position: absolute;

    grid-column: auto;
    grid-row: auto;

    left: auto;
    right: calc(100% + var(--palette-gap));
    top: 50%;
    bottom: auto;

    display: block;

    width: var(--palette-width);
    max-width: none;
    height: 44px;

    margin: 0;
    padding: 0;

    transform: translateY(-50%);
    pointer-events: none;
  }
}

/* HB3D — Commencer un nouveau devis */
#send-restart {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 12px 16px;

  border: 1px solid #c90045;
  border-radius: 8px;
  background: #fff;
  color: #c90045;

  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  white-space: normal;

  cursor: pointer;
  transition: background-color 0.15s ease,
              border-color 0.15s ease;
}

#send-restart:not(:disabled):hover {
  background: #fff0f5;
  border-color: #a8003a;
}

#send-restart:focus-visible {
  outline: 3px solid #c90045;
  outline-offset: 3px;
}

#send-restart:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#send-restart[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  #send-restart {
    transition: none;
  }
}