/* ========== Save the Date — Editor ========== */
:root {
  --sted-gold: #caa24a;
  --sted-green: #2f4f3f;
  --sted-bg: #f5f4f0;
  --sted-panel-bg: #ffffff;
  --sted-border: #e2ddd6;
  --sted-text: #2c2a26;
  --sted-text-muted: #888076;
  --sted-radius: 0.75rem;
  --sted-panel-w: 22rem;
}

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

body.std-editor-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--sted-bg);
  color: var(--sted-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.sted-header {
  height: 3.25rem;
  background: var(--sted-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 10;
}

.sted-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.sted-header-logo { font-weight: 700; }
.sted-header-sep  { opacity: 0.4; }
.sted-header-title { opacity: 0.75; }

.sted-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sted-plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.sted-plan-badge--premium {
  background: var(--sted-gold);
  color: #fff;
}
.sted-plan-badge--base {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.sted-plan-badge--unpaid {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
  .sted-plan-badge--premium {
    background: transparent;
    padding: 0;
    font-size: 1.15rem;
    letter-spacing: 0;
  }
  .sted-plan-badge--premium::before {
    content: '👑';
  }
  .sted-plan-badge--premium > * { display: none; }
  /* Testo nascosto, sostituito dalla corona */
  .sted-plan-badge--premium { color: transparent; font-size: 0; }
  .sted-plan-badge--premium::before { font-size: 1.15rem; color: initial; }

  .sted-plan-badge--base,
  .sted-plan-badge--unpaid {
    display: none;
  }
}

.sted-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.sted-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.sted-btn--ghost     { background: rgba(255,255,255,0.15); color: #fff; }
.sted-btn--primary   { background: var(--sted-gold); color: #fff; }
.sted-btn--whatsapp  { background: #25d366; color: #fff; }
.sted-btn--outline   { background: transparent; color: var(--sted-green); border: 1px solid var(--sted-green); }

/* ---------- Layout principale ---------- */
.sted-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 3.25rem);
}

/* ---------- Pannello sinistro ---------- */
.sted-panel {
  width: var(--sted-panel-w);
  flex-shrink: 0;
  background: var(--sted-panel-bg);
  border-right: 1px solid var(--sted-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Selettore piano Base / Premium */
.sted-plan-selector {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0.5rem;
  background: var(--sted-bg);
  border-bottom: 1px solid var(--sted-border);
}
.sted-plan-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.5rem 0.25rem;
  border: 2px solid var(--sted-border);
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.sted-plan-btn-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sted-text);
}
.sted-plan-btn-price {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: var(--sted-text-muted);
}
.sted-plan-btn.is-active {
  border-color: var(--sted-green);
  background: #f0faf4;
}
.sted-plan-btn.is-active .sted-plan-btn-label {
  color: var(--sted-green);
}
.sted-plan-btn.is-active#stedPlanBtnPremium {
  border-color: var(--sted-gold);
  background: #fffbf0;
}
.sted-plan-btn.is-active#stedPlanBtnPremium .sted-plan-btn-label {
  color: var(--sted-gold);
}
.sted-plan-btn.is-active#stedPlanBtnPlatinum {
  border-color: #8b9eb7;
  background: #f4f6fa;
}
.sted-plan-btn.is-active#stedPlanBtnPlatinum .sted-plan-btn-label {
  color: #4a6080;
}
.sted-plan-selector .sted-btn--primary {
  border-radius: 0.25rem;
  align-self: stretch;
  padding: 0 1rem;
  white-space: nowrap;
}
body.plan-base .sted-plan-selector .sted-btn--primary {
  background: var(--sted-green);
  border-color: var(--sted-green);
}
body.plan-premium .sted-plan-selector .sted-btn--primary {
  background: var(--sted-gold);
  border-color: var(--sted-gold);
}
body.plan-platinum .sted-plan-selector .sted-btn--primary {
  background: #4a6080;
  border-color: #4a6080;
}

/* Tabs */
.sted-tabs {
  display: flex;
  border-bottom: 1px solid var(--sted-border);
  flex-shrink: 0;
}
.sted-tab {
  flex: 1;
  padding: 0.75rem 0.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--sted-text-muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sted-tab.is-active {
  color: var(--sted-green);
  border-bottom-color: var(--sted-green);
}

/* Tab panels */
.sted-tab-panel {
  display: none;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 1rem;
  flex: 1;
}
.sted-tab-panel.is-active { display: flex; }

/* Campi */
.sted-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sted-text-muted);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.sted-section-label:first-child { margin-top: 0; }

