/* ═══ PASSO 1 · STANZA — tavolozza, tela, proprietà: tre pannelli sulla cornice ═══
   Griglia: 232 + 1fr + 320, spazio 8 px fra i pannelli; i bordi esterni stanno a 8 px
   dalla finestra (margine dello .stage), come il foglio della home. */
.stz { position: absolute; inset: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr) 320px; gap: 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); min-height: 0; }
.panel-well { background: var(--well); border: 1px solid var(--border); border-radius: var(--radius-sheet); min-height: 0; }
.stz button svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nf input:focus-visible { outline: none; }

/* tavolozza */
.stz-pal { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.pal-h { margin: 14px 8px 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.pal-h:first-child { margin-top: 0; }
.tool {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; flex: none;
  border: 0; border-radius: var(--radius-control); background: none; color: var(--text);
  font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap;
}
.tool svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.tool span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tool kbd { font: 500 12px/1 var(--font-num); color: var(--muted); }
.tool:hover { background: var(--raised); }
.tool.is-on { background: var(--active); font-weight: 600; }
.tool.is-on svg { color: var(--text); }
.stz-opts { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--rule); }
.stz-opts .opt { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 12px; }
.stz-opts .lbl { font-size: 13px; font-weight: 500; }
.stz-opts .seg { align-self: flex-start; }
.stz-opts .nf { align-self: flex-start; }

/* tela */
.stz-main { position: relative; overflow: hidden; }
.stz-canvas { position: absolute; inset: 0; }
.pz-svg { display: block; width: 100%; height: 100%; user-select: none; touch-action: none; cursor: default; }
.pz-svg[data-tool="muro"], .pz-svg[data-tool="finestra"], .pz-svg[data-tool="porta"] { cursor: crosshair; }
.pz-hit { fill: transparent; stroke: none; pointer-events: all; cursor: pointer; }
.pz-svg[data-tool="finestra"] .pz-hit:not(.pz-hit-o), .pz-svg[data-tool="porta"] .pz-hit:not(.pz-hit-o) { cursor: crosshair; }
.pz-h { cursor: grab; }
.pz-h-op { cursor: ew-resize; }
.stz-tr, .stz-zoom {
  position: absolute; display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.stz-tr { top: 16px; right: 16px; }
.stz-zoom { bottom: 16px; right: 16px; }
.stz-hint {
  position: absolute; left: 16px; bottom: 16px; right: 160px; margin: 0;
  font-size: 13px; line-height: 18px; color: var(--muted); pointer-events: none;
  text-wrap: pretty;   /* a capo fra le parole, mai troncato */
}
.stz-hint:empty { display: none; }

.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.seg button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.nf { display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); padding-right: 9px; }
.nf:focus-within { border-color: var(--accent); }
.nf input { width: 62px; height: 100%; border: 0; background: none; padding: 0 4px 0 9px; font: 500 14px var(--font-num); font-variant-numeric: tabular-nums; outline: none; text-align: right; }
.nf span { font-size: 12px; color: var(--muted); }
.nf.big { height: 40px; }
.nf.big input { width: 100%; font-size: 15px; }
.is-hidden { display: none !important; }

.stz-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.se-card { width: min(480px, 100%); padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.se-card h2 { margin: 0; font-size: 18px; line-height: 24px; }
.se-card p { margin: 6px 0 20px; color: var(--muted); line-height: 21px; }
.se-opts { display: flex; gap: 8px; flex-wrap: wrap; }

.stz-big { position: absolute; inset: 0; background: var(--well); z-index: 3; }
.stz-big-host { position: absolute; inset: 0; }
.stz-big-close { position: absolute; top: 16px; right: 16px; }

/* proprietà */
.stz-side { display: flex; flex-direction: column; overflow: hidden; }
.stz-3d { position: relative; flex: none; height: 232px; margin: 12px 12px 0; border-radius: 10px; overflow: hidden; background: var(--well); }
.stz-3d-host { position: absolute; inset: 0; }
.stz-3d.is-off::after { content: "3D non disponibile in questo browser"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.v3-canvas { display: block; cursor: grab; }
.v3-canvas:active { cursor: grabbing; }
.stz-3d-exp { position: absolute; top: 8px; right: 8px; background: var(--surface); border: 1px solid var(--border); }
.stz-props { flex: 1; min-height: 0; overflow: auto; padding: 20px 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.stz-props h3 { margin: 0; font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.pf { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 500; }
.pf small { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 16px; }
.pf .nf { align-self: flex-start; }
.pf .nf input { width: 90px; }
.pf .seg { align-self: flex-start; }
.stz-props .btn { align-self: flex-start; }
.stz-props .btn kbd { margin-left: 4px; font: 500 12px/1 var(--font-num); color: var(--muted); }
.btn-del { color: var(--negative); }
.btn-del:hover { background: #fdf3f2; }
.riep { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--border); border-radius: var(--radius-card); }
.riep div { padding: 10px 12px; }
.riep div + div { border-left: 1px solid var(--border); }
.riep dt { font-size: 12px; color: var(--muted); }
.riep dd { margin: 2px 0 0; font-size: 20px; line-height: 24px; font-weight: 500; }
.pnota { margin: 0; font-size: 13px; color: var(--muted); line-height: 19px; }
.pavv { margin: 0; padding: 10px 12px; border-radius: var(--radius-card); background: var(--pill-warning-bg); border: 1px solid #fde68a; color: var(--pill-warning-ink); font-size: 13px; line-height: 19px; }
.stz-next { flex: none; padding: 12px 16px 16px; border-top: 1px solid var(--rule); }
.stz-next .btn { width: 100%; height: 40px; }

/* stanza rettangolare (dialogo) */
.rett .dnota { margin: -10px 0 0; color: var(--muted); font-size: 13px; }
.rett-row { display: flex; gap: 12px; align-items: center; }
.rett-row .field { flex: 1; }
.rett .field > .rett-row { margin-top: 2px; }
.rett-err { margin: 0; color: var(--negative); font-size: 13px; font-weight: 500; }

@media (max-width: 1180px) { .stz { grid-template-columns: 200px minmax(0, 1fr) 280px; } .stz-3d { height: 190px; } .tool kbd { display: none; } }
@media (max-width: 900px) { .stz { grid-template-columns: 196px minmax(0, 1fr) 248px; } .stz-hint { display: none; } .tool { font-size: 13px; gap: 8px; } }
