/* ═══════════════════════════════════════════
   REBUS · CONFIGURATORE — Design System
   ═══════════════════════════════════════════ */

:root {
  --bg:       #FFFFFF;
  --surf:     #FFFFFF;
  --surf2:    #FAFAFA;
  --surf3:    #F4F4F4;
  --line:     #ECECEC;
  --line2:    #E0E0E0;
  --ink:      #0F1113;
  --ink2:     #3A3D41;
  --ink3:     #72777D;
  --ink4:     #A4A9AE;
  --accent:   #E96A1D;
  --font:     "Helvetica Neue","Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  --mono:     "JetBrains Mono","SF Mono",ui-monospace,Consolas,monospace;
  --r:        8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ── */
 #rebus-shell {
  width: 100vw;
  height: 100vh;  /* fallback */
  height: 100dvh;  /* v21.1: dynamic viewport height — evita che l'header venga tagliato su mobile Chrome quando la barra URL appare dinamicamente */
  overflow: hidden;
  position: relative;
}

/* ── Screen transitions ── */
.screen {
  position: absolute;
  inset: 0;
  will-change: transform, opacity;
}

.screen.enter-from-right  { transform: translateX(100%); }
.screen.enter-from-left   { transform: translateX(-100%); }
.screen.exit-to-left      { transform: translateX(-100%); opacity: 0; }
.screen.exit-to-right     { transform: translateX(100%); opacity: 0; }
.screen.is-visible        { transform: translateX(0); opacity: 1; }
.screen.transitioning     { transition: transform 380ms cubic-bezier(0.5,0,0.2,1), opacity 280ms ease; }

/* ── Loader screen ── */
.screen-loader {
  background: #0a0a0a;
  display: grid;
  place-items: center;
  color: #fff;
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}.loader-caption {
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin-top: 60px;
  animation: rebusLabelFade 1.8s ease-in-out infinite;
}
@keyframes rebusSpin {
  to { transform: rotate(360deg); }
}
@keyframes rebusDash {
  0%   { stroke-dasharray: 1, 170; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 120, 170; stroke-dashoffset: -30; }
  100% { stroke-dasharray: 120, 170; stroke-dashoffset: -150; }
}
@keyframes rebusLabelFade {
  0%,100% { opacity:.55; } 50% { opacity:1; }
}
.loader-svg { animation: rebusSpin 1.6s linear infinite; transform-origin: center; }
.loader-path {
  stroke: #fff;
  stroke-linecap: round;
  animation: rebusDash 1.6s ease-in-out infinite;
}
.loader-track { stroke: rgba(255,255,255,.08); }

/* ── Dark screen (Welcome + Guida) ── */
.screen-dark {
  background: #0a0a0a;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.dark-bg-radial {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1200px 700px at 50% 45%, rgba(255,255,255,.05), transparent 65%);
}.dark-title strong { font-weight: 700; }.dark-body p {
  font-size: 15px;
  line-height: 1.6;
  font-weight: 300;
  color: rgba(255,255,255,.7);
  max-width: 440px;
}.dark-specs span.sep { opacity: .3; }
/* Mobile dark layout */
@media (max-width: 639px) {
.dark-body p { font-size: 13px; }
/* Mobile carousel */
  .dark-carousel { display: flex; width: 200%; height: 100%; transition: transform 360ms cubic-bezier(.5,0,.2,1); }
  .dark-carousel-pane { width: 50%; height: 100%; flex-shrink: 0; }
  
.dark-topbar-branding { display:inline-flex; align-items:center; gap:12px; pointer-events:none; }
.dark-topbar-rebus { font-size:12px; letter-spacing:3px; text-transform:uppercase; color:#fff; font-family:var(--mono); }
.dark-dots {
    position: absolute; bottom: 18px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 6px; z-index: 2;
  }
  .dark-dot {
    width: 6px; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,.3);
    transition: width .26s, background .26s;
  }
  .dark-dot.active { width: 22px; background: #fff; }
}

.dark-topbar .hamburger-btn,.screen-dark > .hamburger-menu { display:none !important; }.btn-ghost-light {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line2);
  padding: 0 16px;
  height: 44px;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}
.btn-dark {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 0 22px;
  height: 44px;
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
/* ── Hamburger ── */
.hamburger-btn {
  width: 36px; height: 36px;
  border-radius: var(--r);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.hamburger-btn.light {
  background: var(--surf3);
  border: none;
}
.hamburger-btn.open { background: #fff; }
.hamburger-btn.light.open { background: var(--ink); }

/* ── Hamburger menu overlay ── */
.hamburger-menu {
  position: absolute;
  top: 58px; right: 16px;
  z-index: 31;
  width: 260px;
  background: rgba(20,20,22,.96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
  padding: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hamburger-menu.light {
  background: var(--surf);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(15,17,19,.08);
}
.hamburger-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  color: #fff;
  text-decoration: none; /* v22.6: rimuove sottolineatura default per voci <a> (es. "Come si compone") */
}
/* v22.6: anche label/sub interni (default <a> sottolinea anche figli) */
.hamburger-menu-item .hamburger-menu-label,
.hamburger-menu-item .hamburger-menu-sub { text-decoration: none; }
.hamburger-menu.light .hamburger-menu-item { color: var(--ink); }
.hamburger-menu-icon {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-family: var(--mono);
}
.hamburger-menu.light .hamburger-menu-icon {
  background: var(--surf3);
  color: var(--ink);
}
.hamburger-menu-label { font-size: 13px; font-weight: 500; }
.hamburger-menu-sub   { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 1px; }
.hamburger-menu.light .hamburger-menu-sub { color: var(--ink3); }
.hamburger-menu-divider { height: 1px; background: rgba(255,255,255,.08); margin: 2px 6px; }
.hamburger-menu.light .hamburger-menu-divider { background: var(--line); }
.hamburger-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
}

/* ── Configuratore layout ── */
.screen-comp {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.comp-header {
  height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  position: relative;
}
.comp-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.comp-header-tag {
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--ink3);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.comp-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}
.comp-stage-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
.comp-stage {
  flex: 1;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  min-height: 0;
}
.comp-stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .3;
  mask-image: radial-gradient(circle at 50% 55%, #000 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle at 50% 55%, #000 30%, transparent 90%);
}
.comp-stage-label {
  position: absolute;
  left: 18px; bottom: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: .3px;
  pointer-events: none;
}
.comp-stage-zoom {
  position: absolute;
  right: 18px; bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.comp-zoom-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--surf3);
  border: none;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.comp-stage-summary {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  pointer-events: none;
}
.comp-stage-summary span { font-size: 12px; font-weight: 500; color: var(--ink); }
.comp-stage-summary .sep { width: 1px; height: 10px; background: var(--line); }
.comp-stage-summary .meta { font-family: var(--mono); font-size: 11px; color: var(--ink3); }
.comp-canvas-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* ── Config panel ── */
.comp-panel {
  width: 320px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surf);
}
.comp-panel-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.comp-panel-sub { font-size: 11px; color: var(--ink3); letter-spacing: .3px; }
.comp-panel-name { font-size: 15px; font-weight: 500; color: var(--ink); margin-top: 2px; }
.comp-panel-close {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--surf3);
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}
.comp-panel-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1;
  overflow: auto;
}
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink3);
  margin-bottom: 10px;
}

/* ── Shape grid ── */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px;
}
.shape-cell {
  min-height: 92px;
  background: var(--surf2);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.shape-cell.active {
  background: var(--surf);
  border-color: var(--ink);
}
.shape-cell-icon { flex: 1; display: grid; place-items: center; width: 100%; min-height: 48px; }
.shape-cell-label { text-align: center; margin-top: 4px; }
.shape-cell-name { font-size: 11px; font-weight: 600; letter-spacing: .2px; color: var(--ink); }
.shape-cell-dims { font-family: var(--mono); font-size: 9px; color: var(--ink3); margin-top: 1px; }

/* ── Color grid ── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 5px;
}
.color-cell {
  aspect-ratio: 1;
  background: var(--surf2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.color-cell.active { border-color: var(--ink); }
.color-swatch {
  width: 100%; height: 100%;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.color-name { font-size: 11px; color: var(--ink3); margin-top: 8px; }

/* ── Toggle ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.toggle-label { font-size: 13px; color: var(--ink); }
.toggle-track {
  width: 38px; height: 22px;
  border-radius: 999px;
  background: #E8E8E8;
  position: relative;
  flex-shrink: 0;
}
.toggle-track.on { background: var(--ink); }
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: #fff;
  transition: left .15s;
}
.toggle-track.on .toggle-thumb { left: 18px; }

/* ── Mobile drawer overlay ── */
.panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,17,19,.35);
  z-index: 30;
}
.panel-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 88%;
  max-width: 420px;
  background: var(--surf);
  z-index: 31;
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(15,17,19,.1);
  display: flex;
  flex-direction: column;
}

