/* ════════════════════════════════════════════════════════
   Serigest Grid Order – Frontend styles  v1.2.1
   Minimal · Clean · Modern
   ════════════════════════════════════════════════════════ */

:root {
    --sgo-accent:        #16a34a;
    --sgo-accent-bg:     #f0fdf4;
    --sgo-accent-ring:   rgba(22,163,74,.18);
    --sgo-border:        #e4e7ec;
    --sgo-border-focus:  #9ca3af;
    --sgo-bg:            #f9fafb;
    --sgo-surface:       #ffffff;
    --sgo-text:          #111827;
    --sgo-muted:         #6b7280;
    --sgo-danger:        #dc2626;
    --sgo-radius:        8px;
    --sgo-font:          -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

/* ── Hide default WC form when grid is active ─────── */
body.sgo-active .variations_form,
body.sgo-active .single_add_to_cart_button,
body.sgo-active .woocommerce-variation-add-to-cart,
body.sgo-active .woocommerce-variation-description {
    display: none !important;
}

/* ── Intro heading ─────────────────────────────────── */
.sgo-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.sgo-intro__left {
    flex: 1 1 220px;
    min-width: min(100%, 220px);
}
.sgo-intro__title {
    display: block;
    font-family: var(--sgo-font);
    font-size: 20px;
    font-weight: 700;
    color: var(--sgo-text);
    margin-bottom: 4px;
    word-break: normal;
    overflow-wrap: break-word;
}
.sgo-intro__sub {
    font-family: var(--sgo-font);
    font-size: 13px;
    color: var(--sgo-muted);
    margin: 0;
    word-break: normal;
    overflow-wrap: break-word;
}

/* ── Info buttons ──────────────────────────────────── */
.sgo-info-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 2px;
}
.sgo-info-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 0 12px 0 4px !important;
    margin: 0 !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 999px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    font-family: var(--sgo-font) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1 !important;
    letter-spacing: -.01em;
    appearance: none !important;
    -webkit-appearance: none !important;
    transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.sgo-info-btn:hover {
    border-color: #d1d5db !important;
    color: #111827 !important;
    background: #f9fafb !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.sgo-info-btn:focus-visible {
    outline: none;
    border-color: var(--sgo-accent) !important;
    box-shadow: 0 0 0 3px var(--sgo-accent-ring);
}
.sgo-info-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    flex-shrink: 0;
}
.sgo-info-btn:hover .sgo-info-btn__icon {
    background: #eef2f7;
    color: #111827;
}
.sgo-info-btn__icon svg {
    display: block;
    width: 13px;
    height: 13px;
}
.sgo-info-btn__label {
    padding-right: 2px;
}

