/* La pagina del configuratore è a tutto schermo: niente vincoli di larghezza
   del tema (header/footer sono nascosti dal template page-...-piegatura-tubi). */
.bb-fullscreen { margin: 0 !important; padding: 0 !important; max-width: none !important; }

/* ============================================================
   Tubo24 — configuratore immersivo scuro (full-viewport app)
   Layout di riferimento = Laser24 (app a 3 pannelli).
   Material 3 dark · Hanken Grotesk + JetBrains Mono
   NB: gli ID/classi dinamiche sono quelli usati da bender.js.
   ============================================================ */
.bb-app {
  --bg0: #16171d; --bg1: #1a1b21; --bg2: #1e1f25; --bg3: #292a30;
  --sclow: #0d0e14;
  --line: #34343b; --line-warm: #5d3f3e;
  --accent: #e11b38; --accent-h: #C8102E; --accent-2: #ffb3b1;
  --text: #e3e1ea; --muted: #e6bdbb; --outline: #ad8886;
  --ok: #27ae60; --warn: #e1b12c;
  --font: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 8px;

  position: fixed; top: var(--wp-admin--admin-bar--height, 0px); left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 99; overflow: hidden;
  background: var(--bg0); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
}
.bb-app *, .bb-app *::before, .bb-app *::after { box-sizing: border-box; }
.bb-mono, .bb-num { font-family: var(--mono); }

