/* =========================================
   Serramenti Preventivi - UI semplice e veloce
   Pensata per tablet e smartphone, ottimizzata per non tecnici
   ========================================= */
:root {
  --primary: #0E7C73;
  --primary-dark: #0B5E57;
  --primary-light: #D6F5F0;
  --primary-soft: #EEFBF9;
  --accent: #F59E0B;
  --bg: #F1F5F9;
  --bg-card: #FFFFFF;
  --text: #0B1220;
  --text-muted: #64748B;
  --text-soft: #94A3B8;
  --border: #E6EBF1;
  --border-strong: #D5DDE6;
  --danger: #DC2626;
  --ok: #16A34A;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 6px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body { padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3, h4 { letter-spacing: -0.02em; }

/* ===== Sistema icone SVG (stile line / Lucide) ===== */
.icon {
  width: 20px; height: 20px;
  display: inline-block; vertical-align: middle; flex-shrink: 0;
  fill: none; stroke: currentColor;
  stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; stroke-width: 2; }
.icon-lg { width: 26px; height: 26px; stroke-width: 1.7; }
.icon-xl { width: 30px; height: 30px; stroke-width: 1.6; }

/* views */
.view { display: none; min-height: 100vh; flex-direction: column; }
.view.active { display: flex; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 62px;
}
.topbar h1 { font-size: 19px; font-weight: 700; margin: 0; flex: 1; }
.topbar .back {
  width: var(--tap); height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: var(--text); border-radius: var(--radius-sm);
  transition: background .12s ease, color .12s ease;
}
.topbar .back:hover { background: var(--bg); color: var(--primary); }
.topbar .back .icon { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand .logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, #14B8A6 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: -0.02em;
  box-shadow: 0 4px 10px rgba(14,124,115,.30);
}
.brand-title { font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.online-pill { color: var(--ok); font-size: 18px; }

/* container */
.container {
  padding: 16px;
  max-width: 920px; width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* hero */
.hero { margin-top: 12px; }
.btn-hero {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #14B8A6 100%);
  color: white;
  border: none; border-radius: var(--radius);
  padding: 26px; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: 0 8px 24px rgba(14,124,115,.28);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-hero:hover { box-shadow: 0 12px 30px rgba(14,124,115,.34); }
.btn-hero:active { transform: scale(.985); }
.btn-hero .hero-icon {
  font-size: 32px; background: rgba(255,255,255,.2);
  width: 50px; height: 50px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* tile grid */
.grid-tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 18px;
}
.tile {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 96px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile-ic {
  width: 46px; height: 46px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tile:active { background: var(--primary-soft); transform: translateY(0); }

.recent { margin-top: 28px; }
.recent h3 { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin: 0 0 10px; }

/* card list */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px;
  display: flex; align-items: center; gap: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.card-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-row:active { background: var(--primary-soft); transform: translateY(0); }
.card-row .ti {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.card-row .ti .icon { width: 22px; height: 22px; }
.card-row .meta { flex: 1; min-width: 0; }
.card-row .meta-title { font-weight: 700; }
.card-row .meta-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.card-row .badge {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
}
.badge.bozza, .badge.incompilazione { background: #FEF3C7; color: #92400E; }
.badge.pronto { background: #DBEAFE; color: #1E40AF; }
.badge.inviato { background: #E0E7FF; color: #3730A3; }
.badge.accettato { background: #D1FAE5; color: #065F46; }
.badge.rifiutato { background: #FEE2E2; color: #991B1B; }

/* search */
.search {
  width: 100%;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: 16px; background: white;
  margin-bottom: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* form */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13px; color: var(--text-muted); font-weight: 600;
}
.form input, .form select, .form textarea {
  font-size: 17px; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: white; color: var(--text);
  min-height: var(--tap);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form input[type=number] { font-size: 22px; font-weight: 600; text-align: center; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form .check {
  flex-direction: row; align-items: center; gap: 10px;
  font-size: 16px; color: var(--text);
}
.form .check input { width: 22px; height: 22px; }
.form h3 {
  margin: 14px 0 4px; font-size: 12px;
  color: var(--text-soft); text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* buttons */
.primary, .ghost {
  font-size: 16px; font-weight: 600;
  padding: 14px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  min-height: var(--tap); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s ease, box-shadow .12s ease, transform .08s ease, border-color .12s ease;
}
.primary .icon, .ghost .icon { width: 18px; height: 18px; }
.primary.small .icon, .ghost.small .icon { width: 16px; height: 16px; }
.primary { background: var(--primary); color: white; border: none; box-shadow: 0 2px 6px rgba(14,124,115,.22); }
.primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(14,124,115,.28); }
.primary:active { background: var(--primary-dark); transform: translateY(1px); }
.primary.big { width: 100%; padding: 18px; font-size: 18px; margin-top: 10px; }
.primary.small { padding: 6px 12px; min-height: 38px; font-size: 14px; box-shadow: none; }
.ghost { background: white; color: var(--primary); border-color: var(--border-strong); }
.ghost:hover { border-color: var(--primary); background: var(--primary-soft); }
.ghost.small { padding: 6px 12px; min-height: 38px; font-size: 14px; }

/* picker (toggle) */
.picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.picker button {
  background: white; border: 1.5px solid var(--border-strong);
  padding: 14px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--text);
  min-height: var(--tap);
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.picker button:hover { border-color: var(--primary); }
.picker button.sel {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.picker.icon-picker { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.picker.icon-picker button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; padding: 12px 6px;
}
.picker.icon-picker span { font-size: 24px; }
@media (max-width: 520px) {
  .picker.icon-picker { grid-template-columns: repeat(3, 1fr); }
}

/* steps tabs */
/* stepper numerato */
.steps {
  display: flex; align-items: flex-start; gap: 0;
  padding: 16px 16px 14px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.step {
  flex: 1; min-width: 72px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 0 2px;
  border: none; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  cursor: pointer;
  transition: color .15s ease;
}
/* linea connettore tra i pallini */
.step::before {
  content: ""; position: absolute; top: 14px; left: -50%; width: 100%;
  height: 2px; background: var(--border-strong); z-index: 0;
}
.step:first-child::before { display: none; }
.step-num {
  position: relative; z-index: 1;
  width: 29px; height: 29px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--text-soft);
  border: 2px solid var(--border-strong);
  font-size: 13px; font-weight: 700; letter-spacing: 0;
  transition: all .18s ease;
}
.step-lbl { white-space: nowrap; }
.step:hover .step-num { border-color: var(--primary); color: var(--primary); }
.step.active { color: var(--primary); }
.step.active .step-num {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.step.done { color: var(--primary-dark); }
.step.done .step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.step.done::before { background: var(--primary); }
/* spunta sugli step completati */
.step.done .step-num { font-size: 0; }
.step.done .step-num::after {
  content: ""; font-size: 0;
  width: 11px; height: 6px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.step-pane { display: none; }
.step-pane.active { display: block; }

/* quote head */
.quote-head { flex: 1; min-width: 0; }
.quote-num { font-weight: 800; font-size: 18px; }
.quote-state { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

/* cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }

.row { display: flex; gap: 8px; align-items: stretch; }
.row input { flex: 1; }

/* totals (carrello) */
.totals .line {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.totals .line:last-child { border-bottom: none; }
.totals .grand {
  font-size: 22px; font-weight: 800; color: var(--primary);
  padding-top: 10px; margin-top: 10px;
  border-top: 2px solid var(--primary);
}

/* ===== Barra carrello (totale sempre visibile) ===== */
.quote-body { padding-bottom: 96px; }
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.cart-bar-inner {
  max-width: 920px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.cart-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cart-count { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cart-total { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1.15; }
.cart-cta { min-height: 50px; padding: 12px 22px; font-size: 16px; white-space: nowrap; }

/* ===== Chip un-tap (sconto, acconto) ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--tap); padding: 10px 18px;
  font-size: 16px; font-weight: 700; color: var(--text);
  background: white; border: 1.5px solid var(--border-strong);
  border-radius: 999px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.chip:hover { border-color: var(--primary); }
.chip.sel { border-color: var(--primary); background: var(--primary); color: white; }

/* ===== Doppia azione "aggiungi infisso" ===== */
.add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .add-actions { grid-template-columns: 1fr; } }

/* ===== Stato vuoto ===== */
.empty-state {
  margin-top: 16px; padding: 28px 18px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  text-align: center; color: var(--text-muted); font-size: 15px; line-height: 1.6;
  background: var(--bg-card);
}

/* items list */
.item-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.item-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 13px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.item-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.item-card .thumb {
  width: 60px; height: 60px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary-dark);
  font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background-size: cover; background-position: center;
}
.item-card .info { flex: 1; min-width: 0; }
.item-card .info b { font-size: 16px; }
.item-card .info .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.item-card .price { font-weight: 800; color: var(--primary); white-space: nowrap; }
.item-card .warn { color: var(--accent); font-size: 14px; }

/* badge di stato riga (icona + testo, mai solo colore) */
.item-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
}
.item-badge .icon { width: 12px; height: 12px; }
.item-badge.ok { background: #D1FAE5; color: #065F46; }
.item-badge.warn { background: #FEF3C7; color: #92400E; }

/* colonna destra della card: prezzo + azioni rapide */
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.item-actions { display: flex; gap: 6px; }
.item-actions button {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); background: white; cursor: pointer;
  color: var(--text-muted);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.item-actions button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.item-actions button.del:hover { border-color: var(--danger); color: var(--danger); background: #FEF2F2; }

/* thumbs */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumbs img { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }

/* galleria multi-foto */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px;
}
.gallery .photo {
  position: relative;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: white;
  display: flex; flex-direction: column;
}
.gallery .photo img { width: 100%; height: 110px; object-fit: cover; display: block; }
.gallery .photo .actions {
  display: flex; gap: 4px; padding: 6px; border-top: 1px solid var(--border);
  background: rgba(248,250,252,.95); flex-wrap: wrap;
}
.gallery .photo .actions button {
  flex: 1; min-height: 34px; padding: 4px 6px; font-size: 11px; font-weight: 600;
  border-radius: 6px; border: 1px solid var(--border); background: white; cursor: pointer;
}
.gallery .photo .actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.gallery .photo .actions button .icon { width: 14px; height: 14px; }
.gallery .photo .actions button.ai {
  background: var(--primary); color: white; border: none;
}
.gallery .photo .actions button.ai:disabled { opacity: .55; cursor: not-allowed; }
.gallery .photo .actions button.danger { color: var(--danger); border-color: var(--danger); }
.gallery .photo .badge-principale {
  position: absolute; top: 6px; left: 6px;
  background: var(--primary); color: white; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.gallery .photo .badge-ai {
  position: absolute; top: 6px; right: 6px;
  background: var(--primary); color: white; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 999px;
}

/* spinner */
.spin {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: white;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* modale */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,42,.6);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 12px;
}
.modal.show { display: flex; }
.modal-card {
  background: white; border-radius: var(--radius);
  max-width: 600px; width: 100%; max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(2,6,23,.35);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 10px;
}
.modal-head h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 17px; }
.modal-head h3 .icon { color: var(--primary); }
.modal-head .back {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer; color: var(--text-muted);
  border-radius: var(--radius-sm); transition: background .12s ease, color .12s ease;
}
.modal-head .back:hover { background: var(--bg); color: var(--text); }
.ai-confidence {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px;
}
.ai-confidence .pill {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
}
.ai-confidence .pill.warn { background: #FEF3C7; color: #92400E; }

/* Dossier perito */
.modal-card.dossier { max-width: 760px; }
.ai-disclaimer-strong {
  background: #FEF3C7; color: #92400E;
  border: 1px solid #FDE68A; border-radius: 10px;
  padding: 10px 12px; font-size: 13px;
  margin-bottom: 12px;
}
.verdetto {
  border-radius: 12px; padding: 14px; margin-bottom: 16px;
  font-weight: 700; font-size: 16px;
  border: 2px solid transparent;
}
.verdetto-loading { background: var(--bg); color: var(--text-muted); font-style: italic; }
.verdetto-immediato { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.verdetto-daverificare { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.verdetto .label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; opacity: .8; }
.verdetto ul { margin: 6px 0 0; padding-left: 22px; font-weight: 500; font-size: 14px; }

.ai-section {
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px;
  background: white;
}
.ai-section[open] { box-shadow: var(--shadow); }
.ai-section summary {
  cursor: pointer; padding: 10px 12px;
  font-weight: 700; font-size: 14px; color: var(--text);
  user-select: none;
}
.ai-section summary::-webkit-details-marker { display: none; }
.ai-section summary::before { content: "▸ "; color: var(--primary); display: inline-block; transition: transform .15s; }
.ai-section[open] summary::before { content: "▾ "; }
.ai-section .body {
  padding: 0 14px 14px;
  font-size: 14px; line-height: 1.5;
}
.ai-section .body p { margin: 4px 0; }
.ai-section .body ul { margin: 4px 0; padding-left: 22px; }
.ai-section .body li { margin: 2px 0; }
.ai-section.danger { border-color: #FCA5A5; }
.ai-section.danger summary { color: #991B1B; }
.ai-section .badge {
  display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 700;
  margin-left: 6px; vertical-align: middle;
}
.ai-section .badge.warn { background: #FEF3C7; color: #92400E; }
.ai-section .badge.danger { background: #FEE2E2; color: #991B1B; }

.pacchetti {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
@media (max-width: 600px) { .pacchetti { grid-template-columns: 1fr; } }
.pacchetto {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; background: var(--bg);
}
.pacchetto.consigliato { border-color: var(--primary); background: var(--primary-light); }
.pacchetto h4 { margin: 0 0 4px; font-size: 13px; }
.pacchetto p { margin: 0; font-size: 12px; color: var(--text-muted); }
.pacchetto ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 8px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; }

/* signature canvas */
.canvas-wrap { margin-top: 12px; }
#sig-canvas {
  border: 2px dashed var(--border);
  border-radius: 12px;
  width: 100%; height: 200px;
  background: white;
  touch-action: none;
}

.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.hint.ok { color: var(--ok); font-weight: 700; }
.hint.err { color: var(--danger); font-weight: 700; }

/* ===== Bottone foto-first (action card, non invadente) ===== */
.photo-first {
  width: 100%;
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.photo-first:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--primary); }
.photo-first:active { transform: translateY(0); }
.photo-first .pf-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.photo-first .pf-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.photo-first .pf-title { font-size: 16px; font-weight: 700; color: var(--text); }
.photo-first .pf-sub { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.photo-first .pf-arrow { color: var(--text-soft); transform: rotate(180deg); }
.photo-first:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.photo-first:disabled:hover { transform: none; border-color: var(--primary-light); }

/* ===== Badge dossier su item-card ===== */
.item-card .dossier-badge {
  display: inline-block; padding: 2px 6px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  margin-left: 6px; letter-spacing: .03em;
}
.item-card .dossier-badge.immediato { background: #D1FAE5; color: #065F46; }
.item-card .dossier-badge.daverificare { background: #FEE2E2; color: #991B1B; }
.item-card .dossier-badge.analizzata { background: var(--primary-soft); color: var(--primary-dark); }
.item-card .dossier-badge { display: inline-flex; align-items: center; gap: 4px; }
.item-card .dossier-badge .icon { width: 12px; height: 12px; }
.item-card .stato-bozza {
  background: #FEF3C7; color: #92400E;
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  margin-left: 6px;
}

/* ===== Wizard ===== */
.modal-card.wizard { max-width: 760px; }
.wiz-steps {
  display: flex; gap: 0; margin-bottom: 20px;
  align-items: center;
}
.wiz-step {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-soft);
  transition: color .15s ease;
}
.wiz-step::before {
  content: ""; position: absolute; top: 14px; left: -50%; width: 100%;
  height: 2px; background: var(--border-strong); z-index: 0;
}
.wiz-step:first-child::before { display: none; }
.wiz-step span {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: var(--text-soft);
  border: 2px solid var(--border-strong);
  font-size: 13px; font-weight: 700;
  transition: all .18s ease;
}
.wiz-step.active { color: var(--primary); }
.wiz-step.active span {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.wiz-step.done { color: var(--primary-dark); }
.wiz-step.done span { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiz-step.done::before { background: var(--primary); }
.wiz-pane { display: none; }
.wiz-pane.active { display: block; }

/* drop zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 24px; text-align: center; background: var(--bg);
  position: relative; cursor: pointer;
}
.drop-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.drop-zone .drop-icon { color: var(--primary); display: block; margin-bottom: 4px; }
.drop-zone p { margin: 8px 0 4px; }
.drop-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.wiz-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin-top: 12px;
}
.wiz-thumbs .th {
  position: relative; border: 2px solid var(--border); border-radius: 10px;
  overflow: hidden; background: white;
}
.wiz-thumbs .th img { width: 100%; height: 90px; object-fit: cover; display: block; }
.wiz-thumbs .th.principale { border-color: var(--primary); }
.wiz-thumbs .th .princ-tag {
  position: absolute; top: 4px; left: 4px;
  background: var(--primary); color: white; font-size: 9px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px;
}
.wiz-thumbs .th .actions {
  display: flex; border-top: 1px solid var(--border); background: white;
}
.wiz-thumbs .th .actions button {
  flex: 1; border: none; background: white; padding: 4px;
  font-size: 10px; cursor: pointer; font-weight: 600;
}
.wiz-thumbs .th .actions .del { color: var(--danger); }
.wiz-thumbs .th .uploading {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 90px; font-size: 11px; color: var(--text-muted);
  background: var(--bg);
}
.wiz-thumbs .th .size-info,
.gallery .photo .size-info {
  font-size: 10px; color: var(--text-muted);
  padding: 2px 6px; background: rgba(0,0,0,.03);
  text-align: center;
}

/* spinner big */
.spin.big {
  width: 32px; height: 32px; border-width: 3px;
  border-color: var(--border); border-top-color: var(--primary);
  margin: 0 auto 12px;
}
.loading-block, .error-block { text-align: center; padding: 24px 12px; }
.error-block h4 { color: var(--danger); margin: 0 0 8px; }

/* dossier tab nel dettaglio item */
.item-tabs {
  display: flex; gap: 4px; margin: 12px 0;
  border-bottom: 1px solid var(--border);
}
.item-tab {
  padding: 8px 14px; cursor: pointer;
  background: transparent; border: none;
  font-weight: 700; color: var(--text-muted);
  border-bottom: 3px solid transparent;
}
.item-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.item-tab-pane { display: none; }
.item-tab-pane.active { display: block; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: all .2s;
  z-index: 100;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ===== Selettore modello AI ===== */
.ai-model-field {
  display: flex; flex-direction: column; gap: 7px;
  margin: 12px 0;
}
.ai-model-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.ai-model-label .icon { color: var(--primary); }
.verdetto-body { display: inline-flex; align-items: center; gap: 8px; }
.contact-line { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.contact-line .icon { color: var(--text-soft); }
.ai-model-select {
  font-size: 15px; font-weight: 600; color: var(--text);
  padding: 12px 14px; min-height: var(--tap);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: white;
  background-image: linear-gradient(135deg, var(--primary-soft) 0%, #ffffff 60%);
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ai-model-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ai-model-select:disabled {
  background: var(--bg); color: var(--text-soft); cursor: not-allowed;
}

/* =========================================================
   CONFIGURATORE INFISSO (multi-step) — stile "come l'esempio"
   ========================================================= */
.view.cfg { background: linear-gradient(180deg, #EAF1F4 0%, var(--bg) 220px); }

.cfg-topbar { position: static; align-items: flex-start; min-height: 0; padding: 14px 18px 10px; }
.cfg-head { flex: 1; min-width: 0; }
.cfg-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.03em; }
.cfg-title span { color: var(--primary); }
.cfg-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.cfg-reset { box-shadow: none; }
@media (max-width: 640px) {
  .cfg-title { font-size: 19px; }
  .cfg-sub { display: none; }
}

/* progress */
.cfg-progress {
  position: sticky; top: 0; z-index: 9;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px 12px;
}
.cfg-progress-info {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 8px;
}
.cfg-progress-label b { color: var(--primary); }
.cfg-home {
  border: none; background: transparent; cursor: pointer; color: var(--text-soft);
  display: inline-flex; align-items: center; padding: 4px; border-radius: 8px;
}
.cfg-home:hover { color: var(--primary); background: var(--primary-soft); }
.cfg-progress-track {
  height: 6px; border-radius: 999px; background: var(--border-strong);
  max-width: 520px; margin: 0 auto; overflow: hidden;
}
.cfg-progress-fill {
  height: 100%; border-radius: 999px; width: 10%;
  background: linear-gradient(90deg, var(--primary) 0%, #14B8A6 100%);
  transition: width .3s cubic-bezier(.22,1,.36,1);
}
.cfg-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.cfg-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong); border: none; cursor: pointer; padding: 0;
  transition: transform .15s ease, background .15s ease;
}
.cfg-dot.done { background: var(--primary); }
.cfg-dot.active { background: var(--primary); transform: scale(1.45); box-shadow: 0 0 0 3px var(--primary-soft); }
.cfg-dot:disabled { cursor: default; }

/* layout 2 colonne */
.cfg-container { max-width: 1120px; padding: 18px 18px 120px; }
.cfg-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 880px) { .cfg-layout { grid-template-columns: 1fr; } }

.cfg-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.cfg-step-head { display: flex; align-items: center; gap: 14px; }
.cfg-step-ic {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.cfg-step-kicker { font-size: 11px; font-weight: 700; letter-spacing: .09em; color: var(--text-soft); text-transform: uppercase; }
.cfg-step-h { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.cfg-help {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  color: var(--text-soft); padding: 6px; border-radius: 8px; align-self: flex-start;
}
.cfg-help:hover { color: var(--primary); background: var(--primary-soft); }
.cfg-step-desc { margin: 12px 0 18px; color: var(--text-muted); font-size: 14px; }
.cfg-help-box {
  background: var(--primary-soft); border: 1px solid var(--primary-light);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--primary-dark);
  margin: -6px 0 18px; display: flex; gap: 10px;
}
.cfg-help-box .icon { color: var(--primary); flex-shrink: 0; }

/* gruppi (es. INFISSI / PORTE E OSCURANTI) */
.cfg-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-soft); margin: 18px 0 10px;
}
.cfg-group-label:first-child { margin-top: 0; }

/* option cards */
.cfg-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cfg-options.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cfg-options.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .cfg-options, .cfg-options.cols-3 { grid-template-columns: repeat(2, 1fr); } }
.cfg-opt {
  position: relative; text-align: center; cursor: pointer;
  background: white; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 18px 12px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 116px;
  transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease, background .14s ease;
}
.cfg-opt:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.cfg-opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.cfg-opt-ic {
  width: 52px; height: 52px; border-radius: 13px; margin-bottom: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-muted);
  transition: background .14s ease, color .14s ease;
}
.cfg-opt:hover .cfg-opt-ic, .cfg-opt.sel .cfg-opt-ic { background: var(--primary-light); color: var(--primary-dark); }
.cfg-opt-ic .icon { width: 28px; height: 28px; }
.cfg-opt b { font-size: 14.5px; font-weight: 700; color: var(--text); }
.cfg-opt small { font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
.cfg-opt .cfg-check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff; display: none; align-items: center; justify-content: center;
}
.cfg-opt .cfg-check .icon { width: 13px; height: 13px; stroke-width: 3; }
.cfg-opt.sel .cfg-check { display: inline-flex; }
.cfg-opt-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 3px 8px rgba(14,124,115,.3);
}
.cfg-opt-badge .icon { width: 11px; height: 11px; }

/* swatch colore */
.cfg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.cfg-swatch {
  cursor: pointer; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: white; transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease;
}
.cfg-swatch:hover { border-color: var(--primary); transform: translateY(-2px); }
.cfg-swatch.sel { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cfg-swatch-chip {
  width: 100%; height: 40px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12);
  box-shadow: inset 0 -8px 12px rgba(0,0,0,.06);
}
.cfg-swatch span { font-size: 11.5px; font-weight: 600; color: var(--text); text-align: center; }

/* toggle (flag satinato / opzioni) */
.cfg-toggle {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-top: 14px; background: white;
  transition: border-color .14s ease, background .14s ease;
}
.cfg-toggle:hover { border-color: var(--primary); }
.cfg-toggle.on { border-color: var(--primary); background: var(--primary-soft); }
.cfg-toggle .cfg-toggle-text { flex: 1; }
.cfg-toggle .cfg-toggle-text b { display: block; font-size: 14px; }
.cfg-toggle .cfg-toggle-text small { font-size: 12px; color: var(--text-muted); }
.cfg-switch {
  width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong);
  position: relative; flex-shrink: 0; transition: background .18s ease;
}
.cfg-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .18s ease;
}
.cfg-toggle.on .cfg-switch { background: var(--primary); }
.cfg-toggle.on .cfg-switch::after { transform: translateX(18px); }

/* dimensioni / campi */
.cfg-fields { display: flex; flex-direction: column; gap: 14px; }
.cfg-dim-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cfg-dim-row.big2 { grid-template-columns: 1fr 1fr; }
/* campi misura dominanti: si leggono e si toccano al volo */
.cfg-field-xl input {
  font-size: 30px !important; font-weight: 800 !important;
  min-height: 68px; text-align: center;
}

/* chip ambiente: un tap invece della tastiera */
.cfg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cfg-chip {
  min-height: var(--tap); padding: 10px 16px;
  font-size: 15px; font-weight: 600; color: var(--text);
  background: white; border: 1.5px solid var(--border-strong);
  border-radius: 999px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.cfg-chip:hover { border-color: var(--primary); }
.cfg-chip.sel { border-color: var(--primary); background: var(--primary); color: white; }

/* prezzo indicativo in anteprima */
.cfg-preview-price {
  width: 100%; text-align: center;
  border-top: 1px dashed var(--border); padding-top: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.cfg-preview-price .cfg-price-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-soft);
}
.cfg-preview-price b { font-size: 24px; font-weight: 800; color: var(--primary); }
.cfg-preview-price small { font-size: 11px; color: var(--text-muted); }
.cfg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cfg-field > span {
  font-size: 12px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .05em;
}
.cfg-field input, .cfg-field select {
  width: 100%; min-width: 0;
  font-size: 17px; padding: 12px 14px; min-height: var(--tap);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: white; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.cfg-field input[type=number] { font-size: 20px; font-weight: 700; text-align: center; }
.cfg-field input:focus, .cfg-field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cfg-stepper { display: flex; align-items: stretch; min-width: 0; }
.cfg-stepper button {
  width: 48px; border: 1.5px solid var(--border-strong); background: white; cursor: pointer;
  font-size: 22px; font-weight: 700; color: var(--primary);
}
.cfg-stepper button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.cfg-stepper button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.cfg-stepper input { flex: 1; width: auto; min-width: 0; border-radius: 0; border-left: none; border-right: none; text-align: center; }
.cfg-stepper button { flex-shrink: 0; }

/* riepilogo (step finali "già impostato") */
.cfg-recap { display: flex; flex-direction: column; gap: 10px; }
.cfg-recap-row {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; background: var(--bg-card);
}
.cfg-recap-row .cfg-recap-ic {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.cfg-recap-row .cfg-recap-meta { flex: 1; min-width: 0; }
.cfg-recap-row .cfg-recap-meta span { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.cfg-recap-row .cfg-recap-meta b { display: block; font-size: 16px; }
.cfg-recap-row .cfg-recap-edit {
  border: 1px solid var(--border-strong); background: white; color: var(--primary);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cfg-recap-row .cfg-recap-edit:hover { background: var(--primary-soft); border-color: var(--primary); }
.cfg-recap-tag {
  display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark);
}

/* anteprima live */
.cfg-preview {
  position: sticky; top: 92px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
@media (max-width: 880px) { .cfg-preview { position: static; } }
.cfg-preview-stage {
  width: 100%; aspect-ratio: 1 / 1; max-width: 280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.9), rgba(226,232,240,.5) 70%);
  border-radius: 14px;
}
.cfg-window {
  --frame: #7A4B25; --frame-edge: rgba(0,0,0,.28);
  position: relative; width: 78%; height: 78%;
  background: var(--frame);
  border-radius: 5px;
  padding: 9px;
  box-shadow:
    0 10px 24px rgba(15,23,42,.18),
    inset 0 0 0 1px var(--frame-edge),
    inset 0 2px 3px rgba(255,255,255,.25);
  display: flex; gap: 7px;
  transition: width .3s ease, height .3s ease, background .25s ease;
}
.cfg-window.shutter { background: var(--frame); padding: 7px; gap: 5px; }
.cfg-sash {
  position: relative; flex: 1;
  background:
    linear-gradient(135deg, rgba(255,255,255,.85) 0%, rgba(207,224,231,.6) 45%, rgba(255,255,255,.5) 100%);
  border: 2px solid var(--frame);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
}
.cfg-window.frosted .cfg-sash { background: linear-gradient(135deg, #e7ecef 0%, #d7e0e4 100%); }
.cfg-window.solid .cfg-sash { background: var(--frame); filter: brightness(1.08); }
/* maniglia */
.cfg-sash .cfg-handle {
  position: absolute; width: 5px; height: 22px; border-radius: 3px;
  background: #9aa3ad; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.cfg-sash.h-right .cfg-handle { right: 4px; top: 50%; transform: translateY(-50%); }
.cfg-sash.h-left .cfg-handle { left: 4px; top: 50%; transform: translateY(-50%); }
/* indicatori apertura (linee diagonali) */
.cfg-sash .cfg-open {
  position: absolute; inset: 4px; pointer-events: none; opacity: .5;
}
.cfg-sash .cfg-open::before, .cfg-sash .cfg-open::after {
  content: ""; position: absolute; left: 0; right: 0; border-top: 1.5px dashed rgba(11,94,87,.7);
}
.cfg-open.tilt-top::before { top: 0; transform-origin: top; }
.cfg-open.left::before { top: 0; left: 0; width: 50%; height: 100%; border: none;
  border-left: 1.5px dashed rgba(11,94,87,.6); }
.cfg-preview-dim { font-size: 15px; font-weight: 700; color: var(--text); }
.cfg-preview-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.cfg-preview-chips .pchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 11px;
}
.cfg-preview-chips .pchip .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.cfg-preview-chips .pchip .icon { width: 13px; height: 13px; color: var(--primary); }

/* ===== Dettaglio riga: hero coerente col configuratore ===== */
.item-hero { padding: 0; overflow: hidden; }
.item-hero-grid { display: grid; grid-template-columns: 240px 1fr; }
.item-hero-preview {
  background: linear-gradient(160deg, #EAF1F4 0%, #F7FAFB 100%);
  border-right: 1px solid var(--border);
  padding: 22px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.item-hero-preview .cfg-preview-stage { max-width: 200px; }
.item-hero-dim { font-size: 14px; font-weight: 700; color: var(--text); }
.item-hero-info { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.item-hero-top { display: flex; flex-direction: column; gap: 5px; }
.item-hero-code {
  align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .05em;
  color: var(--primary); background: rgba(11,94,87,.1);
  border-radius: 999px; padding: 3px 10px;
}
.item-hero-info h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.item-hero-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px;
}
.pchip .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.pchip .icon { width: 13px; height: 13px; color: var(--primary); }
.item-hero-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px dashed var(--border); padding-top: 12px;
}
.item-hero-prod { font-size: 12px; color: var(--text-soft); }
.item-hero-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.item-hero-edit { align-self: flex-start; }
@media (max-width: 620px) {
  .item-hero-grid { grid-template-columns: 1fr; }
  .item-hero-preview { border-right: none; border-bottom: 1px solid var(--border); }
}

/* bottone compatto (topbar) */
.primary.small { padding: 8px 14px; font-size: 14px; min-height: 0; }

/* ===== Riga aggiunta accessori ===== */
.acc-add { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.acc-select {
  flex: 1; min-width: 180px;
  font-size: 15px; padding: 11px 12px; min-height: var(--tap);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: white; color: var(--text);
}
.acc-add-controls { display: flex; gap: 8px; }
.acc-qty {
  width: 74px; text-align: center;
  font-size: 15px; padding: 11px 8px; min-height: var(--tap);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: white;
}
.acc-add-controls .primary { white-space: nowrap; }

/* footer azioni */
.cfg-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.cfg-footer-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.cfg-selection { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; overflow: hidden; max-height: 30px; }
.cfg-selection .schip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--primary-dark);
  background: var(--primary-soft); border: 1px solid var(--primary-light);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.cfg-selection .schip .icon { width: 13px; height: 13px; color: var(--primary); }
.cfg-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cfg-actions .ghost, .cfg-actions .primary { min-height: 46px; }
@media (max-width: 640px) {
  .cfg-selection { display: none; }
  .cfg-actions { flex: 1; }
  .cfg-actions .ghost, .cfg-actions .primary { flex: 1; }
}
#cfg-prev:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Listino prezzi (admin) ===== */
a.primary { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.listino-report { margin-top: 12px; }
.listino-ok { background: #e9f7ef; border: 1px solid #b6e3c6; color: #1c6b3f; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.listino-ok > div { font-weight: 400; margin-top: 4px; }
.listino-err { background: #fdecec; border: 1px solid #f3b9b9; color: #a12525; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.listino-list { margin: 8px 0 0; padding-left: 18px; font-size: .85rem; }
.listino-list.err li { color: #a12525; }
.listino-list.warn li { color: #8a6d00; }
.listino-list li { margin: 3px 0; }
.listino-h { margin: 6px 0 8px; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.listino-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.listino-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.listino-table th, .listino-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #eee; white-space: nowrap; }
.listino-table th { color: #667; font-weight: 600; background: #fafafa; }
.listino-table td.num, .listino-table th.num { text-align: right; }
