/* HB3D — adaptations réservées à la copie de raccordement. */

/* Même emplacement que l'ancienne illustration :
   entre les palettes gauche et droite. */
.stage .scene > .hb3d-real-viewer {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  justify-self: stretch;

  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;

  border-radius: 10px;
  background: #f3f7fb;
}

/* Le moteur sera raccordé à ce canvas lors de l'étape suivante. */
.hb3d-real-viewer > #cv {
  display: block;
  width: 100%;
  height: 100%;

  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Message provisoire, sans interception des interactions. */
.hb3d-viewer-placeholder {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 16px;
  text-align: center;
  pointer-events: none;
}

.hb3d-viewer-placeholder > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.hb3d-viewer-placeholder > small {
  max-width: 260px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

/* HB3D — sélecteur de vue clairement identifié. */
.hb3d-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;

  max-width: 100%;
  padding: 8px 10px;

  border: 1px solid #c7d5e5;
  border-radius: 11px;
  background: #eaf1f8;
  box-shadow: 0 3px 10px #142c4810;
}

.hb3d-view-switch-label {
  margin-right: 3px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.hb3d-view-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  min-width: 0;
  min-height: 15px;
  padding: 5px 10px;

  border: 1px solid #b7c8dc;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);

  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.hb3d-view-switch button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 20px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hb3d-view-switch button[aria-pressed="true"] {
  border-color: #d62828;
  background: #d62828;
  color: #fff;
  box-shadow: 0 2px 5px #d6282825;
}

.hb3d-view-switch button:not(:disabled):hover {
  border-color: var(--accent);
}

.hb3d-view-switch button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.hb3d-view-switch button:disabled {
  opacity: .45;
  cursor: default;
  box-shadow: none;
}

@media (max-width: 760px) {
  .hb3d-view-switch {
    width: 100%;
    gap: 6px;
    padding: 6px;
  }

  .hb3d-view-switch-label {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .hb3d-view-switch button {
    flex: 1 1 0;
    padding: 7px 5px;
    font-size: 11px;
  }
}

/* HB3D — avertissement anti-doublon intégré au viewer. */
.hb3d-duplicate-notice {
  position: absolute;
  z-index: 20;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: flex-start;
  gap: 10px;

  width: min(430px, calc(100% - 24px));
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: 12px 13px;

  border: 1px solid #d62828;
  border-radius: 10px;
  background: #251c20;
  color: #fff;
  box-shadow: 0 6px 24px #d6282830;
}

.hb3d-duplicate-icon {
  display: grid;
  place-items: center;
  flex: 0 0 21px;
  width: 21px;
  height: 21px;

  border: 1px solid #f05a66;
  border-radius: 50%;
  color: #ff7580;
  font-size: 14px;
  font-weight: 700;
}

#hb3d-duplicate-text {
  flex: 1;
  min-width: 0;
  margin: 0;

  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

#hb3d-duplicate-close {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  padding: 0;

  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

#hb3d-duplicate-close:hover {
  background: #ffffff20;
}

/* Mesures centrées sous le viewer. */
.metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;

  width: 100%;
  box-sizing: border-box;
  gap: 14px 36px;

  padding: 16px 12px;
  text-align: center;
}

.metrics > div {
  flex: 0 1 260px;
  min-width: 0;
}

.metrics > div > span,
.metrics > div > strong {
  display: block;
}

.metrics > div > span {
  margin-bottom: 5px;
}

.metrics > div > strong {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.metrics .metric-unit-note {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: normal;
  opacity: 0.75;
}

@media (max-width: 600px) {
  .metrics {
    gap: 14px;
  }

  .metrics > div {
    flex-basis: 100%;
  }
}

/* Panier compact : une ligne à deux niveaux par fichier. */
#cart-list.cart-overview {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding-right: 4px;
}

#cart-list .cart-piece {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 0;
  row-gap: 5px;

  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  padding: 8px 5px;

  border: 0;
  border-bottom: 1px solid #e1e6ee;
  border-radius: 0;
  background: transparent;
}

#cart-list .cart-piece:last-child {
  border-bottom: 0;
}

#cart-list .cart-piece-name {
  grid-column: 1;
  grid-row: 1;

  min-width: 0;
  margin: 0;

  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;

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

