/* ==========================================================================
   Configuratore 3D — Falegnameria ADN
   ========================================================================== */
.page-configuratore { background: #1b130e; }
.page-configuratore .site-header { height: 64px; }
.page-configuratore .brand { width: 92px; }
.page-configuratore main { padding-top: 64px; }

.cfg {
  --c-bg: #f6f3ef; --c-panel: #fbfaf8; --c-line: #e6dfd5; --c-ink: #231b15; --c-muted: #7a7067; --c-gold: #a8875a; --c-gold-d: #8c6f47; --c-soft: #efe8de;
  position: relative;
  display: grid; grid-template-columns: 88px 380px 1fr;
  height: calc(100vh - 64px); height: calc(100dvh - 64px); min-height: 560px;
  background: var(--c-bg); color: var(--c-ink);
  font-family: var(--f-sans); font-size: 14px;
}
.cfg:fullscreen { height: 100vh; }
/* la finestra dei moduli (invio, salvataggio) sta fuori da .cfg: stessi colori */
.cfg-modal {
  --c-bg: #f6f3ef; --c-panel: #fbfaf8; --c-line: #e6dfd5; --c-ink: #231b15; --c-muted: #7a7067; --c-gold: #a8875a; --c-gold-d: #8c6f47; --c-soft: #efe8de;
}
.cfg .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ---- Rail ---- */
.cfg-rail { background: #1f1712; display: flex; flex-direction: column; padding: 10px 8px; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.cfg-rail::-webkit-scrollbar { display: none; }
.cfg-rail__btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px 10px; border: 0; border-radius: 10px; background: transparent; color: #bfb2a2; font-size: 10.5px; line-height: 1.2; text-align: center;
  transition: background .2s, color .2s;
}
.cfg-rail__btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.cfg-rail__btn.is-active { background: var(--c-gold); color: #fff; }
.cfg-rail__ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.cfg-rail__ico .ico { width: 21px; height: 21px; stroke-width: 1.4; }
.cfg-rail__n { position: absolute; top: 6px; right: 8px; font-size: 9px; opacity: .55; }

/* ---- Pannello ---- */
.cfg-panel { display: flex; flex-direction: column; min-height: 0; background: var(--c-panel); border-right: 1px solid var(--c-line); box-shadow: 8px 0 30px -20px rgba(40,25,10,.25); z-index: 2; }
.cfg-panel__head { padding: 20px 24px 14px; border-bottom: 1px solid var(--c-line); }
.cfg-panel__head small { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold-d); margin-bottom: 4px; }
.cfg-panel__head h1 { font-family: var(--f-serif); font-size: 26px; line-height: 1.1; color: var(--c-ink); }
.cfg-panel__body { flex: 1; overflow-y: auto; padding: 16px 24px 28px; scrollbar-width: thin; scrollbar-color: #d6ccbf transparent; }
.cfg-panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--c-line); background: #fff; }
.cfg-step { font-size: 12px; color: var(--c-muted); }

.cfg-field { margin: 0 0 18px; }
.cfg-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #5f554c; margin-bottom: 8px; }
.cfg-label b { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--c-gold-d); }
.cfg-label--row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cfg-title { font-family: var(--f-serif); font-size: 18px; margin: 26px 0 12px; padding-top: 16px; border-top: 1px solid var(--c-line); color: var(--c-ink); }
.cfg-panel__body > .cfg-title:first-child, .cfg-products > .cfg-title:first-child, .cfg-presets .cfg-title { margin-top: 0; padding-top: 0; border-top: 0; }
.cfg-info { background: var(--c-soft); border-left: 3px solid var(--c-gold); padding: 10px 12px; font-size: 12.5px; line-height: 1.5; color: #4e453d; margin: 0 0 18px; border-radius: 0 6px 6px 0; }
.cfg-hint-inline { font-size: 12px; color: var(--c-muted); margin: 8px 0 14px; }
.cfg-empty { font-size: 13px; color: var(--c-muted); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 12px; background: #fff; border: 1px dashed var(--c-line); border-radius: 8px; }

/* range */
.cfg-range { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; --p: 50%; cursor: pointer; }
.cfg-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--c-gold) var(--p), #e3dbd0 var(--p)); }
.cfg-range::-moz-range-track { height: 4px; border-radius: 4px; background: #e3dbd0; }
.cfg-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--c-gold); }
.cfg-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 2px solid var(--c-gold); box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: transform .15s; }
.cfg-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--c-gold); }
.cfg-range:active::-webkit-slider-thumb { transform: scale(1.15); }
.cfg-numwrap { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; }
.cfg-numwrap small { font-weight: 400; color: var(--c-muted); font-size: 11px; }
.cfg-num { width: 70px; padding: 4px 6px; border: 1px solid var(--c-line); border-radius: 6px; background: #fff; font-size: 13px; font-weight: 600; text-align: right; color: var(--c-ink); }
.cfg-num:focus { outline: none; border-color: var(--c-gold); }

/* segmented */
.cfg-seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 4px; background: #efe9e1; padding: 4px; border-radius: 10px; }
.cfg-seg button { min-width: 0; min-height: 36px; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; font-size: 12.5px; color: #5c524a; transition: all .2s; }
.cfg-seg button:hover { color: var(--c-ink); background: rgba(255,255,255,.5); }
.cfg-seg button.is-on { background: #fff; color: var(--c-ink); font-weight: 600; box-shadow: 0 2px 8px -2px rgba(40,25,10,.2); }

/* toggle */
.cfg-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--c-line); border-radius: 10px; margin: 0 0 12px; cursor: pointer; position: relative; }
.cfg-toggle__lbl { font-size: 13.5px; font-weight: 500; }
.cfg-toggle small { display: block; font-size: 11.5px; color: var(--c-muted); margin-top: 2px; }
.cfg-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cfg-toggle__sw { flex: 0 0 auto; width: 40px; height: 22px; border-radius: 22px; background: #d9d0c4; position: relative; transition: background .2s; }
.cfg-toggle__sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.cfg-toggle input:checked + .cfg-toggle__sw { background: var(--c-gold); }
.cfg-toggle input:checked + .cfg-toggle__sw::after { transform: translateX(18px); }
.cfg-toggle input:focus-visible + .cfg-toggle__sw { outline: 2px solid var(--c-gold); outline-offset: 2px; }

/* cards */
.cfg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cfg-cards--text { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.cfg-cardopt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 64px; padding: 10px 6px; border: 1px solid var(--c-line); border-radius: 10px; background: #fff; font-size: 12px; line-height: 1.25; text-align: center; color: #4a4038; transition: all .2s; }
.cfg-cards--text .cfg-cardopt { min-height: 46px; }
.cfg-cardopt:hover { border-color: var(--c-gold); color: var(--c-ink); }
.cfg-cardopt.is-on { border-color: var(--c-gold); background: #fbf6ee; color: var(--c-ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--c-gold); }
.cfg-cardopt__ico { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }

/* swatches */
.cfg-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cfg-swatches--mat { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px 8px; margin-top: 10px; }
.cfg-sw { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .15s; cursor: pointer; }
.cfg-sw:hover { transform: scale(1.06); }
.cfg-sw.is-on { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 2px #fff, 0 0 0 4px var(--c-gold); }
.cfg-sw--lg { width: auto; height: auto; aspect-ratio: 1; border-radius: 8px; }
.cfg-sw--lg .cfg-sw__name { position: absolute; left: 0; right: 0; top: calc(100% + 4px); font-size: 10.5px; line-height: 1.2; color: #5c524a; text-align: center; pointer-events: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cfg-swatches--mat .cfg-sw--lg { margin-bottom: 26px; }
.cfg-sw--glass { background-image: linear-gradient(135deg, rgba(255,255,255,.7), rgba(255,255,255,.1) 50%, rgba(255,255,255,.5)) !important; }
.cfg-sw--mirror { background-image: linear-gradient(135deg, #fff, rgba(255,255,255,.1) 40%, rgba(255,255,255,.7) 60%, rgba(0,0,0,.1)) !important; }
.cfg-sw--custom { display: grid; place-items: center; background: conic-gradient(#e57373, #ffd54f, #81c784, #4fc3f7, #9575cd, #e57373); color: #fff; overflow: visible; }
.cfg-sw--custom .ico { width: 16px; height: 16px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.cfg-colorpick { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.cfg-sw--metal { width: 38px; height: 38px; }

.cfg-mat__tabs { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 2px; }
.cfg-mat__tabs::-webkit-scrollbar { display: none; }
.cfg-mat__tabs button { flex: 0 0 auto; border: 1px solid var(--c-line); background: #fff; padding: 6px 11px; border-radius: 30px; font-size: 11.5px; color: #5c524a; }
.cfg-mat__tabs button.is-on { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.cfg-mat__filtri { display: grid; gap: 6px; margin-top: 8px; }
.cfg-mat__marche button { font-weight: 600; }
.cfg-mat__marche button small { font-weight: 400; opacity: .6; }
.cfg-mat__riga { display: flex; gap: 6px; flex-wrap: wrap; }
.cfg-mat__cerca { flex: 1 1 100%; min-width: 0; border: 1px solid var(--c-line); border-radius: 30px; padding: 7px 12px; font: inherit; font-size: 12.5px; background: #fff; }
.cfg-mat__coll { flex: 1 1 140px; min-width: 0; border: 1px solid var(--c-line); border-radius: 30px; padding: 6px 10px; font: inherit; font-size: 12px; background: #fff; color: #5c524a; }
.cfg-mat__coll[hidden] { display: none; }
.cfg-mat__vuoto { grid-column: 1 / -1; font-size: 12.5px; color: #8a7f75; margin: 4px 0; }
.cfg-mat__altri { grid-column: 1 / -1; justify-self: center; margin-bottom: 8px; }
.cfg-mat { padding: 12px; background: #fff; border: 1px solid var(--c-line); border-radius: 12px; }

.cfg-select, .cfg-input { width: 100%; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; font-size: 13.5px; color: var(--c-ink); }
.cfg-select:focus, .cfg-input:focus { outline: none; border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(168,135,90,.15); }
textarea.cfg-input { resize: vertical; min-height: 70px; }

/* prodotti */
.cfg-prodgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.cfg-prod { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; min-height: 98px; background: #fff; border: 1px solid var(--c-line); border-radius: 12px; text-align: left; transition: all .2s; }
.cfg-prod:hover { border-color: var(--c-gold); transform: translateY(-1px); box-shadow: 0 10px 22px -16px rgba(40,25,10,.4); }
.cfg-prod.is-on { border-color: var(--c-gold); background: #fbf6ee; box-shadow: inset 0 0 0 1px var(--c-gold); }
.cfg-prod__ico { width: 26px; height: 26px; fill: none; stroke: var(--c-gold-d); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.cfg-prod strong { font-size: 13.5px; font-weight: 600; }
.cfg-prod small { font-size: 11.5px; color: var(--c-muted); line-height: 1.35; }
.cfg-presets { background: #fff; border: 1px solid var(--c-gold); border-radius: 12px; padding: 14px; margin-bottom: 22px; }
.cfg-preset { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--c-line); background: transparent; font-size: 13.5px; text-align: left; color: var(--c-ink); }
.cfg-preset:last-child { border-bottom: 0; }
.cfg-preset:hover { color: var(--c-gold-d); }

/* moduli */
.cfg-strip { display: flex; gap: 3px; height: 62px; padding: 4px; background: #e9e2d8; border-radius: 10px; overflow-x: auto; }
.cfg-strip__m { min-width: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #d8cebf; border-radius: 6px; background: #fff; font-size: 11px; color: #5c524a; padding: 2px; transition: all .15s; }
.cfg-strip__m.is-col { background: linear-gradient(180deg, #fff, #f3eee7); }
.cfg-strip__m b { font-size: 13px; color: var(--c-ink); }
.cfg-strip__m small { font-size: 10px; }
.cfg-strip__m:hover { border-color: var(--c-gold); }
.cfg-strip__m.is-on { background: var(--c-gold); border-color: var(--c-gold); color: #fff; }
.cfg-strip__m.is-on b { color: #fff; }
.cfg-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--c-gold-d); font-size: 12.5px; font-weight: 600; padding: 4px 0; text-transform: none; letter-spacing: 0; }
.cfg-link:hover { color: var(--c-ink); }
.cfg-modedit { background: #fff; border: 1px solid var(--c-line); border-radius: 12px; padding: 14px 14px 2px; box-shadow: 0 16px 30px -26px rgba(40,25,10,.5); }
.cfg-modedit__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cfg-modedit__head strong { font-family: var(--f-serif); font-size: 18px; font-weight: 400; }
.cfg-modedit__acts { display: flex; gap: 4px; }
.cfg-modedit__acts button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; color: #5c524a; }
.cfg-modedit__acts button:hover:not(:disabled) { border-color: var(--c-gold); color: var(--c-ink); }
.cfg-modedit__acts button.is-danger:hover:not(:disabled) { border-color: #c56b5a; color: #b4513f; }
.cfg-modedit__acts button:disabled { opacity: .35; cursor: not-allowed; }
.cfg-group { margin-top: 10px; }

/* riepilogo */
.cfg-pricebox { background: linear-gradient(135deg, #2a1f18, #3a2b20); color: #f1e8dc; border-radius: 12px; padding: 16px 18px; margin: 0 0 16px; }
.cfg-pricebox small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #cdb592; }
.cfg-pricebox strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 26px; margin: 4px 0; color: #fff; }
.cfg-pricebox p { font-size: 11.5px; color: #bfb0a0; margin: 0; }
.cfg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 0 0 18px; }
.cfg-table th, .cfg-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.cfg-table th { width: 40%; color: var(--c-muted); font-weight: 500; }
.cfg-table--cut th { width: auto; background: #f3eee7; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.cfg-cut { margin: 0 0 18px; border: 1px solid var(--c-line); border-radius: 10px; background: #fff; }
.cfg-cut summary { cursor: pointer; padding: 12px 14px; font-size: 13px; font-weight: 600; }
.cfg-cut__scroll { max-height: 280px; overflow: auto; padding: 0 10px 10px; }
.cfg-actions { display: flex; flex-direction: column; gap: 8px; }
.cfg-actions__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* bottoni */
.cfg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap; transition: all .2s; text-decoration: none; }
.cfg-btn--block { width: 100%; min-height: 48px; font-size: 14px; }
.cfg-btn--gold { background: var(--c-gold); color: #fff; }
.cfg-btn--gold:hover { background: var(--c-gold-d); }
.cfg-btn--dark { background: var(--c-ink); color: #fff; }
.cfg-btn--dark:hover { background: #000; }
.cfg-btn--ghost { background: #fff; border-color: var(--c-line); color: var(--c-ink); }
.cfg-btn--ghost:hover:not(:disabled) { border-color: var(--c-gold); }
.cfg-btn--ghost.is-danger:hover { border-color: #c56b5a; color: #b4513f; }
.cfg-btn--wa { background: #25d366; color: #fff; }
.cfg-btn--icon { width: 40px; padding: 0; }
.cfg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Stage ---- */
.cfg-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #e9e4dd; }
.cfg-canvas { position: absolute; inset: 0; }
.cfg-canvas canvas { display: block; touch-action: none; outline: none; cursor: grab; }
.cfg-canvas canvas:active { cursor: grabbing; }
.cfg-dims { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dim-label { position: absolute; left: 0; top: 0; padding: 3px 8px; border-radius: 20px; background: rgba(35,27,21,.86); color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap; will-change: transform; box-shadow: 0 4px 10px rgba(0,0,0,.18); }
.dim-label.dim-mod { background: rgba(168,135,90,.92); font-size: 10.5px; padding: 2px 7px; }

.cfg-toolbar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; z-index: 3; }
.cfg-toolgroup { display: flex; gap: 2px; padding: 4px; background: rgba(255,255,255,.92); border-radius: 12px; box-shadow: 0 8px 24px -12px rgba(40,25,10,.35); backdrop-filter: blur(8px); pointer-events: auto; }
.cfg-tool { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #4a4038; transition: all .15s; }
.cfg-tool:hover:not(:disabled) { background: #f0ebe4; color: var(--c-ink); }
.cfg-tool.is-on { background: var(--c-ink); color: #fff; }
.cfg-tool:disabled { opacity: .3; cursor: not-allowed; }
.cfg-views { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 2px; padding: 4px; background: rgba(255,255,255,.92); border-radius: 12px; box-shadow: 0 8px 24px -12px rgba(40,25,10,.35); backdrop-filter: blur(8px); z-index: 3; }
.cfg-view { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; font-size: 12px; color: #4a4038; }
.cfg-view:hover { background: #f0ebe4; color: var(--c-ink); }
.cfg-hint { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 30px; background: rgba(35,27,21,.72); color: #fff; font-size: 12px; pointer-events: none; opacity: 0; animation: cfgHint 7s ease 1.2s forwards; z-index: 2; white-space: nowrap; }
@keyframes cfgHint { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }

.cfg-card { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 16px; padding: 10px 10px 10px 18px; background: rgba(255,255,255,.96); border-radius: 14px; box-shadow: 0 16px 40px -18px rgba(40,25,10,.45); z-index: 3; max-width: calc(100% - 28px); }
.cfg-card__txt { min-width: 0; }
.cfg-card__txt strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cfg-card__txt small { font-size: 11px; color: var(--c-muted); }
.cfg-card__price { padding-left: 16px; border-left: 1px solid var(--c-line); }
.cfg-card__price small { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.cfg-card__price strong { font-size: 15px; white-space: nowrap; }
.cfg-card__acts { display: flex; gap: 6px; }

.cfg-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(233,228,221,.92); z-index: 6; text-align: center; padding: 24px; font-size: 14px; color: #4a4038; }
.cfg-loader i { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #d8cebf; border-top-color: var(--c-gold); animation: cfgSpin .9s linear infinite; }
.is-nowebgl .cfg-loader i { display: none; }
@keyframes cfgSpin { to { transform: rotate(360deg); } }

/* ---- Modali ---- */
.cfg-modal { position: fixed; inset: 0; z-index: 1400; background: rgba(20,14,10,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s; }
.cfg-modal__box { width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: #fbfaf8; border-radius: 16px; box-shadow: 0 40px 90px -30px rgba(0,0,0,.6); overflow: hidden; animation: cfgPop .25s cubic-bezier(.2,.7,.2,1); font-family: var(--f-sans); color: #231b15; font-size: 14px; }
.cfg-modal__box.is-wide { width: min(760px, 100%); }
@keyframes cfgPop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.cfg-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid #e6dfd5; }
.cfg-modal__head h2 { font-family: var(--f-serif); font-size: 22px; }
.cfg-modal__x { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #efe9e1; display: grid; place-items: center; color: #231b15; }
.cfg-modal__x .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cfg-modal__body { padding: 20px 22px; overflow-y: auto; }
.cfg-modal__foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid #e6dfd5; background: #fff; }
.cfg-modal .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cfg-modal .cfg-btn { font-family: var(--f-sans); }

.cfg-explist { display: flex; flex-direction: column; gap: 8px; }
.cfg-exp { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid #e6dfd5; border-radius: 12px; background: #fff; text-align: left; transition: all .2s; }
.cfg-exp:hover { border-color: #a8875a; transform: translateX(2px); }
.cfg-exp .ico { width: 26px; height: 26px; color: #8c6f47; }
.cfg-exp strong { display: block; font-size: 14px; }
.cfg-exp small { font-size: 12px; color: #7a7067; }

.cfg-projects { display: flex; flex-direction: column; gap: 10px; }
.cfg-projrow { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid #e6dfd5; border-radius: 12px; background: #fff; }
.cfg-projrow.is-current { border-color: #a8875a; }
.cfg-projrow img, .cfg-projrow__ph { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; background: #efe9e1; }
.cfg-projrow__txt strong { display: block; font-size: 14.5px; }
.cfg-projrow__txt small { font-size: 12px; color: #7a7067; }
.cfg-projrow__acts { display: flex; gap: 6px; }

.cfg-share p { font-size: 13px; color: #5c524a; margin: 0 0 14px; }
.cfg-share__row { display: flex; gap: 8px; margin-bottom: 14px; }
.cfg-share__btns { display: flex; gap: 8px; flex-wrap: wrap; }

.cfg-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.cfg-form__f { display: flex; flex-direction: column; gap: 5px; }
.cfg-form__f.is-full { grid-column: 1 / -1; }
.cfg-form__f span { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6d625a; }
.cfg-form__f input, .cfg-form__f textarea { width: 100%; padding: 10px 12px; border: 1px solid #e0d7cb; border-radius: 8px; font-size: 14px; background: #fff; font-family: inherit; }
.cfg-form__f input:focus, .cfg-form__f textarea:focus { outline: none; border-color: #a8875a; box-shadow: 0 0 0 3px rgba(168,135,90,.15); }
.cfg-check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #5c524a; margin-bottom: 8px; }
.cfg-check input { margin-top: 2px; accent-color: #a8875a; width: 16px; height: 16px; flex: 0 0 auto; }
.cfg-check a { text-decoration: underline; }
.cfg-form__status { font-size: 13px; margin: 10px 0 0; }
.cfg-form__status.is-ok { color: #3d7a4d; }
.cfg-form__status.is-err { color: #b4513f; }
.cfg-form__status a, .cfg-form__status .linklike { color: inherit; text-decoration: underline; font-weight: 600; }
.cfg-send__preview { display: flex; gap: 14px; align-items: center; padding: 10px; background: #fff; border: 1px solid #e6dfd5; border-radius: 12px; }
.cfg-send__preview img { width: 150px; height: 94px; object-fit: cover; border-radius: 8px; }
.cfg-send__preview strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 18px; }
.cfg-send__preview small { display: block; font-size: 12px; color: #7a7067; margin-bottom: 4px; }
.cfg-send__preview b { color: #8c6f47; }
.cfg-done { text-align: center; padding: 10px 0; }
.cfg-done__ico { width: 56px !important; height: 56px !important; color: #fff; background: #3d7a4d; border-radius: 50%; padding: 12px; margin: 0 auto 14px; display: block; stroke-width: 2.2 !important; }
.cfg-help ul { margin: 0 0 14px; padding-left: 18px; line-height: 1.9; font-size: 13.5px; }
.cfg-help p { font-size: 13px; color: #5c524a; }

.cfg-toasts { position: fixed; left: 50%; bottom: 92px; /* in basso: non copre la barra degli strumenti in alto */ transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.cfg-toast { padding: 10px 18px; border-radius: 30px; background: #231b15; color: #fff; font-size: 13px; font-family: var(--f-sans); box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); animation: slideUp .3s cubic-bezier(.2,.7,.2,1); transition: opacity .4s, transform .4s; max-width: min(90vw, 560px); text-align: center; }
.cfg-toast--err { background: #9b3f30; }
.cfg-toast.is-out { opacity: 0; transform: translateY(8px); }

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .cfg { grid-template-columns: 76px 340px 1fr; }
  .cfg-rail__btn { font-size: 9.5px; }
  .cfg-card__txt { display: none; }
  .cfg-card__price { border-left: 0; padding-left: 4px; }
}
@media (max-width: 1100px) {
  .cfg-views .cfg-view span { display: none; }
}
@media (max-width: 860px) {
  .page-configuratore .site-header { height: 56px; }
  .page-configuratore main { padding-top: 56px; }
  .cfg {
    grid-template-columns: 1fr; grid-template-rows: minmax(300px, 50vh) auto 1fr;
    height: auto; min-height: calc(100dvh - 56px);
  }
  .cfg-stage { grid-row: 1; height: 50vh; min-height: 300px; position: sticky; top: 56px; z-index: 3; }
  .cfg-rail { grid-row: 2; flex-direction: row; padding: 8px; gap: 6px; overflow-x: auto; position: sticky; top: calc(56px + 50vh); z-index: 3; }
  .cfg-rail__btn { flex: 0 0 auto; flex-direction: row; padding: 6px 12px 6px 6px; border-radius: 30px; font-size: 12px; white-space: nowrap; }
  .cfg-rail__ico { width: 26px; height: 26px; }
  .cfg-rail__ico .ico { width: 18px; height: 18px; }
  .cfg-rail__n { display: none; }
  .cfg-panel { grid-row: 3; border-right: 0; box-shadow: none; }
  .cfg-panel__head { padding: 14px 16px 10px; }
  .cfg-panel__head h1 { font-size: 22px; }
  .cfg-panel__body { overflow: visible; padding: 14px 16px 24px; }
  .cfg-panel__foot { position: sticky; bottom: 0; }
  .cfg-toolbar { top: 8px; left: 8px; right: 8px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .cfg-toolbar::-webkit-scrollbar { display: none; }
  .cfg-toolgroup { flex: 0 0 auto; }
  .cfg-tool { width: 36px; height: 36px; }
  .cfg-views { left: 8px; bottom: 8px; }
  .cfg-view { padding: 0 8px; height: 34px; }
  .cfg-hint { display: none; }
  .cfg-card { right: 8px; bottom: 54px; padding: 6px; gap: 8px; }
  .cfg-card__price { display: none; }
  .cfg-card [data-save], .cfg-card [data-export] { display: none; }
  .cfg-card .cfg-btn--gold { padding: 0 12px; font-size: 12.5px; }
  .cfg-num, .cfg-select, .cfg-input, .cfg-form__f input, .cfg-form__f textarea { font-size: 16px; }
  .cfg-form__grid { grid-template-columns: 1fr; }
  .cfg-projrow { grid-template-columns: 80px 1fr; }
  .cfg-projrow img, .cfg-projrow__ph { width: 80px; height: 56px; }
  .cfg-projrow__acts { grid-column: 1 / -1; }
  .cfg-send__preview img { width: 100px; height: 64px; }
  .cfg-modal { padding: 0; align-items: end; }
  .cfg-modal__box, .cfg-modal__box.is-wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
}
/* telefono: il 3D resta visibile ma lascia più spazio al pannello (filtri e campioni non finiscono sotto il 3D) */
@media (max-width: 600px) {
  .cfg { grid-template-rows: minmax(250px, 40vh) auto 1fr; }
  .cfg-stage { height: 40vh; min-height: 250px; }
  .cfg-rail { top: calc(56px + max(40vh, 250px)); }
  .cfg-panel__body .cfg-field { scroll-margin-top: calc(120px + max(40vh, 250px)); }
  /* barra strumenti: tutti i pulsanti visibili senza scorrere (schermo intero e vista tecnica non servono sul telefono; l’Aiuto resta, contiene la guida) */
  .cfg-toolbar .cfg-tool { width: 33px; height: 33px; }
  .cfg-toolbar [title^="Schermo intero"], .cfg-toolbar [title^="Vista tecnica"] { display: none; }
  /* scheda invio compatta: solo icone, così non copre il mobile nel 3D */
  .cfg-card .cfg-btn--gold { font-size: 0; gap: 0; padding: 0 12px; }
  .cfg-card .cfg-btn--gold .ico { margin: 0; }
}
/* tablet: la barra viste (a sinistra) e la scheda invio (a destra) stanno sulla stessa riga in basso, senza coprire il mobile */
@media (min-width: 640px) and (max-width: 860px) {
  .cfg-card { bottom: 8px; }
}
@media (max-width: 420px) {
  .cfg-prodgrid { grid-template-columns: 1fr 1fr; }
  .cfg-prod { min-height: 88px; padding: 10px; }
  .cfg-prod small { display: none; }
}

/* ---- Guida passo passo, selettore moduli, avvisi ---- */
.cfg-guide { background: linear-gradient(135deg, #fbf6ee, #f4ecdf); border: 1px solid #e6d7bf; border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; }
.cfg-guide__step { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold-d); font-weight: 600; margin-bottom: 4px; }
.cfg-guide strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 18px; color: var(--c-ink); margin-bottom: 4px; }
.cfg-guide p { font-size: 13px; line-height: 1.5; color: #5c524a; margin: 0; }
.cfg-guide b { color: var(--c-ink); }
.cfg-warn { margin-top: 10px !important; padding: 8px 10px; border-radius: 8px; font-size: 12.5px !important; }
.cfg-warn--err { background: #fbe9e5; color: #8f3526 !important; }
.cfg-warn--warn { background: #fdf3dd; color: #7a5a14 !important; }
.cfg-warn--info { background: #eef3ee; color: #35593f !important; }
.cfg-advtoggle { margin-top: 6px; }
.cfg-picker { background: #fff; border: 1px solid var(--c-line); border-radius: 14px; padding: 14px; box-shadow: 0 16px 30px -26px rgba(40,25,10,.5); }
.cfg-picker__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cfg-picker__head strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 19px; }
.cfg-picker__head small { display: block; font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.cfg-picker__head > div, .cfg-picker__head > strong { flex: 1; }
.cfg-cards--mods { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); margin-bottom: 14px; }
.cfg-cards--mods .cfg-cardopt { min-height: 96px; }
.cfg-cards--mods .cfg-cardopt small { font-size: 10.5px; color: var(--c-muted); font-weight: 400; }
.cfg-cards--mods .cfg-cardopt:hover { background: #fbf6ee; transform: translateY(-1px); }
.cfg-start { display: flex; flex-direction: column; gap: 10px; }
.cfg-start__head { display: flex; gap: 12px; align-items: center; padding: 12px; background: #fff; border: 1px solid var(--c-line); border-radius: 12px; }
.cfg-start__head strong { display: block; font-size: 16px; }
.cfg-start__head small { font-size: 12px; color: var(--c-muted); }
.cfg-start__q { font-family: var(--f-serif); font-size: 20px; margin: 8px 0 0; }
.cfg-start__sub { font-size: 12.5px; color: var(--c-muted); margin: 6px 0 0; }
.cfg-startopt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--c-line); border-radius: 12px; text-align: left; transition: all .2s; }
.cfg-startopt:hover { border-color: var(--c-gold); transform: translateX(2px); }
.cfg-startopt strong { display: block; font-size: 14px; }
.cfg-startopt small { display: block; font-size: 12px; color: var(--c-muted); }
.cfg-startopt__ico { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: #f3ece2; display: grid; place-items: center; color: var(--c-gold-d); }
.cfg-startopt__ico .ico { width: 22px; height: 22px; }
.cfg-startopt--main { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.cfg-startopt--main small { color: #d8cdbf; }
.cfg-startopt--main .cfg-startopt__ico { background: var(--c-gold); color: #fff; }
.cfg-startopt--main:hover { border-color: var(--c-gold); }
.cfg-current { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--c-gold); border-radius: 12px; margin-bottom: 8px; }
.cfg-current small { font-size: 11px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .08em; }
.cfg-current strong { flex: 1; font-size: 15px; }
.cfg-alert { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 4; max-width: min(560px, calc(100% - 28px)); padding: 9px 14px; border-radius: 10px; background: #fdf3dd; color: #6b4d10; font-size: 12.5px; box-shadow: 0 10px 24px -14px rgba(0,0,0,.4); text-align: center; }
.cfg-alert.is-err { background: #fbe9e5; color: #8f3526; }
.dim-label.dim-room { background: rgba(140,111,71,.92); font-weight: 500; }
@media (max-width: 860px) { .cfg-alert { top: 52px; font-size: 12px; } }

/* Barra delle viste (in basso a sinistra) e scheda invio (in basso a destra) non devono mai sovrapporsi:
   quando il 3D è stretto le viste diventano solo icone, poi la scheda perde il nome del progetto, poi sale sopra le viste */
.cfg-stage { container: stage / inline-size; }
@container stage (max-width: 1130px) {
  .cfg-view span { display: none; }
  .cfg-view { padding: 0 9px; }
}
@container stage (max-width: 900px) {
  .cfg-card__txt { display: none; }
  .cfg-card { padding-left: 10px; }
}
@container stage (max-width: 720px) {
  .cfg-card { bottom: 54px; }
}
.cfg-ask { margin: 0; font-size: 14.5px; line-height: 1.55; color: #3d342d; }

/* nomi sotto le icone della barra strumenti quando c'è spazio */
.cfg-tool__l { display: none; }
@container stage (min-width: 860px) {
  .cfg-toolbar .cfg-tool { width: auto; min-width: 44px; height: 46px; padding: 3px 6px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  .cfg-tool__l { display: block; font: 500 9.5px/1 var(--f-sans); letter-spacing: .01em; white-space: nowrap; }
}

/* guida al primo utilizzo (tour.js) */
.adn-tour { position: fixed; inset: 0; z-index: 2000; }
.adn-tour__hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(20, 14, 10, .62); transition: all .35s cubic-bezier(.2, .7, .2, 1); pointer-events: none; outline: 2px solid #e4cfa6; }
.adn-tour__bub { position: fixed; background: #fffdf9; color: #2b2019; border-radius: 16px; padding: 16px 18px 14px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55); font-family: var(--f-sans); transition: left .35s, top .35s; animation: fadeIn .3s; }
.adn-tour__bub small { color: #a2885f; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.adn-tour__bub strong { display: block; font-family: var(--f-serif); font-weight: 400; font-size: 20px; margin: 4px 0 6px; }
.adn-tour__bub p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: #4a4038; }
.adn-tour__acts { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.adn-tour__skip { border: 0; background: none; color: #8a7f75; font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.adn-tour__ok { border: 0; background: #b08d57; color: #fff; border-radius: 30px; padding: 9px 18px; font: 600 13.5px var(--f-sans); cursor: pointer; }