/* ── Riepilogo & Export screens ── */
.screen-light {
  background: var(--surf);
  display: flex;
  flex-direction: column;
}
.light-header {
  height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.light-body {
  flex: 1;
  overflow: auto;
  padding: 40px 60px;
}
.screen-title-eyebrow {
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--ink3);
}
.screen-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -.4px;
  margin: 8px 0 0;
  color: var(--ink);
}
.screen-title strong { font-weight: 700; }
.summary-card {
  margin-top: 28px;
  background: var(--surf2);
  border-radius: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
}
.summary-preview {
  background: #fff;
  border-radius: var(--r);
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 16px;
}
.summary-meta {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.summary-field {}
.summary-value { font-size: 14px; color: var(--ink); }
.summary-value.mono { font-family: var(--mono); }
.summary-total {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.summary-total-label { font-size: 11px; color: var(--ink3); letter-spacing: .4px; }
.summary-total-price { font-family: var(--mono); font-size: 20px; color: var(--ink); font-weight: 500; }
.screen-actions {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

/* ── Color swatch inline ── */
.swatch-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.swatch-dot {
  width: 20px; height: 20px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  flex-shrink: 0;
}
@media (max-width: 639px) {
  .light-body { padding: 20px; }
  .screen-title { font-size: 24px; }
  .summary-card { grid-template-columns: 1fr; gap: 16px; }
  .summary-preview { min-height: 180px; }
  .screen-actions { grid-template-columns: 1fr; }
  .comp-header { height: 52px; padding: 0 14px; }
  .comp-stage-grid { background-size: 28px 28px; }
  .comp-panel { width: 88%; max-width: 420px; }
}

/* ===== Phase 3 hybrid overrides ===== */
:root {
  --shell-max: 1440px;
  --shell-gutter: 48px;
  --page-bg: #f6f6f3;
  --card-bg: #fbfbf9;
  --card-line: #ededeb;
}

.screen-light, .screen-comp { background: var(--page-bg); }
.comp-header, .light-header {
  height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--card-line);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  overflow: visible;
}
.comp-header-brand--tight, .comp-header-brand {
  display: inline-flex; align-items: center; gap: 14px;
}
.comp-header-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 2.4px; color: #8e8e89;
}
.comp-body { display:flex; min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); }
.comp-stage-wrap { flex:1; min-width:0; padding: 24px 0 24px 24px; }
.comp-stage {
  position: relative; width: 100%; height: 100%; min-height: 720px;
  border: 1px solid var(--card-line); border-radius: 18px; background:#f7f7f4; overflow:hidden;
}
.comp-stage-grid {
  position:absolute; inset:0;
  background-image: linear-gradient(to right, rgba(17,17,19,.03) 1px, transparent 1px), linear-gradient(to bottom, rgba(17,17,19,.03) 1px, transparent 1px);
  background-size: 76px 76px; pointer-events:none;
}
.comp-stage-summary--pill {
  position:absolute; top:22px; left:50%; transform:translateX(-50%); z-index:4;
  display:inline-flex; align-items:center; gap:12px; padding: 8px 14px; border:1px solid var(--card-line);
  border-radius:999px; background: rgba(255,255,255,.92); font-size:12px;
}
/* Task 3 — banner "composizione salvata dal QR" (rientro da QR). Stesso slot
   in alto al centro; mentre è visibile nasconde la pill riepilogo per non
   sovrapporsi. Dismissibile (×), persistente finché non si chiude. */