/* ── Info modals ───────────────────────────────────── */
.sgo-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(17, 24, 39, .38);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
}
.sgo-modal-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}
body.sgo-modal-open {
    overflow: hidden;
}
.sgo-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 99991;
    transform: translate(-50%, -46%) scale(.98);
    width: min(720px, calc(100vw - 40px));
    max-height: 82dvh;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.6);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .22);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease, transform .24s ease;
}
.sgo-modal:not([hidden]).is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.sgo-modal__inner {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    height: 100%;
}
.sgo-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 32px 18px;
    border-bottom: 1px solid #eef0f3;
    flex-shrink: 0;
}
.sgo-modal__title {
    font-family: var(--sgo-font);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.25;
    color: #111827;
    margin: 0;
}
.sgo-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f4f5f7;
    border: none;
    border-radius: 10px;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    padding: 0;
}
.sgo-modal__close:hover {
    background: #eceef2;
    color: #111827;
}
.sgo-modal__body {
    padding: 24px 32px 32px;
    overflow-y: auto;
    font-family: var(--sgo-font);
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}
.sgo-modal__body > *:first-child { margin-top: 0; }
.sgo-modal__body > *:last-child { margin-bottom: 0; }
.sgo-modal__body p {
    margin: 0 0 14px;
    max-width: 62ch;
    font-weight: 400;
    color: #4b5563;
}
.sgo-modal__body p:last-child { margin-bottom: 0; }
.sgo-modal__body h2,
.sgo-modal__body h3,
.sgo-modal__body h4,
.sgo-modal__body .sgo-modal__heading {
    font-family: var(--sgo-font) !important;
    font-size: 16.5px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    letter-spacing: -.02em;
    line-height: 1.3 !important;
    margin: 22px 0 8px !important;
    text-transform: none !important;
}
.sgo-modal__body h2 { font-size: 18px !important; }
.sgo-modal__body h2:first-child,
.sgo-modal__body h3:first-child,
.sgo-modal__body h4:first-child,
.sgo-modal__body .sgo-modal__heading:first-child {
    margin-top: 0 !important;
}
.sgo-modal__body ul,
.sgo-modal__body ol {
    padding-left: 1.15em;
    margin: 0 0 16px;
}
.sgo-modal__body li {
    margin: 0 0 8px;
    padding-left: 4px;
}
.sgo-modal__body li:last-child { margin-bottom: 0; }
.sgo-modal__body strong,
.sgo-modal__body b {
    color: #111827;
    font-weight: 650;
}
.sgo-modal__body a {
    color: var(--sgo-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.sgo-modal__body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 8px 0 16px;
    display: block;
}

@media (max-width: 480px) {
    .sgo-info-btns { flex-wrap: wrap; align-items: center; justify-content: flex-start; }
}

/* ── Modali info: bottom sheet su mobile ───────────── */
@media (max-width: 768px) {
    .sgo-intro {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .sgo-intro__left {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }
    .sgo-info-btns {
        width: 100%;
        flex-wrap: wrap;
        padding-top: 0;
    }
    .sgo-info-btn {
        white-space: normal !important;
        height: auto !important;
        min-height: 34px !important;
        max-height: none !important;
        padding: 7px 12px 7px 4px !important;
        max-width: 100%;
    }

    .sgo-modal {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        transform: translateY(100%);
        width: 100%;
        max-height: 85dvh;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.14);
        opacity: 1;
        transition: transform .28s cubic-bezier(.32,1,.37,1), visibility 0s linear .28s;
        visibility: hidden;
    }
    .sgo-modal:not([hidden]).is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        transition: transform .28s cubic-bezier(.32,1,.37,1), visibility 0s linear 0s;
    }
    /* Handle bar sopra l'header */
    .sgo-modal__inner::before {
        content: '';
        display: block;
        width: 36px;
        height: 3px;
        background: #d1d5db;
        border-radius: 3px;
        margin: 10px auto 6px;
        flex-shrink: 0;
    }
    .sgo-modal__header {
        padding: 8px 20px 14px;
    }
    .sgo-modal__title { font-size: 18px; }
    .sgo-modal__body {
        padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        font-size: 14.5px;
    }
}

/* ── Base container ────────────────────────────────── */
.sgo-container {
    margin: 0 0 20px;
    font-family: var(--sgo-font);
    font-size: 15px;
    color: var(--sgo-text);
    line-height: 1.5;
}

/* ── Section card ──────────────────────────────────── */
.sgo-card {
    background: var(--sgo-surface);
    border: 1px solid var(--sgo-border);
    border-radius: var(--sgo-radius);
}

/* ── Label / overline text ─────────────────────────── */
.sgo-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sgo-muted);
    margin-bottom: 12px;
}

/* ════════════════════════════════════════════════════
   SWATCHES
   ════════════════════════════════════════════════════ */
.sgo-swatches-section {
    background: #f5f6f8;
    border: 1px solid var(--sgo-border);
    border-radius: var(--sgo-radius);
    padding: 18px 20px;
    margin-bottom: 12px;
}

.sgo-swatches-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sgo-muted);
    margin: 0 0 14px;
}

.sgo-swatches-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 12px;
    align-items: flex-start;
}

.sgo-swatch-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 52px;
}

.sgo-swatch__remove {
    display: none;
    position: absolute;
    top: -6px;
    left: -6px;
    z-index: 2;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    line-height: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.sgo-swatch__remove svg {
    display: block;
    flex-shrink: 0;
}

.sgo-swatch-cell.is-selected .sgo-swatch__remove:not([hidden]) {
    display: flex;
}

.sgo-swatch__remove:hover {
    background: #b91c1c;
}

.sgo-swatch__name {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    color: #9ca3af;
    max-width: 56px;
}

.sgo-swatch-cell.is-selected .sgo-swatch__name {
    color: #6b7280;
}

.sgo-swatch-cell.is-active .sgo-swatch__name {
    color: var(--sgo-text);
    font-weight: 700;
}

.sgo-now {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--sgo-text);
    line-height: 1.4;
}

