/* =========================================================================
   Ricamo Studio — sistema visivo
   Dashboard editoriale: un grande contenitore dagli angoli molto arrotondati
   su sfondo grigio freddo, base bianco caldo / panna con un velo di giallo
   pastello verso destra. Inchiostro quasi nero per testo e stati "forti",
   un oro tenue come unico accento acceso. Bottoni a pillola, ombre morbide.
   ========================================================================= */
:root {
  --outer-bg: #d9dce0;
  --bg: #fdfbf7;
  --bg-2: #f3eee7;
  --panel-solid: #fffefc;
  --panel: rgba(255, 254, 252, .7);
  --panel-2: rgba(243, 238, 231, .6);
  --panel-strong: rgba(255, 254, 252, .88);
  --hover: rgba(26, 21, 18, .05);
  --glass-border: rgba(26, 21, 18, .08);
  --glass-blur: blur(24px) saturate(160%);
  --ink: #1a1512;
  --ink-2: #3a322c;
  --muted: #7a6f66;
  --line: rgba(26, 21, 18, .09);
  --line-2: rgba(26, 21, 18, .15);
  --dark: #19140f;
  --gold: #ffd85d;
  --gold-ink: #241a06;
  --accent: #ab7a21;
  --accent-2: #19140f;
  --accent-soft: rgba(171, 122, 33, .12);
  --accent-line: rgba(171, 122, 33, .35);
  --accent-ink: #ffffff;
  --accent-grad: linear-gradient(135deg, #2b2520 0%, #15120d 100%);
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, .11);
  --warn: #b26b00;
  --warn-soft: rgba(178, 107, 0, .11);
  --danger: #d8314d;
  --danger-soft: rgba(216, 49, 77, .1);
  --canvas: #e9e4da;
  --r-sm: 9px;
  --r: 14px;
  --r-lg: 22px;
  --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(26, 21, 18, .06);
  --shadow: 0 1px 3px rgba(26, 21, 18, .05), 0 8px 24px rgba(26, 21, 18, .08);
  --shadow-lg: 0 12px 32px rgba(26, 21, 18, .1), 0 32px 80px rgba(26, 21, 18, .16);
  --shadow-glass: inset 0 1px 0 rgba(255, 255, 255, .9), 0 24px 60px -24px rgba(45, 28, 16, .22), 0 2px 8px rgba(45, 28, 16, .05);
  --bevel: inset 0 1px 0 rgba(255, 255, 255, .9);
  --spring: cubic-bezier(.3, 1.2, .5, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; color: var(--ink); background: var(--outer-bg); -webkit-font-smoothing: antialiased; }
/* l'app vive in un unico grande contenitore "flottante" dagli angoli molto
   arrotondati, su uno sfondo grigio freddo: base crema con un velo di giallo
   pastello verso destra, in stile dashboard editoriale */
#app {
  position: fixed; inset: clamp(8px, 1.6vw, 20px); border-radius: clamp(26px, 3vw, 42px); overflow: hidden;
  background:
    radial-gradient(1100px 760px at 100% -6%, rgba(255, 216, 93, .55) 0%, rgba(255, 216, 93, 0) 60%),
    radial-gradient(700px 560px at 100% 60%, rgba(255, 224, 140, .35) 0%, rgba(255, 224, 140, 0) 65%),
    linear-gradient(160deg, #fffefb 0%, #fdfbf5 45%, #fbf4de 100%);
  box-shadow: 0 30px 70px -20px rgba(20, 22, 26, .35), 0 2px 10px rgba(20, 22, 26, .12);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; font-weight: 700; font-family: var(--font-display); }
.ico { flex: none; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.small-txt { font-size: 13px; white-space: nowrap; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.5; }
.grow { flex: 1; }
.center { text-align: center; }
.right { text-align: right; }
.error { color: var(--danger); }
.warn { color: #7a4a00; background: var(--warn-soft); border: 1px solid rgba(178, 107, 0, .2); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--hover); color: var(--ink-2); font-size: 12px; font-weight: 600; }

/* macchie di colore, appena percettibili: un tocco "tech", mai protagoniste */
.bg-blobs { display: none; }
.bg-blobs .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .16; }
.blob.b1 { width: 520px; height: 520px; top: -200px; left: -160px; background: radial-gradient(circle, #ffd85d 0%, transparent 70%); }
.blob.b2 { width: 480px; height: 480px; bottom: -200px; right: -160px; background: radial-gradient(circle, #19140f 0%, transparent 70%); }
.blob.b3 { width: 320px; height: 320px; top: 40%; right: 10%; opacity: .1; background: radial-gradient(circle, #19140f 0%, transparent 70%); }
/* evidenziatore che si "ricama" da solo: riempimento a scatti (come punti satin) + un ago che scorre sopra */
.hl { position: relative; display: inline-block; padding: 0 2px; border-radius: 2px; }
.hl::before {
  content: ""; position: absolute; z-index: -1; left: 0; bottom: 12%; height: 40%; width: 0; border-radius: 2px;
  background-color: var(--gold);
  background-image: repeating-linear-gradient(115deg, rgba(26, 21, 18, .16) 0 2px, transparent 2px 6px);
  animation: hl-stitch-fill 1.1s steps(11, end) .5s forwards;
}
.hl::after {
  content: ""; position: absolute; z-index: 1; top: -1px; left: 0; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 254, 252, .8); opacity: 0;
  animation: hl-needle 1.1s steps(11, end) .5s forwards;
}
@keyframes hl-stitch-fill { from { width: 0; } to { width: 100%; } }
@keyframes hl-needle {
  0% { opacity: 0; left: 0; }
  4% { opacity: 1; }
  94% { opacity: 1; }
  100% { opacity: 0; left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .hl::before { width: 100%; animation: none; }
  .hl::after { display: none; }
}

/* ---------------------------------------------------------------- campi */
input[type=number], input[type=text], input[type=search], input[type=email], input[type=password], input:not([type]), select, textarea {
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; background: #fff; color: var(--ink); min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(0, 0, 0, .22); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

/* selettore a tendina con icona (es. tipo di tessuto) */
.material-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--ink);
  font-weight: 500; font-size: 13.5px; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.material-btn:hover { border-color: rgba(0, 0, 0, .22); }
.material-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.material-btn > .ico:first-child { flex: none; color: var(--accent-2); }
.material-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-btn > .ico:last-child { flex: none; color: var(--muted); }
.material-menu { display: grid; gap: 1px; max-height: 60vh; overflow: auto; }
.material-menu button { display: flex; align-items: center; gap: 10px; }
.material-menu button .ico:first-child { color: var(--accent-2); flex: none; }
textarea { width: 100%; resize: vertical; }
input[type=range] { accent-color: var(--accent); }
.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; min-width: 0; }
.field select, .field input { width: 100%; font-weight: 400; color: var(--ink); }

/* ---------------------------------------------------------------- bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px;
  border: 1px solid transparent; border-radius: 999px; padding: 0 18px; font-weight: 600; font-size: 14px;
  background: var(--panel-solid); color: var(--ink); white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--gold); color: var(--gold-ink); border: 1px solid rgba(26, 21, 18, .06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 24px -12px rgba(25, 20, 15, .45); }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 14px 28px -12px rgba(25, 20, 15, .5); }
.btn.ghost { background: var(--panel); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-color: var(--glass-border); box-shadow: var(--shadow-sm); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 254, 252, .95); border-color: rgba(26, 21, 18, .16); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--ok); color: #fff; }
.btn.block { width: 100%; }
.btn.big { height: 46px; font-size: 15px; border-radius: 999px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 999px; }
.btn.fwd .ico:last-child { transform: rotate(180deg); }
.btn.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  border: 0; background: transparent; color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.xs { width: 26px; height: 26px; border-radius: 7px; }
.link { border: 0; background: none; padding: 0; color: var(--accent-2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; cursor: pointer; justify-self: start; }
.link:hover { text-decoration-color: currentColor; }
.center-block { justify-self: center; }

/* segmenti: traccia in vetro smerigliato, pillola attiva anch'essa vetro */
.seg {
  display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--panel-2); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm);
}
.psec > .seg, .art-toolbar .seg { width: 100%; }
.seg button {
  border: 0; background: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px;
  color: var(--ink-2); white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.on {
  background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  color: var(--ink); box-shadow: var(--shadow-glass);
}
.seg.small button { padding: 5px 10px; font-size: 12.5px; }
/* varianti a griglia: una sola riga, colonne uguali, per gruppi di 3 o 4 opzioni
   che altrimenti andrebbero a capo in modo disordinato dentro un pannello stretto */
.seg.even { flex-wrap: nowrap; }
.seg.even button { flex: 1; padding-left: 4px; padding-right: 4px; text-align: center; }

/* interruttore */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s var(--spring); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(16px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* campioni colore */
.sw { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); flex: none; display: inline-block; }
.sw.big { width: 44px; height: 44px; border-radius: 13px; cursor: pointer; padding: 0; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .15); transition: transform .2s var(--spring); }
.sw.big:hover { transform: scale(1.05); }

/* ---------------------------------------------------------------- notifiche, attesa, modali */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; }
.toast { background: #1d1d1f; color: #fff; padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); max-width: min(560px, 90vw); font-weight: 500; transition: opacity .3s, transform .3s; animation: rise .25s var(--ease); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.busy { position: fixed; inset: 0; background: rgba(255, 255, 255, .72); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 90; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.busy-card { background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-radius: var(--r-xl); padding: 28px 40px; text-align: center; box-shadow: var(--shadow-lg); min-width: 300px; border: 1px solid var(--glass-border); }
.busy-text { font-weight: 700; font-size: 16px; margin-top: 16px; }
.busy-steps { color: var(--muted); font-size: 13px; margin-top: 4px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; margin: 0; }
.spinner.inline { display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .32); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 80; padding: 16px; animation: fade .15s; }
.modal { background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: var(--r-xl); width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .22s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px 24px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 8px 24px 20px; overflow: auto; }
.modal-body p { margin: 0 0 8px; color: var(--ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.fatal { max-width: 480px; margin: 15vh auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty-state { display: grid; justify-items: center; gap: 6px; color: var(--muted); padding: 40px 24px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--bg-2); }
.empty-state b { color: var(--ink); font-size: 15px; }
.empty-state .ico { color: var(--accent); margin-bottom: 4px; }

/* ---------------------------------------------------------------- marchio */
.brand-logo { height: 26px; width: auto; display: block; }

/* ---------------------------------------------------------------- home */
.home { height: 100%; overflow: auto; position: relative; background: transparent; }
.home-nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  margin: clamp(10px, 1.6vw, 18px) clamp(14px, 3vw, 32px) 0; padding: 10px 14px; border-radius: 999px;
  background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-glass);
}
.acct { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent-grad); color: #fff; font-weight: 700; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line-2); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 260px; background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; display: grid; animation: pop .18s var(--spring); }
.acct-head { display: grid; gap: 2px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head span { font-size: 12px; color: var(--muted); }
.acct-row { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 13px; color: var(--accent-2); font-weight: 600; }
.acct-menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 13.5px; }
.acct-menu button:hover { background: var(--hover); }
.home-main { max-width: 1160px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; display: grid; gap: 24px; position: relative; z-index: 1; }
.home-head { display: grid; grid-template-columns: 1.3fr 1fr; align-items: stretch; gap: 20px; }
.home-head h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -.03em; font-weight: 700; font-family: var(--font-display); color: var(--ink); animation: rise .5s var(--ease); }
.home-intro { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.stat-panel {
  display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 20px 22px;
  border-radius: var(--r-xl); background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-glass); animation: rise .5s var(--ease) .1s backwards;
}
.stat-row { display: flex; align-items: center; gap: 12px; }
.stat-row + .stat-row { padding-top: 12px; border-top: 1px solid var(--line); }
a.stat-row { color: inherit; text-decoration: none; margin: -4px; padding: 4px; border-radius: var(--r-sm); transition: background .15s; }
a.stat-row:hover { background: var(--hover); }
.stat-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); }
.stat-num { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead { color: var(--ink-2); font-size: 16px; max-width: 620px; margin: 10px 0 0; animation: rise .5s var(--ease) .05s backwards; }
.head-actions { display: flex; gap: 10px; }
.dropzone {
  display: flex; align-items: center; gap: 18px; padding: 24px 26px; cursor: pointer;
  border: 1px solid var(--glass-border); border-radius: var(--r-xl);
  background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-glass); transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease);
}
.dropzone:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.drop-ico { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: var(--r); background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(20, 16, 10, .3); }
.drop-txt { flex: 1; min-width: 0; }
.drop-title { font-size: 17px; font-weight: 700; }
.drop-sub { color: var(--muted); margin-top: 2px; }
.drop-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(12, 47, 43, .08); backdrop-filter: blur(3px); padding: 24px; pointer-events: none; animation: fade .15s; }
.drop-overlay > div { display: grid; justify-items: center; gap: 12px; padding: 48px 64px; border-radius: var(--r-xl); border: 2px dashed var(--accent); background: #fff; color: var(--accent-2); box-shadow: var(--shadow-lg); font-size: 17px; }
.drop-overlay b { color: var(--ink); }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-head h2 { font-size: 18px; }
.steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.steps span { color: var(--muted); font-size: 13px; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 16px; }
.recent-grid > .empty-state, .recent-grid > .error { grid-column: 1 / -1; }
.proj-card { position: relative; background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s; }
.proj-card:hover { box-shadow: var(--shadow-glass); transform: translateY(-3px); border-color: var(--accent-line); }
.proj-card.skeleton { height: 230px; background: linear-gradient(90deg, #f0f0f2 0%, #f8f8fa 50%, #f0f0f2 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-color: var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }
.proj-open { display: block; border: 0; background: none; padding: 0; text-align: left; width: 100%; }
.proj-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; }
.proj-thumb img { max-width: 84%; max-height: 84%; object-fit: contain; transition: transform .3s var(--ease); }
.proj-card:hover .proj-thumb img { transform: scale(1.04); }
.stage-badge { position: absolute; left: 10px; bottom: 10px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.stage-badge.ready { color: #0f7a4d; }
.proj-info { padding: 12px 14px 14px; display: grid; gap: 2px; }
.proj-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-info span { color: var(--muted); font-size: 12px; }
.proj-del { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow-sm); opacity: 0; transition: opacity .15s; }
.proj-del:hover { color: var(--danger) !important; }
.proj-card:hover .proj-del, .proj-del:focus-visible { opacity: 1; }

/* ---------------------------------------------------------------- barra superiore */
.workspace { height: 100%; display: flex; flex-direction: column; overflow: hidden; background: transparent; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; height: 64px; padding: 0 16px; flex: none; background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: 0 1px 0 var(--glass-border), var(--shadow-sm); position: relative; z-index: 15; }
.tb-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tb-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.tb-sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 6px; }
.name-input { border-color: transparent !important; background: transparent !important; box-shadow: none !important; font-weight: 700; font-size: 15px; width: 200px; padding: 6px 8px !important; }
.name-input:hover { background: var(--hover) !important; }
.name-input:focus { background: #fff !important; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.meta-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.meta-btn:hover { border-color: var(--line-2); color: var(--ink); }
.stepper-nav { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--hover); border-radius: 999px; }
.step { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 5px 14px 5px 6px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step i { font-style: normal; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--muted); font-size: 11.5px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-2); }
.step.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.step.on i { background: var(--accent-grad); color: #fff; box-shadow: none; }
.step.done { color: var(--ink-2); }
.step.done i { background: var(--ok); color: #fff; box-shadow: none; }
.step.clickable:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }

/* ---------------------------------------------------------------- artwork */
.art-body { flex: 1; display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
.art-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px; gap: 12px; }
.art-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.art-toolbar .btn.sm { height: 36px; }
.art-stage { flex: 1; min-height: 0; display: grid; gap: 12px; }
.art-stage.view-split { grid-template-columns: 1fr 1fr; }
.art-stage.view-orig .pane-thread, .art-stage.view-thread .pane-orig { display: none; }
.art-pane { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.pane-label { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pane-label span { font-weight: 400; color: var(--muted); font-size: 12px; }
.img-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden; user-select: none; }
.img-stage.pick, .img-stage.cropping { cursor: crosshair; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #f0f0f3 25%, transparent 25%), linear-gradient(-45deg, #f0f0f3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f3 75%), linear-gradient(-45deg, transparent 75%, #f0f0f3 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
.art-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.crop-box { position: absolute; border: 2px solid var(--accent); border-radius: 4px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); pointer-events: none; }
.crop-bar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); padding: 8px 8px 8px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); font-size: 13px; white-space: nowrap; }
.ai-bar { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--accent-grad); box-shadow: 0 4px 14px rgba(20, 16, 10, .25); }
.ai-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; border: 0; background: rgba(255, 255, 255, .16); color: #fff; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px; transition: background .15s; }
.ai-btn:hover { background: rgba(255, 255, 255, .28); }
.ai-bar.disabled { filter: grayscale(1); opacity: .5; box-shadow: none; }
.art-panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-left: 1px solid var(--glass-border); }
.panel-scroll { flex: 1; overflow: auto; padding: 4px 20px 20px; }
.step-sec { display: grid; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.step-sec:last-child { border-bottom: 0; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); font-size: 12px; font-weight: 700; }
.step-head h3 { font-size: 15px; }
.step-sec > select { width: 100%; }
.panel-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--bg-2); }
.palette { display: grid; gap: 6px; }
.pal-count { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pal-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; transition: border-color .15s, background .15s; }
.pal-row:hover { border-color: var(--line-2); }
.pal-row.is-bg { background: var(--bg-2); border-style: dashed; }
.pal-row.is-bg .sw { opacity: .4; }
.pal-txt { flex: 1; min-width: 0; display: grid; }
.pal-txt b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pal-txt span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inner-toggle { font-size: 12.5px; color: var(--ink-2); }
.size-row { display: flex; align-items: flex-end; gap: 8px; }
.size-row label { flex: 1; display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ink-2); position: relative; }
.size-row input { width: 100%; padding-right: 38px; }
.size-row .unit { position: absolute; right: 11px; bottom: 9px; font-size: 12px; color: var(--muted); }
.size-row .times { padding-bottom: 9px; color: var(--muted); }
.art-panel .step-sec select { width: 100%; }