.comp-restored-banner {
  position:absolute; top:22px; left:50%; transform:translateX(-50%); z-index:6;
  display:flex; align-items:center; gap:10px;
  max-width:min(92%, 480px); padding:9px 12px 9px 15px;
  border-radius:999px; background:#111113; color:#fff;
  box-shadow:0 10px 30px rgba(0,0,0,.20); font-size:12.5px; line-height:1.35;
}
.comp-restored-banner[hidden] { display:none; }
.comp-restored-icon { font-size:14px; opacity:.85; flex-shrink:0; }
.comp-restored-text { font-weight:500; }
.comp-restored-close {
  appearance:none; border:0; cursor:pointer; flex-shrink:0;
  width:22px; height:22px; border-radius:50%;
  background:rgba(255,255,255,.15); color:#fff; font-size:15px; line-height:1;
}
.comp-restored-close:hover { background:rgba(255,255,255,.28); }
.screen-comp.is-restored .comp-stage-summary--pill { display:none !important; }
@media (max-width:767px) {
  .comp-restored-banner { top:14px; font-size:11.5px; padding:8px 10px 8px 12px; max-width:calc(100% - 20px); }
}
.comp-stage-summary .sep { width:1px; height:12px; background:#ddd; }
.comp-stage-summary .meta { color:#777; }
.comp-stage-meta-top {
  display:none; position:absolute; top:18px; left:18px; z-index:4; font-family:var(--mono); font-size:11px; color:#595959;
}
.comp-canvas-wrap--runtime { position:absolute; inset:0; }
.comp-runtime-mount { width:100%; height:100%; border:0; display:block; background:#f6f6f3; }
.comp-stage-label {
  position:absolute; left:18px; bottom:16px; z-index:4; font-family:var(--mono); font-size:11px; color:#6b6b68;
}
.comp-stage-zoom--pdf {
  position:absolute; right:18px; bottom:18px; z-index:5; display:flex; flex-direction:column; gap:8px;
}
.comp-zoom-btn {
  width:28px; height:28px; border:1px solid var(--card-line); border-radius:8px; background:#fff; color:#222; cursor:pointer;
}
.comp-panel {
  width: 340px; min-width:340px; border-left:1px solid var(--card-line); background:#fff; display:flex; flex-direction:column;
}
.comp-panel-header { position:sticky; top:0; z-index:3; background:#fff; padding:20px 22px 14px; border-bottom:1px solid var(--card-line); }
.comp-panel-sub { font-size:11px; letter-spacing:1.8px; text-transform:uppercase; color:#858585; }
.comp-panel-name { margin-top:4px; font-size:28px; line-height:1.05; font-weight:700; letter-spacing:-.03em; }
.comp-panel-close { position:relative; z-index:6; width:32px; height:32px; border:1px solid var(--card-line); border-radius:10px; background:#fff; }
.comp-panel-body { padding:18px 22px 22px; overflow:auto; display:flex; flex-direction:column; gap:22px; }
.eyebrow { font-size:10px; letter-spacing:2px; text-transform:uppercase; color:#777; margin-bottom:12px; }
.shape-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; }
.shape-cell { border:1px solid var(--card-line); border-radius:14px; padding:12px 8px; min-height:94px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; background:#fafafa; }
.shape-cell.active { border-color:#0f1113; box-shadow: inset 0 0 0 1px #0f1113; background:#fff; }
.shape-cell-name { font-size:12px; font-weight:600; }
.shape-cell-dims { font-size:10px; color:#888; }
.color-grid { display:grid; grid-template-columns: repeat(5, 1fr); gap:10px; }
.color-cell { border:1px solid var(--card-line); border-radius:10px; padding:4px; background:#fff; }
.color-cell.active { box-shadow: inset 0 0 0 2px #5b1e22; }
.color-swatch { width:100%; aspect-ratio:1; border-radius:7px; }
.color-name { margin-top:10px; font-size:12px; color:#666; }
.toggle-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.toggle-label { font-size:13px; }

.comp-panel-open-desktop {
  position:absolute; top:22px; right:18px; z-index:7;
  width:36px; height:36px; border:1px solid var(--card-line); border-radius:10px;
  background:#fff; color:#111113; display:none; align-items:center; justify-content:center;
  box-shadow:0 8px 20px rgba(0,0,0,.08); cursor:pointer;
}
.screen-comp.is-panel-collapsed .comp-stage-wrap { padding-right:24px; }
.screen-comp.is-panel-collapsed .comp-panel-open-desktop { display:inline-flex; }
.toggle-track { appearance:none; border:1px solid var(--card-line); background:#f5f5f2; width:44px; height:26px; border-radius:999px; position:relative; padding:0; cursor:pointer; }
.toggle-thumb { width:18px; height:18px; border-radius:50%; background:#fff; position:absolute; top:3px; left:3px; box-shadow:0 1px 2px rgba(0,0,0,.12); transition:left .2s ease; }
.toggle-track.on { background:#111113; border-color:#111113; }
.toggle-track.on .toggle-thumb { left:21px; }
.btn-dark, .btn-ghost-light {
  height:48px; border-radius:12px; border:1px solid var(--card-line); padding:0 20px; font-size:14px; cursor:pointer;
}
.btn-dark { background:#111113; color:#fff; border-color:#111113; }
.btn-ghost-light { background:#fff; color:#111113; }

/* intro */
.screen-dark { background:#090909; color:#fff; }.dark-body p { font-size:17px; line-height:1.6; max-width:460px; }
/* summary/export */

.comp-header-brand { display:inline-flex; align-items:center; gap:14px; }
.comp-header-brand svg { flex:0 0 auto; height:20px; width:auto; display:block; }
.comp-header-brand--tight { gap:12px; }
.comp-header-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 2.4px; text-transform: uppercase; color:#8e8e89; border-left:1px solid var(--line2); padding-left:12px; line-height:1; display:inline-flex; align-items:center; min-height:16px; }
.light-header .hamburger-btn.light { margin-left:auto; }
.light-body { padding: 42px 28px 36px; max-width: 1320px; margin: 0 auto; }
.screen-title-eyebrow { font-size:10px; letter-spacing:2.2px; text-transform:uppercase; color:#8a8a86; }
.screen-title { margin-top:12px; font-size:52px; line-height:1; letter-spacing:-.04em; font-weight:300; }
.screen-title strong { font-weight:700; }
.summary-card {
  margin-top:28px; display:grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .95fr); gap:18px;
  border:1px solid var(--card-line); border-radius:18px; background:#fbfbf9; padding:16px;
}
.summary-preview { border:1px solid var(--card-line); border-radius:14px; background:#f8f8f5; min-height:340px; display:grid; place-items:center; }
.summary-preview svg { width:72%; height:72%; }
.summary-meta { display:flex; flex-direction:column; gap:24px; padding:8px 8px 4px 0; }
.summary-value { font-size:18px; line-height:1.4; }
.summary-value.mono { font-family:var(--mono); font-size:16px; }
.summary-total { margin-top:auto; padding-top:18px; border-top:1px solid var(--card-line); display:flex; align-items:flex-end; justify-content:space-between; gap:20px; }
.summary-total-price { font-family:var(--mono); font-size:34px; font-weight:500; }
.screen-actions { display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin-top:18px; }
.screen-actions > * { width:100%; }.pdf-sheet-preview svg { width:84px; height:84px; }.swatch-inline { display:flex; align-items:center; gap:10px; }
.swatch-dot { width:18px; height:18px; border-radius:4px; }
.hamburger-menu.light .hamburger-menu-item { background:#fff; }

@media (max-width: 1279px) {  .light-body { max-width: 980px; }
  .summary-card { grid-template-columns: 1fr 320px; }
}

@media (max-width: 767px) {
  .comp-header, .light-header { height:64px; padding:0 18px; }
  .comp-body {
    display:block;
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px); /* v21.1: accompagna il fix di #rebus-shell */
  }
  .comp-stage-wrap { padding:0; }
  .comp-stage {
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px); /* v21.1: accompagna il fix di #rebus-shell */
    border-radius:0; border:0;
  }
  .comp-stage-summary--pill { top:72px; width: calc(100% - 56px); justify-content:center; font-size:11px; }
  .comp-stage-meta-top { display:block; top:132px; left:16px; }
  .comp-stage-label { display:none; }
  .comp-stage-zoom--pdf { right:14px; bottom:92px; }
  .panel-overlay { position:fixed; inset:0; background:rgba(0,0,0,.18); z-index:19; }
  .panel-drawer { position:fixed; left:10px; right:10px; bottom:10px; top:154px; z-index:20; border:1px solid var(--card-line); border-radius:22px; background:#fff; overflow:hidden; box-shadow:0 20px 40px rgba(0,0,0,.14); }
  .comp-panel-header { padding:16px 16px 12px; }
  .comp-panel-name { font-size:18px; }
  .comp-panel-body { padding:14px 16px 16px; gap:18px; }
  .shape-grid { grid-template-columns: repeat(3, 1fr); gap:8px; }
  .shape-cell { min-height:84px; padding:10px 6px; }
  .color-grid { gap:8px; }
  .light-body { padding: 28px 18px 24px; }
  .screen-title { font-size:28px; }
  .summary-card { grid-template-columns: 1fr; padding:14px; }
  .summary-preview { min-height:220px; }
  .summary-value { font-size:16px; }
  .summary-total-price { font-size:28px; }
  .screen-actions { grid-template-columns: 1fr; }
  #screen-export .screen-actions > :not(:last-child) { display:none; }
}

/* phase6 final alignment */
@media (max-width: 767px) {
  .loader-inner { gap: 20px; }
.loader-caption { font-size: 10px; letter-spacing: 2px; }
  .comp-stage-summary { top: 10px; padding: 6px 10px; gap: 10px; }
  .comp-stage-meta-top { top: 56px; left: 16px; }
  .comp-panel { width: 100%; min-width: 100%; }
}
@media (min-width: 768px) and (max-width: 1279px) {
  .comp-panel { width: 344px; min-width: 344px; }}
@media (min-width: 1280px) {
  .comp-panel { width: 392px; min-width: 392px; }
  .screen-comp.is-panel-collapsed .comp-stage-wrap { padding-right: 24px; }
}

@media (max-width: 639px) {
  #screen-export .screen-actions button:nth-child(-n+2) { display:none; }
  #screen-export .screen-actions { grid-template-columns:1fr; }
}

/* phase6h refinements */
.loader-inner { transform: translateY(-8px); }.loader-caption { font-family: var(--mono); letter-spacing: 2.8px; }.summary-card { padding: 18px; gap: 20px; }
.screen-actions { gap: 14px; }@media (min-width:768px) and (max-width:1279px) {  .dark-body p { font-size: 16px; max-width: 360px; }  .comp-panel { width: 332px; min-width: 332px; }
  .comp-stage-summary--pill { top: 20px; padding: 8px 14px; }
  .summary-card { grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); padding: 16px; }
  .summary-preview { min-height: 300px; }
  .screen-title { font-size: 48px; }
}
@media (min-width:1280px) {
  .comp-panel { width: 384px; min-width: 384px; }
  .summary-card { padding: 18px; }
}
@media (max-width:767px) {
  .loader-inner { transform: translateY(-10px); }
  .loader-caption { font-size: 10px; }
  .comp-stage-summary--pill { top: 12px; width: calc(100% - 44px); }
  .comp-stage-meta-top { top: 58px; }
  .screen-title { font-size: 30px; }
  .summary-card { padding: 12px; gap: 12px; }
  .summary-preview { min-height: 210px; }
}

/* phase6i refinements */
.loader-inner { gap: 18px; }
.loader-svg { opacity: .96; }

@media (min-width:768px) and (max-width:1279px) {
  .light-body { padding: 36px 38px 28px; }  .dark-body p { font-size: 15px; max-width: 340px; }  .summary-card { gap: 14px; }
  .summary-preview { min-height: 288px; }
  .screen-actions { gap: 10px; }
  .comp-stage-wrap { padding: 18px 0 18px 18px; }
  .comp-stage-summary--pill { top: 18px; }
  .comp-stage-meta-top { top: 18px; left: 18px; }
  .comp-stage-zoom--pdf { right: 16px; bottom: 16px; }
}

@media (min-width:1280px) {
  .light-body { padding: 38px 44px 30px; }
  .summary-card { gap: 16px; }
  .summary-preview { min-height: 316px; }
  .comp-stage-wrap { padding: 18px 0 18px 18px; }
  .comp-stage-summary--pill { top: 18px; }
}

@media (max-width:767px) {
  .loader-inner { gap: 16px; }  .summary-total-price { font-size: 26px; }
}

@media (max-width: 639px) {
  .screen-title-eyebrow { font-size: 9px; letter-spacing: 2px; }
  .screen-title { font-size: 29px; }
  .summary-preview { min-height: 204px; }
  .comp-header-brand svg { height:18px; }
  .comp-header-tag { font-size:9px; letter-spacing:2px; padding-left:10px; }
}
@media (min-width:768px) and (max-width:1279px) {
  .comp-header-brand svg { height:19px; }
  .comp-header-tag { font-size:9px; letter-spacing:2.2px; }
}

.comp-empty-state {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.comp-empty-state[hidden] {
  display: none !important;
}

.comp-empty-card {
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,17,19,.08);
  box-shadow: 0 18px 48px rgba(15,17,19,.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
  pointer-events: auto;
}

.comp-empty-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--ink3);
}

.comp-empty-title {
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--ink);
}

.comp-empty-cta {
  margin-top: 18px;
  min-width: 220px;
}

@media (max-width: 767px) {
  .comp-empty-state {
    padding: 18px;
  }

  .comp-empty-card {
    width: min(100%, 360px);
    padding: 20px 18px;
    border-radius: 16px;
  }

  .comp-empty-title {
    font-size: 20px;
  }

  .comp-empty-cta {
    width: 100%;
    min-width: 0;
  }
}

/* ── Runtime diretto + stacking robusto ── */
.screen-comp {
  isolation: isolate;
}

.comp-header,
.light-header {
  position: relative;
  z-index: 1200;
}

.hamburger-btn {
  position: relative;
  z-index: 1201;
}

.hamburger-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1400;
  width: min(320px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.hamburger-menu-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  pointer-events: auto;
  background: var(--surf);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15,17,19,.08);
}

.hamburger-menu.light .hamburger-menu-sheet {
  background: var(--surf);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(15,17,19,.08);
}

.hamburger-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
}

.hamburger-menu-item,
.hamburger-menu-divider {
  position: relative;
  z-index: 1;
}

.hamburger-menu-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  color: var(--ink);
}

.hamburger-menu.light .hamburger-menu-item { color: var(--ink); }

.hamburger-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surf3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-family: var(--mono);
  color: var(--ink);
}

.hamburger-menu-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hamburger-menu-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.hamburger-menu-sub   { font-size: 11px; color: var(--ink3); margin-top: 0; }
.hamburger-menu-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--ink4);
}

.hamburger-menu-divider { height: 1px; background: var(--line); margin: 2px 8px; }

.comp-body,
.comp-stage-wrap,
.comp-stage,
.comp-canvas-wrap--runtime,
.comp-runtime-mount {
  min-height: 0;
}

.comp-stage,
.comp-canvas-wrap--runtime,
.comp-runtime-mount {
  width: 100%;
  height: 100%;
}

.comp-canvas-wrap--runtime {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.comp-runtime-mount {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.comp-stage-grid,
.comp-stage-summary--pill,
.comp-stage-meta-top,
.comp-stage-label,
.comp-stage-zoom--pdf,
.comp-panel-open-desktop {
  position: absolute;
}

.comp-stage-grid,
.comp-stage-summary--pill,
.comp-stage-meta-top,
.comp-stage-label,
.comp-stage-zoom--pdf {
  z-index: 4;
}

.comp-panel-open-desktop {
  z-index: 1100;
}

.comp-panel {
  position: relative;
  z-index: 1000;
}

.panel-overlay {
  z-index: 900 !important;
}

.panel-drawer {
  z-index: 950 !important;
}

@media (max-width: 767px) {
  .hamburger-menu {
    right: 0;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
}

.comp-panel-open-desktop i {
  font-size: 14px;
}

/* ── Fix esplicito full-height mobile viewer ── */
/* v21.1: 100dvh per non tagliare l'header sotto la barra URL Chrome mobile */
@media (max-width: 767px) {
  .comp-stage-wrap {
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
  }

  .comp-stage {
    min-height: calc(100vh - 64px) !important;
    min-height: calc(100dvh - 64px) !important;
    height: calc(100vh - 64px) !important;
    height: calc(100dvh - 64px) !important;
  }

  .comp-canvas-wrap--runtime,
  #comp-runtime-mount {
    height: 100% !important;
  }
}

/* ===== Rebus runtime parity fixes ===== */
/* v21.1: 100dvh per mobile URL-bar handling */
.comp-body {
  display: flex;
  min-height: calc(100vh - 72px);
  min-height: calc(100dvh - 72px);
}

.comp-stage-wrap {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 !important;
}

.comp-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 72px) !important;
  min-height: calc(100dvh - 72px) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f6f6f3 !important;
  overflow: hidden;
}

.comp-stage-grid,
.comp-stage-summary,
.comp-stage-summary--pill,
.comp-stage-meta-top,
.comp-stage-label,
.comp-stage-zoom,
.comp-stage-zoom--pdf {
  display: none !important;
}

.comp-canvas-wrap,
.comp-canvas-wrap--runtime,
.comp-runtime-mount,
#comp-runtime-mount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.shape-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shape-cell {
  min-height: 104px;
  padding: 12px 10px;
}

.shape-cell-icon--raster {
  min-height: 52px;
}

.shape-cell-icon--raster img {
  display: block;
  width: auto;
  height: auto;
  max-width: 92px;
  max-height: 42px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.shape-cell[data-shape-idx="3"] .shape-cell-icon--raster img,
.shape-cell[data-shape-idx="4"] .shape-cell-icon--raster img {
  max-height: 52px;
}

@media (max-width: 767px) {
  .comp-body {
    display: block;
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
  }

  .comp-stage-wrap,
  .comp-stage {
    min-height: calc(100vh - 64px) !important;
    min-height: calc(100dvh - 64px) !important;
    height: calc(100vh - 64px) !important;
    height: calc(100dvh - 64px) !important;
    padding: 0 !important;
  }

  .panel-drawer {
    top: 64px !important;
    left: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    width: min(360px, 92vw) !important;
    border: 0 !important;
    border-left: 1px solid var(--card-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .panel-overlay {
    background: rgba(15, 17, 19, .12) !important;
  }

  .shape-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shape-cell {
    min-height: 96px;
  }

  .shape-cell-icon--raster img {
    max-width: 78px;
    max-height: 36px;
  }

  .shape-cell[data-shape-idx="3"] .shape-cell-icon--raster img,
  .shape-cell[data-shape-idx="4"] .shape-cell-icon--raster img {
    max-height: 44px;
  }
}

/* ═══════════════════════════════════════════════════════════════════ — v6 — EDIT MODE / COLOR MODE / ANIMAZIONI Stile minimale Desalto: easing morbidi, transizioni discrete, */

/* ── Header pannello: icona shape ──────────────────────────────── */
.comp-panel-header {
  align-items: center !important;
  gap: 12px;
}
.comp-panel-header-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: none; /* visibile solo in edit/color/insert mode */
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.comp-panel-header-icon img {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: contain;
}
.comp-panel-header-text {
  flex: 1;
  min-width: 0;
}

/* ── Icona shape nell'header: visibile in TUTTI gli stati 
      (insert, edit, color) per dare contesto visivo del modulo corrente ── */
.screen-comp.is-panel-edit-mode .comp-panel-header-icon,
.screen-comp.is-panel-color-mode .comp-panel-header-icon,
.screen-comp.is-panel-insert-mode .comp-panel-header-icon,
.screen-comp.is-mobile-panel-mode-insert .comp-panel-header-icon,
.screen-comp.is-mobile-panel-mode-color .comp-panel-header-icon {
  display: flex;
}

/* ── Pulsante X pannello: hover sottile ───────────────────────── */
.comp-panel-close {
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.comp-panel-close:hover {
  background: #f3f3f3;
  border-color: #b8b8b8;
}
.comp-panel-close:active {
  transform: scale(.94);
}

/* ── Color cells: feedback hover/active fluido ────────────────── */
.color-cell {
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease;
  cursor: pointer;
}
.color-cell:hover {
  transform: translateY(-1px);
  border-color: #2a2a2a;
}
.color-cell:active {
  transform: translateY(0) scale(.96);
}

/* ── Shape cells: stesso feedback ─────────────────────────────── */
.shape-cell {
  transition: transform .14s ease, border-color .18s ease, background-color .18s ease;
  cursor: pointer;
}
.shape-cell:hover {
  border-color: #2a2a2a;
  background: #fff;
}
.shape-cell:active {
  transform: scale(.97);
}

/* ── Drawer mobile: animazione slide-up ───────────────────────── */
.panel-drawer {
  transition: transform .28s cubic-bezier(.22, .61, .36, 1), opacity .22s ease;
  will-change: transform;
}
.panel-drawer[style*="display: none"],
.panel-drawer:not([style*="display: flex"]):not([style*="display:flex"]) {
  /* stato chiuso: niente transizione attiva */
}
.panel-drawer.is-anim-enter {
  transform: translateY(100%);
  opacity: 0;
}
.panel-drawer.is-anim-enter-active {
  transform: translateY(0);
  opacity: 1;
}
.panel-drawer.is-anim-leave {
  transform: translateY(0);
  opacity: 1;
}
.panel-drawer.is-anim-leave-active {
  transform: translateY(100%);
  opacity: 0;
}
.panel-overlay {
  transition: opacity .22s ease;
}
.panel-overlay.is-anim-enter {
  opacity: 0;
}
.panel-overlay.is-anim-enter-active {
  opacity: 1;
}
.panel-overlay.is-anim-leave-active {
  opacity: 0;
}

/* ── Context menu: fade + scale soft, X di chiusura ──────────── */
#comp-runtime-mount .context-menu {
  transition: opacity .18s ease, transform .22s cubic-bezier(.22, .61, .36, 1);
  transform-origin: top center;
}
#comp-runtime-mount .context-menu[hidden] {
  opacity: 0;
  transform: scale(.94) translateY(-4px);
  pointer-events: none;
  display: block !important; /* serve per la transizione */
  visibility: hidden;
}
#comp-runtime-mount .context-menu:not([hidden]) {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
}

/* Pulsante X nel context menu (iniettato da JS) */
#comp-runtime-mount .context-menu .context-close-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .16s ease, color .16s ease, transform .2s ease;
}
#comp-runtime-mount .context-menu .context-close-x:hover {
  background: rgba(0, 0, 0, .06);
  color: #111;
  transform: rotate(90deg);
}
#comp-runtime-mount .context-menu .context-close-x:active {
  transform: rotate(90deg) scale(.92);
}
#comp-runtime-mount .context-menu .context-head {
  padding-right: 32px; /* spazio per la X */
  position: relative;
}

/* Context menu pulsanti azione: feedback fluido */
#comp-runtime-mount .context-menu .context-actions button {
  transition: background .16s ease, color .16s ease, transform .14s ease;
}
#comp-runtime-mount .context-menu .context-actions button:active {
  transform: scale(.97);
}

/* Versione DESKTOP del context menu (riusa lo stesso DOM via classe) */
@media (min-width: 768px) {
  #comp-runtime-mount .context-menu.is-desktop-context {
    z-index: 35 !important;
    min-width: 220px !important;
    max-width: 260px !important;
    border-radius: 14px !important;
    padding: 12px !important;
    background: rgba(255, 255, 255, .98) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(0, 0, 0, .06) !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-head {
    margin-bottom: 8px !important;
    font-size: 13px;
    font-weight: 600;
    color: #0f1113;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions {
    display: grid !important;
    gap: 4px !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button {
    min-height: 36px !important;
    text-align: left !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: #0f1113 !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button:hover {
    background: rgba(0, 0, 0, .05) !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.danger {
    color: #b1372e !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.danger:hover {
    background: rgba(177, 55, 46, .08) !important;
  }
  /* Su desktop forza la visibilità anche dei mobile-only (Configura/Colore) */
  #comp-runtime-mount .context-menu.is-desktop-context .mobile-only {
    display: block !important;
  }
}

/* ── Hamburger menu: micro-animazione fade ───────────────────── */
.hamburger-menu {
  transition: opacity .18s ease;
}

/* ── Empty state CTA: feedback ───────────────────────────────── */
.comp-empty-cta {
  transition: background .18s ease, transform .14s ease;
}
.comp-empty-cta:active {
  transform: scale(.97);
}

/* ── Toggle tracks: smoother ─────────────────────────────────── */
.toggle-track {
  transition: background .2s ease, border-color .2s ease;
}
.toggle-thumb {
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}

/* ═══════════════════════════════════════════════════════════════════
   v7 — WELCOME riprogettato (layout mockup desiderato)
   ═══════════════════════════════════════════════════════════════════ */

.screen-welcome-v7 {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-welcome-v7 .dark-bg-radial {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 30%, rgba(70, 70, 70, .35) 0%, transparent 60%),
    radial-gradient(ellipse 80% 80% at 80% 100%, rgba(40, 40, 40, .25) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-topbar {
  position: relative;
  z-index: 2;
  padding: 22px 24px 0;
  flex-shrink: 0;
}

.welcome-topbar-inner {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.welcome-topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.welcome-topbar-logo {
  height: 34px;
  width: auto;
  display: block;
}

.welcome-topbar-sep {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, .25);
  display: inline-block;
}

.welcome-topbar-tag {
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
  font-family: var(--mono, monospace);
  font-weight: 500;
}
.welcome-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.welcome-container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  text-align: left;
}
.welcome-title {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -.035em;
  color: #fff;
  margin: 0 0 28px;
  /* Compensazione ottica: la curva della C rientra nel bbox rispetto al lato piatto — della D del logo DESALTO. Sposto il titolo leggermente a sinistra per allineare visivamente il punto di attacco. */
  margin-left: -4px;
}

.welcome-title strong {
  font-weight: 700;
  display: inline;
}

.welcome-body {
  font-size: clamp(14px, 1.3vw, 17px);
  line-height: 1.55;
  color: rgba(255, 255, 255, .68);
  margin: 0 0 38px;
  max-width: 580px;
  font-weight: 300;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  background: #fff;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s ease, transform .14s ease, box-shadow .22s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.welcome-cta:hover {
  background: #f0f0f0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.welcome-cta:active { transform: scale(.98); }

.welcome-cta-arrow {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  transition: transform .22s cubic-bezier(.22, .61, .36, 1);
}

.welcome-cta:hover .welcome-cta-arrow { transform: translateX(3px); }
.welcome-footer {
  position: relative;
  z-index: 2;
  padding: 20px 24px 24px;
  flex-shrink: 0;
}

.welcome-footer-inner {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

.welcome-credit {
  font-size: 11px;
  color: rgba(255, 255, 255, .42);
  letter-spacing: .02em;
}

.welcome-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-self: center;
}

.welcome-dot {
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  transition: background .22s ease, width .22s ease;
}

.welcome-dot.active {
  background: #fff;
  width: 28px;
}

.welcome-footer-spacer { /* equilibra il grid */ }

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .welcome-topbar { padding: 18px 20px; }
  .welcome-topbar-logo { height: 28px; }
  .welcome-topbar-sep { height: 18px; }
  .welcome-topbar-tag { font-size: 10px; letter-spacing: 2px; }
  .welcome-main { padding: 20px; align-items: flex-start; padding-top: 14vh; }
  .welcome-container { max-width: 100%; }
.welcome-title { font-size: 38px; margin-bottom: 22px; }
  .welcome-body { font-size: 13px; margin-bottom: 28px; }
  .welcome-actions { gap: 14px; }
  .welcome-cta { padding: 14px 20px; font-size: 14px; gap: 10px; }
.welcome-footer { padding: 16px 20px 20px; }
}

/* ── DESKTOP wide: testo allineato a sinistra ma container centrato ── */
@media (min-width: 1200px) {
  .welcome-container { max-width: 920px; }
}

/* ── v21.9 — Pane immagine destro, solo desktop ───────────────────── */
/* Default: pane nascosto su tutte le viewport. Il layout welcome resta
   invariato (mobile = full-dark, identico a v21.8). */
.welcome-image-pane { display: none; }

/* Da 768px in su: layout 2-colonne. Pane immagine occupa il 60% destro
   full-bleed (top→bottom). La colonna sinistra contiene il testo nel 40%
   restante. Il fade nero sul bordo sinistro dell'immagine garantisce
   continuità visiva con la colonna scura, e copre eventuali sconfinamenti
   minimi del testo in viewport strette (768-900px). */
@media (min-width: 768px) {
  .welcome-image-pane {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40%;
    z-index: 1; /* sopra dark-bg-radial (no z-index = 0), sotto contenuti (z=2) */
    overflow: hidden;
    pointer-events: none; /* non intercetta click sul CTA */
  }
  .welcome-image-pane-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    /* v22.2 — Sfumatura nativa sul bordo sinistro dell'immagine via mask-image.
       Sostituisce il vecchio .welcome-image-pane-fade (overlay rettangolare che
       creava "effetto cerotto" perché la sua banda di transizione era visibile
       come un rettangolo netto sopra l'immagine).
       Ora l'<img> stessa è mascherata: alpha=0 a sinistra (l'immagine si fonde
       con lo sfondo #0a0a0a della pagina sotto), alpha=1 a destra (immagine
       pulita). Stops: transparent 0%, .15 al 15%, .55 al 30%, .85 al 45%,
       opaque 55%. La libreria nell'immagine resta visibile pulita oltre il 55%.
       Tunabile inline: aumentare 55% per sfumatura più lunga, diminuire per
       più corta. */
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, .15) 15%,
      rgba(0, 0, 0, .55) 30%,
      rgba(0, 0, 0, .85) 45%,
      black 55%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, .15) 15%,
      rgba(0, 0, 0, .55) 30%,
      rgba(0, 0, 0, .85) 45%,
      black 55%
    );
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
  }

  /* Il testo welcome resta nella colonna sinistra (40% della viewport).
     Limito la larghezza di .welcome-container per evitare sovrapposizioni
     con l'immagine, ma lascio respiro al titolo che è multi-riga. */
  .screen-welcome-v7 .welcome-main {
    padding-right: calc(40% + 24px); /* 40% pane + gap 24px */
  }
  /* Il topbar e il footer restano allineati alla colonna 60% sinistra
     per coerenza con il contenuto principale. */
  .screen-welcome-v7 .welcome-topbar,
  .screen-welcome-v7 .welcome-footer {
    padding-right: calc(40% + 24px);
  }
}

/* ── v22.1 — Container Bootstrap-like su desktop: padding-left progressivo
   per spostare il contenuto (logo, titolo, body, CTA, footer dots) verso
   il centro della pagina, NON al bordo sinistro estremo del viewport.
   I valori replicano i breakpoint Bootstrap (sm/md/lg/xl/xxl) per coerenza
   con il mockup (contenuto allineato a ~20% della viewport su monitor wide).
   Mobile (<768px): padding-left dei welcome-* originali invariato. ── */
@media (min-width: 768px) {
  .screen-welcome-v7 .welcome-topbar,
  .screen-welcome-v7 .welcome-main,
  .screen-welcome-v7 .welcome-footer {
    padding-left: 64px;
  }
}
@media (min-width: 992px) {
  .screen-welcome-v7 .welcome-topbar,
  .screen-welcome-v7 .welcome-main,
  .screen-welcome-v7 .welcome-footer {
    padding-left: 120px;
  }
}
@media (min-width: 1280px) {
  .screen-welcome-v7 .welcome-topbar,
  .screen-welcome-v7 .welcome-main,
  .screen-welcome-v7 .welcome-footer {
    padding-left: 200px;
  }
}
@media (min-width: 1600px) {
  .screen-welcome-v7 .welcome-topbar,
  .screen-welcome-v7 .welcome-main,
  .screen-welcome-v7 .welcome-footer {
    padding-left: 280px;
  }
}

/* ── Tablet stretto (768-1023px): riduci dimensioni testo per evitare
   che il titolo trabocchi nella colonna sinistra (su 768px restano
   ~373px disponibili dopo padding-left 64px e padding-right calc(40%+24px)) ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .screen-welcome-v7 .welcome-title { font-size: clamp(28px, 4.5vw, 44px); }
  .screen-welcome-v7 .welcome-body  { font-size: 13px; }
  .screen-welcome-v7 .welcome-cta   { padding: 14px 22px; font-size: 14px; }
}

/* ── v7: Nascondi sempre il pulsante Guida del runtime ────────── */
#comp-runtime-mount #panelGuideBtn,
#comp-runtime-mount #guideBtn,
#comp-runtime-mount [data-action="guide"],
#comp-runtime-mount .guide-overlay,
#comp-runtime-mount .tour-shell,
#comp-runtime-mount #tourShell {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   v7 — EXPORT PDF VIEW
   ═══════════════════════════════════════════════════════════════════ */

#screen-export-pdf {
  background: #f6f6f3;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.export-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid #e8e8e4;
}

.export-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.export-header-sep {
  width: 1px;
  height: 18px;
  background: #d2d2cd;
  display: inline-block;
}

.export-header-tag {
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #555;
  font-family: var(--mono, monospace);
  font-weight: 500;
}

.export-body {
  flex: 1;
  padding: 32px 24px 64px;
}

.export-container {
  max-width: 1100px;
  margin: 0 auto;
}

.export-title-block { margin-bottom: 32px; }

.export-eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #888;
  font-family: var(--mono, monospace);
  margin-bottom: 12px;
}

