.beg-pg-gift, .beg-pg-engraving {
  margin: 16px 0; padding: 16px; background: #fffaf2; border: 1px solid #e4ddd2; color: #1c1916;
}
.beg-pg-gift h3 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 8px; }
.beg-pg-gift label, .beg-pg-engraving label { display: block; margin: 8px 0; }
.beg-pg-gift fieldset { border: 1px solid #d7c7a8; margin: 8px 0; padding: 8px; }
.beg-pg-gift-preview {
  min-height: 48px; margin-top: 12px; padding: 12px; background: #f4efe6; border: 1px solid #e4ddd2;
  white-space: pre-wrap;
}
.beg-pg-gift-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.beg-pg-gift-actions button[disabled] { opacity: .6; }
.beg-pg-gift-files { margin: 24px 0; }
@media (max-width: 480px) {
  .beg-pg-gift, .beg-pg-engraving { padding: 12px; }
}
/* Cart / checkout personalisation panel (classic and Blocks). */
.beg-pg-gift-cart { margin: 24px 0; }
.beg-pg-gift-panel { padding: 16px; background: #fffaf2; border: 1px solid #e4ddd2; color: #1c1916; }
.beg-pg-gift-panel h3 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 12px; }
.beg-pg-gift-panel h4 { margin: 0 0 6px; font-size: 1em; }
.beg-pg-gift-panel label { display: block; margin: 8px 0; }
.beg-pg-gift-panel input:not([type=checkbox]):not([type=radio]), .beg-pg-gift-panel select, .beg-pg-gift-panel textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
.beg-pg-gift-panel fieldset { border: 1px solid #d7c7a8; margin: 8px 0; padding: 8px; }
.beg-pg-gift-block { border-top: 1px solid #e4ddd2; padding-top: 12px; margin-top: 12px; }
.beg-pg-gift-anon { font-size: .92em; }
.beg-pg-gift-status.is-error { color: #8a2f2f; }
.beg-pg-gift-status.is-ok { color: #2f6b3c; }
.beg-pg-gift-panel button[aria-busy=true] { opacity: .6; cursor: progress; }

/* SECTION 3 — Gift template preview */
.beg-pg-gift-visual[hidden] { display: none !important; }
.beg-pg-gift-visual { max-width: 320px; margin: 16px auto; text-align: center; }
.beg-pg-gift-visual-stage { position: relative; width: 100%; aspect-ratio: 5 / 7; background: #faf5eb; border: 1px solid #dfd5c6; overflow: hidden; }
.beg-pg-gift-visual-image { display: block; width: 100%; height: 100%; object-fit: fill; }
.beg-pg-gift-visual-text { position: absolute; inset: 29% 13% 20%; display: grid; place-content: center; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; color: #201b16; font: clamp(12px, 2vw, 17px)/1.5 Georgia, serif; text-align: center; pointer-events: none; }
.beg-pg-gift-visual-caption { font: 13px/1.4 Georgia, serif; color: #6c5740; margin: 8px 0; }
.beg-pg-gift-request-status { min-height: 1.2em; margin-top: 6px; }
@media (max-width: 480px) { .beg-pg-gift-visual { max-width: min(100%, 280px); } }

/* SECTION 4 — Editorial card composer */
.beg-pg-gift-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 0.85fr); gap: 18px; align-items: start; }
.beg-pg-gift-controls { min-width: 0; }
.beg-pg-gift-controls textarea, .beg-pg-gift-controls select, .beg-pg-gift-controls input[type="text"] { max-width: 100%; box-sizing: border-box; }
.beg-pg-gift-gallery { min-width: 0; background: #fffdf9; border: 1px solid #e6dcd0; padding: 12px; }
.beg-pg-gift-gallery-title { font: 600 15px/1.4 Georgia, serif; color: #463728; margin: 0 0 10px; text-align: center; }
.beg-pg-gift-gallery .beg-pg-gift-visual { margin: 0 auto 10px; width: min(100%, 230px); }
.beg-pg-gift-visual-image[hidden] { display: none; }
.beg-pg-gift-gallery .beg-pg-gift-visual-stage { aspect-ratio: 5/7; background: #f6f0e6; }
.beg-pg-gift-gallery .beg-pg-gift-visual-text { font-size: clamp(9px, 1vw, 13px); color: #241c16; inset: 27% 15% 17%; }
.beg-pg-gift-gallery .beg-pg-gift-visual-caption { margin: 4px 0; }
.beg-pg-gift-thumbnails { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.beg-pg-gift-thumb { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 4px; background: #fff; border: 1px solid #d9cebd; color: #382c22; cursor: pointer; font: 10px/1.25 Georgia, serif; }
.beg-pg-gift-thumb img { display: block; width: 100%; height: 83px; object-fit: contain; }
.beg-pg-gift-thumb.is-selected, .beg-pg-gift-thumb[aria-pressed="true"] { border: 2px solid #b28b50; background: #fff8ec; }
.beg-pg-gift-disabled .beg-pg-gift-gallery { opacity: .72; }
@media (max-width: 740px) { .beg-pg-gift-layout { grid-template-columns: 1fr; } .beg-pg-gift-gallery .beg-pg-gift-visual { width: min(100%, 220px); } }

/* SECTION 5 — 3.4.0: destinatario digitale e riepilogo per riga nel carrello */
.beg-pg-gift-recipient[hidden], .beg-pg-gift-recipient-email[hidden] { display: none !important; }
.beg-pg-gift-recipient { margin: 8px 0; padding: 8px 10px; border-left: 2px solid #b28b50; background: #fffdf8; }
.beg-pg-gift-recipient input[type=email] { width: 100%; max-width: 100%; box-sizing: border-box; }
.beg-pg-gift-note { font-size: .9em; color: #6c5740; margin: 6px 0; }
.beg-pg-gift-line { border-top: 1px solid #e4ddd2; padding-top: 12px; margin-top: 12px; }
.beg-pg-gift-line:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.beg-pg-gift-target { font: 600 1.02em/1.4 Georgia, serif; margin: 0 0 6px; }
.beg-pg-card-summary { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: start; }
.beg-pg-card-thumb { padding: 0; border: 1px solid #d9cebd; background: #fff; cursor: zoom-in; width: 92px; }
.beg-pg-card-thumb:focus-visible { outline: 2px solid #b28b50; outline-offset: 2px; }
.beg-pg-card-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: .92em; }
.beg-pg-card-facts dt { color: #6c5740; }
.beg-pg-card-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.beg-pg-card-stage { position: relative; width: 100%; aspect-ratio: 5 / 7; background: #f6f0e6; overflow: hidden; }
.beg-pg-card-stage-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; max-width: none; }
.beg-pg-card-stage-text, .beg-pg-card-stage-sign { position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font: 15px/1.45 Georgia, serif; pointer-events: none; }
.beg-pg-card-stage-sign { font-style: italic; font-size: 13px; justify-content: flex-end; }
.beg-pg-card-stage.is-small .beg-pg-card-stage-text { font-size: 5px; line-height: 1.3; }
.beg-pg-card-stage.is-small .beg-pg-card-stage-sign { font-size: 4.5px; }
.beg-pg-card-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 240px); gap: 16px; align-items: start; }
.beg-pg-card-live { position: sticky; top: 12px; }
.beg-pg-card-dialog { border: 1px solid #d7c7a8; padding: 16px; width: min(92vw, 420px); max-height: 92vh; overflow: auto; background: #fffaf2; color: #1c1916; }
.beg-pg-card-dialog::backdrop { background: rgba(28, 25, 22, .55); }
.beg-pg-card-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.beg-pg-card-dialog-head h3 { margin: 0; font: 600 1.05em/1.3 Georgia, serif; }
@media (max-width: 600px) {
  .beg-pg-card-editor { grid-template-columns: 1fr; }
  .beg-pg-card-live { position: static; max-width: 240px; margin: 0 auto; }
  .beg-pg-card-summary { grid-template-columns: 72px minmax(0, 1fr); }
  .beg-pg-card-thumb { width: 72px; }
}