.sted-description {
  font-size: 0.78rem;
  color: var(--sted-text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.sted-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.sted-field--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.sted-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--sted-text);
}
.sted-hint {
  display: block;
  font-weight: 400;
  color: var(--sted-text-muted);
}

.sted-input,
.sted-textarea-wrap {
  position: relative;
}
.sted-char-count {
  position: absolute;
  bottom: 0.35rem;
  right: 0.5rem;
  font-size: 0.68rem;
  color: var(--sted-text-muted);
  pointer-events: none;
}
.sted-char-count.is-low { color: #c0392b; }

.sted-textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--sted-text);
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  transition: border-color 0.2s ease;
}
.sted-input:focus,
.sted-textarea:focus {
  outline: none;
  border-color: var(--sted-gold);
}
.sted-textarea { resize: vertical; }

.sted-color {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.15rem;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

/* Font grid */
.sted-font-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sted-font-btn {
  padding: 0.6rem 0.5rem;
  font-size: 1rem;
  background: var(--sted-bg);
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sted-font-btn.is-selected {
  border-color: var(--sted-gold);
  background: rgba(202,162,74,0.1);
}

/* Font size stepper */
.sted-font-size-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sted-font-size-btn {
  padding: 0.6rem 0.5rem;
  font-size: 1.1rem;
  background: var(--sted-bg);
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  flex: 1;
  text-align: center;
}
.sted-font-size-btn:hover { border-color: var(--sted-gold); background: rgba(202,162,74,0.1); }
.sted-font-size-val {
  min-width: 3.5rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Foto slots */
.sted-photo-slots {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.sted-photo-slot {
  flex: 1;
  aspect-ratio: 3/4;
  border: 1.5px dashed var(--sted-border);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 0.3rem;
  background: var(--sted-bg);
  transition: border-color 0.2s ease;
  overflow: hidden;
  position: relative;
}
.sted-photo-slot:hover { border-color: var(--sted-gold); }
.sted-photo-slot-icon { font-size: 1.4rem; color: var(--sted-text-muted); }
.sted-photo-slot-label { font-size: 0.7rem; color: var(--sted-text-muted); }
.sted-file-input { display: none; }
.sted-photo-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tema porte */
.sted-theme-grid {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.sted-theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: var(--sted-bg);
  cursor: pointer;
  font-size: 0.72rem;
  transition: border-color 0.2s ease;
  overflow: hidden;
}
.sted-theme-btn img {
  width: 100%;
  aspect-ratio: 1/2;
  object-fit: cover;
  border-radius: 0.3rem;
}
.sted-theme-placeholder {
  width: 100%;
  aspect-ratio: 1/2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--sted-border);
  border-radius: 0.3rem;
}
.sted-theme-btn.is-selected { border-color: var(--sted-gold); }
.sted-theme-btn--locked { opacity: 0.5; cursor: not-allowed; }

/* Emoji barca */
.sted-emoji-grid {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.sted-emoji-btn {
  font-size: 1.4rem;
  width: 2.6rem;
  height: 2.6rem;
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: var(--sted-bg);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sted-emoji-btn.is-selected {
  border-color: var(--sted-gold);
  background: rgba(202,162,74,0.1);
}

.flip-h { transform: scaleX(-1); }

/* Animazione countdown */
.sted-anim-grid {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sted-anim-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.25rem;
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: var(--sted-bg);
  cursor: pointer;
  font-size: 0.72rem;
  transition: border-color 0.2s ease;
}
.sted-anim-icon { font-size: 1.1rem; }
.sted-anim-btn.is-selected { border-color: var(--sted-gold); }
.sted-anim-btn--locked { opacity: 0.5; cursor: not-allowed; }

/* Dimensioni menu immagini iniziali (cuori/farfalle/fiori) */
#edHeartsImg {
  --door-btn-min-width:      4rem;
  --door-btn-padding:        0.4rem;
  --door-btn-font-size:      0.72rem;
  --door-btn-gap:            0.3rem;
  --door-swatch-w:           3rem;
  --door-swatch-h:           2rem;
  --door-sub-btn-min-width:  3.5rem;
  --door-sub-btn-padding:    0.3rem;
  --door-sub-btn-font-size:  0.68rem;
  --door-sub-swatch-w:       2.5rem;
  --door-sub-swatch-h:       1.7rem;
  --door-grid-gap:           0.5rem;
  --door-submenu-gap:        0.5rem;
}

/* Dimensioni menu colore anelli */
#edRingsColor {
  --door-btn-min-width:   3.5rem;
  --door-btn-padding:     0.4rem;
  --door-btn-font-size:   0.72rem;
  --door-btn-gap:         0.3rem;
  --door-swatch-w:        3rem;
  --door-swatch-h:        2rem;
  --door-grid-gap:        0.5rem;
}

/* Dimensioni menu colore scratch */
#edScratchColor {
  --door-btn-min-width:   3.5rem;
  --door-btn-padding:     0.4rem;
  --door-btn-font-size:   0.72rem;
  --door-btn-gap:         0.3rem;
  --door-swatch-w:        3rem;
  --door-swatch-h:        2rem;
  --door-grid-gap:        0.5rem;
}

/* Sfondo texture */
#edBgTexture {
  --door-btn-min-width:      4rem;
  --door-btn-padding:        0.4rem;
  --door-btn-font-size:      0.72rem;
  --door-btn-gap:            0.3rem;
  --door-swatch-w:           4rem;
  --door-swatch-h:           6rem;
  --door-sub-btn-min-width:  3.5rem;
  --door-sub-btn-padding:    0.3rem;
  --door-sub-btn-font-size:  0.68rem;
  --door-sub-swatch-w:       2rem;
  --door-sub-swatch-h:       4rem;
  --door-grid-gap:           0.5rem;
  --door-submenu-gap:        0.5rem;
}

/* Porte — variabili dimensionali facilmente modificabili */
#edDoorTheme {
  /* pulsanti top-row */
  --door-btn-min-width:   4rem;
  --door-btn-padding:     0.4rem;
  --door-btn-font-size:   0.72rem;
  --door-btn-gap:         0.3rem;
  /* swatch */
  --door-swatch-w:        4rem;
  --door-swatch-h:        6rem;
  /* pulsanti submenu */
  --door-sub-btn-min-width:  3.5rem;
  --door-sub-btn-padding:    0.3rem;
  --door-sub-btn-font-size:  0.68rem;
  --door-sub-swatch-w:       2rem;
  --door-sub-swatch-h:       4rem;
  /* spaziatura griglia */
  --door-grid-gap:        0.5rem;
  --door-submenu-gap:     0.5rem;
}