.export-title {
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -.025em;
  color: #0f1113;
  margin: 0 0 14px;
}

.export-title strong { font-weight: 700; }

.export-subtitle {
  font-size: 14px;
  color: #555;
  margin: 0;
  max-width: 560px;
  line-height: 1.5;
}

.export-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  grid-template-areas:
    "preview info"
    "preview abaco";
  gap: 24px;
  margin-bottom: 32px;
}

.export-card {
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.export-card--preview { grid-area: preview; }
.export-card--info    { grid-area: info; }
.export-card--abaco   { grid-area: abaco; }

.export-card-header {
  margin-bottom: 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.export-card-eyebrow {
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #888;
  font-weight: 600;
}

.export-card-title {
  font-size: 22px;
  font-weight: 600;
  color: #0f1113;
  margin: 6px 0 0;
  letter-spacing: -.01em;
}

.export-card-meta {
  font-size: 11px;
  color: #888;
  font-family: var(--mono, monospace);
  letter-spacing: .04em;
}

.export-card-body {
  font-size: 13px;
  line-height: 1.6;
  color: #444;
  margin: 0;
}

/* Preview */
.export-preview-wrap {
  flex: 1;
  background: #ffffff;   /* cliente: NIENTE grigio. Lo snapshot 3:2 va in letterbox in un box quasi quadrato: le bande devono essere bianche, non grigie */
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  overflow: hidden;
  position: relative;
}

.export-preview-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.export-preview-empty {
  font-size: 13px;
  color: #999;
  font-style: italic;
}

/* Abaco */
.export-abaco {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.export-abaco-empty {
  font-size: 13px;
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 24px 0;
}

.export-abaco-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: #fafafa;
  border-radius: 6px;
  border: 1px solid #ececea;
}

.export-abaco-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent; /* cliente: niente riquadro bianco dietro i disegni */
  border-radius: 4px;
  flex-shrink: 0;
}

.export-abaco-icon img {
  display: block;
  max-width: 42px;
  max-height: 42px;
}

.export-abaco-info {
  flex: 1;
  min-width: 0;
}

.export-abaco-qty {
  font-size: 11px;
  color: #888;
  font-family: var(--mono, monospace);
  letter-spacing: .03em;
}

.export-abaco-qty strong {
  color: #0f1113;
  font-size: 13px;
  font-weight: 700;
  margin-right: 2px;
}

.export-abaco-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f1113;
  letter-spacing: .04em;
  margin: 2px 0 4px;
}

