/* ════════════════════════════════════════════════════════════════════
   RESELLA UI — livello componenti condivisi (caricato per ultimo)
   Consuma solo i token di tokens.css: nessun colore hard-coded qui,
   così light e dark restano allineati senza override dedicati.
   Indice: 1 Base · 2 Shell · 3 Home · 4 Card prodotto · 5 Stati
           6 Bottoni e fogli · 7 Profilo e account · 8 Piani e crediti
           9 Scheda prodotto · 10 Assistenza
   ════════════════════════════════════════════════════════════════════ */

/* ── 1. BASE ─────────────────────────────────────────────────────── */
#rs {
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:where(button, a, [role="button"], input, select, textarea):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 2. SHELL: barra superiore e navigazione ─────────────────────── */
@media (max-width: 1023px) {
  #rs #app-top-header {
    height: calc(52px + var(--safe-t));
    padding: calc(6px + var(--safe-t)) var(--space-4) 6px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid transparent;
  }

  #rs #app-top-header .app-top-actions { gap: var(--space-2); }

  #rs #credits-floating-pill {
    min-height: 34px;
    padding: 0 12px 0 9px;
    gap: 6px;
    border: 1px solid var(--primary-mid);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0;
    transition: transform var(--motion-dur-fast) var(--motion-ease-touch);
  }
  #rs #credits-floating-pill:active { transform: scale(.96); }
  #rs #credits-floating-pill.is-low {
    border-color: var(--credit-extra);
    background: var(--credit-extra-soft);
    color: var(--credit-extra);
  }

  #rs .app-top-icon,
  #rs .app-top-avatar {
    width: 36px;
    height: 36px;
    color: var(--text-2);
  }
  #rs .app-top-icon svg { width: 22px; height: 22px; }
  #rs .app-top-avatar {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: var(--text-xs);
    font-weight: 800;
  }

  #rs #bottom-bar-main {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(18px);
    backdrop-filter: saturate(1.4) blur(18px);
    box-shadow: var(--shadow-lg);
  }
  #rs .nav-tab { color: var(--hint); }
  #rs .nav-tab .nav-tab-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0;
  }
  #rs .nav-tab.active { color: var(--primary); }
  #rs .nav-tab.active .nav-tab-label { font-weight: 800; }
  #rs .nav-tab:active .nav-tab-icon-wrap { transform: scale(.9); }
  #rs .nav-tab .nav-tab-icon-wrap { transition: transform var(--motion-dur-fast) var(--motion-ease-touch); }
}

/* ── 3. HOME ─────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* Promo compatta: una riga, non ruba spazio ai prodotti */
  #rs .queue-promo-banner {
    margin: var(--space-2) var(--space-4) var(--space-3);
    padding: var(--space-3);
    gap: var(--space-3);
    flex-direction: row;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
  }
  #rs .queue-promo-banner .qpb-main { flex: 1; min-width: 0; align-items: center; gap: var(--space-3); }
  #rs .queue-promo-banner .qpb-icon-wrap { display: none; }
  #rs .queue-promo-banner .qpb-tag,
  #rs .queue-promo-banner .qpb-desc { display: none; }
  #rs .queue-promo-banner .qpb-title {
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
  }
  #rs .queue-promo-banner .qpb-actions {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    gap: var(--space-1);
    align-items: center;
  }
  #rs .queue-promo-banner .qpb-pill-note { display: none; }
  #rs .queue-promo-banner .qpb-cta {
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: none;
    font-size: var(--text-xs);
    font-weight: 800;
  }
  #rs .queue-promo-banner .qpb-close {
    position: static;
    width: 32px;
    height: 32px;
    color: var(--hint);
  }

  #rs .sticky-zone {
    padding: var(--space-1) 0 var(--space-2);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
  }
  #rs .search-wrap { padding: 0 var(--space-4); }
  #rs .search-wrap .search-input {
    height: var(--tap-min);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--text-md);
    box-shadow: none;
  }
  #rs .search-wrap .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
  }

  #rs .tab-area .tabs-scroll { padding: 0 var(--space-4); gap: 6px; }
  #rs .tab-pill .tab-icon { display: none; }
  #rs .tab-pill,
  #rs :is(#screen-queue, #screen-generated, #screen-published) .tab-pill {
    border-radius: var(--radius-pill) !important;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--text-sm);
    font-weight: 600;
  }
  #rs .tab-pill.active,
  #rs :is(#screen-queue, #screen-generated, #screen-published) .tab-pill.active {
    border-color: var(--ink) !important;
    background: var(--ink) !important;
    color: var(--on-ink) !important;
    box-shadow: none;
  }
  #rs .tab-pill.active .tab-badge {
    background: color-mix(in srgb, var(--on-ink) 18%, transparent);
    color: var(--on-ink);
  }

  #rs .product-toolbar { padding: var(--space-2) var(--space-4); }
  #rs .product-toolbar .product-count {
    color: var(--hint);
    font-size: var(--text-sm);
    font-weight: 600;
  }
  #rs .cards-wrap { padding: 0 var(--space-4); }
}

/* ── 4. CARD PRODOTTO: struttura classica di produzione, rifinita con i token attuali ─────────────────── */
#rs .product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform var(--motion-dur-fast) var(--motion-ease-touch),
              box-shadow var(--motion-dur-normal) var(--motion-ease-standard);
}
#rs .product-card .card-inner { border-radius: calc(var(--radius-lg) - 1px); }
#rs .product-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

@media (max-width: 1023px) {
  #rs .product-card { margin-bottom: var(--space-3); }
  #rs .product-card .card-main {
    display: flex;
    align-items: flex-start;
    padding: var(--space-3);
    gap: var(--space-3);
  }
  #rs .product-card .card-thumb {
    flex: 0 0 84px;
    width: 84px;
    height: 108px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    overflow: hidden;
  }
  #rs .product-card .card-thumb img { width: 100%; height: 100%; object-fit: cover; }
  #rs .product-card .card-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
  }
  #rs .product-card .card-title {
    font-size: var(--text-md);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: var(--tracking-tight);
    color: var(--text);
  }
  #rs .product-card .card-sub {
    margin-top: var(--space-1);
    color: var(--hint);
    font-size: var(--text-sm);
    line-height: 1.35;
  }
  #rs .product-card .card-price {
    margin-top: var(--space-1);
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    color: var(--text);
  }
  #rs .product-card .card-copy-btn,
  #rs .product-card .card-3dot {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    color: var(--hint);
  }
  #rs .product-card .card-secondary-actions { margin: -4px -4px 0 0; gap: 2px; }
  #rs .product-card .card-action-row {
    padding: 0 var(--space-3) var(--space-3);
    gap: var(--space-2);
    border-top: 0;
  }
}

#rs .card-action-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  transition: transform var(--motion-dur-fast) var(--motion-ease-touch),
              background-color var(--motion-dur-fast) var(--motion-ease-standard);
}
#rs .card-action-btn:active:not(:disabled) { transform: scale(.98); }

/* Azione che crea valore: piena. Azioni di ritocco: tenui. */
#rs .card-action-btn.action-generate,
#rs :is(#cards-container, #cards-container-generated, #cards-container-published) .card-action-btn.action-generate {
  /* Stessa forma di "Completa prodotto", in viola pieno: niente gradiente né ombra. */
  border: 1px solid var(--primary) !important;
  background: var(--primary) !important;
  background-image: none !important;
  color: var(--on-primary) !important;
  box-shadow: none !important;
}
#rs .card-action-btn.action-generate .action-arrow { display: inline-flex; }
#rs .card-action-btn.action-generate svg { color: currentColor; }

#rs .card-action-btn.action-complete {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  box-shadow: none;
}
#rs .card-action-btn.action-complete .card-action-icon { color: var(--orange); }

#rs .card-action-btn.action-regenerate,
#rs .card-action-btn.action-regenerate.is-primary {
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}
/* Da solo a tutta larghezza: stessa struttura di "Genera" (icona e testo a sinistra, freccia a destra). */
#rs .card-action-btn.action-regenerate.is-primary { justify-content: flex-start; }
#rs .card-action-btn.action-regenerate .regenerate-cost {
  color: var(--hint);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ── 5. STATI: vuoti, caricamento ────────────────────────────────── */
#rs .empty-state {
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
#rs .empty-state .es-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
#rs .empty-state > * { margin-inline: auto; }
#rs .empty-state .es-sub {
  max-width: 30ch;
  margin-top: var(--space-2);
  color: var(--hint);
  font-size: var(--text-md);
  line-height: 1.45;
}
#rs .empty-state .queue-empty-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin-bottom: var(--space-5);
  margin-top: 0;
  border-radius: var(--radius-xl);
  background: var(--primary-soft);
  color: var(--primary);
}
#rs .empty-steps {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  counter-reset: empty-step;
}
#rs .empty-steps li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.35;
  counter-increment: empty-step;
}
#rs .empty-steps li::before {
  content: counter(empty-step);
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--text-xs);
  font-weight: 800;
}
#rs .empty-state .queue-empty-add,
#rs .empty-state .empty-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  min-height: 52px;
  margin-top: var(--space-5);
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius);
  background: var(--gradient-cta);
  color: var(--on-primary);
  box-shadow: var(--shadow-cta);
  font: 800 var(--text-md)/1 var(--font-family);
  cursor: pointer;
}
#rs .empty-state .empty-note {
  margin-top: var(--space-3);
  color: var(--hint);
  font-size: var(--text-xs);
}

#rs .skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
#rs .skeleton {
  background: linear-gradient(100deg, var(--surface2) 30%, var(--surface3) 50%, var(--surface2) 70%);
  background-size: 200% 100%;
}

/* ── 6. BOTTONI E FOGLI ──────────────────────────────────────────── */
#rs .bottom-sheet,
#rs dialog.resella-modal--sheet {
  background: var(--surface);
  color: var(--text);
}
#rs .sheet-title {
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs .sheet-close-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface2);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 700;
}

/* Paywall crediti: una proposta chiara, una via alternativa, nessuna pressione */
#rs .credits-paywall-dialog .credits-ended-badge {
  border: 0;
  background: var(--credit-extra-soft);
  color: var(--credit-extra);
  font-size: var(--text-xs);
  font-weight: 800;
}
#rs .credits-paywall-dialog h2 {
  color: var(--text);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.15;
}
#rs .credits-paywall-dialog .credits-paywall-copy {
  color: var(--text-2);
  font-size: var(--text-md);
  line-height: 1.45;
}
#rs .credits-paywall-dialog .paywall-plan-teaser {
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  box-shadow: none;
}
#rs .credits-paywall-dialog .paywall-plan-credits {
  background: var(--credit-plan-soft);
  color: var(--primary);
  font-weight: 800;
}
#rs .credits-paywall-dialog .credits-paywall-primary {
  min-height: 54px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gradient-cta);
  color: var(--on-primary);
  box-shadow: var(--shadow-cta);
  font-size: var(--text-md);
  font-weight: 800;
}
#rs .credits-paywall-topup {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font: 500 var(--text-sm)/1.35 var(--font-family);
  text-align: center;
  cursor: pointer;
}
#rs .credits-paywall-topup strong { color: var(--credit-extra); font-weight: 800; }
#rs .credits-paywall-dialog .credits-paywall-secondary {
  min-height: var(--tap-min);
  color: var(--hint);
  font-size: var(--text-sm);
  font-weight: 700;
}

/* ── 7. PROFILO E ACCOUNT ────────────────────────────────────────── */
#rs .profile-card,
#rs .account-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

@media (max-width: 1023px) {
  #rs .profile-redesign-shell {
    display: flex;
    flex-direction: column;
  }
  /* Il tutorial è un aiuto, non la prima cosa da vedere */
  #rs .profile-tutorial-row {
    order: 99;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-5) var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: transparent;
    color: var(--hint);
    font-size: var(--text-sm);
    line-height: 1.35;
  }
  #rs .profile-tutorial-replay {
    flex: 0 0 auto;
    min-height: 36px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--surface2);
    color: var(--text);
    font-size: var(--text-xs);
    font-weight: 700;
  }

  #rs .profile-avatar {
    width: 52px;
    height: 52px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: var(--text-lg);
    font-weight: 800;
  }
  #rs .profile-user-name {
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
  }
  #rs .profile-user-handle { color: var(--hint); font-size: var(--text-sm); }
  #rs .profile-user-manage {
    color: var(--text-2);
    font-size: var(--text-sm);
    font-weight: 700;
  }

  /* Piano e crediti: il numero che conta, poi l'azione */
  #rs #profile-plan-row .profile-plan-tile {
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    box-shadow: none;
  }
  #rs #profile-plan-row .profile-plan-tile.is-credits { background: var(--credit-plan-soft); }
  #rs #profile-plan-row .profile-plan-tile-heading {
    color: var(--hint);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  #rs .profile-plan-tile-heading svg { display: none; }
  #rs .profile-plan-tile strong {
    color: var(--text);
    font-size: var(--text-xl);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
  }
  #rs .profile-plan-tile.is-credits strong { color: var(--primary); font-variant-numeric: tabular-nums; }
  #rs .profile-plan-active-label,
  #rs .profile-plan-credit-value span { color: var(--hint); font-size: var(--text-xs); font-weight: 600; }
  #rs #profile-plan-row .profile-plan-cta {
    justify-content: center;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: none;
  }
  #rs .profile-plan-cta .profile-setting-copy { flex: 0 1 auto; }
  #rs #profile-plan-row .profile-plan-cta .profile-setting-title { color: inherit; font-size: var(--text-sm); font-weight: 800; }
  #rs #profile-plan-row .profile-plan-cta .profile-plan-cta-plus,
  #rs #profile-plan-row .profile-plan-cta .profile-setting-arrow { color: inherit; background: transparent; }

  /* Impostazioni: righe da app nativa */
  #rs .profile-setting-item:not(.profile-plan-cta) {
    min-height: 64px;
    border-radius: var(--radius);
    box-shadow: none;
  }
  #rs .profile-setting-icon {
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text-2);
  }
  #rs .profile-setting-title { color: var(--text); font-size: var(--text-md); font-weight: 700; }
  #rs .profile-setting-sub { color: var(--hint); font-size: var(--text-sm); }
  #rs .profile-setting-arrow { color: var(--hint); }
}

/* ── 9. SCHEDA PRODOTTO ──────────────────────────────────────────── */
#rs #screen-details .product-back-btn,
#rs .product-back-btn {
  min-height: var(--tap-min);
  color: var(--text-2);
  font-size: var(--text-md);
  font-weight: 700;
}
#rs #screen-details .details-hero {
  gap: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
#rs #screen-details .details-hero-thumb {
  flex: 0 0 96px;
  width: 96px;
  height: 128px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  overflow: hidden;
}
#rs #screen-details .details-hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
#rs #screen-details .details-hero-title {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: var(--tracking-tight);
}
#rs #screen-details .details-missing-summary {
  border: 0;
  border-radius: var(--radius);
  background: var(--orange-soft);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.4;
}
#rs #screen-details .details-missing-summary strong { color: var(--orange); }

/* Campi: obbligatorio = segnale ambra, il rosso resta per gli errori veri */
#rs #screen-details .edit-row { margin-bottom: var(--space-3); }
#rs #screen-details .edit-field-label,
#rs #screen-details .edit-row > .edit-row-label { margin-bottom: 6px; }
#rs #screen-details .edit-row-label,
#rs #screen-details .edit-row.is-missing .edit-row-label {
  color: var(--text-2) !important;
  font-size: var(--text-sm);
  font-weight: 700;
}
#rs #screen-details .edit-missing-hint,
#rs #screen-details .edit-row.is-missing .edit-missing-hint {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface2);
  color: var(--hint);
  font-size: 11px;
  font-weight: 700;
}
#rs #screen-details .edit-row.is-missing .edit-missing-hint {
  background: var(--orange-soft);
  color: var(--orange);
}
#rs #screen-details .edit-row-right,
#rs #screen-details .edit-row.is-missing .edit-row-right,
#rs #screen-details .edit-row.is-empty .edit-row-right {
  min-height: 52px;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
  background: var(--surface) !important;
  box-shadow: none;
  transition: border-color var(--motion-dur-fast) var(--motion-ease-standard);
}
#rs #screen-details .edit-row.is-missing .edit-row-right { border-color: var(--credit-extra) !important; }
#rs #screen-details .edit-row-right:active { background: var(--surface2); }
#rs #screen-details .edit-row-value {
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 600;
}
#rs #screen-details .edit-row-value.is-empty,
#rs #screen-details .edit-row.is-missing .edit-row-value.is-empty {
  color: var(--primary) !important;
  font-weight: 700;
}
#rs #screen-details .details-field-icon,
#rs #screen-details .edit-row-arrow { color: var(--hint); }