.sted-bg-grid {
  display: flex;
  flex-direction: column;
  gap: var(--door-grid-gap);
  margin-bottom: 0.75rem;
}
.sted-bg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--door-btn-gap);
  padding: var(--door-btn-padding);
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: var(--sted-bg);
  cursor: pointer;
  font-size: var(--door-btn-font-size);
  transition: border-color 0.2s ease;
  min-width: var(--door-btn-min-width);
}
.sted-bg-swatch {
  width: var(--door-swatch-w);
  height: var(--door-swatch-h);
  border-radius: 0.3rem;
  border: 1px solid var(--sted-border);
}

.sted-bg-swatch--pattern {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--sted-border);
}
.sted-bg-btn.is-selected { border-color: var(--sted-gold); }
.sted-bg-btn--locked { opacity: 0.5; cursor: not-allowed; }

.sted-bg-top-row {
  display: flex;
  gap: var(--door-grid-gap);
  flex-wrap: wrap;
}
.sted-bg-group {
  display: contents;
}
.sted-bg-group-toggle.is-active {
  border-color: var(--sted-gold);
}
.sted-bg-submenu {
  flex-direction: row;
  gap: var(--door-submenu-gap);
  flex-wrap: wrap;
  padding: 0.5rem 0 0 0;
  border-top: 1px solid var(--sted-border);
  width: 100%;
}
.sted-bg-submenu .sted-bg-btn {
  min-width: var(--door-sub-btn-min-width);
  padding: var(--door-sub-btn-padding);
  font-size: var(--door-sub-btn-font-size);
}
.sted-bg-submenu .sted-bg-swatch {
  width: var(--door-sub-swatch-w);
  height: var(--door-sub-swatch-h);
}