.export-abaco-color {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #666;
}

.export-abaco-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.1);
  display: inline-block;
  flex-shrink: 0;
}

.export-abaco-extras {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #ddd;
}

.export-abaco-extra {
  font-size: 11px;
  color: #666;
}

.export-abaco-extra-qty {
  font-family: var(--mono, monospace);
  letter-spacing: .03em;
  margin-right: 6px;
}

.export-abaco-extra-qty strong {
  color: #0f1113;
  font-size: 12px;
  font-weight: 700;
}

.export-abaco-extra-label {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
  font-size: 10px;
}

/* Actions */
.export-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background .18s ease, transform .14s ease, box-shadow .22s ease;
}

.export-btn--ghost {
  background: transparent;
  color: #555;
  border: 1px solid #ccc;
}

.export-btn--ghost:hover {
  background: #fff;
  color: #0f1113;
  border-color: #0f1113;
}

.export-btn--primary {
  background: #0f1113;
  color: #fff;
}

.export-btn--primary:hover {
  background: #2a2c2e;
  box-shadow: 0 6px 18px rgba(15, 17, 19, .18);
}

.export-btn:active { transform: scale(.98); }

.export-btn-arrow,
.export-btn-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

/* ── Condivisione composizione (stesso link del QR) — non invasiva ──
   Icone EVIDENTI: glifo bianco dentro un chip tondo colorato (verde WhatsApp,
   ink Desalto per gli altri) su pill chiara. Touch target ≥48px. */
.export-share {
  margin: 0 0 28px;
  padding-top: 20px;
  border-top: 1px solid #ececec;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.export-share[hidden] { display: none; }
.export-share-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #3d3d3a;
}
.export-share-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.export-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;               /* touch target comodo (mobile + desktop) */
  padding: 6px 20px 6px 6px;      /* left ridotto: lo occupa il chip tondo */
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1b1d;
  background: #f4f4f2;
  border: 1px solid #e6e6e3;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .2s ease, transform .14s ease;
}
.export-share-btn:hover {
  background: #fff;
  border-color: #d2d2ce;
  box-shadow: 0 6px 18px rgba(15, 17, 19, .10);
  transform: translateY(-1px);
}
.export-share-btn:active { transform: scale(.98); }
.export-share-btn[hidden] { display: none; }
/* chip tondo colorato col glifo bianco — è ciò che rende l'icona evidente */
.export-share-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  background: #0f1113;            /* default ink: Email / Copia / Condividi */
  flex-shrink: 0;
}
.export-share-btn--wa .export-share-chip { background: #25d366; }  /* verde WhatsApp */
.export-share-ico { display: block; flex-shrink: 0; }

.export-disclaimer {
  font-size: 11px;
  color: #999;
  line-height: 1.55;
  max-width: 720px;
  margin: 0;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .export-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "preview"
      "info"
      "abaco";
  }
  .export-header { padding: 14px 18px; }
  .export-body { padding: 24px 18px 48px; }
  .export-card { padding: 18px; }
  .export-preview-wrap { min-height: 240px; }
  .export-actions { flex-direction: column; align-items: stretch; }
  .export-btn { justify-content: center; width: 100%; }
  .export-share-btns { gap: 10px; }
  .export-share-btn { flex: 1 1 calc(50% - 5px); justify-content: flex-start; min-height: 52px; }
}