.sgo-now[hidden] {
    display: none !important;
}

.sgo-now__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.12);
}

.sgo-now__hint {
    font-weight: 500;
    color: var(--sgo-muted);
}

.sgo-swatch {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    flex-shrink: 0;
}

.sgo-swatch--light {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}

.sgo-swatch:hover {
    box-shadow: 0 0 0 3px var(--sgo-accent-ring);
}

.sgo-swatch.is-selected {
    border-color: var(--sgo-accent);
    box-shadow: 0 0 0 3px var(--sgo-accent-ring);
}

.sgo-swatch.is-active {
    border-color: var(--sgo-accent);
    box-shadow: 0 0 0 4px var(--sgo-accent-ring);
}

/* SVG check inside swatch */
.sgo-swatch__check {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
}
.sgo-swatch__check svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}
.sgo-swatch.is-selected .sgo-swatch__check {
    display: flex;
}

/* Badge counter */
.sgo-swatch__num {
    display: none;
    position: absolute;
    top: -14px;
    right: -13px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--sgo-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
    font-family: var(--sgo-font);
}
.sgo-swatch.is-selected .sgo-swatch__num {
    display: flex;
}

.sgo-swatch__num.is-empty {
    min-width: 10px;
    width: 10px;
    height: 10px;
    padding: 0;
    top: -4px;
    right: -4px;
}

/* ════════════════════════════════════════════════════
   CONTENT (tabs + panels)
   ════════════════════════════════════════════════════ */
.sgo-content {
    background: var(--sgo-surface);
    border: 1px solid var(--sgo-border);
    border-radius: var(--sgo-radius);
    overflow: hidden;
    animation: sgoFadeIn .18s ease;
}
@keyframes sgoFadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: none; }
}

/* ── Tabs nav ─────────────────────────────────────── */
.sgo-tabs-nav[hidden],
.sgo-tabs-nav:empty {
    display: none !important;
}
.sgo-tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--sgo-border);
    overflow-x: auto;
    scrollbar-width: none;
    background: #f5f6f8;
}
.sgo-tabs-nav::-webkit-scrollbar { display: none; }

.sgo-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: var(--sgo-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--sgo-muted);
    white-space: nowrap;
    transition: color .12s, border-color .12s;
    outline: none;
}
.sgo-tab:hover:not(.is-active) {
    color: var(--sgo-text);
}
.sgo-tab.is-active {
    color: var(--sgo-text);
    border-bottom-color: var(--sgo-text);
    background: var(--sgo-surface);
    font-weight: 600;
}

.sgo-tab__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.1);
}

/* × remove button on tab (desktop only) */
.sgo-tab__remove {
    display: none;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid transparent;
    color: var(--sgo-muted);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s, border-color .12s;
    margin-left: 2px;
}
.sgo-tab__remove:hover {
    background: #fee2e2;
    border-color: var(--sgo-danger);
    color: var(--sgo-danger);
}
@media (min-width: 901px) {
    .sgo-tab__remove {
        display: inline-flex;
    }
}

/* ── Panel ────────────────────────────────────────── */
.sgo-panels-area {
    min-height: 200px;
}

.sgo-panel__layout {
    display: flex;
    min-height: 200px;
}

.sgo-panel__image {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #fff;
    border-right: 1px solid var(--sgo-border);
}
.sgo-panel__image img {
    max-width: 100%;
    max-height: 440px;
    width: 100%;
    object-fit: contain;
    display: block;
}

.sgo-panel__sizes {
    flex: 1;
    min-width: 0;
    padding: 20px 24px;
}

.sgo-panel__sizes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
}

.sgo-panel__sizes-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.02em;
    text-transform: none;
    color: var(--sgo-text);
    margin: 0;
}

.sgo-min-order {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #6b7280;
    background: #f4f5f7;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
    line-height: 1.3;
    flex-shrink: 0;
}

.sgo-min-order.is-progress {
    color: #92400e;
    background: #fff7ed;
    border-color: #fed7aa;
}