#rs .details-save-wrap {
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}
#rs #details-save-top-btn,
#rs .details-save-top-btn {
  min-height: 54px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gradient-cta);
  color: var(--on-primary);
  box-shadow: var(--shadow-cta);
  font-size: var(--text-md);
  font-weight: 800;
}

/* ── Generati: foto grandi, azioni chiare ── */
@media (max-width: 1023px) {
  #rs #cards-container-generated .product-card,
  #rs #cards-container-generated .generated-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }
}

/* ── 11. GENERAZIONE: scelta stile, conferma, avanzamento ────────── */
#rs .generation-choice-dialog { background: var(--surface); color: var(--text); }
#rs .generation-choice-dialog .generation-choice-title {
  color: var(--text);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs .generation-choice-dialog .generation-choice-title svg { color: var(--primary); }
#rs .generation-choice-dialog > p,
#rs .generation-choice-dialog .flatlay-confirm-subtitle {
  color: var(--hint);
  font-size: var(--text-sm);
  line-height: 1.4;
}
#rs .generation-choice-close,
#rs .flatlay-confirm-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text-2);
}
#rs .generation-product-summary { border-bottom: 1px solid var(--border); }
#rs .generation-product-summary h2 {
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs .generation-product-summary p { color: var(--hint); font-size: var(--text-sm); }
#rs .generation-product-price { color: var(--text); font-size: var(--text-md); font-weight: 800; }

#rs .generation-mode-option,
#rs .generation-gender-option {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  transition: border-color var(--motion-dur-fast) var(--motion-ease-standard),
              background-color var(--motion-dur-fast) var(--motion-ease-standard),
              transform var(--motion-dur-fast) var(--motion-ease-touch);
}
#rs .generation-mode-option:hover,
#rs .generation-mode-option:focus-visible,
#rs .generation-mode-option.is-selected,
#rs .generation-gender-option:hover,
#rs .generation-gender-option:focus-visible {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
#rs .generation-mode-option:active,
#rs .generation-gender-option:active { transform: scale(.97); }
#rs .generation-mode-option strong,
#rs .generation-gender-option strong {
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 800;
}
#rs .generation-mode-option > span,
#rs .generation-gender-option > span:not(.generation-gender-icon) {
  color: var(--hint);
  font-size: var(--text-xs);
}
/* Costo in crediti visibile prima della scelta */
#rs .generation-mode-cost {
  margin-top: 2px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--credit-plan-soft);
  color: var(--primary);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
#rs .generation-mode-cost[hidden] { display: none; }
#rs .generation-choice-hint {
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
#rs .generation-choice-hint svg { color: var(--primary); }

#rs .flatlay-confirm-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}
#rs .flatlay-confirm-placeholder,
#rs .flatlay-confirm-message { color: var(--hint); font-size: var(--text-sm); }
#rs .flatlay-confirm-actions button {
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  font-size: var(--text-md);
  font-weight: 700;
}
/* L'azione che fa proseguire è sempre quella piena */
#rs .flatlay-confirm-actions #flatlay-confirm-start,
#rs .flatlay-confirm-actions #flatlay-confirm-create-scene {
  order: -1;
  border: 0;
  background: var(--gradient-cta);
  color: var(--on-primary);
  box-shadow: var(--shadow-cta);
  font-weight: 800;
}
#rs .flatlay-confirm-actions #flatlay-confirm-start:disabled { opacity: .5; box-shadow: none; }
#rs .flatlay-confirm-actions #flatlay-confirm-cancel {
  border-color: transparent;
  background: transparent;
  color: var(--hint);
}

/* Avanzamento sulla card: stato leggibile, non un dettaglio */
#rs .product-card .card-progress { padding: 0 var(--space-3) var(--space-3); }
#rs .product-card .progress-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface3);
  overflow: hidden;
}
#rs .product-card .progress-fill {
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width var(--motion-dur-slow) var(--motion-ease-standard);
}
#rs .product-card .progress-phase {
  margin-top: var(--space-2);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
#rs .product-card[data-busy="1"] .card-thumb img { opacity: .72; }
/* Errore generazione: riga compatta (icona + max 2 righe) che non allunga la card */
#rs .product-card .card-generation-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: var(--space-1);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: normal;
}
#rs .product-card .card-generation-error.is-retrying { color: var(--orange); }
#rs .product-card .card-generation-error-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red-soft);
}
#rs .product-card .card-generation-error.is-retrying .card-generation-error-icon { background: var(--orange-soft); }
#rs .product-card .card-generation-error-icon svg { width: 11px; height: 11px; }
#rs .product-card .card-generation-error-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* Menu aggiunta prodotto */
#rs .add-product-choice { transition: transform var(--motion-dur-fast) var(--motion-ease-spring); }
#rs .add-product-choice:active { transform: scale(.92); }

/* ── 10. ASSISTENZA ──────────────────────────────────────────────── */
#rs .support-title {
  color: var(--text);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
}
#rs .support-tickets-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
#rs .support-chat-row { min-height: 76px; transition: background-color var(--motion-dur-fast) var(--motion-ease-standard); }
#rs .support-chat-row:active { background: var(--surface2); }
#rs .support-chat-title { color: var(--text); font-size: var(--text-md); font-weight: 800; }
#rs .support-chat-snippet { color: var(--hint); font-size: var(--text-sm); }
#rs .support-chat-time.is-online { color: var(--green); font-weight: 700; }
#rs .support-empty-state h3 { color: var(--text); font-size: var(--text-lg); font-weight: 800; }
#rs .support-empty-state p { color: var(--hint); font-size: var(--text-md); line-height: 1.45; }

#rs .support-thread-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
#rs .support-thread-back-sq-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  margin-left: -6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}
#rs .support-thread-back-sq-btn:active { background: var(--surface2); }
#rs .support-thread-subject { color: var(--text); font-weight: 800; letter-spacing: var(--tracking-tight); }
#rs .support-welcome-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}
#rs .support-welcome-card h3 { color: var(--text); }
#rs .support-welcome-card p { color: var(--hint); }
#rs .support-input-bar {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
#rs .support-input-bar:focus-within { border-color: var(--primary); }
#rs .support-attach-btn { width: 40px; height: 40px; color: var(--hint); }
#rs .support-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  transition: transform var(--motion-dur-fast) var(--motion-ease-touch), opacity var(--motion-dur-fast);
}
#rs .support-send-btn:active { transform: scale(.92); }
#rs .support-send-btn:disabled { opacity: .45; }

/* ── 12. SCENA PERSONALE ─────────────────────────────────────────── */
#rs .scene-back-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
#rs .scene-preview-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
#rs .scene-preview-add-button strong {
  color: var(--text);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs .scene-preview-add-button small { color: var(--text-2); font-size: var(--text-sm); }
#rs .scene-preview-add-plus { color: var(--primary); box-shadow: var(--shadow-md); }
#rs .scene-mobile-panel,
#rs .scene-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
#rs .scene-mobile-panel h2,
#rs .scene-card h3 {
  color: var(--text);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs .scene-mobile-panel p,
#rs .scene-card-header p { color: var(--hint); font-size: var(--text-sm); line-height: 1.4; }
#rs .scene-action.primary {
  min-height: 52px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gradient-cta);
  color: var(--on-primary);
  box-shadow: var(--shadow-cta);
  font-size: var(--text-md);
  font-weight: 800;
}
#rs .scene-action.primary:disabled { opacity: .45; box-shadow: none; }
#rs .profile-scene-card .scene-action.primary {
  background: var(--surface2);
  color: var(--text);
  box-shadow: none;
}
#rs .scene-example-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
#rs .scene-plan-note {
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-2);
  font-size: var(--text-xs);
  line-height: 1.45;
}

/* ── 13. NOTIFICHE ───────────────────────────────────────────────── */
#rs #notifications-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
#rs .notifications-panel-head,
#rs .notifications-push-control { border-color: var(--border); }
#rs .notifications-panel-title { color: var(--text); font-size: var(--text-md); font-weight: 800; }
#rs #notifications-mark-read { min-height: 32px; color: var(--primary); font-size: var(--text-xs); }
#rs #notifications-mark-read:disabled { color: var(--hint); }
#rs #push-notifications-toggle {
  min-height: var(--tap-min);
  border: 1px solid var(--primary-mid);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--text-sm);
}
#rs #push-notifications-status { color: var(--hint); font-size: var(--text-xs); }
#rs .notification-item {
  min-height: 60px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}
#rs .notification-item:hover,
#rs .notification-item.is-unread { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
#rs .notification-item-icon {
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
}
#rs .notification-item-icon.is-credit { background: var(--credit-extra-soft); color: var(--credit-extra); }
#rs .notification-item-title { color: var(--text); font-size: var(--text-sm); font-weight: 700; }
#rs .scene-upgrade-link {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  margin-top: var(--space-2);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: 500 var(--text-sm)/1.35 var(--font-family);
  cursor: pointer;
}
#rs .scene-upgrade-link strong { color: var(--primary); font-weight: 800; }
#rs .scene-upgrade-link[hidden] { display: none; }

/* ── 14. HOME: ordine di lettura ─────────────────────────────────────
   Titolo e azioni → ricerca → filtri → prodotti. Le promozioni non
   precedono mai il lavoro; solo gli avvisi utili (crediti, primo passo)
   stanno sopra la lista. */
#rs .home-heading { display: contents; }
#rs .home-title { display: none; }

@media (max-width: 1023px) {
  #rs #screen-queue.active { display: flex; flex-direction: column; }
  #rs #screen-queue.active > * { flex-shrink: 0; }
  #rs #screen-queue > .product-toolbar { order: 1; }
  #rs #screen-queue > .sticky-zone { order: 2; }
  #rs #screen-queue > .tab-area { order: 3; }
  #rs #screen-queue > .sel-bar { order: 4; }
  #rs #screen-queue > .queue-promo-banner { order: 8; }
  #rs #screen-queue > .queue-promo-banner[data-banner-id="low_credits"],
  #rs #screen-queue > .queue-promo-banner[data-banner-id="first_gen"] { order: 5; }
  #rs #screen-queue > .queue-skeleton,
  #rs #screen-queue > .cards-wrap,
  #rs #screen-queue > .empty-state { order: 6; }

  /* Riga titolo: cosa sto guardando a sinistra, strumenti a destra */
  #rs #screen-queue > .product-toolbar {
    align-items: center;
    gap: var(--space-2);
    min-height: 52px;
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4) var(--space-1);
  }
  #rs #screen-queue .home-heading { display: block; flex: 1; min-width: 0; }
  #rs #screen-queue .home-title {
    display: block;
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: var(--tracking-display);
    white-space: nowrap;
  }
  /* Il conteggio è già nel filtro "Tutti": resta per i lettori di schermo */
  #rs #screen-queue .home-heading .product-count {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  #rs #screen-queue .toolbar-right { flex: 0 0 auto; gap: 2px; align-items: center; }
  #rs #screen-queue .toolbar-right .filter-btn {
    position: relative;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    box-shadow: none;
  }
  #rs #screen-queue .toolbar-right .filter-btn svg { width: 20px; height: 20px; }
  #rs #screen-queue .toolbar-right .filter-btn:active { background: var(--surface2); }
  #rs #screen-queue .toolbar-right .filter-btn .queue-sort-label,
  #rs #screen-queue .toolbar-right .filter-btn .queue-date-filter-label,
  #rs #screen-queue .toolbar-right .filter-btn .filter-btn-tag { display: none; }
  /* Filtro attivo: colore + puntino, senza etichette che spingono il layout */
  #rs #screen-queue .toolbar-right .filter-btn.has-filter {
    background: var(--primary-soft);
    color: var(--primary);
  }
  #rs #screen-queue .toolbar-right .filter-btn.has-filter::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--primary);
  }
  #rs #screen-queue .select-toggle-new {
    min-height: 36px;
    margin-left: var(--space-1);
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    box-shadow: none;
    font-size: var(--text-sm);
    font-weight: 700;
  }
  #rs #screen-queue .select-toggle-new svg { display: none; }
  #rs #screen-queue .select-toggle-new[aria-pressed="true"] {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
  }

  #rs #screen-queue > .sticky-zone { padding: var(--space-2) 0; }
  #rs #screen-queue > .tab-area { margin-bottom: var(--space-3); }
  #rs #screen-queue > .queue-promo-banner { margin: 0 var(--space-4) var(--space-3); }
  #rs #screen-queue > .queue-promo-banner:not([data-banner-id="low_credits"]):not([data-banner-id="first_gen"]) {
    margin-top: var(--space-2);
  }
  /* Ultimo elemento della pagina: resta sopra la barra di navigazione */
  #rs #screen-queue > .cards-wrap,
  #rs #screen-queue > .empty-state { padding-bottom: 0; }
  #rs #screen-queue.active::after {
    content: '';
    order: 9;
    flex: 0 0 calc(104px + var(--safe-b));
  }
}

/* ── 15. SELEZIONE SU MOBILE ── */
@media (max-width: 1023px) {
  #rs #screen-queue.active::after { flex-basis: calc(100px + var(--safe-b)); }
}

/* ── 16. CARD HOME COMPATTE (mobile) ─────────────────────────────── */
@media (max-width: 1023px) {
  #rs #cards-container .product-card { margin-bottom: var(--space-2); border-radius: var(--radius); }
  #rs #cards-container .product-card .card-inner { border-radius: calc(var(--radius) - 1px); }
  #rs #cards-container .product-card .card-main { padding: 10px 10px 8px; gap: 10px; min-height: 0; }
  #rs #cards-container .product-card .card-thumb {
    flex: 0 0 60px;
    width: 60px;
    height: 76px;
    min-height: 0;
    border-radius: 10px;
  }
  #rs #cards-container .product-card .card-title { font-size: 14px; line-height: 1.25; }
  #rs #cards-container .product-card .card-sub { margin-top: 1px; font-size: var(--text-xs); }
  #rs #cards-container .product-card .card-price { margin-top: 2px; padding-top: 0; font-size: var(--text-md); }
  #rs #cards-container .product-card .card-copy-btn,
  #rs #cards-container .product-card .card-3dot { width: 28px; height: 28px; }
  #rs #cards-container .product-card .card-action-row { padding: 0 10px 10px; gap: 6px; }
  #rs #cards-container .product-card .card-action-btn {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: var(--text-sm);
  }
  #rs #cards-container .product-card .card-action-btn svg { width: 16px; height: 16px; }
}

/* ── 17. SCHEDA PRODOTTO (mobile) ────────────────────────────────────
   Titolo, poi foto in griglia con tessera per aggiungerne, poi campi a
   tessere: brevi su due colonne, testi lunghi a tutta larghezza. */