/* ═══════════════════════════════════════════════════════════════════
   v8 — Fix dimensione logo configuratore su mobile
   v22.18 — Refix #1: il vecchio `height: auto !important` sovrascriveva
   l'inline 34px senza constraint sostitutivo → logo a dimensione naturale
   (1052×168) durante la transizione blur, dando l'illusione di un
   "logo gigantesco sfocato".
   v22.19 — Refix #2: la versione precedente usava `height:28px;
   width:auto` con !important, ma in pratica `width:auto` su un IMG
   in un container `inline-flex` (`.comp-header-brand`) può comportarsi
   in modi imprevedibili — abbiamo osservato un rendering distorto
   (rapporto 2.94:1 invece di 6.26:1, lettere DESALTO stirate
   verticalmente) confermato via misurazione pixel-perfect dello
   screenshot. Soluzione robusta: settare ESPLICITAMENTE sia height
   sia width (175px = round(28 × 1052/168)) così il browser non ha
   alcun grado di libertà sulle dimensioni. `aspect-ratio` come backup
   difensivo per i browser che dovessero ignorare uno dei due.
   Breakpoint esteso da 640px a 767px per coprire tutto il range
   mobile (allineato al resto del file dove le regole mobile usano
   max-width: 767px o 767.98px).
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  .comp-header .desalto-logo,
  .light-header .desalto-logo {
    /* Dimensioni fisse: 175 × 28 = aspect ratio nativo del PNG (1052/168 = 6.262) */
    width: 175px !important;
    height: 28px !important;
    max-width: 175px !important;
    max-height: 28px !important;
    min-width: 175px !important;
    min-height: 28px !important;
    aspect-ratio: 1052 / 168 !important;
    /* Safety: blocca qualsiasi transform/scale ereditato che potrebbe
       distorcere il rendering durante la transizione blur. */
    object-fit: contain !important;
    /* Preserva display block dell'inline style */
    display: block !important;
    flex: 0 0 auto !important;
  }
  .comp-header { height: 60px !important; }
}

/* ═══════════════════════════════════════════════════════════════════ — v11 — Pannello desktop: solo hide su mobile, nessun anti-FOUC (il hack opacity:0/is-panel-ready creava pannello vuoto pe */