/* ---------- Anteprima destra ---------- */
.sted-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0 0 0;
  gap: 0.5rem;
  overflow: auto;
  background: var(--sted-bg);
}

/* Hide scrollbar, keep scroll */
.sted-tab-panel,
.sted-preview-area {
  scrollbar-width: none;
}
.sted-tab-panel::-webkit-scrollbar,
.sted-preview-area::-webkit-scrollbar {
  display: none;
}

.sted-preview-toolbar {
  display: flex;
  gap: 0.5rem;
}
.sted-device-btn {
  font-size: 1.1rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: var(--sted-panel-bg);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.sted-device-btn.is-active { border-color: var(--sted-gold); }

.sted-preview-frame-wrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

/* ---------- Filigrana anteprima (vive nel parent, non nell'iframe) ---------- */
.sted-watermark {
  position: absolute !important;
  inset: 0 !important;
  z-index: 9999 !important;
  pointer-events: none !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-content: space-around !important;
  justify-content: space-around !important;
  overflow: hidden !important;
  border-radius: 1.5rem !important;
}
.sted-watermark span {
  display: block !important;
  font-family: 'DM Sans', system-ui, sans-serif !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.25em !important;
  color: rgba(202, 162, 74, 0.35) !important;
  transform: rotate(-35deg) !important;
  white-space: nowrap !important;
  user-select: none !important;
  text-transform: uppercase !important;
}

.sted-preview-iframe {
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: width 0.3s ease, height 0.3s ease;
}

/* Device sizes — iframe renderizzato a dimensioni reali, scalato all'80% nel wrapper */
.sted-preview-frame-wrap[data-device="mobile"] .sted-preview-iframe {
  width: 390px;
  height: 844px;
  transform: scale(0.8);
  transform-origin: top center;
  margin-bottom: calc(844px * -0.2);
}
.sted-preview-frame-wrap[data-device="tablet"] .sted-preview-iframe {
  width: 768px;
  height: 1024px;
  transform: scale(0.8);
  transform-origin: top center;
  margin-bottom: calc(1024px * -0.2);
}

.sted-preview-note {
  font-size: 0.72rem;
  color: var(--sted-text-muted);
  text-align: center;
}

/* ---------- Header: errore pubblicazione ---------- */
.sted-publish-error {
  font-size: 0.75rem;
  color: #ffb3b3;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Header: user label ---------- */
.sted-user-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Modal (auth + success) ---------- */
.sted-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sted-modal.is-open { display: flex; }

.sted-modal-box {
  background: #fff;
  border-radius: var(--sted-radius);
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 22rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sted-auth-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--sted-text-muted);
  line-height: 1;
}

.sted-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sted-text);
  margin: 0;
}
.sted-modal-sub {
  font-size: 0.82rem;
  color: var(--sted-text-muted);
  margin: 0;
}

.sted-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--sted-border);
  border-radius: 0.5rem;
  background: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.sted-btn-google:hover { border-color: #4285F4; }

.sted-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--sted-text-muted);
  font-size: 0.75rem;
}
.sted-auth-divider::before,
.sted-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sted-border);
}

.sted-auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--sted-border);
}
.sted-auth-tab {
  flex: 1;
  padding: 0.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sted-text-muted);
  cursor: pointer;
}
.sted-auth-tab.is-active {
  color: var(--sted-green);
  border-bottom-color: var(--sted-green);
}

.sted-auth-panel { display: none; }
.sted-auth-panel.is-active { display: block; }

.sted-auth-input {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--sted-text);
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
  display: block;
}
.sted-auth-input:focus { outline: none; border-color: var(--sted-gold); }

.sted-auth-error {
  font-size: 0.78rem;
  color: #c0392b;
  min-height: 1.1em;
  margin: 0 0 0.25rem;
}

.sted-btn--full { width: 100%; justify-content: center; border-radius: 0.5rem; }

/* Modal successo */
.sted-success-icon { font-size: 2.5rem; text-align: center; }
.sted-published-url {
  display: block;
  font-size: 0.78rem;
  color: var(--sted-green);
  word-break: break-all;
  text-align: center;
  text-decoration: underline;
}
#stedShareUrl { margin-top: 0.5rem; }