@media (max-width: 1023px) {
  /* Intestazione: solo titolo e stato; le foto sono subito sotto */
  #rs #screen-details .details-hero {
    display: block;
    margin: var(--space-2) 0 var(--space-4);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #rs #screen-details .details-hero-thumb { display: none; }
  #rs #screen-details .details-hero-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: var(--tracking-display);
  }
  #rs #screen-details .details-hero-badges { margin-top: var(--space-2); }

  /* Foto: griglia a tre colonne, la tessera per aggiungere fa da ultima cella */
  #rs #screen-details #draft-photo-editor {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #rs #screen-details #draft-photo-editor > .draft-photo-editor-header,
  #rs #screen-details #draft-photo-editor > p { grid-column: 1 / -1; }
  #rs #screen-details #draft-photo-editor .draft-photo-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
  }
  #rs #screen-details #draft-photo-editor .edit-section-header {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    text-transform: none;
  }
  #rs #screen-details .draft-photo-count {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface2);
    color: var(--text-2);
    font-size: var(--text-xs);
    font-weight: 700;
  }
  #rs #screen-details .draft-photo-editor-hint { display: none; }
  #rs #screen-details .draft-photo-view-status {
    margin: -2px 0 var(--space-1);
    color: var(--hint);
    font-size: var(--text-xs);
    line-height: 1.4;
  }
  #rs #screen-details .draft-source-photo-grid,
  #rs #screen-details .draft-photo-editor-controls { display: contents; }
  #rs #screen-details .draft-source-photo {
    position: relative;
    aspect-ratio: 3 / 4;
    margin: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    overflow: hidden;
  }
  #rs #screen-details .draft-source-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  #rs #screen-details .draft-source-photo-label {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
  }
  #rs #screen-details .draft-photo-remove {
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 15px;
  }
  /* Fronte/Retro: selettore unico in basso, la scelta attiva diventa bianca */
  #rs #screen-details .draft-photo-view-controls {
    position: absolute;
    right: 5px;
    bottom: 5px;
    left: 5px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  #rs #screen-details .draft-photo-side-choice {
    min-width: 0;
    min-height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: rgba(255, 255, 255, .85);
    box-shadow: none;
    font-size: 10.5px;
    font-weight: 700;
  }
  #rs #screen-details .draft-photo-side-choice.is-selected {
    background: #fff;
    color: #16161D;
  }
  #rs #screen-details .draft-photo-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    margin: 0;
    padding: var(--space-2);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--primary);
    box-shadow: none;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1.2;
  }
  #rs #screen-details .draft-photo-add::before {
    content: "+";
    font-size: 26px;
    font-weight: 500;
    line-height: 1;
  }
  #rs #screen-details .draft-photo-add:active { background: var(--primary-soft); }
  /* "Rileva automaticamente" è un'azione secondaria: pulsante compatto sotto la griglia */
  #rs #screen-details .draft-photo-automatic {
    grid-column: 1 / -1;
    order: 2;
    justify-self: start;
    width: auto;
    height: auto;
    min-height: 36px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    box-shadow: none;
    font-size: var(--text-sm);
    font-weight: 700;
  }
  #rs #screen-details .draft-photo-automatic:active { background: var(--surface2); }
  #rs #screen-details .draft-photo-automatic:disabled { opacity: .5; }

  /* Campi: elenco raggruppato (riferimento: editor annuncio di app di rivendita).
     Titolo di sezione fuori dalla card, righe etichetta → valore → freccia.
     Il valore va a capo su due righe invece di troncarsi. */
  #rs #screen-details .details-fields {
    display: block;
    margin: 0 0 var(--space-6);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }
  #rs #screen-details .details-fields > .edit-section-header {
    display: block;
    margin: 0 0 var(--space-3);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    text-transform: none;
  }
  #rs #screen-details .details-fields .edit-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
    min-height: 54px;
    margin: 0;
    padding: 10px var(--space-4);
    border: 1px solid var(--border) !important;
    border-top-width: 0 !important;
    border-radius: 0;
    background: var(--surface);
    cursor: pointer;
  }
  /* La card è fatta dalle righe: prima e ultima portano gli angoli */
  #rs #screen-details .details-fields > .edit-section-header + .edit-row,
  #rs #screen-details .details-fields > .edit-row:first-child {
    border-top-width: 1px !important;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
  }
  #rs #screen-details .details-fields > .edit-row:last-child {
    border-bottom-right-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
  }
  #rs #screen-details .details-fields .edit-row:active { background: var(--surface2); }
  #rs #screen-details .details-fields .edit-field-label,
  #rs #screen-details .details-fields .edit-row > .edit-row-label {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 0;
  }
  #rs #screen-details .details-fields .edit-row-label {
    color: var(--hint) !important;
    font-size: var(--text-md);
    font-weight: 500;
    text-align: left !important;
    white-space: nowrap;
  }
  /* Obbligatorio mancante: un punto ambra accanto all'etichetta, niente badge */
  #rs #screen-details .details-fields .edit-missing-hint,
  #rs #screen-details .details-fields .edit-row.is-missing .edit-missing-hint {
    order: -1;
    width: 7px;
    height: 7px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 0;
    overflow: hidden;
  }
  #rs #screen-details .details-fields .edit-row.is-missing .edit-missing-hint { background: var(--credit-extra); }
  #rs #screen-details .details-fields .edit-row:not(.is-missing) .edit-missing-hint { display: none; }
  #rs #screen-details .details-fields .edit-row-right,
  #rs #screen-details .details-fields .edit-row.is-missing .edit-row-right,
  #rs #screen-details .details-fields .edit-row.is-empty .edit-row-right {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
  }
  #rs #screen-details .details-fields .details-field-icon { display: none; }
  #rs #screen-details .details-fields .edit-row-value {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text) !important;
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1.3;
    text-align: right;
    white-space: normal;
  }
  #rs #screen-details .details-fields .edit-row-value.is-empty,
  #rs #screen-details .details-fields .edit-row.is-missing .edit-row-value.is-empty {
    color: var(--primary) !important;
    font-weight: 700;
  }
  #rs #screen-details .details-fields .edit-row-arrow {
    display: block;
    flex: 0 0 auto;
    color: var(--border-strong);
    font-size: 20px;
    line-height: 1;
  }
  /* Testi lunghi: etichetta sopra, testo sotto su tre righe */
  #rs #screen-details .details-fields #edit-row-notes,
  #rs #screen-details .details-fields #edit-row-seo-desc {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
  }
  #rs #screen-details .details-fields #edit-row-notes,
  #rs #screen-details .details-fields #edit-row-seo-desc { min-height: 0; height: auto; }
  #rs #screen-details .details-fields #edit-row-notes .edit-row-right,
  #rs #screen-details .details-fields #edit-row-seo-desc .edit-row-right {
    flex: 0 0 auto;
    justify-content: space-between;
  }
  #rs #screen-details .details-fields #edit-row-notes .edit-row-value,
  #rs #screen-details .details-fields #edit-row-seo-desc .edit-row-value {
    -webkit-line-clamp: 3;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
  }
  #rs #screen-details .details-fields #edit-row-notes .edit-row-value.is-empty,
  #rs #screen-details .details-fields #edit-row-seo-desc .edit-row-value.is-empty { font-size: var(--text-md); }

  /* Avviso dei dati mancanti: una riga sobria che spiega il punto ambra */
  #rs #screen-details .details-missing-summary {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--text-sm);
    line-height: 1.4;
  }
  #rs #screen-details .details-missing-summary strong { color: var(--text); }
  #rs #screen-details .details-advanced {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: none;
  }
}

/* ── 18. SCHEDA PRODOTTO: opzioni foto al posto di "Avanzate" ────────
   Niente sezione a scomparsa: restano visibili solo le due opzioni utili
   (sfondo dell'indossato e categoria Depop Fold). Il tipo di foto si
   sceglie al momento della generazione; i canali di vendita tornano
   quando ci saranno le integrazioni. */
#rs #screen-details #details-advanced {
  margin: 0 0 var(--space-6);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#rs #screen-details #details-advanced > summary { display: none; }
#rs #screen-details #details-advanced > .edit-section-card:not(.model-selector-card) { display: none; }
#rs #screen-details #model-selector-card {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#rs #screen-details #model-selector-card::before {
  content: "Opzioni foto";
  display: block;
  margin: 0 0 var(--space-3);
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}
#rs #screen-details #model-selector-card .model-selector-header,
#rs #screen-details #model-selector-card .product-generation-mode-options { display: none; }
#rs #screen-details #model-selector-card .worn-background-control,
#rs #screen-details #model-selector-card .flatlay-category-control {
  display: grid !important;
  gap: var(--space-2);
  margin: 0 !important;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--hint);
  font-size: var(--text-sm);
  font-weight: 600;
}
#rs #screen-details #model-selector-card .worn-background-control {
  border-bottom-width: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
#rs #screen-details #model-selector-card .flatlay-category-control {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
#rs #screen-details #model-selector-card .flatlay-category-control > label {
  margin: 0 !important;
  color: var(--hint);
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
}
#rs #screen-details #model-selector-card select.form-input,
#rs #screen-details #model-selector-card .flatlay-category-picker > summary {
  min-height: var(--tap-min);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface2);
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 600;
}

/* Opzioni foto: stesse righe "etichetta → valore → freccia" dei campi sopra */
#rs #screen-details #details-advanced,
#rs #screen-details #model-selector-card {
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding: 0 !important;
}
#rs #screen-details #model-selector-card .worn-background-control,
#rs #screen-details #model-selector-card .flatlay-category-control {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-4);
  row-gap: 4px;
  min-height: 54px;
  padding: 10px var(--space-4);
  color: var(--hint);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
}
#rs #screen-details #model-selector-card .flatlay-category-control > label {
  color: var(--hint);
  font-size: var(--text-md) !important;
  font-weight: 500 !important;
  white-space: nowrap;
}
/* Il valore è testo allineato a destra, senza riquadro; la freccia è la stessa delle altre righe */
#rs #screen-details #model-selector-card select.form-input,
#rs #screen-details #model-selector-card .flatlay-category-picker > summary {
  justify-self: end;
  width: 100%;
  min-height: 32px;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14' fill='none' stroke='%23A6A8B8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l6 6-6 6'/%3E%3C/svg%3E") no-repeat right center;
  box-shadow: none;
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 600;
  text-align: right;
  text-align-last: right;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#rs #screen-details #model-selector-card .flatlay-category-picker { min-width: 0; }
#rs #screen-details #model-selector-card .flatlay-category-picker > summary {
  display: block;
  overflow: hidden;
  line-height: 32px;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#rs #screen-details #model-selector-card .flatlay-category-picker > summary::-webkit-details-marker { display: none; }
#rs #screen-details #model-selector-card .flatlay-category-picker > summary::after { content: none; }
#rs #screen-details #model-selector-card .flatlay-category-picker > summary > span { color: inherit; font: inherit; }
/* Aperto, l'elenco delle categorie usa tutta la larghezza della riga */
#rs #screen-details #model-selector-card .flatlay-category-picker[open] { grid-column: 1 / -1; }
#rs #screen-details #model-selector-card .flatlay-category-control > :not(label):not(.flatlay-category-picker) {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--hint);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
}

/* Sentinella del caricamento progressivo dei prodotti in home */
#rs .queue-load-more { height: 1px; }
#rs .queue-load-more[hidden] { display: none; }
@media (max-width: 1023px) {
  #rs #screen-queue > .queue-load-more { order: 6; }
}

/* Categoria Depop Fold: etichetta e valore sono lunghi, quindi valore sotto come per le note */
#rs #screen-details #model-selector-card .flatlay-category-control {
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-3) var(--space-4);
}
#rs #screen-details #model-selector-card .flatlay-category-picker > summary {
  text-align: left;
  text-align-last: left;
}

/* ── Home vuota: semplice e centrata nello spazio libero ─────────────────── */
#rs #queue-empty:not([style*="none"]) {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-4) var(--space-4) 96px;
}
#rs #queue-empty .es-title { max-width: none; line-height: 1.2; }
#rs #queue-empty .queue-empty-add { background: var(--primary) !important; background-image: none !important; box-shadow: none !important; filter: none !important; }
#rs #queue-empty .queue-empty-icon { width: auto; height: auto; margin-bottom: var(--space-3); border-radius: 0; background: transparent; }
#rs #queue-empty .empty-steps { gap: 6px; max-width: 300px; margin-top: var(--space-4); }
#rs #queue-empty .empty-steps li { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#rs #queue-empty .empty-steps li::before { flex: 0 0 auto; width: auto; height: auto; border-radius: 0; background: transparent; content: counter(empty-step) "."; display: inline; margin-right: 6px; font-size: inherit; }
#rs #queue-empty .queue-empty-icon { position: relative; color: var(--primary); }
#rs #queue-empty .es-title { font-size: 22px; letter-spacing: -.4px; }
#rs #queue-empty .es-sub { max-width: 30ch; font-size: 15px; }
#rs #queue-empty .empty-steps { gap: 10px; margin-top: var(--space-5); }
#rs #queue-empty .empty-steps { width: fit-content; max-width: 100%; margin-inline: auto; }
#rs #queue-empty .empty-steps { width: 100%; max-width: 340px; text-align: center; }
#rs #queue-empty .empty-steps li { display: block; color: var(--text); font-size: 14px; font-weight: 600; text-align: center; }
#rs #queue-empty .empty-steps li::before { color: var(--primary); font-weight: 800; }
#rs #queue-empty .queue-empty-add { margin-top: var(--space-6); border-radius: 16px; }
#rs #queue-empty .qe-note { margin-top: var(--space-3); color: var(--hint); font-size: 12.5px; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  #rs #queue-empty > * { animation: qeIn 520ms cubic-bezier(.2, .7, .2, 1) both; }
  #rs #queue-empty > :nth-child(2) { animation-delay: 60ms; }
  #rs #queue-empty > :nth-child(3) { animation-delay: 110ms; }
  #rs #queue-empty > :nth-child(4) { animation-delay: 160ms; }
  #rs #queue-empty > :nth-child(5) { animation-delay: 210ms; }
  #rs #queue-empty > :nth-child(6) { animation-delay: 260ms; }
}
@keyframes qeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Filtri della Home (mobile): solo testo, niente sfondi ───────────────── */
@media (max-width: 1023px) {
  #rs #screen-queue .tabs-scroll { display: flex; justify-content: safe center; gap: 10px; padding: 0 12px; }
  #rs #screen-queue .tab-pill,
  #rs #screen-queue .tab-pill:hover:not(.active) {
    min-height: 36px;
    padding: 0 2px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--hint) !important;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent !important;
    transition: color 160ms ease, border-color 160ms ease;
  }
  #rs #screen-queue .tab-pill:hover:not(.active) { color: var(--text) !important; border-bottom-color: var(--border) !important; }
  #rs #screen-queue .tab-pill.active {
    border: 0 !important;
    border-bottom: 2px solid var(--primary) !important;
    background: transparent !important;
    color: var(--primary) !important;
    font-weight: 700;
  }
  #rs #screen-queue .tab-pill .tab-icon { display: inline-flex; }
  #rs #screen-queue .tab-pill .tab-icon { align-items: center; color: inherit; }
  #rs #screen-queue .tab-pill .tab-badge { min-width: 0; margin-left: 2px; padding: 0; border-radius: 0; background: transparent !important; color: inherit !important; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .65; }
  #rs #screen-queue .tab-pill.active .tab-badge { opacity: .9; }
}

/* ── Card prodotto della Home (mobile): margini e altezza come in produzione ── */
@media (max-width: 1023px) {
  #rs #cards-container.cards-wrap { padding-left: 20px; padding-right: 20px; }
  #rs #cards-container .product-card { margin-bottom: 14px; }
  #rs #cards-container .product-card .card-main { gap: 12px; padding: 14px 14px 10px; }
  #rs #cards-container .product-card .card-thumb { flex: 0 0 74px; width: 74px; height: 96px; }
  #rs #cards-container .product-card .card-action-row { padding: 0 12px 12px; }
  #rs #cards-container .product-card .card-action-btn { min-height: 39px; font-size: 14px; }
  #rs #cards-container .product-card .card-title { font-size: 15px; line-height: 1.25; }
  #rs #cards-container .product-card .card-title > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; }
  #rs #cards-container .product-card .card-sub { margin-top: 5px; font-size: 12px; }
  #rs #cards-container .product-card .card-price { margin-top: 7px; font-size: 19px; }
}