/* ---------------------------------------------------------------- editor */
.ed-body { flex: 1; display: grid; grid-template-columns: 280px 1fr 300px; min-height: 0; }
.ed-layers, .ed-props { background: var(--panel-2); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); overflow: auto; min-width: 0; min-height: 0; }
.ed-layers { border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.ed-props { border-left: 1px solid var(--line); padding: 18px 18px 24px; display: flex; flex-direction: column; gap: 2px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 0 6px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; }
.panel-hint { width: 100%; font-size: 12px; color: var(--muted); }
.panel-group { display: grid; gap: 12px; padding: 14px 6px 0; border-top: 1px solid var(--line); min-width: 0; }
.panel-group h4, .psec h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ed-canvas { container-type: size; position: relative; min-width: 0; min-height: 0; background-color: var(--canvas); background-image: radial-gradient(rgba(0, 0, 0, .07) 1px, transparent 1px); background-size: 18px 18px; overflow: hidden; }
.stitch-canvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.stitch-canvas.grabbing { cursor: grabbing; }
.stitch-canvas[data-tool=erase], .stitch-canvas[data-tool=draw] { cursor: none; }
.stitch-canvas[data-tool=fill], .stitch-canvas[data-tool=split] { cursor: crosshair; }
.stitch-canvas.grab { cursor: grab; }
.computing { position: absolute; top: 64px; right: 14px; display: flex; align-items: center; gap: 8px; background: var(--panel-strong); backdrop-filter: var(--glass-blur); padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow); font-size: 12.5px; font-weight: 600; z-index: 3; border: 1px solid var(--glass-border); }