.sgo-min-order.is-met {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* ── Size grid ────────────────────────────────────── */
.sgo-size-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sgo-size-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 12px;
    border-bottom: none;
    border-radius: 999px;
}

.sgo-size-row.has-qty {
    background: var(--sgo-accent-bg);
}

.sgo-size-row__note {
    flex: 1 1 100%;
    width: 100%;
    margin: 4px 0 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.sgo-size-row__note[hidden] {
    display: none !important;
}
.sgo-size-row:last-child { border-bottom: none; }

.sgo-size-row__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sgo-text);
    letter-spacing: .02em;
    width: 52px;
    flex-shrink: 0;
    line-height: 1.15;
}

/* Qty control */
.sgo-size-row__input {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sgo-border);
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.sgo-size-row__input.has-qty {
    border-color: var(--sgo-accent);
    background: #fff;
    box-shadow: none;
}

.sgo-qty-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sgo-text);
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    padding: 0;
    transition: background .1s;
    flex-shrink: 0;
    touch-action: manipulation;
}
.sgo-qty-btn:hover:not(:disabled) {
    background: var(--sgo-bg);
}
.sgo-qty-btn:disabled {
    opacity: .3;
    cursor: default;
}

.sgo-qty-field {
    width: 40px;
    height: 32px;
    border: none;
    border-left: 1px solid var(--sgo-border);
    border-right: 1px solid var(--sgo-border);
    background: transparent;
    text-align: center;
    font-family: var(--sgo-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--sgo-text);
    padding: 0;
    -moz-appearance: textfield;
    outline: none;
}
.sgo-qty-field::-webkit-outer-spin-button,
.sgo-qty-field::-webkit-inner-spin-button { -webkit-appearance: none; }

.sgo-size-row__stock {
    font-size: 11px;
    color: var(--sgo-muted);
    white-space: nowrap;
    margin-left: auto;
}

.sgo-size-row.is-out-of-stock .sgo-size-row__name,
.sgo-size-row.is-out-of-stock .sgo-size-row__stock {
    color: #d1d5db;
}
.sgo-size-row.is-out-of-stock .sgo-size-row__input {
    opacity: .4;
    pointer-events: none;
}

/* Actions row (remove + add color) */
.sgo-panel__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Remove colour — small, quiet, right-aligned */
.sgo-btn-remove-color {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-family: var(--sgo-font);
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    letter-spacing: .01em;
}
.sgo-btn-remove-color:hover {
    background: none;
    color: var(--sgo-danger);
}

/* Add color button — visibile solo su mobile */
.sgo-btn-add-color {
    display: none; /* hidden on desktop */
    align-items: center;
    background: #fff;
    border: 1.5px solid #111;
    border-radius: 50px;
    padding: 8px 20px;
    font-family: var(--sgo-font);
    font-size: 13px;
    font-weight: 500;
    color: #111;
    cursor: pointer;
    transition: background .15s, color .15s;
    letter-spacing: .01em;
}
.sgo-btn-add-color:hover {
    background: #111;
    color: #fff;
}

@media (max-width: 900px) {
    .sgo-btn-add-color {
        display: inline-flex;
    }
}

/* ════════════════════════════════════════════════════
   FULL-WIDTH LAYOUT (grid + sticky sidebar)
   ════════════════════════════════════════════════════ */
.sgo-below-product {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
    margin: 32px 0 24px;
    clear: both;
    font-family: var(--sgo-font);
}

.sgo-below-main {
    min-width: 0;
}
.sgo-below-main .sgo-container { margin: 0 0 12px; }

/* Pulsante carrello: sotto griglia + personalizzazioni (non più in sidebar) */
.sgo-below-main .sgo-cart-bar--main {
    margin-top: 28px;
}

.sgo-below-sidebar {
    position: sticky;
    /* Sotto la category bar sticky (.scb-bar.is-sticky ≈ 86px) */
    top: 104px;
    align-self: start;
    max-height: none;
    overflow: visible;
}

.admin-bar .sgo-below-sidebar {
    top: 136px;
}

/* ════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════ */
.sgo-sidebar {
    background: #f4f6f8;
    border: 1px solid var(--sgo-border);
    border-radius: var(--sgo-radius);
    overflow: hidden;
}