/* ── Barra in basso (mobile): voce attiva con indicatore, senza riquadro ─── */
@media (max-width: 1023px) {
  #rs #bottom-bar-main .nav-tab.active {
    background: transparent !important;
    box-shadow: none !important;
    color: var(--primary) !important;
  }
  #rs #bottom-bar-main .tab-nav { position: relative; }
  #rs #bottom-bar-main .nav-indicator {
    position: absolute;
    top: -5px;
    left: 0;
    width: 24px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--primary);
    pointer-events: none;
    will-change: transform;
  }
  #rs #bottom-bar-main .nav-indicator.is-ready { transition: transform 320ms cubic-bezier(.3, 1.3, .5, 1), opacity 130ms ease; }
  #rs #bottom-bar-main .nav-indicator.is-hidden { opacity: 0; }
  #rs #bottom-bar-main .nav-indicator.no-slide { transition: none !important; }
  #rs #bottom-bar-main .nav-tab.active .nav-tab-icon { animation: navIconPop 360ms cubic-bezier(.3, 1.5, .5, 1); }
  #rs #bottom-bar-main .nav-tab.active .nav-tab-icon { transform: scale(1.1); }
  #rs #bottom-bar-main .nav-tab.active .nav-tab-label { color: var(--primary) !important; font-weight: 800; }
  #rs #bottom-bar-main .nav-tab .nav-tab-icon { transition: transform 180ms ease; }
}
@keyframes navIconPop { 0% { transform: scale(.85); } 100% { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
  #rs #bottom-bar-main .nav-indicator.is-ready { transition: none; }
  #rs #bottom-bar-main .nav-tab.active .nav-tab-icon { animation: none; }
}

/* ── Pagina Fatturazione ─────────────────────────────────────────────────── */
#screen-billing.active {
  position: fixed; inset: 0; z-index: 1200; width: 100%; max-width: none; height: 100dvh; margin: 0 !important;
  padding: calc(18px + var(--safe-t, 0px)) 16px calc(28px + var(--safe-b, 0px));
  overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
}
body:has(#screen-billing.active) #app-top-header,
body:has(#screen-billing.active) #bottom-bar-main { display: none !important; }
#screen-billing .billing-shell { width: min(100%, 640px); margin: 0 auto; }
#screen-billing .billing-top-row { margin-bottom: 18px; }
#screen-billing .billing-title { margin: 0 0 16px; color: var(--text); font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
#screen-billing .billing-card { margin-bottom: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: none; }
#screen-billing .billing-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#screen-billing .billing-eyebrow { color: var(--hint); font-size: 12px; font-weight: 700; }
#screen-billing .billing-plan-name { margin: 2px 0 0; color: var(--text); font-size: 22px; font-weight: 800; }
#screen-billing .billing-section-title { margin: 0 0 8px; color: var(--text); font-size: 16px; font-weight: 800; }
#screen-billing .billing-status { flex: 0 0 auto; padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 12px; font-weight: 700; }
#screen-billing .billing-status.is-muted { background: var(--surface2); color: var(--hint); }
#screen-billing .billing-status.is-warning { background: color-mix(in srgb, var(--orange, #f59e0b) 16%, transparent); color: var(--orange, #b45309); }
#screen-billing .billing-desc { margin: 10px 0 0; color: var(--hint); font-size: 14px; line-height: 1.5; }
#screen-billing .billing-facts { display: grid; gap: 10px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
#screen-billing .billing-facts > div { display: flex; justify-content: space-between; gap: 12px; }
#screen-billing .billing-facts dt { color: var(--hint); font-size: 13px; }
#screen-billing .billing-facts dd { margin: 0; color: var(--text); font-size: 13px; font-weight: 700; text-align: right; }
#screen-billing .billing-portal-btn { width: 100%; min-height: 48px; margin-top: 14px; border: 0; border-radius: 14px; background: var(--primary); color: var(--on-primary, #fff); font: 700 15px/1 var(--font-family, inherit); box-shadow: none; cursor: pointer; }
#screen-billing .billing-portal-btn[hidden] { display: none; }
#screen-billing .billing-link-btn { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; background: transparent; color: var(--primary); font: 700 14px/1 var(--font-family, inherit); cursor: pointer; }
#screen-billing .account-invoice-list { max-height: none; padding-right: 0; }
#screen-billing .account-invoice-row { border-top-color: var(--border); }
#screen-billing .account-invoice-meta strong, #screen-billing .account-invoice-amount { color: var(--text); }
#screen-billing .account-invoice-meta span, #screen-billing .account-invoice-empty { color: var(--hint); }

/* ── Banner "Invita un amico" sotto i filtri della Home ──────────────────── */
#rs #queue-invite-banner { display: none; }
#rs #screen-queue:has(#cards-container:not([style*="none"])) #queue-invite-banner {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 40px); margin: 0 20px 12px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; box-shadow: none; order: 5;
}
#rs #queue-invite-banner .qib-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
#rs #queue-invite-banner .qib-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#rs #queue-invite-banner .qib-copy strong { font-size: 14px; font-weight: 700; line-height: 1.2; }
#rs #queue-invite-banner .qib-copy span { margin-top: 2px; color: var(--hint); font-size: 12px; line-height: 1.25; }
#rs #queue-invite-banner .qib-arrow { color: var(--hint); display: grid; place-items: center; }
#rs #queue-invite-banner:active { background: var(--surface2); }

/* ── Scena: card "Crea scena" (nessuna scena / slot di creazione) ─────────── */
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-carousel-add-slide {
  background: radial-gradient(circle at 50% 36%, color-mix(in srgb, var(--primary) 16%, var(--surface)) 0, var(--surface) 62%);
}
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button {
  gap: 14px; padding: 28px 26px; border: 1.5px dashed color-mix(in srgb, var(--primary) 45%, var(--border)); border-radius: 18px;
  background: transparent; color: var(--text);
}
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-plus {
  width: 68px; height: 68px; border: 0; border-radius: 22px; color: var(--primary); box-shadow: none;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
}
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button.is-empty .scene-preview-add-plus { border-radius: 50%; }
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button strong { color: var(--text); font-size: 21px; line-height: 1.2; letter-spacing: -.01em; }
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button small { max-width: 250px; color: var(--hint); font-size: 14px; line-height: 1.45; }

/* ── Scena vuota: esempio reale a tutta card ─────────────────────────────── */
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button.is-empty {
  position: relative; display: block; overflow: hidden; padding: 0; border: 0; border-radius: 16px; background: #1a1a22; text-align: left;
}
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-carousel-add-slide:has(.is-empty) { padding: 0; background: none; }
.scene-empty-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-preview-add-button.is-empty::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,16,0) 38%, rgba(10,10,16,.55) 64%, rgba(10,10,16,.92) 100%);
}
.scene-empty-chip {
  position: absolute; z-index: 2; top: 14px; left: 14px; padding: 5px 11px; border-radius: 999px;
  background: rgba(10,10,16,.55); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.scene-empty-copy { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding: 22px 20px 40px; }
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button.is-empty strong { color: #fff; font-size: 24px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
#rs #screen-scene[data-mobile-step="intro"] .scene-preview-add-button.is-empty small { max-width: 280px; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1.4; }
.scene-empty-swatches { display: flex; gap: 8px; margin-bottom: 8px; }
.scene-empty-swatches img { width: 34px; height: 34px; border: 2px solid rgba(255,255,255,.4); border-radius: 50%; object-fit: cover; }
.scene-empty-swatches img.is-active { border-color: #fff; }
.scene-empty-photo { transition: opacity .35s ease; }
.scene-empty-photo.is-fading { opacity: 0; }
.scene-empty-swatches img { transition: border-color .25s ease; }
@media (prefers-reduced-motion: reduce) { .scene-empty-photo { transition: none; } }

/* ── Scena (mobile): riquadro con la proporzione reale della scena, 3:4 ───── */
@media (max-width: 767px) {
  #rs #screen-scene[data-mobile-step="intro"] .scene-preview-frame {
    width: min(100%, calc((100dvh - 250px) * .75)); height: auto; max-height: none; aspect-ratio: 3 / 4; margin-inline: auto;
  }
}

/* ── Scena (mobile): passaggi della creazione ─────────────────────────────── */
@media (max-width: 767px) {
  /* 1. Superficie: due schede affiancate invece di due foto a tutta larghezza */
  #rs #screen-scene #scene-surfaces { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #rs #screen-scene #scene-surfaces .scene-choice { padding: 6px 6px 10px; gap: 8px; font-size: 14px; font-weight: 700; text-align: left; }
  #rs #screen-scene #scene-surfaces .scene-choice::before,
  #rs #screen-scene #scene-surfaces .scene-choice-image { width: 100%; height: auto; aspect-ratio: 1 / 1; flex: 0 0 auto; }
  #rs #screen-scene #scene-surfaces .scene-choice > span:not(.scene-choice-image) { padding: 0 4px; }
  /* 4. Oggetti: Indietro resta disponibile accanto a "Crea Scena", senza ombre */
  #rs #screen-scene[data-mobile-step="objects"] .scene-mobile-actions,
  #rs #screen-scene[data-mobile-step="color"][data-mobile-step-count="2"] .scene-mobile-actions { display: flex; }
  #rs #screen-scene[data-mobile-step="objects"] #scene-mobile-next,
  #rs #screen-scene[data-mobile-step="color"][data-mobile-step-count="2"] #scene-mobile-next { display: none; }
  #rs #screen-scene[data-mobile-step="objects"] #scene-generate-btn,
  #rs #screen-scene[data-mobile-step="color"][data-mobile-step-count="2"] #scene-generate-btn {
    left: 124px; right: 16px; width: auto; min-height: 46px; padding: 0 14px; border-radius: 12px; box-shadow: none; transform: none;
    bottom: calc(108px + var(--safe-b, 0px)); z-index: 1002; justify-content: center;
  }
  #rs #screen-scene .scene-mobile-actions #scene-mobile-next { box-shadow: none; }
}
@media (max-width: 767px) {
  #rs #screen-scene #scene-generate-btn { background: #6247f4 !important; border: 0; box-shadow: none !important; }
  #rs #screen-scene #scene-generate-btn .scene-generate-icon { background: transparent; box-shadow: none; }
}

/* ── Notifiche: pannello laterale, toast e avviso di generazione ─────────── */
/* Pannello (sidebar a destra) */
#rs #notifications-backdrop {
  position: fixed; inset: 0; z-index: 10030; background: rgba(8, 8, 14, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: notifFade .2s ease both;
}
#rs #notifications-backdrop[hidden] { display: none; }
#rs #notifications-panel {
  position: fixed; top: 0; right: 0; bottom: 0; left: auto; z-index: 10040;
  display: flex; flex-direction: column; width: min(400px, calc(100vw - 44px)); max-height: none; margin: 0; overflow: hidden;
  border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--bg); color: var(--text);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .28); outline: none;
}
#rs #notifications-panel[hidden] { display: none; }
#rs #notifications-panel:not([hidden]) { animation: notifSlide .26s cubic-bezier(.22, .8, .3, 1) both; }
body.notifications-open { overflow: hidden; }
#rs .notifications-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(18px + var(--safe-t, 0px)) 20px 8px; border: 0 !important;
}
#rs .notifications-panel-title { margin: 0; font-size: 24px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
#rs .notifications-close {
  display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
}
#rs .notifications-toolbar { display: flex; justify-content: flex-start; padding: 0 20px 12px; border-bottom: 1px solid var(--border); }
#rs #notifications-mark-read { padding: 6px 0; color: var(--primary); font-size: 13px; font-weight: 700; }
#rs #notifications-mark-read:disabled { color: var(--hint); opacity: .7; }
#rs .notifications-push-control { margin: 12px 20px 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
#rs #push-notifications-toggle { border-radius: 10px; }
#rs #push-notifications-status { color: var(--hint); }
#rs #notifications-list { flex: 1; max-height: none; padding: 4px 0 calc(24px + var(--safe-b, 0px)); overflow-y: auto; }
#rs .notification-group { padding: 16px 20px 6px; color: var(--hint); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
#rs .notification-item {
  position: relative; display: flex; align-items: flex-start; gap: 12px; width: calc(100% - 24px); margin: 2px 12px; padding: 12px;
  border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer;
}
#rs .notification-item:hover, #rs .notification-item:active { background: var(--surface); }
#rs .notification-item.is-unread { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
#rs .notification-item:last-child { border-bottom: 0; }
#rs .notification-item-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
#rs .notification-item-icon.is-credits { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #f59e0b; }
#rs .notification-item-icon.is-support { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #60a5fa; }
#rs .notification-item-icon.is-product { background: color-mix(in srgb, #22c55e 18%, transparent); color: #22c55e; }
#rs .notification-item-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
#rs .notification-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
#rs .notification-item-title { color: var(--text); font-size: 14px; font-weight: 700; line-height: 1.3; }
#rs .notification-item-time { flex: 0 0 auto; margin: 0; color: var(--hint); font-size: 12px; }
#rs .notification-item-message { margin: 0; color: var(--text-2, var(--hint)); font-size: 13px; line-height: 1.45; }
#rs .notification-item-dot { position: absolute; top: 16px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
#rs .notification-item.is-unread .notification-item-time { margin-right: 14px; }
#rs .notifications-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 64px 32px; color: var(--hint); font-size: 14px; text-align: center; }
#rs .notifications-empty strong { color: var(--text); font-size: 16px; }
#rs .notifications-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 50%; background: var(--surface); color: var(--hint); }
@keyframes notifSlide { from { transform: translateX(100%); } to { transform: none; } }
@keyframes notifFade { from { opacity: 0; } to { opacity: 1; } }

/* Toast e avviso di generazione: stessa card, in alto sotto l'header */
#rs .toast-region { top: calc(58px + var(--safe-t, 0px)); bottom: auto; left: 12px; right: 12px; }
#rs .app-toast {
  width: min(100%, 420px); align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28); transform: translateY(-12px);
}
#rs .app-toast.visible { transform: none; }
#rs .app-toast::before { display: none; }
#rs .app-toast-icon, #rs .scene-generation-notice-icon, #rs .scene-generation-notice-spinner {
  display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
}
#rs .app-toast-icon { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
#rs .app-toast.success .app-toast-icon { background: color-mix(in srgb, var(--green, #22c55e) 18%, transparent); color: var(--green, #22c55e); }
#rs .app-toast.error .app-toast-icon { background: color-mix(in srgb, var(--red, #ef4444) 18%, transparent); color: var(--red, #ef4444); }
#rs .app-toast.warning .app-toast-icon { background: color-mix(in srgb, var(--orange, #f59e0b) 18%, transparent); color: var(--orange, #f59e0b); }
#rs .app-toast-text { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
#rs .scene-generation-notice {
  top: calc(58px + var(--safe-t, 0px)); bottom: auto; width: min(calc(100vw - 24px), 420px); padding: 12px 14px; gap: 12px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28); animation: noticeDrop .28s cubic-bezier(.22, .8, .3, 1) both;
}
#rs .scene-generation-notice-spinner { flex-basis: 30px; width: 30px; height: 30px; border-width: 3px; border-color: color-mix(in srgb, var(--primary) 22%, transparent); border-top-color: var(--primary); }
#rs .scene-generation-notice-icon { background: color-mix(in srgb, var(--green, #22c55e) 18%, transparent); color: var(--green, #22c55e); }
#rs #scene-generation-notice[data-state="error"] .scene-generation-notice-icon { background: color-mix(in srgb, var(--red, #ef4444) 18%, transparent); color: var(--red, #ef4444); }
#rs #scene-generation-notice[data-state="loading"] .scene-generation-notice-icon { display: none; }
#rs .scene-generation-notice-spinner[hidden] { display: none !important; }
#rs #scene-generation-notice[data-state="complete"], #rs #scene-generation-notice[data-state="error"] { border-color: var(--border); }
#rs .scene-generation-notice-copy { gap: 2px; }
#rs .scene-generation-notice-copy strong { color: var(--text); font-size: 14px; }
#rs .scene-generation-notice-copy > span { color: var(--hint); font-size: 12px; }
#rs .scene-generation-notice-open { min-height: 34px; padding: 0 14px; border-radius: 10px; background: #6247f4; font-size: 13px; }
#rs .scene-generation-notice-dismiss { align-self: center; background: transparent; color: var(--hint); }
body:has(#scene-generation-notice:not([hidden])) #rs .toast-region, body:has(#scene-generation-notice:not([hidden])) .toast-region { top: calc(58px + 76px + var(--safe-t, 0px)); }
@keyframes noticeDrop { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) {
  #rs #notifications-panel:not([hidden]), #rs #notifications-backdrop, #rs .scene-generation-notice { animation: none; }
}

/* Notifiche: elimina con swipe */
#rs .notification-swipe { position: relative; overflow: hidden; margin: 2px 12px; border-radius: 14px; transition: height .22s ease, margin .22s ease, opacity .22s ease; }
#rs .notification-swipe.is-removing { height: 0 !important; margin-top: 0; margin-bottom: 0; opacity: 0; }
#rs .notification-swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 22px;
  background: var(--red, #ef4444); color: #fff; font-size: 13px; font-weight: 700; visibility: hidden; opacity: calc(.35 + var(--swipe-progress, 0) * .65);
}
#rs .notification-swipe.is-left .notification-swipe-bg { justify-content: flex-end; }
#rs .notification-swipe:not(.is-left) .notification-swipe-bg { justify-content: flex-start; }
#rs .notification-swipe .notification-item { width: 100%; margin: 0; background: var(--bg); touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .2s ease; }
#rs .notification-swipe .notification-item.is-unread { background: linear-gradient(color-mix(in srgb, var(--primary) 12%, transparent), color-mix(in srgb, var(--primary) 12%, transparent)), var(--bg); }
#rs .notification-swipe .notification-item:hover, #rs .notification-swipe .notification-item:active { background: linear-gradient(var(--surface), var(--surface)), var(--bg); }
#rs .notification-swipe .notification-item.is-dragging { transition: none; }
#rs .notification-swipe.is-swiping .notification-swipe-bg { visibility: visible; }
/* Logo header: solo scritta, bianca nel tema scuro (filtro già presente) */
#rs .app-top-brand img { width: auto; height: 21px; }

/* Toast e avviso: swipe per chiudere */
#rs .app-toast { pointer-events: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#rs .app-toast.is-swiping, #rs .scene-generation-notice.is-swiping { transition: none !important; animation: none !important; }
/* Badge crediti compatto: icona + numero */
#rs #credits-floating-pill { min-height: 32px; padding: 0 11px 0 9px; gap: 5px; font-size: 14px; font-variant-numeric: tabular-nums; }
#rs #credits-floating-pill svg { width: 16px; height: 16px; }

/* ── Home: controlli (ordina, data, seleziona) in un'unica capsula ─────────── */
#rs #screen-queue .toolbar-right {
  gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
#rs #screen-queue .toolbar-right .filter-btn { width: 32px; height: 34px; }
#rs #screen-queue .toolbar-right .filter-btn svg { width: 18px; height: 18px; }
#rs #screen-queue .toolbar-right .filter-btn:hover { background: var(--surface2); }
#rs #screen-queue .toolbar-right .filter-btn.has-filter::after { top: 5px; right: 5px; border-color: var(--surface); }
#rs #screen-queue .select-toggle-new {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; margin-left: 1px; padding: 0 11px 0 8px; border: 0;
  background: var(--primary-soft); color: var(--primary); font-size: 12.5px;
}
#rs #screen-queue .select-toggle-new svg { display: block; width: 15px; height: 15px; }
#rs #screen-queue .select-toggle-new[aria-pressed="true"] { background: var(--primary); color: var(--on-primary, #fff); }