/* barra comandi flottante: strumenti, vista, tessuto e colori dei layer */
.ed-dock { flex: none; margin: 12px 14px 0; padding: 8px 10px; border-radius: var(--r-xl); background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); box-shadow: var(--shadow-glass); }
.dock-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; overflow-x: auto; }
.dock-push { margin-left: auto; }
.toolbar { display: flex; gap: 2px; background: var(--hover); border-radius: 12px; padding: 3px; }
.tool { display: flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 9px; padding: 7px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; }
.tool:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.tool.on { background: var(--accent-grad); color: #fff; box-shadow: 0 2px 8px rgba(20, 16, 10, .3); }
.layer-chips { display: flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 2px; margin: -3px -2px; overflow-x: auto; overflow-y: hidden; }
.chips-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.chip { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #fff; background: var(--c, #eee); padding: 0; flex: none; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); transition: transform .15s var(--spring); }
.chip:hover { transform: scale(1.08); }
.chip.all { background: var(--hover); color: var(--ink-2); border-color: var(--hover); }
.chip.sel { box-shadow: 0 0 0 2px var(--ink); }
.chip.on { box-shadow: 0 0 0 2px var(--accent); }
.chip.hidden-l { opacity: .3; }
.tool-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 2px 2px; font-size: 12.5px; animation: rise .15s var(--ease); }
.opt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opt-row.end { justify-content: flex-end; }
.opt-row input[type=range] { width: 180px; }
.target { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 2px 8px 2px 4px; border-radius: 999px; background: var(--hover); flex: none; }
.target i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.fabric { display: inline-flex; gap: 5px; }
.fab-sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; padding: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); transition: transform .12s; }
.fab-sw:hover { transform: scale(1.12); }
.fab-sw.on { box-shadow: 0 0 0 2px var(--accent); }
.meta-btn.warn { border-color: rgba(178, 107, 0, .3); color: var(--warn); background: var(--warn-soft); }
.meta-btn.ok { border-color: rgba(31, 157, 85, .3); color: var(--ok); background: var(--ok-soft); }