/* Vantaggi — solo colonna desktop (l’aside è già nascosta sotto 900px) */
.sgo-perks {
    margin-top: 12px;
    padding: 15px 16px 14px;
    border-radius: 10px;
    border: 1px solid #dbe4ff;
    background: #f7f9ff;
    font-family: var(--sgo-font);
}

.sgo-perks__title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #1e293b;
}

.sgo-perks__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sgo-perks__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sgo-perks__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
}

.sgo-perks__icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.sgo-perks__item--save .sgo-perks__icon { background: #ecfdf5; color: #15803d; }
.sgo-perks__item--art  .sgo-perks__icon { background: #eef2ff; color: #4f46e5; }
.sgo-perks__item--help .sgo-perks__icon { background: #fff7ed; color: #c2410c; }
.sgo-perks__item--it   .sgo-perks__icon { background: #eff6ff; color: #1d4ed8; }

.sgo-perks__text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #1f2937;
    padding-top: 5px;
}

.sgo-sidebar__title {
    font-family: var(--sgo-font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sgo-muted);
    margin: 0;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--sgo-border);
}

/* Tiers section */
.sgo-sidebar__tiers {
    padding: 14px 18px;
    border-bottom: 1px solid var(--sgo-border);
}
.sgo-sidebar__tiers h4 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sgo-muted);
    margin: 0 0 10px;
}

.sgo-tiers-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--sgo-font);
    font-size: 14px;
}
.sgo-tiers-table td {
    padding: 5px 4px;
    vertical-align: middle;
}
.sgo-tiers-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--sgo-border);
}
.sgo-tier-row__qty   { color: var(--sgo-muted); }
.sgo-tier-row__price { font-weight: 600; text-align: right; padding-right: 8px; }
.sgo-tier-row__badge { text-align: right; }

.sgo-tiers-vat-note {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--sgo-muted);
    line-height: 1.4;
}

.sgo-tier-row.is-active {
    background: var(--sgo-accent-bg);
}
.sgo-tier-row.is-active td {
    color: #15803d;
    font-weight: 700;
}

.sgo-tier-badge {
    display: inline-block;
    background: #15803d;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: .02em;
}

/* Empty state */
.sgo-sidebar__empty {
    padding: 24px 18px;
}
.sgo-sidebar__empty p {
    font-size: 13px;
    color: var(--sgo-muted);
    text-align: center;
    margin: 0;
    line-height: 1.6;
}

/* Active summary */
.sgo-sidebar__active {
    padding: 14px 18px;
}

/* Section heading */
.sgo-summary-section-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sgo-text);
    margin: 0 0 10px;
}

/* Per-size rows */
.sgo-sum-size {
    padding: 7px 0;
    border-bottom: 1px solid var(--sgo-border);
}
.sgo-sum-size:last-child { border-bottom: none; }

.sgo-sum-size__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.sgo-sum-size__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sgo-text);
}
.sgo-sum-size__qty {
    font-size: 12px;
    font-weight: 700;
    color: var(--sgo-text);
    flex-shrink: 0;
}

/* Color breakdown */
.sgo-sum-size__colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 2px;
}
.sgo-sum-color {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--sgo-muted);
}
.sgo-sum-color__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.1);
    display: inline-block;
}
.sgo-sum-color__label {
    white-space: nowrap;
    color: var(--sgo-muted);
}

/* Base total */
.sgo-summary-total {
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--sgo-border);
}
.sgo-summary-total__qty {
    font-size: 12px;
    color: var(--sgo-muted);
    margin-bottom: 3px;
}
.sgo-summary-total__price {
    font-size: 20px;
    font-weight: 700;
    color: var(--sgo-text);
    line-height: 1.2;
}
.sgo-summary-total__price del {
    font-size: 13px;
    font-weight: 400;
    color: var(--sgo-muted);
    margin-right: 4px;
}

.sgo-discount-badge {
    display: inline-block;
    background: var(--sgo-accent-bg);
    color: #15803d;
    border: 1px solid #bbf7d0;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Personalizzazioni extra */
.sgo-summary-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 9px 0;
    border-top: 1px dashed var(--sgo-border);
    font-size: 13px;
    gap: 8px;
}
.sgo-summary-extra__label {
    color: var(--sgo-muted);
    font-weight: 500;
}
.sgo-summary-extra__amount {
    font-weight: 600;
    color: var(--sgo-text);
}