#cart-list .cart-piece-config {
  grid-column: 1;
  grid-row: 2;

  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;

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

  font-size: 10px;
  line-height: 1.4;
  color: #586579;

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

#cart-list .cart-color-label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;

  min-width: 0;
  margin: 0;

  white-space: nowrap;
  vertical-align: middle;
}

#cart-list .cart-color-swatch {
  display: inline-block;
  flex: 0 0 9px;

  width: 9px;
  height: 9px;
  box-sizing: border-box;

  border: 1px solid rgba(30, 45, 65, 0.3);
  border-radius: 50%;
}

/* Sélecteur de couleur propre à chaque pièce du panier. */
#cart-list .cart-color-select {
  box-sizing: border-box;
  width: 62px;
  min-width: 0;
  height: 26px;
  margin: 0;
  padding: 0 2px;

  border: 1px solid #c9d3e1;
  border-radius: 5px;
  background-color: #fff;
  color: #132746;

  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

#cart-list .cart-color-select:hover {
  border-color: #c90049;
}

#cart-list .cart-color-select:focus-visible {
  outline: 2px solid #c90049;
  outline-offset: 2px;
}

#cart-list .cart-piece-prices {
  grid-column: 1;
  grid-row: 3;

  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0;

  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;

  font-size: 10px;
  line-height: 1.35;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#cart-list .cart-piece-prices > span {
  color: #657186;
}

#cart-list .cart-piece-prices > strong {
  margin: 0;
  color: #132746;
  font-size: 11px;
  font-weight: 600;
}

#hb3d-pricing-summary {
  margin: 7px 0;
  font-size: 10px;
  line-height: 1.4;
  color: #586579;
  overflow-wrap: anywhere;
}

#cart-total {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}


/* Pastilles visibles, y compris pour le blanc et le jaune. */
#cart-list .cart-color-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  vertical-align: middle;
}

#cart-list .cart-color-label .cart-color-swatch {
  display: inline-block !important;
  flex: 0 0 12px;

  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;

  box-sizing: border-box;
  border: 1px solid #68758a;
  border-radius: 50%;

  box-shadow: 0 0 0 2px #fff;
  opacity: 1;
  visibility: visible;
}

/* Quantité modifiable dans chaque ligne du panier. */
#cart-list .cart-quantity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
  white-space: nowrap;
}

#cart-list .cart-quantity-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 26px;
  height: 26px;
  min-width: 26px;

  margin: 0;
  padding: 0;

  border: 1px solid #c9d3e1;
  border-radius: 5px;
  background: #fff;
  color: #132746;

  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

#cart-list .cart-quantity-button:hover:not(:disabled) {
  border-color: #c90049;
  background: #fff1f6;
  color: #c90049;
}

#cart-list .cart-quantity-button:focus-visible {
  outline: 2px solid #c90049;
  outline-offset: 2px;
}

#cart-list .cart-quantity-button:disabled {
  opacity: 0.4;
  cursor: default;
}

#cart-list .cart-quantity-value {
  min-width: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* SLA : couleurs non disponibles, visibles mais non cliquables. */
.color-dot.is-color-unavailable {
  opacity: 0.22;
  filter: grayscale(100%);
  cursor: not-allowed;
  box-shadow: none;
}

.color-dot.is-color-unavailable:hover {
  transform: none;
  box-shadow: none;
}

/* Mesures centrées sous le viewer. */
.metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;

  width: 100%;
  box-sizing: border-box;
  gap: 14px 36px;

  padding: 16px 12px;
  text-align: center;

  background: #edf1f7;
  border-radius: 0;
  box-shadow: none;
}

.metrics > div {
  position: relative;
  flex: 0 1 260px;
  min-width: 0;

  /* Place réservée au petit repère coloré. */
  padding-top: 12px;
  border-radius: 0;
}

/* Repères centrés au-dessus des libellés. */
.metrics > div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 34px;
  height: 3px;
  background: #142548;
  transform: translateX(-50%);
}

.metrics > div:last-child::before {
  background: #cf0055;
}

.metrics > div > span,
.metrics > div > strong {
  display: block;
}

/* Libellés. */
.metrics > div > span {
  margin-bottom: 5px;
  color: #34445f;
  font-size: 11px;
  line-height: 1.4;
}