/* ---------- Lock per piano ----------
   sted-base-locked    = bloccato in Base, libero in Premium e Platinum
   sted-premium-locked = bloccato in Base e Premium, libero in Platinum
   --------------------------------------------------------- */

/* Base: blocca entrambi */
body.plan-base .sted-base-locked,
body.plan-base .sted-premium-locked,
body.plan-premium .sted-premium-locked {
  position: relative;
  cursor: pointer;
}
body.plan-base .sted-base-locked input,
body.plan-base .sted-base-locked textarea,
body.plan-base .sted-base-locked button,
body.plan-base .sted-base-locked select,
body.plan-base .sted-premium-locked input,
body.plan-base .sted-premium-locked textarea,
body.plan-base .sted-premium-locked button,
body.plan-base .sted-premium-locked select,
body.plan-premium .sted-premium-locked input,
body.plan-premium .sted-premium-locked textarea,
body.plan-premium .sted-premium-locked button,
body.plan-premium .sted-premium-locked select {
  pointer-events: none;
  user-select: none;
}
body.plan-base .sted-base-locked::after,
body.plan-base .sted-premium-locked::after,
body.plan-premium .sted-premium-locked::after {
  content: '🔒';
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  font-size: 0.7rem;
  line-height: 1;
  pointer-events: none;
}

/* Sezione intera bloccata (overlay) */
body.plan-base .sted-premium-section {
  position: relative;
  cursor: pointer;
}
body.plan-base .sted-premium-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(3px);
  z-index: 10;
  border-radius: 0 0 var(--sted-radius) var(--sted-radius);
  cursor: pointer;
}
body.plan-base .sted-premium-section::after {
  content: '🔒  Funzione Premium';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  background: var(--sted-gold);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

/* Popup avviso premium */
.sted-premium-popup {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
}
.sted-premium-popup.is-hidden { display: none; }
.sted-premium-popup-box {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem 1.8rem 1.6rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
}
.sted-premium-popup-icon {
  font-size: 2.4rem;
  margin-bottom: 0.6rem;
}
.sted-premium-popup-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #2d2d2d;
  margin-bottom: 0.5rem;
}
.sted-premium-popup-body {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: #666;
  margin-bottom: 1.4rem;
  line-height: 1.55;
}
.sted-premium-popup-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}
.sted-premium-popup-close:hover { color: #555; }
.sted-premium-popup-btn {
  display: inline-block;
  background: var(--sted-gold);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.sted-premium-popup-btn:hover { opacity: 0.88; }

/* ---------- Overlay blocco editor (pre-login) ---------- */
.sted-editor-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245, 244, 240, 0.65);
  backdrop-filter: blur(2px);
  z-index: 50;
  pointer-events: all;
}

/* Modal obbligatorio: nascondi X e click-outside */
.sted-modal--required .sted-auth-close { display: none; }

/* ---------- Pulsante profilo header ---------- */
.sted-btn-profile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.sted-btn-profile:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.7); }
.sted-btn-profile img { border-radius: 50%; display: block; }
.sted-btn-profile:has(img) { border-color: transparent; background: transparent; padding: 0; overflow: hidden; }

/* ---------- Drawer dashboard ---------- */
.sted-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1100;
  transition: opacity 0.25s;
}
.sted-drawer-overlay.is-hidden { display: none; }

.sted-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(22rem, 100vw);
  background: #fff;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sted-drawer.is-hidden { transform: translateX(100%); pointer-events: none; }

.sted-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.875rem;
  border-bottom: 1px solid var(--sted-border);
  flex-shrink: 0;
  background: var(--sted-green);
  color: #fff;
}
.sted-drawer-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}
.sted-drawer-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.sted-drawer-close:hover { color: #fff; }

/* Utente */
.sted-drawer-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sted-border);
  flex-shrink: 0;
}
.sted-drawer-logout {
  margin-left: auto;
  order: 99;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  flex-shrink: 0;
  background: transparent;
  color: var(--sted-text-muted);
  border: 1px solid var(--sted-border);
}
.sted-drawer-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--sted-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sted-drawer-userinfo {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.sted-drawer-username {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--sted-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sted-drawer-useremail {
  font-size: 0.75rem;
  color: var(--sted-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sezioni */
.sted-drawer-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sted-border);
}
.sted-drawer-section:last-child { border-bottom: none; }

.sted-drawer-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sted-text-muted);
  margin-bottom: 0.75rem;
}