/* Mobile: pannello desktop sempre nascosto */
@media (max-width: 767px) {
  #comp-panel-desktop {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   v8 — Empty state: testi differenziati desktop/mobile
   ═══════════════════════════════════════════════════════════════════ */

/* Anti-FOUC strategy: entrambi display:none di default, la media query sblocca SOLO quello — pertinente. Se la CSS si carica in ritardo, nessun titolo è visibile (meglio di "flash" di entrambi). Questo CSS è in <h */
.comp-empty-title--mobile,
.comp-empty-title--desktop,
.comp-empty-steps--desktop {
  display: none;
}

/* Mobile */
@media (max-width: 767px) {
  .comp-empty-title--mobile { display: block; }
}

/* Desktop */
@media (min-width: 768px) {
  .comp-empty-title--desktop { display: block; }
  .comp-empty-steps--desktop {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0 24px;
    padding: 0;
    list-style: none;
    text-align: left;
    max-width: 460px;
  }
  .comp-empty-steps--desktop li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: #444;
    line-height: 1.5;
  }
  .comp-empty-steps--desktop li strong { font-weight: 600; color: #0f1113; }
  .comp-empty-steps-n {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0f1113;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono, monospace);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   v8 — Loader logo
   ═══════════════════════════════════════════════════════════════════ */

.loader-logo {
  height: 42px;
  width: auto;
  display: block;
  margin-bottom: 60px;
}

@media (max-width: 640px) {
  .loader-logo { height: 34px; }
}

/* ═══════════════════════════════════════════════════════════════════ — v10 — Hamburger button con label "AZIONI" (solo desktop) ═══════════════════════════════════════════════════════════════ */

/* Stato base del bottone labeled — solo icona su mobile */
.hamburger-btn.hamburger-btn--labeled {
  width: auto;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 8px;
}

/* Label nascosta di default (mobile) */
.hamburger-btn--labeled .hamburger-btn-label {
  display: none;
}

/* Mobile: icona leggermente più grande */
@media (max-width: 767px) {
  .hamburger-btn.hamburger-btn--labeled {
    width: 44px;
    height: 44px;
  }
  .hamburger-btn.hamburger-btn--labeled svg {
    width: 20px;
    height: 20px;
  }
  /* v22.16 — Quando il menu è aperto su mobile, il bottone ha sfondo scuro
     (.hamburger-btn.light.open → background var(--ink)). Le 3 linee dell'icona
     SVG sono renderizzate inline con fill="#0a0a0a" da hamburger_icon() PHP,
     quindi risultano invisibili sul fondo nero. Forziamo il fill a bianco
     quando lo stato .open è attivo, in modo coerente con la regola desktop
     (riga ~2348). Scope: solo mobile (max-width 767px). */
  .hamburger-btn.hamburger-btn--labeled.open svg rect {
    fill: #fff !important;
  }
}

/* Desktop: label visibile a sinistra dell'icona, bottone più grande */
@media (min-width: 768px) {
  .hamburger-btn.hamburger-btn--labeled {
    height: 48px;
    padding: 0 18px;
    gap: 14px;
    border-radius: 10px;
    background: var(--surf3, #f3f3f0);
    border: 1px solid var(--card-line, #ededeb);
    transition: background .18s ease, border-color .18s ease;
  }
  .hamburger-btn.hamburger-btn--labeled:hover {
    background: #fff;
    border-color: var(--ink, #0f1113);
  }
  .hamburger-btn.hamburger-btn--labeled.open {
    background: var(--ink, #0f1113);
  }
  .hamburger-btn.hamburger-btn--labeled.open .hamburger-btn-label {
    color: #fff;
  }
  .hamburger-btn.hamburger-btn--labeled.open svg rect {
    fill: #fff !important;
  }

  .hamburger-btn--labeled .hamburger-btn-label {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 2.4px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--ink, #0f1113);
    font-family: var(--mono, monospace);
    line-height: 1;
    transition: color .18s ease;
  }

  .hamburger-btn.hamburger-btn--labeled svg {
    width: 18px;
    height: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════════════ — v10 — Empty state desktop: no bottone, steps come guida funzionale ═════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  /* Nascondi il bottone CTA su desktop: l'utente deve usare il pannello a destra */
  .comp-empty-cta {
    display: none !important;
  }

  /* Card leggermente più larga su desktop per contenere gli step in modo ariosos */
  .comp-empty-card {
    width: min(520px, calc(100% - 32px));
    padding: 30px 32px;
    text-align: left;
  }

  .comp-empty-kicker {
    text-align: left;
  }

  .comp-empty-title--desktop {
    font-size: 26px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -.02em;
    margin: 10px 0 4px;
  }

  /* Override degli step: più ariosi, con tipografia più leggibile */
  .comp-empty-steps--desktop {
    margin: 22px 0 0;
    gap: 14px;
  }
  .comp-empty-steps--desktop li {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
  }
  .comp-empty-steps--desktop li strong {
    color: var(--ink, #0f1113);
    font-weight: 600;
  }
  .comp-empty-steps-n {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════ — v12 — Export PDF: overflow + overlay + toast + bottone spinner ═════════════════════════════════════════════════════════ */

.export-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Overlay loader durante generazione PDF */
.export-pdf-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(15, 17, 19, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rebusOverlayFadeIn .22s ease-out both;
}
/* CRITICAL FIX: senza questa regola, `display: flex` sopra sovrascrive — il comportamento standard dell'attributo HTML `hidden` (che dovrebbe nascondere l'elemento). Risultato del bug: l'overla */
.export-pdf-overlay[hidden] {
  display: none !important;
}
@keyframes rebusOverlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.export-pdf-overlay-inner {
  background: #fff;
  padding: 36px 44px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  min-width: 280px;
}
.export-pdf-overlay-inner .loader-svg {
  display: block;
}
.export-pdf-overlay-inner .loader-track {
  stroke: rgba(15,17,19,.08);
}
.export-pdf-overlay-inner .loader-path {
  stroke: var(--ink, #0f1113);
  stroke-linecap: round;
  transform-origin: center;
  animation: rebusSpin .9s linear infinite, rebusDash 1.4s ease-in-out infinite;
}
@keyframes rebusSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
@keyframes rebusDash {
  0%   { stroke-dasharray: 1, 170; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 90, 170; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 170; stroke-dashoffset: -125; }
}
.export-pdf-overlay-text {
  font-size: 13px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink, #0f1113);
  font-family: var(--mono, monospace);
  font-weight: 500;
}

/* Toast notifica */
.export-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 5100;
  padding: 14px 22px;
  background: var(--ink, #0f1113);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  letter-spacing: .2px;
  box-shadow: 0 10px 32px rgba(0,0,0,.28);
  max-width: 360px;
  animation: rebusToastIn .28s cubic-bezier(.22, .61, .36, 1) both;
}@keyframes rebusToastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (max-width: 640px) {
  .export-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}

/* Spinner inline nel bottone "Scarica PDF" durante generazione */
.export-btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  display: inline-block;
  animation: rebusSpin .7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
.export-btn--primary:disabled {
  opacity: .85;
  cursor: progress;
}

/* ═══════════════════════════════════════════════════════════════════ — v12 — Transizioni schermate più soft (easing + durata) ═════════════════════════════════════════════════════════════════ */

.screen.transitioning {
  transition: opacity .45s cubic-bezier(.65, 0, .35, 1),
              transform .55s cubic-bezier(.65, 0, .35, 1);
}

/* ═══════════════════════════════════════════════════════════════════ — v13 — Header pannello: allineamento verticale perfetto icon/text ═══════════════════════════════════════════════════════ */

.comp-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comp-panel-header-icon {
  align-self: center;
}

.comp-panel-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: center;
  line-height: 1.2;
}

.comp-panel-header-text .comp-panel-sub {
  line-height: 1.2;
  margin-bottom: 2px;
}

.comp-panel-header-text .comp-panel-name {
  line-height: 1.2;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════ — v13 — Blur elegante su schermata pending Sostituisce il loader full-screen. La schermata parte sfocata e si */

.screen.is-screen-pending {
  position: relative;
  pointer-events: none;
}

/* HEADER del configuratore e light pages: blur sottile */
.screen.is-screen-pending .comp-header,
.screen.is-screen-pending .light-header,
.screen.is-screen-pending .export-header,
.screen.is-screen-pending .welcome-topbar {
  filter: blur(4px) saturate(.85);
  transition: filter .55s cubic-bezier(.22, .61, .36, 1);
  will-change: filter;
}

/* CONTENT (tutto il resto dentro la schermata) blur più marcato */
.screen.is-screen-pending .comp-body,
.screen.is-screen-pending .comp-stage-wrap,
.screen.is-screen-pending .comp-stage,
.screen.is-screen-pending .comp-panel,
.screen.is-screen-pending #comp-panel-desktop,
.screen.is-screen-pending #panel-drawer,
.screen.is-screen-pending .export-body,
.screen.is-screen-pending .welcome-main,
.screen.is-screen-pending .welcome-footer {
  filter: blur(10px) saturate(.75);
  transition: filter .6s cubic-bezier(.22, .61, .36, 1);
  will-change: filter;
}

/* Piccolo fade del contenuto per un effetto più "elegante" durante il loading */
.screen.is-screen-pending .comp-body,
.screen.is-screen-pending .export-body {
  opacity: .88;
  transition: filter .6s cubic-bezier(.22, .61, .36, 1),
              opacity .55s ease;
}

/* Dissolvenza: rimosso il blur quando ready */
.screen:not(.is-screen-pending) .comp-header,
.screen:not(.is-screen-pending) .light-header,
.screen:not(.is-screen-pending) .export-header,
.screen:not(.is-screen-pending) .welcome-topbar {
  filter: blur(0) saturate(1);
  transition: filter .55s cubic-bezier(.22, .61, .36, 1);
}

.screen:not(.is-screen-pending) .comp-body,
.screen:not(.is-screen-pending) .comp-stage-wrap,
.screen:not(.is-screen-pending) .comp-stage,
.screen:not(.is-screen-pending) .comp-panel,
.screen:not(.is-screen-pending) #comp-panel-desktop,
.screen:not(.is-screen-pending) #panel-drawer,
.screen:not(.is-screen-pending) .export-body,
.screen:not(.is-screen-pending) .welcome-main,
.screen:not(.is-screen-pending) .welcome-footer {
  filter: blur(0) saturate(1);
  opacity: 1;
  transition: filter .6s cubic-bezier(.22, .61, .36, 1),
              opacity .55s ease;
}

/* Mobile: blur leggermente meno marcato per non affaticare la lettura */
@media (max-width: 767px) {
  .screen.is-screen-pending .comp-header,
  .screen.is-screen-pending .light-header,
  .screen.is-screen-pending .export-header,
  .screen.is-screen-pending .welcome-topbar {
    filter: blur(3px) saturate(.9);
  }
  .screen.is-screen-pending .comp-body,
  .screen.is-screen-pending .comp-stage-wrap,
  .screen.is-screen-pending .comp-stage,
  .screen.is-screen-pending .export-body,
  .screen.is-screen-pending .welcome-main,
  .screen.is-screen-pending .welcome-footer {
    filter: blur(8px) saturate(.8);
  }
}

/* ═══════════════════════════════════════════════════════════════════ — v16 — Visibilità sezioni pannello Funziona sia per il pannello desktop (#comp-panel-desktop) sia per */

/* --- DEFAULT: forma nascosta; finitura + opzioni visibili --- */
#rebus-shell .screen-comp .comp-panel-section--shape {
  display: none !important;
}
#rebus-shell .screen-comp .comp-panel-section--finish {
  display: block !important;
}

/* --- INSERT (desktop) O insert (mobile): SOLO forma, nascondi finitura+opzioni --- */
#rebus-shell .screen-comp.is-panel-insert-mode .comp-panel-section--shape,
#rebus-shell .screen-comp.is-mobile-panel-mode-insert .comp-panel-section--shape {
  display: block !important;
}
#rebus-shell .screen-comp.is-panel-insert-mode .comp-panel-section--finish,
#rebus-shell .screen-comp.is-panel-insert-mode .comp-panel-section--options,
#rebus-shell .screen-comp.is-mobile-panel-mode-insert .comp-panel-section--finish,
#rebus-shell .screen-comp.is-mobile-panel-mode-insert .comp-panel-section--options {
  display: none !important;
}

/* --- COLOR MODE: solo finitura, nascondi forma + opzioni --- */
#rebus-shell .screen-comp.is-panel-color-mode .comp-panel-section--shape,
#rebus-shell .screen-comp.is-panel-color-mode .comp-panel-section--options,
#rebus-shell .screen-comp.is-mobile-panel-mode-color .comp-panel-section--shape,
#rebus-shell .screen-comp.is-mobile-panel-mode-color .comp-panel-section--options {
  display: none !important;
}
#rebus-shell .screen-comp.is-panel-color-mode .comp-panel-section--finish,
#rebus-shell .screen-comp.is-mobile-panel-mode-color .comp-panel-section--finish {
  display: block !important;
}

/* ═════════════════════════════════════════════════════════════════════════════ — PATCH v19 — welcome.php layout fixes Modifiche da brief cliente (screenshot "modifiche-welcome-mobile/desktop"): */

/* 3) Footer (dots/handle) non visibile su tutte le viewport */
#rebus-shell .screen-welcome-v7 .welcome-footer {
  display: none !important;
}

/* 1) MOBILE: blocco centrato verticalmente nella viewport */
@media (max-width: 640px) {
  #rebus-shell .screen-welcome-v7 .welcome-main {
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* 2) DESKTOP wide (>=1200px): topbar-inner allineato al container (920px),
 *    così logo e testo condividono lo stesso margine sinistro.            */
@media (min-width: 1200px) {
  #rebus-shell .screen-welcome-v7 .welcome-topbar-inner {
    max-width: 920px;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ — PATCH v20 — Mobile UX refinements FIX v20 — #4: editMode MOBILE mostra SOLO "Opzioni" (no Forma, no Finitura). */
@media (max-width: 767.98px) {
  #rebus-shell .screen-comp.is-panel-edit-mode:not(.is-panel-color-mode) .comp-panel-section--finish {
    display: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
 * v22.5 — Pagina Guida (guida.php)
 * Stile light-bg coerente con export.php (riusa header partial variant 'guida').
 * Sezioni verticali con titolo + body + figure, immagini estratte dal PDF
 * "ipotesi-sequenze.pdf" (assets/guida/seq-XX.jpg).
 * ════════════════════════════════════════════════════════════════════════════ */

#screen-guida {
  background: #fbfbfb;
  color: #0f1113;
  /* v22.7: overflow-y auto consente lo scroll della pagina (8 sezioni, contenuto lungo).
     Senza, il parent #rebus-shell con overflow:hidden clippa tutto sotto la fold. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* momentum scroll su iOS */
}

.guida-body {
  flex: 1;
  padding: 32px 24px 64px;
}

.guida-container {
  max-width: 920px;
  margin: 0 auto;
}

/* Title block */
.guida-title-block {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(15, 17, 19, 0.08);
}

.guida-eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #888;
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  margin-bottom: 14px;
}

.guida-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.025em;
  color: #0f1113;
  margin: 0 0 18px;
}

.guida-title strong { font-weight: 700; }

.guida-subtitle {
  font-size: 16px;
  color: #555;
  margin: 0;
  max-width: 620px;
  line-height: 1.5;
}

/* Sezioni */
.guida-section {
  margin-bottom: 56px;
}

.guida-section-header {
  margin-bottom: 22px;
}

.guida-section-eyebrow {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #999;
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  margin-bottom: 10px;
  font-weight: 500;
}

.guida-section-title {
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.015em;
  color: #0f1113;
  margin: 0;
}

.guida-section-body {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(15, 17, 19, 0.78);
}

.guida-section-body p {
  margin: 0 0 18px;
  max-width: 720px;
}

.guida-section-body p:last-child {
  margin-bottom: 0;
}

.guida-section-body strong {
  color: #0f1113;
  font-weight: 600;
}

/* Callout — Regola fondamentale */
.guida-callout {
  background: rgba(15, 17, 19, 0.04);
  border-left: 3px solid #0f1113;
  padding: 16px 20px;
  margin: 24px 0 0;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  line-height: 1.6;
}

/* Stats (Sezione 01 — limiti dimensionali) */
.guida-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.guida-stat {
  background: #ffffff;
  border: 1px solid rgba(15, 17, 19, 0.08);
  border-radius: 10px;
  padding: 24px 20px;
  text-align: center;
}

.guida-stat-value {
  font-size: 56px;
  font-weight: 200;
  line-height: 1;
  color: #0f1113;
  letter-spacing: -.04em;
  margin-bottom: 10px;
}

.guida-stat-label {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

/* Figure — immagini esempio */
.guida-figure {
  margin: 24px 0 0;
  padding: 0;
}

.guida-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid rgba(15, 17, 19, 0.08);
  border-radius: 8px;
  /* Le immagini estratte dal PDF sono ~800x780 con sfondo bianco e griglia
     leggera. Il container fornisce solo una sottile cornice per coerenza. */
}

.guida-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: #777;
  font-style: italic;
  line-height: 1.4;
}

.guida-figure--large img {
  max-width: 720px;
  margin: 0 auto;
}

.guida-figure--large figcaption {
  text-align: center;
}

/* Grid di figure (es. sezione "Aggiungere moduli" con 3 immagini side-by-side) */
.guida-figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 28px 0 0;
}

.guida-figure-grid .guida-figure {
  margin: 0;
}

/* Actions — CTA bottoni in fondo */
.guida-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid rgba(15, 17, 19, 0.08);
}

.guida-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  letter-spacing: 0.01em;
}

.guida-btn:focus-visible {
  outline: 2px solid #0f1113;
  outline-offset: 2px;
}

.guida-btn--ghost {
  color: rgba(15, 17, 19, 0.65);
  border-color: rgba(15, 17, 19, 0.15);
}

.guida-btn--ghost:hover {
  color: #0f1113;
  border-color: rgba(15, 17, 19, 0.4);
  background: rgba(15, 17, 19, 0.03);
}

.guida-btn--primary {
  background: #0f1113;
  color: #ffffff;
  border-color: #0f1113;
}

.guida-btn--primary:hover {
  background: #2a2d31;
  border-color: #2a2d31;
}

.guida-btn--primary:active {
  transform: scale(0.97);
}

.guida-btn-arrow,
.guida-btn-icon {
  font-size: 16px;
  font-weight: 400;
}