/* Les trois valeurs ont exactement la même taille. */
.metrics #metric-dimensions,
.metrics #metric-volume,
.metrics #metric-total {
  color: #142548;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

/* Le total se distingue uniquement par sa couleur. */
.metrics #metric-total {
  color: #cf0055;
}

/* Surbrillance ponctuelle des informations modifiées. */
.metrics > div.metric-updated {
  animation: hb3d-metric-highlight 650ms ease-out;
}

.metrics > div:last-child.metric-updated {
  animation-name: hb3d-total-highlight;
}

@keyframes hb3d-metric-highlight {
  from {
    background-color: rgba(20, 37, 72, 0.13);
  }
  to {
    background-color: transparent;
  }
}

@keyframes hb3d-total-highlight {
  from {
    background-color: rgba(207, 0, 85, 0.14);
  }
  to {
    background-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .metrics > div.metric-updated {
    animation: none;
  }
}

/* Invitation à importer dans le viewer vide. */
.hb3d-import-invitation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.hb3d-import-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  max-width: 100%;
  padding: 12px 20px;

  border: 1px solid var(--accent, #d90056);
  border-radius: 0;

  background: var(--accent, #d90056);
  color: #fff;

  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;

  cursor: pointer;
  pointer-events: auto;
}

.hb3d-import-button:hover {
  background: #b80049;
  border-color: #b80049;
}

.hb3d-import-invitation .hb3d-import-formats {
  display: block;
  color: #526178;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

/* Indicateur de préparation de l’aperçu 3D */
#hb3d-viewer-placeholder.hb3d-preview-loading::before {
  content: "";
  display: block;
  width: 38px;
  height: 38px;
  box-sizing: border-box;
  margin: 0 auto 16px;
  border: 4px solid rgba(128, 128, 128, 0.25);
  border-top-color: #f28c28;
  border-radius: 50%;
  animation: hb3d-preview-spin 0.9s linear infinite;
}

@keyframes hb3d-preview-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #hb3d-viewer-placeholder.hb3d-preview-loading::before {
    animation: none;
  }
}

/* Configuration : couleur modifiable */
#panel-config .config-color-control {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#config-color-select {
  box-sizing: border-box;
  width: 105px;
  max-width: 100%;
  min-width: 0;
  height: 30px;
  margin: 0;
  padding: 0 6px;

  border: 1px solid #c9d3e1;
  border-radius: 5px;
  background: #fff;
  color: #132746;

  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

/* Configuration : quantité modifiable */
#panel-config .config-quantity-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

#config-quantity {
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#config-minus,
#config-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;
  flex: 0 0 auto;
  width: 30px;
  min-width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;

  border: 1px solid #c9d3e1;
  border-radius: 5px;
  background: #fff;
  color: #132746;

  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

#config-color-select:hover:not(:disabled),
#config-minus:hover:not(:disabled),
#config-plus:hover:not(:disabled) {
  border-color: #c90049;
}

#config-color-select:focus-visible,
#config-minus:focus-visible,
#config-plus:focus-visible {
  outline: 2px solid #c90049;
  outline-offset: 2px;
}

#config-color-select:disabled,
#config-minus:disabled,
#config-plus:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ==========================================================
   HB3D — Présentation smartphone / tablette

   - Présentation existante jusqu'à 1024 px.
   - Extension aux écrans tactiles en paysage :
     largeur de 1025 à 1366 px, hauteur maximale de 900 px,
     pointeur principal tactile et absence de survol.

   Le contenu du bloc reste inchangé.
   ========================================================== */