/* ---------- top bar ---------- */
.bb-appbar { display: flex; align-items: center; gap: 14px; height: 56px; flex-shrink: 0;
  padding: 0 18px; background: #121317; border-bottom: 1px solid var(--line); }
.bb-appbrand { font-size: 22px; font-weight: 800; letter-spacing: -.5px; text-decoration: none; color: #fff; }
.bb-appbrand span { color: var(--accent-2); }
.bb-appnav { display: flex; gap: 2px; margin-left: 6px; }
.bb-appnav a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 8px; transition: color .12s, background .12s; }
.bb-appnav a:hover { color: #fff; background: var(--bg2); }
.bb-appright { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bb-appcart { color: var(--muted); text-decoration: none; font-size: 17px; line-height: 1; }
.bb-appcart:hover { color: #fff; }
.bb-apptotal { font-family: var(--mono); font-size: 18px; font-weight: 700; color: #fff; }
.bb-appexit { color: var(--muted); text-decoration: none; font-size: 18px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 9px; }
.bb-appexit:hover { background: var(--bg2); color: #fff; }
.bb-badge-mandrel { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ok); border: 1px solid #2c5038;
  background: rgba(39,174,96,.10); border-radius: 999px; padding: 3px 10px; }

/* ---------- workspace 3 colonne ---------- */
.bb-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 400px 1fr 380px; grid-template-rows: minmax(0, 1fr); }
/* min-height:0 sui figli della griglia: senza, con molto contenuto la riga cresce oltre il box
   fisso e i pannelli non scrollano. Con questo l'overflow-scroll si riattiva. */
.bb-pane { overflow-y: auto; padding: 18px; background: var(--bg1); min-height: 0; }
.bb-left { border-right: 1px solid var(--line); }
.bb-right { border-left: 1px solid var(--line); }
.bb-pane::-webkit-scrollbar { width: 10px; }
.bb-pane::-webkit-scrollbar-thumb { background: #353844; border-radius: 6px; }

/* ---------- blocchi / step (pannello sinistro) ---------- */
.bb-block { padding: 4px 2px 16px; }
.bb-block + .bb-block { border-top: 1px solid var(--line); padding-top: 16px; }
.bb-h { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 15px; font-weight: 700; color: #fff; }
.bb-step { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  background: var(--accent); color: #fff; border-radius: 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.bb-editlabel { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); }
.bb-inline { display: flex; gap: 8px; }
.bb-inline .bb-btn { width: auto; flex: 1; }
.bb-addrow { display: grid; grid-template-columns: 88px 1fr; gap: 9px; align-items: end; margin-top: 6px; }
.bb-qtyf { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bb-qtyf input { text-transform: none; letter-spacing: 0; font-weight: 400; height: 42px; box-sizing: border-box; }
.bb-addrow #bb-reset { grid-column: 1 / -1; }

/* ---------- campi ---------- */
.bb-field { margin-bottom: 12px; }
.bb-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.bb-input, .bb-select {
  width: 100%; background: var(--sclow); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; font-family: var(--mono); font-size: 14px;
}
.bb-input:focus, .bb-select:focus { outline: none; border-color: var(--outline); }
.bb-help { font-size: 12px; color: var(--muted); margin: -2px 0 12px; line-height: 1.45; }
.bb-help b { color: var(--accent-2); font-weight: 600; }

/* ---------- percorso Z/X/Y ---------- */
.bb-rows-head { display: grid; grid-template-columns: 1fr 1fr 1fr 24px; gap: 8px; padding: 0 2px 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bb-bends { display: flex; flex-direction: column; gap: 8px; }

/* Editor "umano": segmenti tratto+piega */
.bb-seg-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; }
.bb-seg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bb-seg-n { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); }
.bb-seg-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bb-seg-fields .bb-field { margin-bottom: 0; }
.bb-seg-adv { margin-top: 8px; }
.bb-seg-adv > summary { cursor: pointer; font-size: 11px; color: var(--muted); list-style: none; padding: 2px 0; }
.bb-seg-adv > summary::-webkit-details-marker { display: none; }
.bb-seg-adv > summary:hover { color: var(--accent-2); }
.bb-seg-adv .bb-field { margin: 8px 0 0; }
.bb-seg-adv .bb-help { margin: 6px 0 2px; }
.bb-row { display: grid; grid-template-columns: 1fr 1fr 1fr 24px; gap: 8px; align-items: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.bb-row:hover { border-color: var(--outline); }
.bb-row input { width: 100%; background: var(--sclow); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px; font-family: var(--mono); font-size: 13px; }
.bb-row input:focus { outline: none; border-color: var(--outline); }
.bb-row-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }
.bb-row-del:hover { color: var(--accent-2); }
.bb-row-first input:first-child { opacity: .5; } /* prima riga: Z iniziale ininfluente */

/* ---------- bottoni ---------- */
.bb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  white-space: nowrap; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: 13px 20px; border-radius: var(--r);
  border: 1px solid var(--accent); transition: background .2s, border-color .2s; width: 100%; }
.bb-addrow #bb-addpiece { height: 42px; padding: 0 12px; box-sizing: border-box; }
.bb-btn:hover { background: var(--accent-h); border-color: var(--accent-2); }
.bb-btn:disabled { opacity: .45; cursor: not-allowed; }
.bb-btn.bb-ghost { background: transparent; color: var(--accent-2); border-color: var(--line); }
.bb-btn.bb-ghost:hover { border-color: var(--outline); background: var(--bg2); color: #fff; }
.bb-mini { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 11px; font-family: var(--mono); }
.bb-mini:hover { border-color: var(--outline); color: var(--accent-2); }

/* ---------- centro: canvas (3D + pezzi + accessori) ---------- */
.bb-canvas { overflow: hidden; min-height: 0; background: var(--bg0); display: flex; flex-direction: column; }
.bb-canvas-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; background: #121317; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.bb-canvas-bar span:first-child { color: #fff; font-weight: 600; }
.bb-hint-inline { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.bb-util { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); text-align: right; }
.bb-util .bb-free { color: #2ec26a; }
/* ===== blocco prezzo "hero" colonna destra (stesso impianto del laser) ===== */
#bb-price { background: var(--bg2); border: 1px solid var(--line); padding: 12px; margin-bottom: 14px; }
.bb-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.bb-total b { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; color: #fff; }
.bb-total .bb-each { color: var(--muted); font-size: 12px; text-align: right; line-height: 1.4; }
.bb-perpiece { font-weight: 800; color: var(--text); }
.bb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bb-badge { background: var(--bg2); color: var(--muted); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 700; }
.bb-disc-chip { background: rgba(46,194,106,.16); color: #2ec26a; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 800; }
.bb-nudge2 { margin-top: 8px; font-size: 12.5px; color: #2ec26a; font-weight: 600; }
.bb-lead-line { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; background: var(--bg2); border-radius: 10px; font-size: 13px; font-weight: 600; }
.bb-break { border-top: 1px dashed var(--line); margin-top: 13px; padding-top: 12px; font-size: 12.5px; }
.bb-break div { display: flex; justify-content: space-between; padding: 2.5px 0; color: var(--muted); }
.bb-vatline { margin-top: 12px; padding: 10px 13px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; font-size: 13px; }
.bb-vatline div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.bb-vatline div:last-child { margin-top: 5px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 16px; color: var(--text); }
.bb-vatline b { color: #fff; font-weight: 800; }
.bb-warn { background: rgba(225,27,56,.12); border: 1px solid rgba(225,27,56,.4); color: var(--accent-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.bb-warn b { display: block; margin-bottom: 3px; }
.bb-seam { color: #ff5a5f; }
/* vista 2D (3 viste ortografiche, sopra il 3D) */
.bb-2d { position: relative; width: 100%; flex: 1 1 50%; min-height: 0;
  background-color: #0f1015;
  background-image: radial-gradient(#22232a 1px, transparent 1px); background-size: 22px 22px;
  display: flex; align-items: center; justify-content: center; padding: 10px; }
.bb-2d-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; height: 100%; }
.bb-2d-cell { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); background: rgba(13,14,20,.35); }
.bb-2d-name { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.bb-2d-svg { width: 100%; height: 100%; display: block; flex: 1; min-height: 0; cursor: zoom-in; touch-action: none; }
.bb-2d.bb-grab, .bb-2d.bb-grab .bb-2d-svg { cursor: grabbing; }
.bb-2d-dim { fill: var(--muted); font-family: var(--mono); font-size: 13px; letter-spacing: .03em; }
.bb-2d-empty { color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .bb-2d-grid { grid-template-columns: 1fr; grid-auto-flow: column; overflow-x: auto; } .bb-2d-cell { min-width: 70vw; } }

/* STEP 1: controllo segmentato (profilo) + griglia spessori */
.bb-seg { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.bb-seg button { flex: 1; background: var(--bg2); color: var(--muted); border: 0; border-right: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 9px 4px; cursor: pointer; }
.bb-seg button:last-child { border-right: 0; }
.bb-seg button.is-active { background: var(--accent); color: #fff; }
.bb-wgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bb-wgrid button { background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 8px 0; cursor: pointer; border-radius: 6px; }
.bb-wgrid button:hover { border-color: var(--outline); }
.bb-wgrid button.is-active { background: rgba(225,27,56,.12); border-color: var(--accent); color: var(--accent-2); }

.bb-viewer { position: relative; width: 100%; flex: 1 1 50%; min-height: 0;
  background: radial-gradient(circle at 50% 30%, #16171d 0%, #0d0e14 70%); }
.bb-viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.bb-viewer-hud { position: absolute; left: 14px; top: 14px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: rgba(13,14,20,.6); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: grid; gap: 2px; pointer-events: none; }
.bb-viewer-hud b { color: var(--accent-2); font-weight: 600; }
/* controlli barra 3D + modalità ingrandita (come il laser) */
.bb-3d-ctl { display: flex; align-items: center; gap: 10px; }
.bb-3d-btn { background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 30px; height: 26px; cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; }
.bb-3d-btn:hover { border-color: var(--accent); }
.bb-canvas.bb-3d-big .bb-2d { flex: 1 1 24%; }
.bb-canvas.bb-3d-big .bb-viewer { flex: 1 1 76%; }
/* griglia tecnica + linee di quota nelle viste 2D */
.bb-2d-grid-line { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.bb-2d-dimline line { stroke: var(--muted); stroke-width: 1; opacity: .5; }

/* utilizzo barra (nesting tubi: quante barre da 6000 / residuo-sfrido) */
.bb-usage { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bb-usage-track { height: 7px; background: var(--sclow); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bb-usage-fill { height: 100%; width: 0; background: var(--ok); transition: width .2s, background .2s; }
.bb-usage-label { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; letter-spacing: .02em; }
.bb-usage-label b { color: var(--text); font-weight: 600; }
.bb-usage-label b.over { color: var(--accent); }

/* pezzi nella commessa */
.bb-pieces { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
  /* intestazione lotto (raggruppa i pezzi per matrice) */
  .bb-lot-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 -2px; font-weight: 700; font-size: 12.5px; color: var(--text); }
  .bb-lot-head:not(:first-child) { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
  .bb-lotdot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
  .bb-lot-title { flex: 1 1 auto; }
  .bb-lot-n { font-size: 11px; font-weight: 600; color: var(--muted); }
.bb-piece-item { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bb-piece-item:hover { border-color: var(--outline); }
.bb-piece-thumb { width: 54px; height: 40px; flex: 0 0 auto; background: var(--sclow); border: 1px solid var(--line); border-radius: 7px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bb-piece-thumb svg { width: 100%; height: 100%; }
.bb-piece-main { flex: 1 1 auto; min-width: 0; }
.bb-piece-title { font-size: 13.5px; color: var(--text); font-weight: 600; }
.bb-piece-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.bb-piece-sub b { color: var(--accent-2); font-weight: 600; }
.bb-piece-ctl { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.bb-pic-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 7px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; line-height: 1; flex-shrink: 0; }
.bb-pic-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.bb-pic-del:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.bb-empty-line { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* shop accessori */
.bb-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 14px 16px 24px; }
.bb-acc-card { background: var(--bg1); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s; }
.bb-acc-card:hover { border-color: var(--outline); }
.bb-acc-img { width: 100%; height: 120px; object-fit: contain; background: radial-gradient(circle at 50% 35%, #1a1b21, #0d0e14); border-bottom: 1px solid var(--line); }
.bb-acc-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.bb-acc-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25; }
.bb-acc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.bb-tag { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.bb-tag.inox { color: #bfe3ff; border-color: #2d4456; }
.bb-tag.zincato { color: #e9d8b3; border-color: #57492c; }
.bb-acc-price { font-family: var(--mono); font-size: 16px; color: #fff; margin-top: auto; }
.bb-acc-add { display: flex; gap: 6px; align-items: center; }
.bb-acc-add input { width: 56px; background: var(--sclow); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px; font-family: var(--mono); font-size: 13px; }
.bb-acc-add .bb-btn { flex: 1; padding: 9px 10px; }
.bb-acc-note { font-size: 11px; color: var(--muted); }

/* ---------- destra: prezzo + riepilogo + destinazione ---------- */
.bb-qs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #121317; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-bottom: 12px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); }
.bb-qs-sep { margin-top: 18px; }
.bb-msgs { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.bb-msg { font-size: 13px; padding: 8px 10px; border-radius: 6px; border: 1px solid; display: flex; gap: 8px; }
.bb-msg.err { color: #ffd9dc; background: rgba(225,27,56,.12); border-color: var(--line-warm); }
.bb-msg.warn { color: #f4e3b3; background: rgba(225,177,44,.10); border-color: #5d5230; }
.bb-price-rows { display: grid; gap: 6px; margin-bottom: 4px; }
.bb-price-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bb-price-row .bb-num { color: var(--text); }
.bb-price-empty { color: var(--muted); font-size: 13px; }
.bb-qs-head .material-symbols-outlined { font-size: 20px; }
.bb-vat { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.bb-vat label { display: flex; align-items: center; gap: 6px; margin: 0; }
.bb-vat select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; background: var(--bg2); color: var(--text); font-size: 14px; }

.bb-dest { margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); }
.bb-dest > summary { cursor: pointer; padding: 11px 13px; font-size: 13px; font-weight: 600; color: var(--text); list-style: none; }
.bb-dest > summary::-webkit-details-marker { display: none; }
.bb-dest > summary::after { content: "▾"; float: right; color: var(--muted); }
.bb-dest[open] > summary::after { content: "▴"; }
.bb-dest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 13px 13px; }
.bb-dest-grid .bb-field.full { grid-column: 1 / -1; }
.bb-dest-grid .bb-field { margin-bottom: 0; }
.bb-actions { display: grid; gap: 10px; margin-top: 8px; }

/* ---- Parità colonna riepilogo col laser (stesse dimensioni testo, stile, contenuti) ---- */
.bb-msgs:empty { display: none; }                                  /* niente spazio sopra la barra quando non ci sono messaggi */
#bb-price .bb-empty-line { text-align: center; padding: 14px 0; }  /* box vuoto centrato come #l24-price .l24-empty */
#bb-save-hint { text-align: center; margin: 12px 0 0; }            /* nota in fondo centrata come .l24-note-sm */
.bb-right .bb-btn { font-family: inherit; }                        /* bottoni col font dell'app (no mono) come .l24-cta */

/* ---------- bottom-bar (solo mobile) ---------- */
.bb-bottombar { display: none; }

/* ---- Modale "Aiuto & guida" (in-app) ---- */
.bb-help-modal { position: fixed; inset: 0; z-index: 220; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10,11,15,.55); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.bb-help-modal[hidden] { display: none; }
.bb-help-card { position: relative; width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto; background: var(--bg1); border: 1px solid var(--line); border-radius: 16px; padding: 26px 26px 24px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.bb-help-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: var(--bg2); color: var(--text); border-radius: 9px; cursor: pointer; }
.bb-help-x:hover { color: var(--accent); }
.bb-help-card h2 { margin: 0 0 16px; font-size: 21px; font-weight: 800; color: var(--text); }
.bb-help-card h3 { margin: 0 0 9px; font-size: 14px; font-weight: 700; color: var(--text); }
.bb-help-guide { margin-bottom: 20px; }
.bb-help-guide ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.bb-help-guide li { margin-bottom: 7px; }
.bb-help-guide li b { color: var(--text); font-weight: 700; }
.bb-help-ask { border-top: 1px solid var(--line); padding-top: 18px; }
.bb-help-ask p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.bb-help-row { display: flex; gap: 10px; margin-bottom: 10px; }
.bb-help-form input, .bb-help-form textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; color: var(--text); font-family: inherit; font-size: 13.5px; }
.bb-help-form input:focus, .bb-help-form textarea:focus { outline: none; border-color: var(--accent); }
.bb-help-form textarea { resize: vertical; }
.bb-help-form .bb-btn { width: 100%; margin-top: 12px; }
.bb-help-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.bb-help-msg { font-size: 12.5px; margin: 10px 0 0; min-height: 1em; }
.bb-help-msg.ok { color: var(--ok); }
.bb-help-msg.err { color: var(--accent); }
.bb-app button.lv3-icon { background: none; border: 0; padding: 0; cursor: pointer; }
@media (max-width: 560px) { .bb-help-row { flex-direction: column; gap: 10px; } }

/* ================= MOBILE — app touch ================= */
@media (max-width: 1100px) {
  .bb-appnav, .bb-badge-mandrel { display: none; }
  .bb-appbar { height: 50px; }

  .bb-workspace { display: block; position: relative; }
  .bb-canvas { position: absolute; top: 0; left: 0; right: 0; bottom: 58px; }

  .bb-pane {
    position: fixed; left: 0; right: 0; bottom: 58px; top: auto; width: auto;
    max-height: 76vh; border: none; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; box-shadow: 0 -12px 34px rgba(0,0,0,.55);
    transform: translateY(120%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    z-index: 70; padding-top: 4px;
  }
  .bb-pane::before { content: ""; display: block; width: 42px; height: 4px; background: #3c3f4b; border-radius: 3px; margin: 8px auto 12px; }
  #bb-app[data-sheet="config"] .bb-left { transform: translateY(0); }
  #bb-app[data-sheet="price"] .bb-right { transform: translateY(0); }
  /* "Pezzi": apre il pannello sinistro mostrando SOLO la lista pezzi (come il laser) */
  #bb-app[data-sheet="parts"] .bb-left { transform: translateY(0); max-height: 60vh; }
  #bb-app[data-sheet="parts"] .bb-sec-edit,
  #bb-app[data-sheet="parts"] .bb-sec-path { display: none; }
  #bb-app[data-sheet="config"] .bb-sec-parts { display: none; }
  #bb-app[data-sheet]:not([data-sheet=""]) .bb-canvas::after {
    content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 60; pointer-events: none; }

  .bb-bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px; z-index: 80; background: #101116; border-top: 1px solid var(--line); }
  .bb-bnav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; border: none; color: var(--muted); font-size: 19px; cursor: pointer; }
  .bb-bnav span { font-size: 11px; font-weight: 700; }
  .bb-bnav.is-active { color: #fff; box-shadow: inset 0 2px 0 var(--accent); }
}

/* A11y: rispetta prefers-reduced-motion in tutto il configuratore tubi (parità col laser) */
@media (prefers-reduced-motion: reduce){
  .bb-app *, .bb-app *::before, .bb-app *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