/* Notifiche: riga riepilogo + azione */
#rs .notifications-toolbar { align-items: center; justify-content: space-between; gap: 12px; padding: 4px 20px 14px; }
#rs .notifications-summary { color: var(--hint); font-size: 13px; font-weight: 600; }
#rs #notifications-mark-read {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer;
}
#rs #notifications-mark-read[hidden] { display: none; }
#rs #notifications-mark-read:active { background: color-mix(in srgb, var(--primary) 24%, transparent); }
/* Allineamento: titolo, riepilogo, gruppi e icone sulla stessa linea (20px) */
#rs .notification-swipe { margin: 4px 20px; }
#rs .notification-item-dot { right: 12px; }
/* Pallino "nuova" sull'angolo dell'icona: libera spazio per titolo e orario */
#rs .notification-item-dot { top: 9px; left: 42px; right: auto; width: 11px; height: 11px; border: 2px solid var(--bg); box-sizing: border-box; }
#rs .notification-item.is-unread .notification-item-time { margin-right: 0; }
#rs .notification-item-top { align-items: flex-start; }
#rs .notification-item-time { padding-top: 2px; font-size: 11.5px; white-space: nowrap; }

/* Schermi stretti: "Seleziona" diventa solo icona, il titolo non viene più coperto */
#rs #screen-queue .home-heading { overflow: hidden; }
#rs #screen-queue .home-title { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 389px) {
  #rs #screen-queue .select-toggle-new[aria-pressed="false"] { width: 34px; padding: 0; justify-content: center; border-radius: 50%; }
  #rs #screen-queue .select-toggle-new[aria-pressed="false"] .select-toggle-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
/* Riga riepilogo: stesso spazio sopra e sotto */
#rs .notifications-panel-head { padding-bottom: 4px; }
#rs .notifications-toolbar { padding: 10px 20px 14px; }
#rs .notifications-toolbar { border-bottom: 0; padding-bottom: 8px; }
#rs .notifications-toolbar[hidden] { display: none; }

/* ── Scena (mobile): esempi senza contorni, nota del piano nascosta ───────── */
@media (max-width: 767px) {
  #rs #screen-scene[data-mobile-step="intro"] .scene-examples .scene-card-header p { display: none; }
  #rs #screen-scene[data-mobile-step="intro"] .scene-examples .scene-card-header { margin: 4px 0 12px; }
  #rs #screen-scene[data-mobile-step="intro"] .scene-examples .scene-card-header h3 { font-size: 18px; letter-spacing: -.01em; }
  #rs #screen-scene[data-mobile-step="intro"] .scene-example-list {
    gap: 12px; margin: 0 -16px; padding: 0 16px 8px; scroll-padding-inline: 16px;
  }
  #rs #screen-scene[data-mobile-step="intro"] .scene-example-option {
    flex: 0 0 142px; padding: 0 !important; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important; text-align: left;
  }
  #rs #screen-scene[data-mobile-step="intro"] .scene-example-option .scene-example-art,
  #rs #screen-scene[data-mobile-step="intro"] .scene-example-option img {
    display: block; width: 100%; aspect-ratio: 3 / 4; height: auto; border-radius: 16px; background-size: cover; background-position: center;
  }
  #rs #screen-scene[data-mobile-step="intro"] .scene-example-option strong {
    margin-top: 8px; padding: 0 2px; color: var(--text); font-size: 13px; font-weight: 700; line-height: 1.25;
  }
  #rs #screen-scene #scene-plan-note { display: none; }
}

/* ── Modal esempio scena ("Clona questa scena") ───────────────────────────── */
#rs .scene-example-dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
#rs .scene-example-dialog::backdrop { background: rgba(8, 8, 14, .6); }
#rs .scene-example-dialog h3 { color: var(--text); }
#rs .scene-example-dialog p { color: var(--hint); }
#rs .scene-example-dialog .scene-example-eyebrow { color: var(--primary) !important; }
#rs .scene-example-dialog-close { border: 0; background: var(--surface2); color: var(--text); }
#rs .scene-example-dialog .scene-example-art { background: var(--surface2); box-shadow: none; }
#rs .scene-example-composition-panel h4 { color: var(--text); }
#rs .scene-example-tag { border: 0; background: var(--surface2); color: var(--text); }
#rs .scene-example-tag:first-child { background: var(--surface2); color: var(--text); }
#rs .scene-example-tag-swatch { border-color: var(--border); }
#rs .scene-example-premium-note { border: 0; background: var(--surface2); color: var(--hint) !important; }
#rs .scene-example-actions button { border: 0; background: var(--surface2); color: var(--text); }
#rs .scene-example-actions .primary { background: #6247f4; color: #fff; box-shadow: none; }
#rs .scene-example-actions .primary.is-locked { background: var(--surface2); color: var(--hint); }
@media (max-width: 767px) {
  #rs dialog.scene-example-dialog[open] {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 92dvh; margin: 0; padding: 0;
    border-width: 1px 0 0; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; overflow: hidden;
  }
  #rs .scene-example-dialog-header { flex: 0 0 auto; padding: 22px 64px 12px 20px; }
  #rs .scene-example-dialog .scene-example-eyebrow { margin-bottom: 4px !important; font-size: 11px !important; letter-spacing: .1em; }
  #rs .scene-example-dialog h3 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
  #rs .scene-example-dialog p#scene-example-description { font-size: 14px; line-height: 1.45; }
  #rs .scene-example-dialog-close { top: 16px; right: 16px; width: 38px; height: 38px; min-height: 38px; font-size: 24px; }
  #rs .scene-example-dialog-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; gap: 16px; padding: 4px 20px 12px; }
  #rs .scene-example-dialog .scene-example-art {
    width: min(100%, calc(52vh * .75), 340px); max-height: none; height: auto; aspect-ratio: 3 / 4; border-radius: 18px; object-fit: cover;
  }
  #rs .scene-example-composition-panel h4 { margin: 0 0 10px; font-size: 14px; color: var(--hint); font-weight: 700; }
  #rs .scene-example-tag { min-height: 36px; padding: 6px 12px 6px 8px; font-size: 13px; }
  #rs .scene-example-actions {
    flex: 0 0 auto; margin: 0; padding: 12px 20px calc(14px + var(--safe-b, 0px)); border-top: 1px solid var(--border); background: var(--surface);
  }
  #rs .scene-example-actions button { min-height: 50px; border-radius: 14px; font-size: 15px; font-weight: 700; }
  #rs .scene-example-actions #scene-example-dismiss { flex: 0 0 auto; padding-inline: 20px; }
  #rs .scene-example-actions #scene-example-recreate { flex: 1; }
}
/* Modal esempio: solo titolo, foto e azioni (niente badge né note) */
@media (max-width: 767px) {
  #rs .scene-example-composition-panel h4, #rs .scene-example-composition { display: none; }
  #rs .scene-example-premium-note { margin: 0; font-size: 13px !important; line-height: 1.45; }
  #rs .scene-example-premium-note[hidden] { display: none; }
}

/* ── Modal "Scegli il tipo di foto" ───────────────────────────────────────── */
#rs #generation-style-dialog { border: 1px solid var(--border); box-shadow: none; }
#rs #generation-style-dialog::backdrop { background: rgba(8, 8, 14, .6); }
#rs #generation-style-dialog .generation-product-summary {
  display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 0 44px 0 0; border: 0; background: transparent;
}
#rs #generation-style-dialog .generation-product-photo {
  flex: 0 0 56px; width: 56px; height: 72px; overflow: hidden; border-radius: 12px; background: var(--surface2);
}
#rs #generation-style-dialog .generation-product-photo img { width: 100%; height: 100%; object-fit: cover; }
#rs #generation-style-dialog .generation-product-summary > div:last-child { min-width: 0; }
#rs #generation-style-dialog .generation-product-summary h2 { margin: 0 0 3px; font-size: 16px; line-height: 1.25; }
#rs #generation-style-dialog .generation-product-summary p { margin: 0 0 4px; font-size: 13px; }
#rs #generation-style-dialog .generation-product-price { font-size: 15px; }
#rs #generation-style-dialog .generation-choice-title {
  display: block; margin: 0 0 14px; font-size: 22px; line-height: 1.15; letter-spacing: -.02em; text-align: left;
}
#rs #generation-style-dialog .generation-choice-title svg { display: none; }
#rs #generation-style-dialog .generation-mode-options { gap: 12px; }
#rs #generation-style-dialog .generation-mode-option {
  min-height: 0; gap: 4px; padding: 12px 10px 14px; border: 1.5px solid var(--border); border-radius: 18px; background: var(--surface2);
}
#rs #generation-style-dialog .generation-mode-option img {
  width: 100%; height: auto; aspect-ratio: 1 / 1; max-height: 118px; margin-bottom: 8px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 10%, var(--surface2)); object-fit: contain; padding: 6px; box-sizing: border-box;
}
#rs #generation-style-dialog .generation-mode-option strong { font-size: 17px; }
#rs #generation-style-dialog .generation-mode-option > span { font-size: 13px; }
#rs #generation-style-dialog .generation-mode-cost { margin-top: 8px; padding: 4px 11px; font-size: 12px; }
#rs #generation-style-dialog .generation-choice-hint {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; padding: 0; border: 0; background: transparent; color: var(--hint); font-size: 13px; font-weight: 600;
}
@media (max-width: 767px) {
  #rs dialog#generation-style-dialog[open] {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 92dvh; margin: 0; overflow-y: auto;
    padding: 22px 20px calc(18px + var(--safe-b, 0px)); border-width: 1px 0 0; border-radius: 24px 24px 0 0;
  }
}
#rs #generation-style-dialog .generation-product-summary { background: transparent !important; border: 0 !important; box-shadow: none !important; }
#rs #generation-style-dialog .generation-choice-hint { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }

/* ── Passaggi della generazione: stesso foglio dal basso per tutti ────────── */
#rs dialog.generation-gender-dialog,
#rs dialog.generation-background-dialog,
#rs dialog.flatlay-confirm-dialog,
#rs dialog.photo-regeneration-dialog { border: 1px solid var(--border); box-shadow: none; background: var(--surface); color: var(--text); }
#rs dialog.generation-gender-dialog::backdrop,
#rs dialog.generation-background-dialog::backdrop,
#rs dialog.flatlay-confirm-dialog::backdrop,
#rs dialog.photo-regeneration-dialog::backdrop { background: rgba(8, 8, 14, .6); }
@media (max-width: 767px) {
  #rs dialog.generation-gender-dialog[open], #rs dialog.generation-background-dialog[open], #rs dialog.flatlay-confirm-dialog[open],
  #rs dialog.photo-regeneration-dialog[open] {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 92dvh; margin: 0; overflow-y: auto;
    padding: 22px 20px calc(18px + var(--safe-b, 0px)); border-width: 1px 0 0; border-radius: 24px 24px 0 0;
  }
}
/* Titoli e testi: a sinistra, senza icona */
#rs :is(.generation-gender-dialog, .generation-background-dialog, .flatlay-confirm-dialog) .generation-choice-title {
  display: block; margin: 0 0 6px; padding-right: 44px; font-size: 22px; line-height: 1.15; letter-spacing: -.02em; text-align: left;
}
#rs :is(.generation-gender-dialog, .generation-background-dialog, .flatlay-confirm-dialog) .generation-choice-title svg { display: none; }
#rs :is(.generation-gender-dialog, .generation-background-dialog, .photo-regeneration-choice-dialog) > p,
#rs .flatlay-confirm-dialog .flatlay-confirm-subtitle,
#rs .photo-regeneration-dialog > p { margin: 0 0 16px; padding-right: 44px; color: var(--hint); font-size: 14px; line-height: 1.45; text-align: left; }
#rs .flatlay-confirm-header { display: block; position: static; margin: 0; padding: 0; }
#rs .flatlay-confirm-dialog .flatlay-confirm-subtitle { margin: 0 0 14px; }
#rs :is(.generation-gender-dialog, .generation-background-dialog, .photo-regeneration-choice-dialog, .flatlay-confirm-dialog) :is(.generation-choice-close, .flatlay-confirm-close) {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface2); color: var(--text-2);
}

/* Chi indossa il capo?: due schede come nella scelta del tipo di foto */
#rs .generation-gender-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#rs .generation-gender-option {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; padding: 12px 10px 14px;
  border: 1.5px solid var(--border); border-radius: 18px; background: var(--surface2); color: var(--text);
}
#rs .generation-gender-option .generation-gender-icon {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1; max-height: 118px; margin-bottom: 8px; padding: 6px; box-sizing: border-box;
  border-radius: 12px; background: color-mix(in srgb, var(--primary) 10%, var(--surface2));
}
#rs .generation-gender-option .generation-gender-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: transparent; }
#rs .generation-gender-option strong { font-size: 17px; }
#rs .generation-gender-option > span:not(.generation-gender-icon) { font-size: 13px; color: var(--hint); text-align: center; }

/* Righe di scelta (sfondo, rigenerazione): schede con freccia */
#rs .generation-background-options, #rs .photo-regeneration-choice-options { display: grid; gap: 10px; }
#rs .generation-background-options button, #rs .photo-regeneration-choice-options button {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 14px 44px 14px 16px;
  border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface2); color: var(--text); text-align: left;
}
#rs .generation-background-options button::after, #rs .photo-regeneration-choice-options button::after {
  content: ''; position: absolute; top: 50%; right: 18px; width: 8px; height: 8px; border-top: 2px solid var(--hint); border-right: 2px solid var(--hint); transform: translateY(-50%) rotate(45deg);
}
#rs .generation-background-options button:hover, #rs .photo-regeneration-choice-options button:hover,
#rs .generation-background-options button:focus-visible, #rs .photo-regeneration-choice-options button:focus-visible {
  border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface2));
}
#rs .generation-background-options button strong, #rs .photo-regeneration-choice-options button { font-size: 16px; font-weight: 800; }
#rs .generation-background-options button span, #rs .photo-regeneration-choice-options button span { display: block; color: var(--hint); font-size: 13px; font-weight: 500; }
#rs .photo-regeneration-choice-dialog h2, #rs .photo-regeneration-dialog h2 { margin: 0 0 6px; padding-right: 44px; color: var(--text); font-size: 22px; line-height: 1.15; letter-spacing: -.02em; text-align: left; }