.sted-readonly-banner {
  display: none;
  background: var(--sted-green);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 0.6rem 1rem;
}

/* Card STD */
.sted-drawer-loading {
  font-size: 0.82rem;
  color: var(--sted-text-muted);
  padding: 0.5rem 0;
}

/* ---- Sezione "Le tue creazioni" nel pannello ---- */
.sted-creations {
  border-bottom: 1px solid var(--sted-border);
}
.sted-creations-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: #ffab3d;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #000;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sted-creations-toggle:hover { color: #000; }
.sted-creations-action { font-size: 0.7rem; font-weight: 400; opacity: 0.7; margin-right: 0.25rem; }
.sted-creations-chevron { font-size: 1rem; transition: transform 0.15s; }
.sted-creations-list {
  padding: 0 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sted-creation-item {
  width: 100%;
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: border-color 0.15s, background 0.15s;
}
.sted-creation-item:hover { border-color: var(--sted-green); background: #f0faf4; }
.sted-creation-names { font-size: 0.85rem; font-weight: 700; color: var(--sted-text); }
.sted-creation-meta  { font-size: 0.75rem; color: var(--sted-text-muted); }

/* ---- Vista dettaglio creazione ---- */
.sted-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1;
}
.sted-detail-back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sted-green);
  padding: 0;
  text-align: left;
}
.sted-detail-back:hover { opacity: 0.75; }
.sted-detail-link-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
}
.sted-detail-link {
  flex: 1;
  font-size: 0.72rem;
  color: var(--sted-green);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sted-detail-copy {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--sted-green);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
}
.sted-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}
.sted-detail-names { font-weight: 700; color: var(--sted-text); }
.sted-detail-date  { color: var(--sted-text-muted); }
.sted-detail-plan  {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--sted-text-muted);
  width: fit-content;
}
.sted-detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sted-text-muted);
  margin-top: 0.25rem;
}
.sted-detail-responses {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sted-detail-response-card {
  background: #fff;
  border: 1px solid var(--sted-border);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sted-detail-response-name { font-size: 0.8rem; font-weight: 700; color: var(--sted-green); }
.sted-detail-response-msg  { font-size: 0.85rem; color: var(--sted-text); line-height: 1.5; }
.sted-detail-response-time { font-size: 0.72rem; color: var(--sted-text-muted); }

.sted-std-card {
  background: var(--sted-bg);
  border: 1px solid var(--sted-border);
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sted-std-card-names {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--sted-text);
}
.sted-std-card-meta {
  font-size: 0.75rem;
  color: var(--sted-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.sted-std-card-plan {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(202,162,74,0.15);
  color: var(--sted-gold);
}
.sted-std-card-plan--premium {
  background: rgba(202,162,74,0.2);
  color: #a07a20;
}
.sted-std-card-plan--base {
  background: rgba(47,79,63,0.1);
  color: var(--sted-green);
}
.sted-std-card-responses {
  font-size: 0.75rem;
  color: var(--sted-text-muted);
}
.sted-std-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.sted-std-card-actions a {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  text-decoration: none;
  transition: opacity 0.15s;
}
.sted-std-card-actions a:hover { opacity: 0.8; }
.sted-std-card-link-editor {
  background: var(--sted-green);
  color: #fff;
}
.sted-std-card-link-answers {
  background: transparent;
  color: var(--sted-green);
  border: 1px solid var(--sted-green);
}

/* ---------- Mobile: editor fullscreen, anteprima nascosta ---------- */
@media (max-width: 768px) {
  .sted-layout {
    height: calc(100vh - 3.25rem);
  }

  .sted-panel {
    width: 100%;
    border-right: none;
  }

  .sted-preview {
    display: none;
  }

  /* Header: nascondi titolo lungo */
  .sted-header-sep,
  .sted-header-title {
    display: none;
  }

  /* Header: riduce padding e gap */
  .sted-header {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .sted-header-actions {
    gap: 0.4rem;
  }
  .sted-header-brand {
    gap: 0.35rem;
    min-width: 0;
  }

  /* Pulsanti header più compatti */
  .sted-btn {
    font-size: 0.72rem;
    padding: 0.38rem 0.75rem;
  }
}

@media (max-width: 420px) {
  .sted-header-logo {
    font-size: 0.78rem;
  }
}