@media (max-width: 1024px),
       (min-width: 1025px) and (max-width: 1366px)
       and (orientation: landscape)
       and (hover: none)
       and (pointer: coarse) {

  /* Cadre général : ne plus comprimer la page dans 100dvh. */
  body {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    grid-template-rows: auto auto auto;
  }

  .topbar {
    min-height: 64px;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
  }

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

  /* Viewer au-dessus des volets. */
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    min-width: 0;
    min-height: 0;
  }

  .workspace > .stage {
    grid-column: 1;
    grid-row: 1;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;
  }

  .workspace > .navigation {
    grid-column: 1;
    grid-row: 2;

    min-width: 0;
    min-height: 0;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .workspace > .progress {
    display: none;
  }

  .navigation > .panel,
  .navigation > .panel:has(
    .panel-toggle[aria-expanded="true"]
  ) {
    flex: 0 0 auto;
  }

  .navigation .panel-body {
    flex: 0 0 auto;
    min-height: 0;
  }

  /* En-tête du viewer sur deux lignes. */
  .stage > .viewer {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
  }

  .viewer-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px;
  }

  .viewer-header > .active-piece {
    grid-column: 1;
    grid-row: 1;
  }

  .viewer-header > .hb3d-view-switch {
    grid-column: 1;
    grid-row: 2;

    justify-self: center;
    width: 100%;
    max-width: 480px;
  }

  /* Une seule colonne : aucune palette latérale. */
  .stage .scene {
    display: grid;
    flex: 0 0 auto;

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

    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 32px 8px 10px;

    overflow: visible;
  }

  .stage .scene > .scene-note {
    top: 5px;
    left: 8px;
    right: 8px;

    font-size: 8px;
    line-height: 1.3;
  }

  /* Surface 3D indépendante des outils. */
  .stage .scene > .hb3d-real-viewer {
    grid-column: 1;
    grid-row: 1;

    align-self: stretch;
    justify-self: stretch;

    width: 100%;
    height: clamp(300px, 48vh, 480px);
    min-width: 0;
    min-height: 0;

    overflow: hidden;
  }

  /* Commandes : navigation, affichage, vues, puis repère. */
  .stage .scene > .viewer-toolbar {
    position: relative;

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

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

    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 6px 0;
  }

  .stage .scene .viewer-toolbar > .viewer-navigation,
  .stage .scene .viewer-toolbar > .viewer-modes,
  .stage .scene .viewer-toolbar > .viewer-views {
    position: static;

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

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

    gap: 5px;
    width: auto;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;

    transform: none;
  }

  .stage .scene .viewer-toolbar > .viewer-navigation {
    grid-row: 1;
  }

  .stage .scene .viewer-toolbar > .viewer-modes {
    grid-row: 2;
  }

  .stage .scene .viewer-toolbar > .viewer-views {
    grid-row: 3;
  }

  .stage .scene .viewer-toolbar > .viewer-axis {
    position: static;

    grid-column: 1;
    grid-row: 4;
    justify-self: center;

    width: 60px;
    height: 44px;
    max-width: none;
    margin: 0;
    padding: 0;

    transform: none;
  }

  .stage .scene .viewer-toolbar > .viewer-modes::before,
  .stage .scene .viewer-toolbar > .viewer-views::before {
    content: none;
  }

  .stage .viewer-toolbar button {
    min-height: 32px;
  }

  /* Outils sous le viewer, dans leur propre grille. */
  .stage .scene > .toolbox {
    grid-column: 1;
    grid-row: 3;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

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

  .stage .scene .toolbox > .toolbox-card {
    grid-column: auto;
    grid-row: auto;

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

    gap: 12px;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 10px;

    overflow: visible;
  }

  .stage .scene .toolbox > .toolbox-card:first-child,
  .stage .scene .toolbox > .toolbox-card:last-child {
    grid-column: auto;
    grid-row: auto;
  }

  .stage .toolbox .technology-options {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;

    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .stage .toolbox .machine-choice {
    flex: 1 1 54px;

    width: auto;
    max-width: 100px;
    min-width: 0;
    height: 66px;
    padding: 4px;
  }

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

  .stage .toolbox .color-options {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 10px;
    width: 100%;
    height: auto;
    padding: 6px 0;
  }

  .stage .toolbox .color-options .color-dot {
    flex: 0 0 24px;

    width: 24px;
    min-width: 24px;
    max-width: 24px;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
  }

  .stage .toolbox .material-group,
  .stage .toolbox .quantity-group {
    width: 100%;
    min-width: 0;
    margin-top: auto;
    padding-top: 10px;
    padding-left: 0;

    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .stage .toolbox .material-group select {
    height: 34px;
  }

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

  .stage .toolbox .quantity-control button {
    width: 32px;
    height: 30px;
  }

  /* Mesures : hauteur naturelle, sans ligne fixée à 45 px. */
  .stage > .metrics {
    flex: 0 0 auto;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;

    height: auto;
    min-height: 0;
    padding: 14px 10px;
  }

  .stage > .metrics > div {
    min-width: 0;
  }

  /* Assistance dans le flux de la page. */
  .stage > .hb3d-ai-bar {
    flex: 0 0 auto;

    grid-template-columns: minmax(0, 1fr);
    gap: 8px;

    height: auto;
    min-height: 0;
    margin: 6px;
    padding: 10px;
  }

  .hb3d-ai-status {
    grid-column: 1;
    max-width: none;
    text-align: left;
  }

  .hb3d-ai-field {
    width: 100%;
  }

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

  .stage > .hb3d-chat-conversation {
    flex: 0 0 auto;
    min-height: 0;
  }

  .demo-caption {
    display: block;
    padding: 6px 10px;
  }

/* Panier : réserver la hauteur réelle de tout son contenu. */
#panel-cart {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  overflow: visible;
}

#cart-summary {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  overflow: visible;
}

#cart-summary > #cart-list {
  flex: 0 0 auto;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
}