/* Azioni: principale a tinta unita, secondaria discreta */
#rs :is(.generation-choice-cancel, .photo-regeneration-choice-cancel) {
  display: block; width: 100%; min-height: 48px; margin: 10px 0 0; border: 0; border-radius: 14px; background: var(--surface2); color: var(--text); font: 700 15px/1 var(--font-family, inherit);
}
#rs .flatlay-confirm-actions, #rs .photo-regeneration-actions { display: flex; flex-direction: column-reverse; gap: 10px; margin-top: 14px; }
#rs .flatlay-confirm-actions button, #rs .photo-regeneration-actions button {
  width: 100%; min-height: 50px; border: 0; border-radius: 14px; background: var(--surface2); color: var(--text); font: 700 15px/1 var(--font-family, inherit); box-shadow: none;
}
#rs .flatlay-confirm-actions .primary, #rs .photo-regeneration-actions #photo-regeneration-confirm { background: #6247f4 !important; color: #fff !important; box-shadow: none !important; }
#rs .flatlay-confirm-message { margin: 12px 0 0; color: var(--hint); font-size: 13px; line-height: 1.45; text-align: left; }

/* Passaggio tra due fogli della generazione: stessa cornice, il contenuto si dissolve */
dialog.is-handoff[open], dialog.is-handoff[open]::backdrop { animation: none !important; }
dialog.is-handoff[open] > * { animation: generationStepFade .24s ease both; }
@keyframes generationStepFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.is-handoff[open] > * { animation: none; } }
/* L'opzione "Auto" resta nascosta quando ha l'attributo hidden */
#rs .generation-gender-option[hidden] { display: none !important; }

/* Genera con Depop Fold: scelta della scena (una o più) */
#rs .flatlay-confirm-handle { display: none !important; }
#rs .flatlay-confirm-dialog .flatlay-confirm-stage { margin: 0 0 12px; }
#rs .flatlay-confirm-preview { border: 0; border-radius: 18px; background: var(--surface2); overflow: hidden; }
#rs .flatlay-confirm-caption { background: rgba(10, 10, 16, .62) !important; color: #fff !important; border: 0 !important; }
#rs .flatlay-confirm-caption strong, #rs .flatlay-confirm-caption span { color: #fff !important; }
#rs .flatlay-confirm-scenes { justify-content: flex-start; gap: 10px; max-width: none; margin: 0 -2px 4px; padding: 2px 2px 6px; }
#rs .flatlay-confirm-scene {
  position: relative; flex: 0 0 auto; width: 78px; padding: 0 !important; gap: 6px; border: 0 !important; background: transparent !important; box-shadow: none !important;
}
#rs .flatlay-confirm-scene img { width: 100%; max-width: none; aspect-ratio: 3 / 4; border-radius: 12px; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s ease; }
#rs .flatlay-confirm-scene[aria-pressed="true"] img { outline-color: #6247f4; }
#rs .flatlay-confirm-scene strong { color: var(--hint); font-size: 12px; font-weight: 700; }
#rs .flatlay-confirm-scene[aria-pressed="true"] strong { color: var(--text); }
#rs .flatlay-confirm-scene-check { top: 6px; left: auto; right: 6px; width: 20px; height: 20px; border-color: var(--surface); font-size: 12px; }
#rs .flatlay-confirm-actions { flex-direction: column-reverse !important; }
#rs .flatlay-confirm-actions button:not(.primary) { background: var(--surface2) !important; color: var(--text) !important; }
#rs .flatlay-confirm-actions #flatlay-confirm-create-scene { background: #6247f4 !important; color: #fff !important; }
/* Con una sola scena la striscia di miniature è superflua */
#rs .flatlay-confirm-scenes:has(.flatlay-confirm-scene:only-child) { display: none; }
/* Nessuna scena ancora: segnaposto compatto con uno sfondo di esempio */
#rs .flatlay-confirm-preview:has(#flatlay-confirm-image[hidden]) { aspect-ratio: auto; min-height: 0; height: 150px; }
#rs .flatlay-confirm-placeholder {
  display: grid; place-items: center; width: 100%; height: 100%; padding: 16px; text-align: center; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4;
  background: linear-gradient(rgba(10,10,16,.55), rgba(10,10,16,.55)), url('assets/scene/examples/01-parquet-marrone.webp') center / cover;
}
#rs .flatlay-confirm-placeholder[hidden] { display: none; }
#rs :is(.generation-choice-cancel, .photo-regeneration-choice-cancel) { background: var(--surface2) !important; color: var(--text) !important; }

/* ── Misure: avatar quadrati interi, foto scena a tutta larghezza ─────────── */
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon,
#rs #generation-style-dialog .generation-mode-option img {
  width: min(100%, 124px); height: auto; max-height: none; aspect-ratio: 1 / 1; margin: 0 auto 8px; padding: 4px; box-sizing: border-box;
  border-radius: 16px; background: color-mix(in srgb, var(--primary) 12%, var(--surface2)); overflow: hidden;
}
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon img {
  display: block; width: 100%; height: 100%; max-width: none; padding: 0; margin: 0; border-radius: 0; background: transparent; object-fit: contain;
}
#rs #generation-style-dialog .generation-mode-option img { object-fit: contain; }

#rs .flatlay-confirm-dialog .flatlay-confirm-stage { display: block; margin: 0 0 12px; }
#rs .flatlay-confirm-dialog .flatlay-confirm-preview {
  position: relative; width: 100%; max-width: none; height: auto; max-height: none; aspect-ratio: 3 / 4; border-radius: 18px;
}
#rs .flatlay-confirm-dialog .flatlay-confirm-preview img { width: 100%; height: 100%; object-fit: cover; }
#rs .flatlay-confirm-dialog .flatlay-confirm-preview:has(#flatlay-confirm-image[hidden]) { aspect-ratio: auto; height: 150px; }
#rs .flatlay-confirm-scenes { margin: 0 -6px 2px; padding: 8px 6px 8px; }
#rs .flatlay-confirm-scene { width: 64px; }
#rs .flatlay-confirm-scene img { outline-offset: 0; box-shadow: 0 0 0 0 transparent; outline: 0; border: 2px solid transparent; box-sizing: border-box; }
#rs .flatlay-confirm-scene[aria-pressed="true"] img { border-color: #6247f4; outline: 0; }
@media (max-width: 767px) {
  #rs .flatlay-confirm-dialog .flatlay-confirm-subtitle { display: none; }
  #rs .flatlay-confirm-dialog .generation-choice-title { margin-bottom: 14px; }
  #rs .flatlay-confirm-actions { flex-direction: row !important; margin-top: 8px; gap: 10px; }
  #rs .flatlay-confirm-actions button { width: auto; flex: 1 1 auto; }
  #rs .flatlay-confirm-actions #flatlay-confirm-cancel, #rs .flatlay-confirm-actions #single-view-confirm-cancel { flex: 0 0 auto; padding-inline: 20px; }
  #rs .flatlay-confirm-dialog { padding-top: 20px; }
}
#rs .flatlay-confirm-dialog .flatlay-confirm-close { top: -6px !important; right: 0 !important; margin: 0 !important; z-index: 2; }
#rs dialog :is(.generation-choice-close, .flatlay-confirm-close, .scene-example-dialog-close):focus { outline: none; box-shadow: none; }
/* X allineata al centro del titolo in ogni foglio */
#rs #generation-gender-dialog .generation-choice-close, #rs #generation-background-dialog .generation-choice-close { top: 31px; }
#rs #photo-regeneration-choice-dialog .generation-choice-close { top: 31px; }
/* Scelta uomo/donna: linea consigliata dall'analisi */
#rs .generation-gender-option { position: relative; }
#rs .generation-gender-option.is-suggested { border-color: #6247f4; background: color-mix(in srgb, #6247f4 10%, var(--surface2)); }
#rs .generation-suggested {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 3px 11px; border-radius: 999px;
  background: #6247f4; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
/* Angoli annidati coerenti: raggio interno = raggio scheda - spazio interno (22 - 8 = 14) */
#rs #generation-gender-dialog .generation-gender-option,
#rs #generation-style-dialog .generation-mode-option { padding: 8px 8px 14px; border-radius: 22px; }
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon,
#rs #generation-style-dialog .generation-mode-option img { width: 100%; max-width: none; border-radius: 14px; margin: 0 0 8px; }
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon img { border-radius: 0; }
#rs .generation-suggested { top: -11px; }
/* Avatar: il fondo e l'angolo sono solo del riquadro, l'immagine è trasparente */
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon { padding: 0; }
#rs #generation-gender-dialog .generation-gender-option .generation-gender-icon img {
  width: 100%; height: 100%; padding: 8px; box-sizing: border-box; background: transparent !important; border-radius: 0 !important; object-fit: contain;
}
/* Galleria prodotto: tasto "tieni premuto per vedere l'originale" */
#rs .publication-gallery { position: relative; }
#rs .publication-compare-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(10, 10, 16, .62); color: #fff; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: transform .12s ease, background-color .12s ease;
}
#rs .publication-compare-btn.is-holding { transform: scale(.92); background: #6247f4; }
#rs .publication-original {
  position: absolute; top: 0; left: 0; z-index: 2; width: 100%; aspect-ratio: 3 / 4; max-height: min(72vh, 680px); overflow: hidden; border-radius: 18px; background: var(--surface2, #222);
  pointer-events: none;
}
#rs .publication-original[hidden] { display: none; }
#rs .publication-original img { position: absolute; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; }
#rs .publication-original img.is-current { display: block; }
#rs .publication-original span {
  position: absolute; top: 10px; left: 10px; padding: 5px 11px; border-radius: 999px; background: #6247f4; color: #fff; font-size: 12px; font-weight: 700;
}

/* ── Foglio "Crediti esauriti" ────────────────────────────────────────────── */
#rs #credits-paywall-dialog { border: 1px solid var(--border); box-shadow: none; background: var(--surface); }
#rs #credits-paywall-dialog::backdrop { background: rgba(8, 8, 14, .6); }
@media (max-width: 767px) {
  #rs dialog#credits-paywall-dialog[open] {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 94dvh; margin: 0; overflow-y: auto;
    padding: 0; border-width: 1px 0 0; border-radius: 24px 24px 0 0;
  }
}
#rs #credits-paywall-dialog .credits-paywall-content { display: flex; flex-direction: column; gap: 0; padding: 22px 20px calc(18px + var(--safe-b, 0px)); }
#rs #credits-paywall-dialog .credits-paywall-handle { display: none; }
#rs #credits-paywall-dialog .credits-ended-badge, #rs #credits-paywall-dialog .credits-current-plan { display: none !important; }
#rs #credits-paywall-dialog h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.15; letter-spacing: -.02em; text-align: left; }
#rs #credits-paywall-dialog .credits-paywall-copy { margin: 0 0 18px; color: var(--hint); font-size: 14px; line-height: 1.45; text-align: left; }
#rs #credits-paywall-dialog .paywall-plan-teaser {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 14px; padding: 8px; border: 1.5px solid var(--border) !important; border-radius: 22px;
  background: var(--surface2) !important; box-shadow: none !important; text-align: left;
}
#rs #credits-paywall-dialog .paywall-plan-teaser img { flex: 0 0 76px; width: 76px; height: 76px; border-radius: 14px; object-fit: cover; }
#rs #credits-paywall-dialog .paywall-plan-details { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
#rs #credits-paywall-dialog .paywall-plan-label { color: var(--hint); font-size: 12px; font-weight: 600; }
#rs #credits-paywall-dialog .paywall-plan-name { color: var(--text); font-size: 18px; font-weight: 800; line-height: 1.1; }
#rs #credits-paywall-dialog .paywall-plan-price { color: var(--text); font-size: 16px; font-weight: 800; }
#rs #credits-paywall-dialog .paywall-plan-price small { color: var(--hint); font-size: 13px; font-weight: 600; }
#rs #credits-paywall-dialog .paywall-plan-credits { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, #6247f4 18%, transparent); color: var(--primary); font-size: 12px; font-weight: 700; }
#rs #credits-paywall-dialog .paywall-plan-action { display: none; }
#rs #credits-paywall-dialog .paywall-benefits { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
#rs #credits-paywall-dialog .paywall-benefits li { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--surface2); color: var(--text); font-size: 13px; font-weight: 600; }
#rs #credits-paywall-dialog .paywall-benefit-icon { display: grid; place-items: center; width: 20px; height: 20px; border: 0; background: transparent; color: var(--primary); }
#rs #credits-paywall-dialog .credits-paywall-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 52px; margin: 0 0 10px; border: 0; border-radius: 14px;
  background: #6247f4 !important; color: #fff !important; box-shadow: none !important; font: 700 16px/1 var(--font-family, inherit);
}
#rs #credits-paywall-dialog .credits-paywall-topup {
  display: block; width: 100%; min-height: 50px; margin: 0 0 6px; border: 0 !important; border-radius: 14px; background: var(--surface2) !important; color: var(--text) !important; font: 700 15px/1 var(--font-family, inherit);
}
#rs #credits-paywall-dialog .credits-paywall-topup span { display: none; }
#rs #credits-paywall-dialog .credits-paywall-topup strong { color: var(--text); font-weight: 700; }
#rs #credits-paywall-dialog .credits-paywall-secondary { width: 100%; min-height: 44px; border: 0 !important; background: transparent !important; color: var(--hint) !important; font: 600 14px/1 var(--font-family, inherit); }
#rs #credits-paywall-dialog .credits-paywall-manage { width: 100%; min-height: 36px; border: 0; background: transparent; color: var(--hint); font: 500 13px/1.3 var(--font-family, inherit); }
#rs #credits-paywall-dialog .credits-paywall-manage strong { color: var(--primary); font-weight: 700; text-decoration: none; }
#rs #credits-paywall-dialog .paywall-benefits { flex-direction: column; flex-wrap: nowrap; gap: 8px; margin: 0 2px 18px; }
#rs #credits-paywall-dialog .paywall-benefits li { padding: 0; background: transparent; font-size: 14px; font-weight: 600; gap: 10px; }
#rs #credits-paywall-dialog .paywall-benefit-icon { flex: 0 0 20px; background: transparent !important; box-shadow: none !important; border-radius: 0; }

/* Crediti esauriti: con il piano più alto si mostrano solo le ricariche */
#rs #credits-paywall-dialog.is-topup-only .paywall-plan-teaser,
#rs #credits-paywall-dialog.is-topup-only .paywall-benefits,
#rs #credits-paywall-dialog.is-topup-only .credits-paywall-primary,
#rs #credits-paywall-dialog.is-topup-only .credits-paywall-topup { display: none !important; }
#rs #credits-paywall-dialog .credits-paywall-packs:not([hidden]) { display: grid; gap: 10px; margin: 0 0 12px; }
#rs #credits-paywall-dialog .paywall-pack {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 58px; padding: 0 18px;
  border: 1.5px solid var(--border); border-radius: 18px; background: var(--surface2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
#rs #credits-paywall-dialog .paywall-pack:hover, #rs #credits-paywall-dialog .paywall-pack:focus-visible { border-color: #6247f4; }
#rs #credits-paywall-dialog .paywall-pack:disabled { opacity: .5; cursor: default; }
#rs #credits-paywall-dialog .paywall-pack strong { font-size: 17px; font-weight: 800; }
#rs #credits-paywall-dialog .paywall-pack span { padding: 6px 14px; border-radius: 999px; background: #6247f4; color: #fff; font-size: 14px; font-weight: 700; }
#rs #credits-paywall-dialog .paywall-pack:disabled span { background: var(--surface); color: var(--hint); }
#rs #credits-paywall-dialog .credits-paywall-packs-note { margin: 0; padding: 14px 0; color: var(--hint); font-size: 14px; text-align: center; }

/* ── Paywall: proposta di acquisto (versione definitiva) ──────────────────── */
/* Foto prima / dopo: mostra subito il risultato, solo per chi non ha ancora un piano */
#rs #credits-paywall-dialog .paywall-hero { display: none; }
#rs #credits-paywall-dialog.is-trial .paywall-hero { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; }
#rs #credits-paywall-dialog .paywall-hero figure { position: relative; flex: 0 1 132px; margin: 0; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 18px; background: var(--surface2); }
#rs #credits-paywall-dialog .paywall-hero figure.is-after { outline: 2px solid #6247f4; outline-offset: 0; }
#rs #credits-paywall-dialog .paywall-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
#rs #credits-paywall-dialog .paywall-hero figcaption {
  position: absolute; left: 8px; bottom: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 10, 16, .66); color: #fff; font-size: 11px; font-weight: 700;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
#rs #credits-paywall-dialog .paywall-hero figure.is-after figcaption { background: #6247f4; }
#rs #credits-paywall-dialog .paywall-hero-arrow { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #6247f4; color: #fff; }

/* Titolo e testo */
#rs #credits-paywall-dialog h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.12; letter-spacing: -.025em; }
#rs #credits-paywall-dialog .credits-paywall-copy { margin: 0 0 22px; font-size: 14.5px; line-height: 1.45; }