/* Grand total */
.sgo-summary-grand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sgo-border);
    gap: 8px;
}
.sgo-summary-grand span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sgo-muted);
}
.sgo-summary-grand strong {
    font-size: 22px;
    font-weight: 700;
    color: var(--sgo-text);
}

/* ════════════════════════════════════════════════════
   CART BUTTON
   ════════════════════════════════════════════════════ */
.sgo-cart-bar {
    margin-top: 12px;
}

.sgo-btn-cart {
    display: block;
    width: 100%;
    padding: 13px 20px;
    background: var(--sgo-accent);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-family: var(--sgo-font);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    text-align: center;
    transition: background .15s, opacity .15s;
}
.sgo-btn-cart:hover:not(:disabled) {
    background: #15803d;
}
.sgo-btn-cart:disabled {
    opacity: .35;
    cursor: default;
}
.sgo-btn-cart.sgo-btn-cart--done {
    background: var(--sgo-accent);
}

/* ════════════════════════════════════════════════════
   MOBILE: bottom bar + drawer
   ════════════════════════════════════════════════════ */
.sgo-mobile-bar {
    display: none;
}

.sgo-mobile-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}
.sgo-mobile-drawer.is-open { display: block; }

.sgo-mobile-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
}

.sgo-mobile-drawer__sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sgo-surface);
    border-radius: 12px 12px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 12px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: sgoSheetUp .26s cubic-bezier(.32,1,.37,1);
}
@keyframes sgoSheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sgo-mobile-drawer__handle {
    width: 36px;
    height: 3px;
    background: #d1d5db;
    border-radius: 3px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.sgo-mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--sgo-border);
}
.sgo-mobile-drawer__header strong {
    font-family: var(--sgo-font);
    font-size: 15px;
    font-weight: 600;
    color: var(--sgo-text);
}

.sgo-mobile-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--sgo-bg);
    border: 1px solid var(--sgo-border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--sgo-muted);
    padding: 0;
    transition: background .12s;
}
.sgo-mobile-drawer__close:hover { background: #f3f4f6; }
.sgo-mobile-drawer__close svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
}

.sgo-mobile-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    -webkit-overflow-scrolling: touch;
}