#cart-notes {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
}

  #cart-list .cart-piece-config {
    flex-wrap: wrap;
    white-space: normal;
    row-gap: 6px;
  }

  .site-footer {
    min-height: 58px;
    padding: 10px;
  }
}

@media (max-width: 600px) {
  .stage > .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .hb3d-viewer-placeholder {
    padding: 8px;
  }

  .hb3d-viewer-placeholder > span {
    font-size: 11px;
  }

  .hb3d-viewer-placeholder > small,
  .hb3d-import-invitation .hb3d-import-formats {
    font-size: 9px;
  }

  .hb3d-import-button {
    padding: 10px 6px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .stage .scene > .toolbox {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Desktop : conserver les lignes du lot et faire défiler le volet. */
@media (min-width: 1025px) {
  #panel-cart {
    min-height: 0;
    overflow-y: auto;
  }

  #cart-summary {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #cart-summary > #cart-list {
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  #cart-summary > #cart-notes {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
}

/* HB3D — barre d'outils compacte sur tablette paysage. */
/* HB3D — barre d'outils compacte sur tablette,
   en portrait comme en paysage. */
@media (min-width: 601px) and (max-width: 1366px)
       and (hover: none)
       and (pointer: coarse) {

  .stage .scene > .viewer-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 6px 12px;
    padding: 4px 0;
  }

  .stage .scene .viewer-toolbar > .viewer-navigation,
  .stage .scene .viewer-toolbar > .viewer-modes,
  .stage .scene .viewer-toolbar > .viewer-views {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    margin: 0;
  }

  .stage .scene .viewer-toolbar > .viewer-axis {
    flex: 0 0 44px;
    width: 44px;
    height: 32px;
    margin: 0;
    align-self: center;
  }
}

/* HB3D — attente de la réponse de l'assistant. */
#hb3d-chat-conversation .hb3d-chat-waiting-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;

  color: #586579;
  font-size: 12px;
  line-height: 1.5;
}

.hb3d-chat-waiting-dots {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;

  min-height: 18px;
}

.hb3d-chat-waiting-dots > span {
  display: block;
  width: 5px;
  height: 5px;

  border-radius: 50%;
  background: #142548;
  opacity: 0.35;

  animation: hb3d-chat-dot-pulse 1.2s ease-in-out infinite;
}

.hb3d-chat-waiting-dots > span:nth-child(2) {
  animation-delay: 0.15s;
}

.hb3d-chat-waiting-dots > span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes hb3d-chat-dot-pulse {
  0%, 60%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* Garder un indicateur statique si les animations sont réduites. */
@media (prefers-reduced-motion: reduce) {
  .hb3d-chat-waiting-dots > span {
    animation: none;
    opacity: 0.7;
    transform: none;
  }
}

/* HB3D — logo dans l'en-tête du chat. */
#hb3d-help-dialog .hb3d-chat-heading .hb3d-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;

  min-width: 0;
  margin: 0;
}

#hb3d-help-dialog .hb3d-chat-title > .hb3d-chat-logo {
  display: block;
  flex: 0 0 24px;

  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* HB3D — champ de saisie aux arrondis discrets. */
#hb3d-help-dialog .hb3d-ai-field > #hb3d-ai-question {
  border-radius: 4px;
}