/* Scheda del piano proposto */
#rs #credits-paywall-dialog .paywall-plan-teaser {
  position: relative; display: block; margin: 8px 0 16px; padding: 18px 16px 14px; border: 2px solid #6247f4 !important; border-radius: 22px;
  background: color-mix(in srgb, #6247f4 9%, var(--surface2)) !important;
}
#rs #credits-paywall-dialog .paywall-plan-teaser > img { display: none; }
#rs #credits-paywall-dialog .paywall-plan-badge {
  position: absolute; top: -11px; left: 16px; padding: 3px 12px; border-radius: 999px; background: #6247f4; color: #fff; font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
}
#rs #credits-paywall-dialog .paywall-plan-details { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name price" "note note" "credits credits"; align-items: end; gap: 4px 12px; width: 100%; }
#rs #credits-paywall-dialog .paywall-plan-label { display: none; }
#rs #credits-paywall-dialog .paywall-plan-name { grid-area: name; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
#rs #credits-paywall-dialog .paywall-plan-price { grid-area: price; justify-self: end; display: flex; align-items: baseline; gap: 3px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
#rs #credits-paywall-dialog .paywall-plan-price small { font-size: 13px; font-weight: 600; }
#rs #credits-paywall-dialog .paywall-plan-billing-note { grid-area: note; color: var(--hint); font-size: 12.5px; line-height: 1.4; }
#rs #credits-paywall-dialog .paywall-plan-credits { grid-area: credits; justify-self: start; margin-top: 8px; padding: 4px 11px; font-size: 12.5px; }

/* Vantaggi: elenco con spunte */
#rs #credits-paywall-dialog .paywall-benefits { gap: 10px; margin: 0 2px 20px; }
#rs #credits-paywall-dialog .paywall-benefits li { align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.35; }
#rs #credits-paywall-dialog .paywall-benefit-icon {
  flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; border-radius: 50% !important; background: color-mix(in srgb, #6247f4 20%, transparent) !important; color: var(--primary);
}

/* Azione principale e rassicurazioni */
#rs #credits-paywall-dialog .credits-paywall-primary { min-height: 56px; margin: 0 0 8px; border-radius: 16px; font-size: 17px; }
#rs #credits-paywall-dialog .paywall-trust { margin: 0 0 10px; color: var(--hint); font-size: 12.5px; text-align: center; }
#rs #credits-paywall-dialog .credits-paywall-topup { min-height: 44px; margin: 0; background: transparent !important; color: var(--primary) !important; font-size: 14px; }
#rs #credits-paywall-dialog .credits-paywall-topup strong { color: var(--primary); font-weight: 700; }
#rs #credits-paywall-dialog .credits-paywall-secondary { min-height: 40px; }

/* Solo ricariche (piano più alto): niente scheda, vantaggi né garanzie sul piano */
#rs #credits-paywall-dialog.is-topup-only .paywall-trust { display: none; }
/* Compatta: tutto il foglio entra in uno schermo da 812px senza scorrere */
#rs #credits-paywall-dialog.is-trial .paywall-hero { margin-bottom: 14px; }
#rs #credits-paywall-dialog .paywall-hero figure { flex: 0 1 112px; }
#rs #credits-paywall-dialog .credits-paywall-content { padding-top: 18px; }
#rs #credits-paywall-dialog .credits-paywall-copy { margin-bottom: 18px; }
#rs #credits-paywall-dialog .paywall-benefits { gap: 8px; margin-bottom: 16px; }
#rs #credits-paywall-dialog .credits-paywall-manage { min-height: 30px; }
/* Primo acquisto: un solo percorso, senza alternative che distraggono */
#rs #credits-paywall-dialog.is-trial .credits-paywall-topup { display: none; }

/* ── Paywall: rifinitura (scala di spazi 8 / 16 / 24, un solo raggio) ──────── */
#rs #credits-paywall-dialog .credits-paywall-content { padding: 24px 24px calc(20px + var(--safe-b, 0px)); }

/* Prima / dopo: un'unica immagine divisa a metà */
#rs #credits-paywall-dialog .paywall-hero { display: none; }
#rs #credits-paywall-dialog.is-trial .paywall-hero {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 100%; height: 200px; margin: 0 0 24px; overflow: hidden; border-radius: 20px; background: var(--surface2);
}
#rs #credits-paywall-dialog .paywall-hero img { display: block; width: 100%; height: 100%; min-width: 0; object-fit: cover; }
#rs #credits-paywall-dialog .ph-before { object-position: 50% 30%; }
#rs #credits-paywall-dialog .ph-after { object-position: 50% 38%; }
#rs #credits-paywall-dialog .ph-divider {
  position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); color: var(--text); transform: translate(-50%, -50%); border: 2px solid var(--surface);
}
#rs #credits-paywall-dialog .ph-tag {
  position: absolute; top: 10px; padding: 4px 11px; border-radius: 999px; background: rgba(10, 10, 16, .66); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
#rs #credits-paywall-dialog .ph-tag-before { left: 10px; }
#rs #credits-paywall-dialog .ph-tag-after { right: 10px; background: #6247f4; }

/* Testi */
#rs #credits-paywall-dialog h2 { margin: 0 0 8px; font-size: 25px; }
#rs #credits-paywall-dialog .credits-paywall-copy { margin: 0 0 24px; font-size: 14.5px; }

/* Scheda piano: più respiro, bordo sottile, prezzo come protagonista */
#rs #credits-paywall-dialog .paywall-plan-teaser {
  margin: 0 0 24px; padding: 22px 20px 18px; border: 1.5px solid color-mix(in srgb, #6247f4 70%, var(--border)) !important; border-radius: 20px;
  background: color-mix(in srgb, #6247f4 7%, var(--surface2)) !important;
}
#rs #credits-paywall-dialog .paywall-plan-badge { top: -12px; left: 20px; padding: 4px 12px; font-size: 11px; }
#rs #credits-paywall-dialog .paywall-plan-details { gap: 6px 12px; }
#rs #credits-paywall-dialog .paywall-plan-name { font-size: 20px; }
#rs #credits-paywall-dialog .paywall-plan-price { font-size: 28px; }
#rs #credits-paywall-dialog .paywall-plan-billing-note { font-size: 12.5px; }
#rs #credits-paywall-dialog .paywall-plan-credits { margin-top: 10px; padding: 5px 12px; background: color-mix(in srgb, #6247f4 16%, transparent); }

/* Vantaggi */
#rs #credits-paywall-dialog .paywall-benefits { gap: 12px; margin: 0 0 24px; }
#rs #credits-paywall-dialog .paywall-benefits li { font-size: 14.5px; }

/* Azione */
#rs #credits-paywall-dialog .credits-paywall-primary { min-height: 56px; margin: 0 0 12px; border-radius: 16px; }
#rs #credits-paywall-dialog .paywall-trust { margin: 0 0 8px; }
#rs #credits-paywall-dialog .credits-paywall-secondary { min-height: 40px; }
#rs #credits-paywall-dialog .credits-paywall-manage { min-height: 32px; margin-top: 4px; }

/* Schermi bassi: foto meno alta */
@media (max-height: 760px) { #rs #credits-paywall-dialog.is-trial .paywall-hero { height: 150px; margin-bottom: 18px; } }
/* Il pulsante deve vedersi senza scorrere: foto più bassa, spazi 20, niente "gestisci" per chi non ha un piano */
#rs #credits-paywall-dialog .credits-paywall-content { padding-top: 22px; }
#rs #credits-paywall-dialog.is-trial .paywall-hero { height: 168px; margin-bottom: 20px; }
#rs #credits-paywall-dialog .credits-paywall-copy { margin-bottom: 20px; }
#rs #credits-paywall-dialog .paywall-plan-teaser { margin-bottom: 20px; padding: 20px 20px 16px; }
#rs #credits-paywall-dialog .paywall-benefits { gap: 10px; margin-bottom: 20px; }
#rs #credits-paywall-dialog.is-trial .credits-paywall-manage { display: none; }
#rs #credits-paywall-dialog .credits-paywall-secondary { min-height: 36px; }
/* Foto prima/dopo: il capo si vede per intero (niente ritagli), la riga dei crediti non si ripete */
#rs #credits-paywall-dialog.is-trial .paywall-hero { height: 232px; }
#rs #credits-paywall-dialog .paywall-hero img { object-fit: contain; background: var(--surface2); }
#rs #credits-paywall-dialog .ph-before, #rs #credits-paywall-dialog .ph-after { object-position: 50% 50%; }
#rs #credits-paywall-dialog .paywall-plan-credits { display: none; }
@media (max-height: 760px) { #rs #credits-paywall-dialog.is-trial .paywall-hero { height: 180px; } }
/* Prima/dopo: pannelli proporzionati alle due foto (il capo riempie il riquadro, niente barre, niente ritagli) */
#rs #credits-paywall-dialog.is-trial .paywall-hero { height: 200px; grid-template-columns: 1fr 1.2fr; }
#rs #credits-paywall-dialog .paywall-hero img { object-fit: cover; background: transparent; }
@media (max-height: 760px) { #rs #credits-paywall-dialog.is-trial .paywall-hero { height: 168px; } }

/* ── Schermata "Modifica prodotto": schede pulite, righe leggibili ─────────── */
#rs #screen-details #details-form:not(.is-publication-sheet) {
  display: flex; flex-direction: column; gap: 16px; padding-bottom: calc(110px + var(--safe-b, 0px));
}
#rs #screen-details #details-form:not(.is-publication-sheet) > :is(.edit-section-card, .details-hero, .details-missing-summary, .details-advanced, .draft-photo-editor) {
  margin: 0 !important; padding: 18px 16px !important; border: 1px solid var(--border) !important; border-radius: 20px !important;
  background: var(--surface) !important; box-shadow: none !important;
}
/* Intestazione prodotto: foto + titolo + stato */
#rs #screen-details .details-hero { display: flex; align-items: center; gap: 14px; padding: 14px 16px !important; }
#rs #screen-details .details-hero-thumb { flex: 0 0 64px; width: 64px; height: 84px; border-radius: 12px; overflow: hidden; }
#rs #screen-details .details-hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
#rs #screen-details .details-hero-info { min-width: 0; }
#rs #screen-details .details-hero-title { margin: 0 0 8px; font-size: 20px; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; color: var(--text); }
/* Titoli di sezione */
#rs #screen-details #details-form:not(.is-publication-sheet) .edit-section-header { margin: 0 0 6px !important; font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
/* Righe: elenco unico con separatori sottili */
#rs #screen-details #details-form:not(.is-publication-sheet) .edit-row {
  min-height: 54px; margin: 0 !important; padding: 12px 0 !important; border: 0 !important; border-top: 1px solid var(--border) !important; border-radius: 0 !important; background: transparent !important;
}
#rs #screen-details #details-form:not(.is-publication-sheet) .edit-section-header + .edit-row { border-top: 0 !important; }
#rs #screen-details .edit-row-label { color: var(--hint); font-size: 14px; font-weight: 500; }
#rs #screen-details .edit-row-value { color: var(--text); font-size: 15px; font-weight: 600; }
#rs #screen-details .edit-row-value.is-empty { color: var(--primary); font-weight: 700; }
#rs #screen-details .edit-row-arrow { color: var(--hint) !important; opacity: .7; }
#rs #screen-details .edit-row.is-missing .edit-row-label { color: var(--text); font-weight: 700; }
/* Foto originali */
#rs #screen-details .draft-photo-editor-hint, #rs #screen-details .draft-photo-view-status { color: var(--hint); font-size: 13px; line-height: 1.45; }
#rs #screen-details .draft-photo-add { border: 1.5px dashed color-mix(in srgb, var(--primary) 55%, var(--border)); border-radius: 16px; }
/* Avviso campi obbligatori */
#rs #screen-details #details-missing-summary:not([hidden]) { background: color-mix(in srgb, #f59e0b 9%, var(--surface)) !important; border-color: color-mix(in srgb, #f59e0b 35%, var(--border)) !important; }
/* Campi obbligatori mancanti: pallino, testo "+ Completa" e freccia in rosso */
#rs #screen-details .details-fields .edit-row.is-missing .edit-missing-hint { background: var(--red, #ef4444) !important; }
#rs #screen-details .details-fields .edit-row.is-missing .edit-row-value.is-empty { color: var(--red, #ef4444) !important; }
#rs #screen-details .details-fields .edit-row.is-missing .edit-row-arrow { color: var(--red, #ef4444) !important; opacity: 1; }
/* Fronte/Retro sulle foto originali: la scelta attiva è viola pieno, quella inattiva resta leggibile */
#rs #screen-details .draft-photo-view-controls { gap: 3px; padding: 3px; border-radius: 999px; background: rgba(10, 10, 16, .66); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#rs #screen-details .draft-photo-view-controls .draft-photo-side-choice {
  min-height: 28px; border: 0 !important; border-radius: 999px; background: transparent !important; color: rgba(255, 255, 255, .78); font-size: 11px; font-weight: 700; letter-spacing: .01em;
  transition: background-color .15s ease, color .15s ease;
}
#rs #screen-details .draft-photo-view-controls .draft-photo-side-choice.is-selected { background: #6247f4 !important; color: #fff; }
#rs #screen-details .draft-photo-view-controls .draft-photo-side-choice:not(.is-selected):hover:not(:disabled) { background: rgba(255, 255, 255, .14) !important; color: #fff; }
/* Opzioni foto: il menu a tendina non viene più tagliato */
#rs #screen-details #model-selector-card .worn-background-control,
#rs #screen-details #model-selector-card .flatlay-category-control {
  grid-template-columns: minmax(0, 1fr) !important; gap: 6px; padding: 14px 0 !important; border: 0 !important; border-top: 1px solid var(--border) !important; border-radius: 0 !important; background: transparent !important;
}
#rs #screen-details #model-selector-card .worn-background-control { border-top: 0 !important; padding-top: 4px !important; }
#rs #screen-details #details-advanced, #rs #screen-details #model-selector-card { background: transparent !important; border: 0 !important; box-shadow: none !important; }
#rs #screen-details #model-selector-card .worn-background-control > select.form-input {
  background-color: transparent !important; border: 0 !important; box-shadow: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14' fill='none' stroke='%23A6A8B8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l6 6-6 6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right center !important;
}
#rs #screen-details #model-selector-card .worn-background-control select.form-input {
  min-height: 30px; line-height: 1.3; text-align: left; text-align-last: left; padding: 0 22px 0 0;
}

/* ── App feel (PWA): niente pull-to-refresh/rimbalzo, nessun highlight o selezione sui controlli ── */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html, body { overscroll-behavior-y: none; }
}
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
button, [role="button"], summary, .nav-tab, .tab-nav, #bottom-bar-main, #app-top-header {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

/* ── Caricamenti: skeleton al posto dello spinner ── */
.screen-loading-overlay {
  justify-content: flex-start;
  align-items: stretch;
  padding: calc(64px + var(--safe-t, env(safe-area-inset-top, 0px))) 16px 24px;
}
.screen-loader-skeleton {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}
#screen-plan > .plan-loading-state .plan-loader-content {
  justify-content: flex-start;
  align-items: stretch;
  padding-top: 16px;
}
.screen-loader-skeleton .sk-hero { aspect-ratio: 4 / 3; border-radius: var(--radius-lg, 16px); }
.screen-loader-skeleton .sk-hero--short { aspect-ratio: 16 / 7; }
.screen-loader-skeleton .sk-block { padding: 6px 2px; }
.screen-loader-skeleton .sk-block .skeleton-line { margin-bottom: 12px; }
.screen-loader-skeleton .sk-block .skeleton-line:last-child { margin-bottom: 0; }
.screen-loader-skeleton .sk-row {
  display: grid;
  grid-template-columns: 44px 1fr 72px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  background: var(--surface);
}
.screen-loader-skeleton .sk-row--flat {
  grid-template-columns: 1fr 64px;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.screen-loader-skeleton .sk-row-lines .skeleton-line { margin-bottom: 10px; }
.screen-loader-skeleton .sk-row-lines .skeleton-line:last-child { margin-bottom: 0; }
.screen-loader-skeleton .sk-circle { width: 44px; height: 44px; border-radius: 50%; }
.screen-loader-skeleton .sk-pill { height: 30px; border-radius: 999px; }
/* Il testo resta per i lettori di schermo ma non si vede */
.screen-loading-overlay .screen-loader-text,
.plan-loader-content .screen-loader-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .screen-loader-skeleton .skeleton::after { animation: none !important; }
}