.sgo-mobile-drawer__footer {
    padding: 12px 18px;
    flex-shrink: 0;
    border-top: 1px solid var(--sgo-border);
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */
@media ( max-width: 900px ) {
    .sgo-below-product {
        grid-template-columns: 1fr;
    }

    /* Il carrello su mobile è solo nella barra fissa + drawer, non il bottone in main */
    .sgo-below-main .sgo-cart-bar--main {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .sgo-below-sidebar {
        display: none !important;
    }

    .sgo-mobile-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: var(--sgo-surface);
        border-top: 1px solid var(--sgo-border);
        box-shadow: 0 -2px 16px rgba(0,0,0,.08);
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px));
        align-items: center;
        gap: 12px;
        font-family: var(--sgo-font);
    }

    .sgo-mobile-bar__info {
        flex: 1;
        min-width: 0;
    }

    /* Placeholder — visibile solo quando non ci sono quantità */
    .sgo-mobile-bar__placeholder {
        display: block;
        font-size: 12px;
        color: var(--sgo-muted);
        font-style: italic;
    }
    .sgo-mobile-bar.has-qty .sgo-mobile-bar__placeholder { display: none; }

    .sgo-mobile-bar__qty {
        display: none;
        font-size: 15px;
        font-weight: 700;
        color: #000000;
        letter-spacing: .03em;
    }
    .sgo-mobile-bar.has-qty .sgo-mobile-bar__qty { display: block; }

    .sgo-mobile-bar__price {
        display: none;
        font-size: 17px;
        font-weight: 700;
        color: var(--sgo-text);
    }
    .sgo-mobile-bar.has-qty .sgo-mobile-bar__price { display: block; }

    /* Prezzo pieno (prima dello sconto tier) — solo nella barra mobile */
    .sgo-mobile-bar__price .sgo-price-old {
        font-size: 12px;
        font-weight: 500;
        color: var(--sgo-muted, #6b7280);
        text-decoration: line-through;
    }
    .sgo-mobile-bar__price strong {
        font-weight: 700;
    }

    .sgo-mobile-bar__actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    /* Aggiungi al carrello – pill verde */
    .sgo-mobile-bar__cart {
        background: #22c55e;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 10px 14px;
        font-family: var(--sgo-font);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        transition: background .12s, opacity .12s;
    }
    .sgo-mobile-bar__cart:disabled,
    .sgo-mobile-bar__cart.smo-btn-blocked {
        opacity: .4;
        cursor: not-allowed;
        pointer-events: none;
    }
    .sgo-mobile-bar__cart:not(:disabled):not(.smo-btn-blocked):hover { background: #16a34a; }

    /* Riepilogo – icona + etichetta */
    .sgo-mobile-bar__recap {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: none;
        border: none;
        padding: 6px 8px;
        cursor: pointer;
        color: var(--sgo-text);
    }
    .sgo-mobile-bar__recap-icon {
        width: 22px;
        height: 22px;
        display: block;
    }
    .sgo-mobile-bar__recap-label {
        font-family: var(--sgo-font);
        font-size: 10px;
        color: #999;
        line-height: 1;
        letter-spacing: .02em;
    }
    .sgo-mobile-bar__recap:hover .sgo-mobile-bar__recap-icon { opacity: .7; }

    /* La bar è sempre visibile, aggiungiamo padding fisso al body su single product */
    body.single-product .sgo-below-product,
    body.sgo-active .sgo-below-product {
        padding-bottom: 5px;
    }
}

@media ( max-width: 640px ) {
    .sgo-panel__layout {
        flex-direction: column;
    }
    .sgo-panel__image {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--sgo-border);
        padding: 16px;
    }
    .sgo-panel__image img { max-height: 300px; width: auto; margin: 0 auto; }
    .sgo-swatch { width: 32px; height: 32px; }
    .sgo-size-row { grid-template-columns: 44px 1fr auto; }
    .sgo-swatches-section { padding: 14px 16px; }
    .sgo-panel__sizes { padding: 16px; }
}

/* ── Product info bar ────────────────────────────────────────────────────────── */
.sgo-product-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 16px 0 20px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

.sgo-info-item {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 18px;
    border-right: 1px solid #e4e7ec;
}
.sgo-info-item:last-child { border-right: none; }

.sgo-info-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9ca3af;
}

.sgo-info-value {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.sgo-info-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sgo-size-pill {
    display: inline-block;
    padding: 2px 8px;
    background: #f4f6f8;
    border: 1px solid #e4e7ec;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    line-height: 1.6;
}

/* ── Hide SKU and categories on single product page ─────────────────────────── */
.single-product .product_meta,
.single-product .posted_in,
.single-product .tagged_as,
.single-product .sku_wrapper,
.wp-block-woocommerce-product-sku,
.wp-block-woocommerce-product-categories,
.wc-block-components-product-sku,
.wc-block-components-product-categories,
.wc-block-grid__product-categories,
[class*="product-categories"],
[class*="product-sku"],
.wp-block-post-terms.taxonomy-product_cat {
    display: none !important;
}

/* ── Alert "nessuna personalizzazione" ───────────────────────────────────── */
#sgo-no-perso-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    line-height: 1.5;
    transition: opacity .2s, max-height .3s;
    overflow: hidden;
    max-height: 100px;
}

#sgo-no-perso-alert.sgo-no-perso-alert--hidden,
#sgo-missing-file-alert.sgo-cart-alert--hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    pointer-events: none;
}

#sgo-missing-file-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #92400e;
    line-height: 1.5;
    transition: opacity .2s, max-height .3s;
    overflow: hidden;
    max-height: 240px;
}
#sgo-missing-file-alert strong {
    font-weight: 700;
    color: #78350f;
}

.sgo-no-perso-alert__icon {
    flex-shrink: 0;
    color: #94a3b8;
    margin-top: 1px;
}
#sgo-missing-file-alert .sgo-no-perso-alert__icon {
    color: #f59e0b;
}

.sgo-no-perso-alert__icon svg {
    display: block;
}

/* ── Disabilita auto-zoom iOS: font-size minimo 16px su mobile ── */
@media (max-width: 768px) {
    .sgo-qty-field {
        font-size: 16px !important;
    }
}