/* elementi flottanti sulla tela: solo zoom, simulazione e statistiche */
.zoom, .sim, .stats-chip { background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.float-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 2; }
.float-bottom > * { pointer-events: auto; }
.zoom { display: flex; align-items: center; gap: 2px; border-radius: 999px; padding: 3px; }
.zoom-label { min-width: 48px; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sim { display: flex; align-items: center; gap: 10px; border-radius: 999px; padding: 4px 6px 4px 4px; flex: 1 1 260px; max-width: 540px; }
.sim > .icon-btn { background: var(--accent-grad); color: #fff; border-radius: 999px; }
.sim > .icon-btn:hover:not(:disabled) { filter: brightness(1.06); color: #fff; }
.sim input[type=range] { flex: 1; min-width: 80px; }
.sim-label { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.sim select { height: 30px; padding: 0 26px 0 8px; font-size: 12px; background-position: right 8px center; border-radius: 999px; }
.stats-chip { display: flex; gap: 14px; padding: 9px 16px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.stats-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
@container (max-width: 980px) { .stats-chip { display: none; } }
@container (max-width: 560px) { .sim select { display: none; } }
@media (max-width: 860px) { .tool span { display: none; } .tool { padding: 7px; } }

/* pannello proprietà */
.props-head { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; }
.props-title { display: grid; min-width: 0; flex: 1; }
.layer-name { border-color: transparent !important; box-shadow: none !important; font-weight: 700; font-size: 16px; padding: 3px 6px !important; margin-left: -6px; }
.layer-name:hover { background: var(--hover); }
.layer-name:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.kinds { font-size: 12px; font-weight: 600; color: var(--accent-2); background: var(--accent-soft); border-radius: 999px; padding: 4px 12px; align-self: flex-start; }
.psec { display: grid; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.psec > .seg { margin-top: 2px; }
.desc { margin: 0; font-size: 12.5px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; }
.param { display: grid; gap: 6px; }
.param-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.param-head label { font-size: 13px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.param.custom .param-head label::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.info { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--hover); color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; }
.info:hover, .info:focus-visible { background: var(--accent-soft); color: var(--accent-2); outline: none; }
.info[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 220px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--ink); color: #fff;
  font-size: 11.5px; font-weight: 500; line-height: 1.4; text-align: left; white-space: normal;
  box-shadow: var(--shadow-lg); pointer-events: none; z-index: 30; opacity: 0; visibility: hidden;
  transition: opacity .12s var(--ease), transform .12s var(--ease), visibility .12s;
}
.info[data-tip]:hover::after, .info[data-tip]:focus-visible::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.num { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.num input { border: 0 !important; box-shadow: none !important; width: 58px; padding: 4px 6px !important; text-align: right; font-variant-numeric: tabular-nums; }
.num .unit { font-size: 11.5px; color: var(--muted); padding: 0 8px; background: var(--bg-2); align-self: stretch; display: grid; place-items: center; }
.param input[type=range] { width: 100%; }
.ed-props > .btn { margin-top: 16px; }

/* elenco livelli */
.lrows { display: grid; gap: 4px; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 8px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.lrow:hover { background: #fff; }
.lrow.sel { background: var(--accent-soft); border-color: var(--accent-line); }
.lrow.off { opacity: .45; }
.lrow.dragging { opacity: .3; }
.lrow.dropto { border-color: var(--accent); border-style: dashed; }
.lnum { width: 16px; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.lrow .sw { width: 28px; height: 28px; border-radius: 9px; }
.ltxt { flex: 1; min-width: 0; display: grid; }
.ltxt b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltxt span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbtns { display: none; }
.lrow:hover .lbtns, .lrow.sel .lbtns, .lbtns:focus-within { display: flex; }
.menu { position: fixed; z-index: 70; background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; display: grid; animation: pop .18s var(--spring); }
.menu button { display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.menu button:hover:not(:disabled) { background: var(--hover); }
.menu .danger { color: var(--danger); }
.menu-sub { display: grid; padding: 4px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.menu-sub > span { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.menu-sub button { padding-left: 32px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* controllo qualità */
.quality { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.quality li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r); font-size: 12.5px; background: #fff; border: 1px solid var(--line); }
.quality li > div { display: grid; gap: 2px; min-width: 0; }
.quality span:not(.q-ico) { color: var(--ink-2); }
.q-ico { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800; color: #fff; background: var(--muted); }
.q-warn { background: var(--warn-soft) !important; border-color: rgba(178, 107, 0, .2) !important; }
.q-warn .q-ico { background: var(--warn); }
.q-info .q-ico { background: #2563eb; }
.q-ok { background: var(--ok-soft) !important; border-color: rgba(31, 157, 85, .2) !important; }
.q-ok .q-ico { background: var(--ok); }
.q-tip { background: var(--accent-soft) !important; border-color: var(--accent-line) !important; }
.q-tip .q-ico { background: var(--accent); }
.q-title { font-size: 12.5px; font-weight: 700; text-align: left; color: var(--ink); }
.q-title.link { border: 0; background: none; padding: 0; text-decoration: underline dotted; cursor: pointer; }
.exp-quality { grid-column: 1 / -1; }

/* "cerchia" un controllo per un istante, come un assistente che indica dove intervenire */
.spotlight-ring {
  position: fixed; z-index: 95; pointer-events: none; border-radius: var(--r-lg);
  border: 2px solid var(--gold);
  animation: spotlight-pulse 1.3s var(--ease) 2, spotlight-out .5s ease-in 2.1s forwards;
}
@keyframes spotlight-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 216, 93, .35), 0 0 22px 6px rgba(255, 216, 93, .45); }
  50% { box-shadow: 0 0 0 8px rgba(255, 216, 93, .15), 0 0 34px 12px rgba(255, 216, 93, .65); }
}
@keyframes spotlight-out { to { opacity: 0; } }

/* scelta colore filo */
.color-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.custom-color { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.custom-color input { width: 40px; height: 32px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 2px; background: #fff; }
.modal input[type=search] { width: 100%; margin-bottom: 12px; }
.thread-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; }
.thread { display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto; column-gap: 9px; align-items: center; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 7px 9px; transition: border-color .15s, background .15s; }
.thread:hover { border-color: var(--accent); background: var(--accent-soft); }
.thread .sw { grid-row: span 2; width: 24px; height: 24px; }
.tname { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcode { font-size: 11px; color: var(--muted); }
.hoops { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }

/* ---------------------------------------------------------------- export */
.export { display: grid; gap: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { display: inline-flex; gap: 7px; align-items: center; border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent-2); border-bottom-color: var(--accent); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--muted); }
.stepper span { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.stepper i { font-style: normal; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--hover); font-size: 12px; font-weight: 700; }
.stepper .on { color: var(--ink); }
.stepper .on i { background: var(--accent-grad); color: #fff; }
.stepper .done { color: var(--ok); }
.stepper .done i { background: var(--ok); color: #fff; }
.stepper .line { width: 48px; height: 2px; background: var(--line); border-radius: 2px; }
.form-step { display: grid; gap: 12px; max-width: 520px; margin: 0 auto; width: 100%; }
.form-step h3 { font-size: 18px; }
.form-step p { margin: 0; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; flex-wrap: wrap; }
.card-row select { max-width: 280px; }
.card-col { display: grid; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.out-size { display: flex; justify-content: space-between; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; }
.exp-bar { display: flex; align-items: center; gap: 8px; }
.fmt-badge { font-weight: 800; font-size: 12px; background: var(--ink); color: #fff; border-radius: 7px; padding: 4px 9px; letter-spacing: .03em; }
.exp-canvas { position: relative; height: min(42vh, 380px); border-radius: var(--r-lg); overflow: hidden; background: var(--canvas); }
.exp-canvas canvas { position: absolute; inset: 0; }
.exp-info { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; }
.exp-info > .muted, .exp-info > .error { grid-column: 1 / -1; padding: 12px; }
.run-time { display: grid; background: var(--accent-grad); border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--r-lg); padding: 14px; box-shadow: 0 8px 22px rgba(20, 16, 10, .25); }
.run-time span { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .85); letter-spacing: .05em; }
.run-time b { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: #fff; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 20px; }
.kv > div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.seq { grid-column: 1 / -1; font-size: 13px; }
.seq summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.seq ol { padding-left: 20px; display: grid; gap: 6px; }
.seq li .sw { width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; }
.exp-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.fname-wrap { flex: 1; display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; min-width: 160px; height: 38px; background: #fff; }
.fname-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fname-wrap input { border: 0 !important; box-shadow: none !important; flex: 1; border-radius: 0 !important; height: 100%; }
.fname-wrap span { padding: 0 12px; color: var(--muted); background: var(--bg-2); align-self: stretch; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.svg-prev { height: min(46vh, 400px); display: grid; place-items: center; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--bg-2); }
.svg-prev img { max-width: 90%; max-height: 90%; }
.preview-step { display: grid; gap: 14px; }
.preview-step .exp-foot { position: sticky; bottom: -20px; z-index: 2; background: var(--panel-strong); backdrop-filter: var(--glass-blur); margin: 0 -24px -20px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- accesso e abbonamento */
.auth-page { height: 100%; position: relative; overflow: auto; display: grid; place-items: center; padding: 32px 16px; background: transparent; }
.auth-card { position: relative; z-index: 1; width: min(420px, 100%); background: var(--panel-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 32px; display: grid; gap: 16px; animation: pop .25s var(--spring); }
.auth-card.wide { width: min(540px, 100%); }
.auth-card.center { text-align: center; justify-items: center; }
.auth-card h1 { font-size: 26px; letter-spacing: -.025em; color: var(--ink); }
.auth-card p { margin: 0; }
.auth-card > .brand-logo { height: 30px; margin-bottom: 6px; }
.auth-top { display: flex; align-items: center; gap: 12px; }
.auth-top .brand-logo { margin-right: auto; }
.auth-form { display: grid; gap: 10px; }
.auth-form input { width: 100%; height: 44px; padding: 0 14px; font-size: 15px; border-radius: var(--r); }
.google-btn { gap: 10px; }
.g-logo { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 800; font-size: 13px; color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; }
.form-error:empty { display: none; }
.auth-switch { font-size: 13.5px; color: var(--ink-2); text-align: center; }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.features li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.features .ico { color: var(--ok); margin-top: 2px; }
.onetime-price { display: flex; align-items: baseline; gap: 10px; justify-content: center; padding: 16px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); }
.onetime-price b { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.onetime-price span { color: var(--muted); font-size: 13px; }
.plans { display: grid; gap: 10px; }
.plan { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "r n p" "r b p"; align-items: center; column-gap: 14px; text-align: left; border: 1.5px solid var(--line-2); background: #fff; border-radius: var(--r-lg); padding: 14px 16px; transition: border-color .15s, background .15s, box-shadow .15s; }
.plan:hover { border-color: var(--accent-line); }
.plan.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(20, 16, 10, .1); }
.plan .radio { grid-area: r; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); transition: border .15s; }
.plan.on .radio { border: 6px solid var(--accent); }
.plan b { grid-area: n; font-size: 15px; }
.plan .badge { grid-area: b; justify-self: start; font-size: 11px; font-weight: 700; color: #0f7a4d; background: var(--ok-soft); border-radius: 999px; padding: 2px 9px; margin-top: 2px; }
.plan .price { grid-area: p; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- schermi stretti */
@media (max-width: 1240px) {
  .ed-body { grid-template-columns: 250px 1fr 280px; }
  .art-body { grid-template-columns: 1fr 330px; }
  .stepper-nav .step > span { display: none; }
  .step { padding: 5px; }
}
@media (max-width: 960px) {
  .home-head { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr auto; height: auto; min-height: 56px; padding: 8px 10px; }
  .stepper-nav { display: none; }
  .name-input { width: 130px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr; }
  .art-body { display: flex; flex-direction: column; overflow: auto; }
  .art-main { flex: none; height: 62vh; }
  .art-stage.view-split { grid-template-columns: 1fr; }
  .art-stage.view-split .pane-thread { display: none; }
  .art-panel { flex: none; border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { overflow: visible; }
  .ed-body { display: flex; flex-direction: column; overflow: auto; }
  .ed-canvas { order: -1; flex: none; height: 64vh; }
  .ed-layers, .ed-props { flex: none; min-height: auto; border: 0; border-top: 1px solid var(--line); overflow: visible; }
  .exp-info { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .dropzone { flex-wrap: wrap; }
  .dropzone .btn { width: 100%; }
  .tb-right .icon-btn { display: none; }
  .tb-sep { display: none; }
}