/* Shimmer più tenue nel tema scuro */
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) .screen-loader-skeleton .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
}

/* ── Avvio: scheletro che ricalca la home vera (misure prese dall'app) ── */
.app-loading.app-loading--shell { display: block; padding: 0; gap: 0; overflow: hidden; }
.app-loading--shell .app-loading-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.app-loading--shell .als-side, .app-loading--shell .als-dsearch { display: none; }
.app-loading--shell .als-header {
  display: flex; align-items: center; gap: 10px;
  height: calc(52px + var(--safe-t, env(safe-area-inset-top, 0px)));
  padding: var(--safe-t, env(safe-area-inset-top, 0px)) 16px 0;
  box-sizing: border-box;
}
.app-loading--shell .als-brand { width: 80px; height: 21px; border-radius: 6px; }
.app-loading--shell .als-spacer { flex: 1; }
.app-loading--shell .als-chip { width: 140px; height: 32px; border-radius: 999px; }
.app-loading--shell .als-dot { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; }
.app-loading--shell .als-content { padding: 52px 16px 120px; max-width: 620px; margin: 0 auto; box-sizing: border-box; }
.app-loading--shell .als-toolbar { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.app-loading--shell .als-title { width: 174px; height: 28px; border-radius: 8px; }
.app-loading--shell .als-pill {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 6px 0 14px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.app-loading--shell .als-pill > .skeleton { width: 20px; height: 20px; border-radius: 6px; }
.app-loading--shell .als-pill > .als-pill-wide { width: 86px; height: 32px; border-radius: 999px; }
.app-loading--shell .als-search {
  display: flex; align-items: center; gap: 10px; height: 44px; margin-top: 8px; padding: 0 14px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.app-loading--shell .als-search-icon { width: 16px; height: 16px; border-radius: 50%; }
.app-loading--shell .als-search-text { width: 130px; height: 12px; border-radius: 6px; }
.app-loading--shell .als-tabs { display: flex; justify-content: center; gap: 22px; height: 40px; margin-top: 16px; align-items: flex-start; padding-top: 10px; box-sizing: border-box; }
.app-loading--shell .als-tab { width: 60px; height: 14px; border-radius: 6px; }
.app-loading--shell .als-tab-wide { width: 118px; }
.app-loading--shell .als-tab.is-active { background: color-mix(in srgb, var(--primary, #6346F5) 22%, var(--surface2)); }
.app-loading--shell .als-invite {
  display: flex; align-items: center; gap: 12px; height: 54px; margin: 12px 4px 0; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.app-loading--shell .als-invite-icon { width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto; }
.app-loading--shell .als-invite-lines { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.app-loading--shell .als-l { display: block; height: 11px; border-radius: 6px; }
.app-loading--shell .als-l-title { width: 62%; height: 14px; }
.app-loading--shell .als-l-meta { width: 38%; }
.app-loading--shell .als-l-price { width: 46%; height: 18px; }
.app-loading--shell .als-grid { display: grid; gap: 12px; margin: 12px 4px 0; }
.app-loading--shell .als-card {
  display: flex; flex-direction: column; gap: 12px; padding: 15px 12px 12px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
}
.app-loading--shell .als-card-row { display: flex; gap: 12px; padding-left: 3px; }
.app-loading--shell .als-thumb { width: 74px; height: 96px; border-radius: 10px; flex: 0 0 auto; }
.app-loading--shell .als-card-lines { display: flex; flex-direction: column; gap: 12px; flex: 1; padding-top: 6px; }
.app-loading--shell .als-card-lines .als-l-meta { margin-top: 10px; }
.app-loading--shell .als-cta { height: 39px; border-radius: 12px; background: color-mix(in srgb, var(--primary, #6346F5) 20%, var(--surface2)); }
.app-loading--shell .als-bar {
  position: absolute; left: 14px; right: 14px; bottom: calc(16px + var(--safe-b, env(safe-area-inset-bottom, 0px)));
  max-width: 512px; height: 74px; margin: 0 auto; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-around; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 26px; background: var(--surface);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(20, 22, 40, .08));
}
.app-loading--shell .als-navi { width: 34px; height: 34px; border-radius: 10px; }
.app-loading--shell .als-fab {
  width: 64px; height: 64px; margin-top: -8px; border-radius: 24px;
  background: color-mix(in srgb, var(--primary, #6346F5) 70%, var(--surface));
}
@media (min-width: 1024px) {
  .app-loading--shell .als-bar, .app-loading--shell .als-brand { display: none; }
  .app-loading--shell .als-side {
    position: absolute; inset: 0 auto 0 0; width: 186px; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 6px; padding: 22px 14px 18px;
    background: rgb(23, 25, 31);
  }
  .app-loading--shell .als-side-brand { display: flex; align-items: center; gap: 10px; height: 40px; margin: 0 0 18px 6px; }
  .app-loading--shell .als-side-logo { width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--primary, #6346F5) 70%, #17191f); }
  .app-loading--shell .als-side-word { width: 70px; height: 16px; border-radius: 6px; background: rgba(255, 255, 255, .14); }
  .app-loading--shell .als-side-nav { height: 44px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
  .app-loading--shell .als-side-nav.is-active { background: rgb(48, 39, 81); }
  .app-loading--shell .als-side-spacer { flex: 1; }
  .app-loading--shell .als-side-cta { height: 44px; border-radius: 10px; background: rgb(88, 56, 232); opacity: .55; margin-bottom: 18px; }
  .app-loading--shell .als-side-foot { height: 20px; width: 70%; border-radius: 6px; background: rgba(255, 255, 255, .08); margin-left: 10px; }
  .app-loading.app-loading--shell { background: rgb(245, 247, 251); }
  :is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) .app-loading.app-loading--shell { background: rgb(13, 13, 20); }
  :is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) .app-loading--shell .als-side { background: rgb(14, 15, 23); }
  .app-loading--shell .als-main { margin-left: 186px; }
  .app-loading--shell .als-tabs { position: relative; }
  .app-loading--shell .als-tabs::after {
    content: ""; position: absolute; right: 0; top: 0; width: 250px; height: 42px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); box-sizing: border-box;
  }
  .app-loading--shell .als-header { height: 72px; padding: 0 40px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .app-loading--shell .als-dsearch { display: block; width: 360px; height: 40px; border-radius: 12px; }
  .app-loading--shell .als-chip { width: 140px; height: 32px; border-radius: 10px; }
  .app-loading--shell .als-content { max-width: none; padding: 64px 40px 40px; }
  .app-loading--shell .als-toolbar, .app-loading--shell .als-search { display: none; }
  .app-loading--shell .als-invite { order: -1; max-width: 808px; margin: 0 0 12px 20px; }
  .app-loading--shell .als-content { display: flex; flex-direction: column; }
  .app-loading--shell .als-tabs { justify-content: flex-start; gap: 24px; margin: 0; height: 56px; padding-top: 22px; border-bottom: 1px solid var(--border); }
  .app-loading--shell .als-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin: 16px 0 0; }
  .app-loading--shell .als-card { border-radius: 20px; padding: 17px; height: 185px; }
  .app-loading--shell .als-thumb { width: 84px; height: 104px; border-radius: 8px; }
  .app-loading--shell .als-cta { height: 38px; border-radius: 8px; margin-top: auto; }
}
@media (max-width: 1023px) {
  .app-loading--shell .als-card:nth-child(n+4) { display: none; }
}

/* ── Foto ingrandita: riflesso che scorre sull'anteprima al posto dello spinner ── */
#rs .img-modal-loader {
  inset: 0; top: 0; left: 0; transform: none;
  width: auto; height: auto;
  border: 0; border-radius: 0; box-shadow: none;
  background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  overflow: hidden;
}
#rs .img-modal-loader .img-modal-spinner { display: none; }
#rs .img-modal-loader::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .16) 50%, transparent 70%);
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite;
}

/* ── Anteprima scena: riquadro skeleton con il testo, niente spinner ── */
#rs .scene-preview-loading {
  overflow: hidden;
  background: var(--surface2);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  color: var(--text-2);
}
#rs .scene-preview-loading .scene-preview-spinner { display: none; }
#rs .scene-preview-loading::before {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite;
}
#rs .scene-preview-loading > span { position: relative; }
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) #rs .scene-preview-loading::before,
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) .app-loading--shell .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
}

@media (prefers-reduced-motion: reduce) {
  .app-loading--shell .skeleton::after,
  #rs .img-modal-loader::after,
  #rs .scene-preview-loading::before { animation: none !important; }
}

/* ── Scena: skeleton mentre arrivano i dati (niente "La tua scena apparirà qui") ── */
#rs #screen-scene.is-scene-boot .scene-preview-frame {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
}
#rs #screen-scene.is-scene-boot .scene-preview-frame > :not(.scene-preview-loading),
#rs #screen-scene.is-scene-boot .scene-preview-carousel-dots,
#rs #screen-scene.is-scene-boot .scene-status,
#rs #screen-scene.is-scene-boot .scene-example-list > * {
  visibility: hidden;
}
#rs #screen-scene.is-scene-boot .scene-preview-frame::after,
#rs #screen-scene.is-scene-boot :is(#scene-mobile-start, #scene-generate-btn)::after,
#rs #screen-scene.is-scene-boot .scene-example-list::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite;
  pointer-events: none;
}
#rs #screen-scene.is-scene-boot :is(#scene-mobile-start, #scene-generate-btn) {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: var(--surface2) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}
#rs #screen-scene.is-scene-boot :is(#scene-mobile-start, #scene-generate-btn) > * { visibility: hidden; }
#rs #screen-scene.is-scene-boot .scene-example-list {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  border-radius: 12px;
  background:
    linear-gradient(var(--surface2), var(--surface2)) 0 0 / calc((100% - 20px) / 3) 100% no-repeat,
    linear-gradient(var(--surface2), var(--surface2)) 50% 0 / calc((100% - 20px) / 3) 100% no-repeat,
    linear-gradient(var(--surface2), var(--surface2)) 100% 0 / calc((100% - 20px) / 3) 100% no-repeat;
}
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) #rs #screen-scene.is-scene-boot .scene-preview-frame::after,
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) #rs #screen-scene.is-scene-boot :is(#scene-mobile-start, #scene-generate-btn)::after,
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) #rs #screen-scene.is-scene-boot .scene-example-list::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
}
@media (prefers-reduced-motion: reduce) {
  #rs #screen-scene.is-scene-boot :is(.scene-preview-frame, #scene-mobile-start, #scene-generate-btn, .scene-example-list)::after { animation: none !important; }
}

/* ── Chat: skeleton delle conversazioni ── */
#support-tickets-loading.screen-loader-skeleton { padding: 8px 0; gap: 10px; }
#support-tickets-loading[hidden] { display: none !important; }
.screen-loader-skeleton .sk-row--chat { grid-template-columns: 48px 1fr 36px; align-items: start; }
.screen-loader-skeleton .sk-row--chat .sk-circle { width: 48px; height: 48px; }
.screen-loader-skeleton .sk-row--chat .sk-row-lines { padding-top: 6px; }
.screen-loader-skeleton .sk-time { height: 10px; margin-top: 8px; border-radius: 6px; }

/* ── Conversazione: skeleton di bolle e intestazione ── */
.support-thread-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 6px 2px; }
.support-thread-skeleton .sk-msg { display: flex; }
.support-thread-skeleton .sk-msg--out { justify-content: flex-end; }
.support-thread-skeleton .sk-msg-bubble {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 78%; padding: 14px 16px; border-radius: 18px;
}
.support-thread-skeleton .sk-msg--in .sk-msg-bubble { border-bottom-left-radius: 6px; }
.support-thread-skeleton .sk-msg--out .sk-msg-bubble { border-bottom-right-radius: 6px; }
.support-thread-skeleton .sk-msg-bubble span { display: block; max-width: 100%; height: 10px; }
#screen-support-thread.is-thread-loading .support-thread-subject {
  color: transparent !important;
  width: 150px; max-width: 60%;
  border-radius: 8px;
  background: var(--surface2);
}
#screen-support-thread.is-thread-loading .support-thread-subject:empty::before { content: "\00a0"; }
#screen-support-thread.is-thread-loading .support-thread-meta-row > *,
#screen-support-thread.is-thread-loading .support-verified-badge {
  visibility: hidden;
}
#screen-support-thread.is-thread-loading .support-thread-meta-row {
  width: 90px; height: 18px; border-radius: 999px; background: var(--surface2);
}
/* Riflesso tenue per tutti gli skeleton nel tema scuro */
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent) !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent) !important;
  }
}

/* ── Foto in caricamento: skeleton al posto dello spinner (vale per tutta l'app) ── */
html body#rs .image-loading.image-loading.image-loading.image-loading {
  background: var(--surface2) !important;
  overflow: hidden;
}
#rs .image-loading::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important; left: 0 !important;
  width: auto !important; height: auto !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .6) 50%, transparent 70%) !important;
  transform: translateX(-100%);
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite !important;
  pointer-events: none;
}
:is(:root[data-theme="dark"], html.theme-dark-early:not([data-theme="light"])) #rs .image-loading::after {
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .06) 50%, transparent 70%) !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #rs .image-loading::after {
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .06) 50%, transparent 70%) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #rs .image-loading::after { animation: none !important; }
}

/* Il banner si scorre di lato per chiuderlo: il browser gestisce solo lo scroll verticale */
[data-swipe-dismiss] { touch-action: pan-y; }

/* ── Caricamenti brevi: lo skeleton compare solo se l'attesa supera ~350ms,
      così una risposta rapida non lo fa lampeggiare ── */
@keyframes skDelayedAppear { from { opacity: 0; } to { opacity: 1; } }
.screen-loader-skeleton,
.support-thread-skeleton {
  animation: skDelayedAppear 180ms ease 350ms both;
}
#rs #screen-scene.is-scene-boot .scene-preview-frame::after,
#rs #screen-scene.is-scene-boot :is(#scene-mobile-start, #scene-generate-btn)::after,
#rs #screen-scene.is-scene-boot .scene-example-list::after {
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite, skDelayedAppear 180ms ease 350ms both;
}
#rs .image-loading::after {
  animation: skeletonSweep 1.35s cubic-bezier(.4, 0, .2, 1) infinite, skDelayedAppear 180ms ease 350ms both !important;
}
@media (prefers-reduced-motion: reduce) {
  .screen-loader-skeleton, .support-thread-skeleton { animation: none; }
  #rs .image-loading::after,
  #rs #screen-scene.is-scene-boot :is(.scene-preview-frame, #scene-mobile-start, #scene-generate-btn, .scene-example-list)::after { animation: none !important; }
}

/* Il tema scuro della pagina affiliati colpiva anche il contenitore del link
   nel profilo (stesso id) lasciando uno sfondo squadrato sotto gli angoli. */
html body#rs #screen-profile #affiliate-dashboard { background: transparent !important; }

/* ── Scena: etichette sull'anteprima, stile vetro come il badge 3:4,
      su una riga sola e lontane da pulsante "ingrandisci" e pallini ── */
#rs #screen-scene .scene-preview-tags {
  left: 14px; right: 66px; bottom: 14px; z-index: 4;
  flex-wrap: nowrap; gap: 6px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
#rs #screen-scene .scene-preview:has(.scene-preview-carousel-dots:not([hidden])) .scene-preview-tags { bottom: 48px; }
#rs #screen-scene .scene-preview-tags span {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(20, 18, 28, .62) !important;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: none; color: #fff !important;
  font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
#rs #screen-scene .scene-tag-swatch {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
}

/* Alcune × stavano sotto l'intestazione o il titolo e non ricevevano il tocco */
#rs .scene-example-dialog-close,
#rs dialog .generation-choice-close { z-index: 5; }

/* Griglia desktop: card della stessa riga alla stessa altezza, azioni allineate in basso */
@media (min-width: 1024px) {
  #rs :is(#cards-container, #cards-container-generated, #cards-container-published) { align-items: stretch; }
  #rs :is(#cards-container, #cards-container-generated, #cards-container-published) > .product-card {
    display: flex;
    flex-direction: column;
  }
  #rs :is(#cards-container, #cards-container-generated, #cards-container-published) > .product-card > .card-inner {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  #rs :is(#cards-container, #cards-container-generated, #cards-container-published) > .product-card > .card-inner > .card-main { flex: 1 1 auto; }
}