/* Mobile responsive — guida.php */
@media (max-width: 767.98px) {
  .guida-body {
    padding: 24px 18px 48px;
  }

  .guida-title-block {
    margin-bottom: 36px;
    padding-bottom: 24px;
  }

  .guida-section {
    margin-bottom: 40px;
  }

  .guida-section-header {
    margin-bottom: 16px;
  }

  .guida-section-body {
    font-size: 14px;
    line-height: 1.6;
  }

  .guida-section-body p {
    margin-bottom: 14px;
  }

  /* Stats: stack su mobile */
  .guida-stats {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 22px;
  }

  .guida-stat {
    padding: 18px 14px;
  }

  .guida-stat-value {
    font-size: 42px;
  }

  .guida-stat-label {
    font-size: 11px;
  }

  /* Figure grid: stack a 1 colonna su mobile */
  .guida-figure-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 22px;
  }

  .guida-figure {
    margin-top: 18px;
  }

  .guida-figure figcaption {
    font-size: 12px;
  }

  /* Actions: stack verticale, full-width */
  .guida-actions {
    flex-direction: column-reverse;
    gap: 10px;
    align-items: stretch;
    margin-top: 48px;
    padding-top: 24px;
  }

  .guida-btn {
    justify-content: center;
    padding: 14px 22px;
  }

  .guida-callout {
    padding: 14px 16px;
    font-size: 13px;
    margin-top: 18px;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
 * v22.14 — Context menu: voci con icona Font Awesome
 * v22.14: rimossi selettori legacy .context-help (era per "Come procedo?",
 * voce rimossa con la rimozione totale del tour). Resta .context-icon-btn
 * usato da: Colore (palette), Muovi, Ruota, Inserisci Modulo (plus), Elimina.
 *
 * .context-divider-top → divider visivo sopra il pulsante (separa "Inserisci
 * Modulo" e "Elimina" dal gruppo di azioni del modulo selezionato).
 * ════════════════════════════════════════════════════════════════════════════ */

#comp-runtime-mount .context-menu .context-actions button.context-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#comp-runtime-mount .context-menu .context-actions button.context-icon-btn i {
  font-size: 14px;
  width: 16px; /* stessa larghezza per allineamento label */
  text-align: center;
  opacity: 0.78;
  transition: opacity .16s ease;
}
#comp-runtime-mount .context-menu .context-actions button.context-icon-btn:hover i {
  opacity: 1;
}

/* v22.9: divider visivo sopra il pulsante (1px linea sottile in linea col tema) */
#comp-runtime-mount .context-menu .context-actions button.context-divider-top {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0 0 8px 8px; /* angoli alti rimossi per coerenza con il bordo */
}

/* Su desktop: icona allineata, label visibile */
@media (min-width: 768px) {
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.context-icon-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.context-icon-btn i {
    font-size: 13px !important;
    width: 16px !important;
    text-align: center !important;
    opacity: 0.6 !important;
  }
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.context-icon-btn:hover i {
    opacity: 0.95 !important;
  }
  /* Divider top: spaziatura coerente con grid gap del context desktop */
  #comp-runtime-mount .context-menu.is-desktop-context .context-actions button.context-divider-top {
    margin-top: 6px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 8px !important;
  }
}
/* Mobile: icona accanto al testo, stessa familigia degli altri bottoni */
@media (max-width: 767.98px) {
  #comp-runtime-mount .context-menu .context-actions button.context-icon-btn i {
    font-size: 13px;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
 * v22.17 / v22.18 — Context menu mobile: trasparenza, feedback, allineamento
 * ────────────────────────────────────────────────────────────────────────────
 * Tre patch mobile-only sul context menu del modulo:
 *
 *   1. PILLOLA GRIGIA (v22.17) — Engine CSS (assets/rebus-engine.css, NON
 *      modificabile) imposta su tutte le `.context-actions button`:
 *         min-height:40px; border-radius:12px; background:#f6f6f6; ...
 *      Il `background:#f6f6f6` produce una "pillola" grigia attorno a ogni
 *      voce (Colore, Muovi, Ruota, Inserisci Modulo, Elimina). Override:
 *      fondo trasparente a riposo, fondo grigio chiaro solo al press
 *      (:active) come feedback tattile. Il separatore .context-divider-top
 *      è preservato (tocchiamo solo `background`, non bordi/margini).
 *
 *   2. ALLINEAMENTO TESTI (v22.18) — La regola base (riga ~3080) imposta
 *      sull'`<i>` icona `width: 16px; text-align: center` per allineare
 *      i testi. Però `<i>` è `display: inline` di default, e su elementi
 *      inline la `width` viene IGNORATA: il box si dimensiona al glifo
 *      contenuto. Risultato: glifi più larghi (es. fa-palette) spingono
 *      il testo a destra rispetto a glifi più stretti (fa-arrow-*).
 *      Visivamente "Colore" appariva disallineato rispetto a Muovi/Ruota.
 *      Fix: `display: inline-block` sull'`<i>` mobile, così la `width:16px`
 *      viene effettivamente rispettata e tutti i testi partono dallo
 *      stesso x. Niente trick di margin per singolo glifo.
 *
 *   3. FEEDBACK PRESS — Su touchscreen `:hover` resta "stuck" dopo il tap;
 *      `:active` è il pseudo-class corretto (feedback solo durante il
 *      press, sparisce al rilascio). Variante .danger con tinta rossa
 *      coerente con il pattern desktop (riga ~1463).
 *
 * Scope: solo mobile (max-width 767.98px). Desktop invariato.
 * ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  /* (1) Voci trasparenti a riposo, feedback solo al press */
  #comp-runtime-mount .context-menu .context-actions button {
    background: transparent !important;
  }
  #comp-runtime-mount .context-menu .context-actions button:active {
    background: rgba(0, 0, 0, 0.05) !important;
  }
  /* Variante danger (Elimina): feedback al press leggermente tinto di rosso */
  #comp-runtime-mount .context-menu .context-actions button.danger:active {
    background: rgba(177, 55, 46, 0.07) !important;
  }
  /* (2) Allineamento testi v22.20 — TENTATIVO 4.
     Storico tentativi falliti:
       v22.17: margin-right su fa-palette → ha peggiorato
       v22.18: display:inline-block sull'<i> → no-op (FA7 lo è già)
       v22.19: text-align:right sull'<i> → no-op anche questo, perché
               il glifo fa-palette riempie il box 16px completamente
               (1.25em = ~16px @ font-size 13px) e non ha whitespace
               su cui text-align possa agire
     Misurazione precisa screenshot 21:19 (374px wide, ~dpr=1):
       - Muovi/Ruota: icon_end x=62-63, label_start x=78 → gap 15-16px
       - Colore: icon (palette) end x=74, label_start x≈70-72 (overlap)
       - Stefano ha confermato che vuole "Colore" SPOSTATO A DESTRA per
         allinearsi alla colonna verticale di Muovi/Ruota (label_start x=78)
     Fix v22.20: padding-left chirurgico sul <span> del SOLO button Colore.
     Selettore basato sull'ID `#contextColorBtn` (presente in rebus-app.js
     riga 951, garantito unico nel DOM). Il <span> è figlio diretto del
     button. Padding-left = 8px sposta la "C" da x≈70 a x≈78 → allineamento
     con Muovi/Ruota. Le altre voci NON sono toccate. */
  #comp-runtime-mount .context-menu .context-actions button#contextColorBtn > span {
    padding-left: 8px !important;
  }
}

/* ===== Barra anteprima — stile Desalto pulito (classi, NO inline) =====
   Card bianca flottante in basso, full-width su mobile (12px dai bordi),
   max-width 720px centrata su desktop. Tipografia var(--font), pulsanti come
   il pannello laterale. Niente arcade/gamification. */
.rebus-preview-bar{
  position:fixed; left:12px; right:12px; bottom:12px; z-index:1000;
  max-width:720px; margin:0 auto;
  display:flex; flex-direction:column;
  background:#FFFFFF; border:1px solid var(--line,#ECECEC); border-radius:12px;
  box-shadow:0 -2px 16px rgba(0,0,0,.06);
  font-family:var(--font); color:var(--ink,#0F1113); pointer-events:auto;
  padding-bottom:env(safe-area-inset-bottom);
}
.rebus-preview-bar *{ box-sizing:border-box; }
.rpb-head{ display:flex; align-items:center; justify-content:space-between; padding:14px 16px 0; }
.rpb-label{ font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--ink,#0F1113); }
.rpb-info{
  appearance:none; cursor:pointer; width:26px; height:26px; min-width:26px; border-radius:50%;
  border:1px solid var(--line2,#E0E0E0); background:#fff; color:var(--ink3,#72777D); font:inherit;
  font-size:13px; font-style:italic; font-weight:700; line-height:1;
  display:flex; align-items:center; justify-content:center; padding:0;
}
.rpb-status{
  display:none; align-items:center; gap:8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  margin:12px 16px 0; padding:0;
}
.rpb-status-icon{ font-size:18px; line-height:1; font-weight:700; flex:0 0 auto; }
.rpb-status-text{ font-size:15px; line-height:1.3; font-weight:600; color:var(--ink2,#3A3D41); overflow:hidden; text-overflow:ellipsis; }
.rpb-status--ok .rpb-status-icon{ color:#2E7D32; }
.rpb-status--ko .rpb-status-icon{ color:#C62828; }
.rpb-actions{ display:flex; gap:8px; align-items:stretch; padding:14px 16px 16px; flex-wrap:nowrap; }
.rpb-spacer{ flex:1 1 auto; }
.rpb-btn{
  appearance:none; cursor:pointer; font-family:var(--font); font-weight:600; font-size:14px;
  min-height:44px; min-width:44px; padding:0 16px; border-radius:10px; line-height:1;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:#fff; color:var(--ink,#0F1113); border:1px solid var(--line2,#E0E0E0); white-space:nowrap;
  transition:background .12s ease, border-color .12s ease;
  touch-action:manipulation;
}
.rpb-btn:hover{ border-color:#c9ccd0; }
.rpb-move{ flex:0 0 auto; font-size:18px; padding:0; }
.rpb-rotate{ flex:0 0 auto; }
.rpb-rot-icon{ font-size:18px; display:inline-block; }
.rpb-cancel{ flex:0 0 auto; }
.rpb-confirm{ flex:0 0 auto; background:#111113; color:#fff; border-color:#111113; }
.rpb-confirm:hover{ background:#000; }
.rpb-btn:disabled{ background:#F4F4F2; color:var(--ink4,#A4A9AE); border-color:var(--line,#ECECEC); cursor:not-allowed; }
