.wic-shell {
        position: relative;
        margin: 24px 0 24px;
}

.wic-stage-wrap {
        background: linear-gradient(180deg, #ffffff 0%, #f7f7fb 100%);
        border: 1px solid #e8e8ee;
        border-radius: 24px;
        padding: 20px;
        box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
        margin-bottom: 20px;
}

/* ── 3-column desktop layout ─────────────────────────────────────────── */
.wic-stage-layout {
        display: grid;
        grid-template-columns: 1fr 2fr 1fr;
        grid-template-areas: "left canvas right";
        gap: 20px;
        align-items: start;
}

.wic-stage-layout.is-post-purchase {
        grid-template-columns: 1fr 2fr 1fr;
        grid-template-areas: "left canvas right";
}

/* On desktop the sidebar wrapper is invisible to the grid —
   its two children (left-panel, right-panel) become direct grid items */
.wic-sidebar {
        display: contents;
}

.wic-left-panel {
        grid-area: left;
        min-width: 0;
}

.wic-left-panel__inner {
        display: flex;
        flex-direction: column;
        gap: 16px;
        position: sticky;
        top: 24px;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
}

.wic-right-panel {
        grid-area: right;
        min-width: 0;
}

.wic-right-panel__inner {
        display: flex;
        flex-direction: column;
        gap: 16px;
        position: sticky;
        top: 24px;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
}

.wic-preview-column {
        grid-area: canvas;
        min-width: 0;
}

.wic-mobile-sidebar-toggle,
.wic-mobile-sidebar-overlay,
.wic-sidebar-close {
        display: none !important;
}

/* sidebar__inner kept for backward compat with any theme overrides */
.wic-sidebar__inner {
        display: flex;
        flex-direction: column;
        gap: 16px;
}

.wic-sidebar__header {
        display: none;
}

.wic-panel {
        background: #ffffff;
        border: 1px solid #e8e8ee;
        border-radius: 20px;
        padding: 18px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.wic-panel__title {
        font-size: 15px;
        font-weight: 700;
        margin-bottom: 14px;
        color: #111827;
}

.wic-stage-header {
        margin-bottom: 18px;
}

.wic-stage-header h3 {
        margin: 0 0 6px;
        font-size: 22px;
        line-height: 1.2;
}

.wic-stage-header p {
        margin: 0;
        color: #6b7280;
}

.wic-stage {
        position: relative;
        background: #ffffff;
        border-radius: 20px;
        padding: 22px;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: auto;
        min-height: 880px;
        cursor: default;
        touch-action: none;
        -webkit-overflow-scrolling: touch;
}

.wic-stage.is-dragging {
        cursor: grabbing;
}

/* ── Floating Toolbar ────────────────────────────────────── */
/* Use .wic-root scope + !important to prevent theme/Elementor overrides */
.wic-root .wic-field-toolbar,
.wic-field-toolbar {
        position: absolute !important;
        z-index: 20 !important;
        background: #1e293b !important;
        border-radius: 10px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 4px 6px !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.18) !important;
        white-space: nowrap !important;
        pointer-events: auto !important;
        transform: translateY(-6px) !important;
}

.wic-root .wic-field-toolbar[hidden],
.wic-field-toolbar[hidden] {
        display: none !important;
}

.wic-root .wic-field-toolbar::after,
.wic-field-toolbar::after {
        content: '' !important;
        position: absolute !important;
        bottom: -6px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        border: 6px solid transparent !important;
        border-top-color: #1e293b !important;
        border-bottom: 0 !important;
        pointer-events: none !important;
}

.wic-root .wic-field-toolbar__row,
.wic-field-toolbar__row {
        display: flex !important;
        align-items: center !important;
        gap: 1px !important;
}

.wic-root .wic-field-toolbar__group,
.wic-field-toolbar__group {
        display: inline-flex !important;
        align-items: center !important;
        gap: 1px !important;
}

.wic-root .wic-field-toolbar__btn,
.wic-field-toolbar__btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 30px !important;
        height: 28px !important;
        background: transparent !important;
        border: none !important;
        border-radius: 6px !important;
        color: rgba(255,255,255,0.80) !important;
        cursor: pointer !important;
        transition: background 0.12s, color 0.12s !important;
        flex-shrink: 0 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        outline: none !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        letter-spacing: 0 !important;
}

.wic-root .wic-field-toolbar__btn:hover,
.wic-field-toolbar__btn:hover {
        background: rgba(255,255,255,0.13) !important;
        color: #ffffff !important;
}

.wic-root .wic-field-toolbar__btn.is-active,
.wic-field-toolbar__btn.is-active {
        background: rgba(99,102,241,0.65) !important;
        color: #ffffff !important;
}

.wic-root .wic-field-toolbar__btn.is-dimmed,
.wic-field-toolbar__btn.is-dimmed {
        opacity: 0.28 !important;
        pointer-events: none !important;
}

.wic-root .wic-field-toolbar__btn svg,
.wic-field-toolbar__btn svg {
        width: 15px !important;
        height: 15px !important;
        flex-shrink: 0 !important;
        fill: currentColor !important;
        display: block !important;
}

.wic-root .wic-field-toolbar__sep,
.wic-field-toolbar__sep {
        width: 1px !important;
        height: 18px !important;
        background: rgba(255,255,255,0.15) !important;
        margin: 0 4px !important;
        flex-shrink: 0 !important;
}

/* Looks like a sep on desktop; becomes a full-width row-break on mobile */
.wic-root .wic-field-toolbar__break,
.wic-field-toolbar__break {
        width: 1px !important;
        height: 18px !important;
        background: rgba(255,255,255,0.15) !important;
        margin: 0 4px !important;
        flex-shrink: 0 !important;
}

/* ── Undo / Redo floating action buttons ─────────────────── */
.wic-history-fab {
        position: fixed;
        right: 18px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        gap: 8px;
        z-index: 10020;
        pointer-events: auto;
}

.wic-hist-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 14px;
        background: #1e293b;
        color: #ffffff;
        border: none;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 4px 16px rgba(0,0,0,0.28);
        transition: background 0.15s, opacity 0.15s, transform 0.1s;
        white-space: nowrap;
}

.wic-hist-btn svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        pointer-events: none;
}

.wic-hist-btn:hover:not(:disabled) {
        background: #334155;
        transform: scale(1.05);
}

.wic-hist-btn:disabled {
        opacity: 0.35;
        cursor: default;
        transform: none;
}

/* ── Pencil overlay button (top-left of selected text field) */
.wic-pencil-btn {
        position: absolute;
        z-index: 25;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        padding: 0;
        background: #6366f1;
        color: #ffffff;
        border: 2px solid #ffffff;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.30);
        transform: translate(-40%, -40%);
        transition: background 0.15s, transform 0.1s;
        pointer-events: auto;
        touch-action: manipulation;
}

.wic-pencil-btn svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
        pointer-events: none;
}

.wic-pencil-btn:hover {
        background: #4f46e5;
        transform: translate(-40%, -40%) scale(1.15);
}

.wic-pencil-btn:active {
        transform: translate(-40%, -40%) scale(0.95);
}

/* ── Inline canvas text editor ───────────────────────────── */
.wic-inline-text-wrap {
        display: none;
        position: absolute;
        z-index: 30;
        pointer-events: none;
}

.wic-inline-text-ta {
        display: block;
        width: 100%;
        pointer-events: auto;
        background: rgba(255,255,255,0.88);
        border: 2px solid rgba(99,102,241,0.75);
        border-radius: 4px;
        padding: 4px 6px;
        box-sizing: border-box;
        resize: none;
        outline: none;
        overflow: hidden;
        line-height: 1.25;
        font-family: inherit;
}

.wic-preview-click-hint {
        position: absolute;
        top: 14px;
        right: 14px;
        background: rgba(17, 24, 39, 0.86);
        color: #ffffff;
        font-size: 12px;
        font-weight: 700;
        padding: 8px 10px;
        border-radius: 999px;
        pointer-events: none;
        z-index: 2;
}

.wic-canvas {
        width: 100%;
        max-width: 680px;
        height: auto;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
        cursor: grab;
        display: block;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        transform: translate3d(0, 0, 0);
        will-change: transform;
}

.wic-field-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
}

.wic-field-item {
        width: 100%;
        border: 1px solid #d08aa8;
        background: #fff6fa;
        color: #8f4667;
        padding: 12px 14px;
        border-radius: 12px;
        text-align: center;
        cursor: pointer;
        font-weight: 600;
        font-size: 16px;
        transition: all 0.2s ease;
}

.wic-field-item:hover,
.wic-field-item.is-active {
        background: #111827;
        color: #ffffff;
        border-color: #111827;
}

.wic-control-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 14px;
}

.wic-control-group label {
        font-size: 13px;
        font-weight: 600;
        color: #374151;
}

.wic-input {
        width: 100%;
        border: 1px solid #dfe3ea;
        border-radius: 14px;
        padding: 12px 14px;
        background: #fff;
        font-size: 14px;
        box-sizing: border-box;
}

.wic-input:focus {
        outline: none;
        border-color: #111827;
        box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.wic-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
}

.wic-grid-3 {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
}

.wic-icon-btn-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
}

.wic-icon-btn {
        width: 36px;
        height: 36px;
        border: 1.5px solid #e2e6ee;
        background: #f8fafc;
        color: #374151;
        border-radius: 10px;
        cursor: pointer;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.13s ease, color 0.13s ease, border-color 0.13s ease;
        position: relative;
}

.wic-icon-btn svg {
        width: 17px;
        height: 17px;
        fill: currentColor;
        pointer-events: none;
        display: block;
}

.wic-icon-btn:hover {
        background: #111827;
        color: #ffffff;
        border-color: #111827;
}

.wic-icon-btn.is-active {
        background: #111827;
        color: #ffffff;
        border-color: #111827;
}

.wic-icon-btn[title]:hover::after {
        content: attr(title);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%);
        background: rgba(15, 23, 42, 0.92);
        color: #fff;
        font-size: 11px;
        white-space: nowrap;
        padding: 3px 7px;
        border-radius: 6px;
        pointer-events: none;
        z-index: 20;
}

.wic-color-control-row {
        display: flex;
}

.wic-color-open-btn {
        width: 100%;
        min-height: 48px;
        border-radius: 14px !important;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 0 14px !important;
        font-weight: 700;
}

.wic-color-open-btn__swatch {
        width: 22px;
        height: 22px;
        border-radius: 999px;
        border: 2px solid rgba(0,0,0,0.12);
        flex: 0 0 auto;
}

.wic-gradient-controls {
        display: block;
}

/* Gradient stop position row */
.wic-gradient-stop-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 6px;
}

.wic-gradient-stop-label {
        font-size: 12px;
        color: #94a3b8;
        white-space: nowrap;
        flex: 0 0 auto;
        min-width: 52px;
}

.wic-gradient-stop-slider {
        flex: 1 1 auto;
        -webkit-appearance: none;
        appearance: none;
        height: 4px;
        border-radius: 2px;
        background: linear-gradient(to right, #475569, #94a3b8);
        outline: none;
        cursor: pointer;
        accent-color: #7c3aed;
}

.wic-gradient-stop-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: #7c3aed;
        border: 2px solid #fff;
        box-shadow: 0 0 0 1px #7c3aed;
        cursor: pointer;
}

.wic-gradient-stop-slider::-moz-range-thumb {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: #7c3aed;
        border: 2px solid #fff;
        box-shadow: 0 0 0 1px #7c3aed;
        cursor: pointer;
}

.wic-gradient-stop-value {
        font-size: 12px;
        color: #cbd5e1;
        flex: 0 0 auto;
        min-width: 32px;
        text-align: right;
}

.wic-editor-tip {
        margin-top: 4px;
        padding: 12px 14px;
        border-radius: 14px;
        background: #f8fafc;
        border: 1px solid #e5e7eb;
        color: #4b5563;
        font-size: 13px;
        line-height: 1.5;
}

.wic-actions-panel {
        margin: 0 0 16px;
}

.wic-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
}

.wic-btn {
        width: 100%;
        min-height: 42px;
        border-radius: var(--wic-btn-radius, 12px);
        border: none;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 16px;
        transition: filter 0.13s ease, transform 0.1s ease;
}

.wic-btn svg {
        width: 16px;
        height: 16px;
        fill: currentColor;
        flex-shrink: 0;
}

.wic-btn--primary {
        background: var(--wic-btn-primary-bg, #111827);
        color: var(--wic-btn-primary-text, #ffffff);
}

.wic-btn--primary:hover {
        filter: brightness(1.18);
}

.wic-btn--secondary {
        background: var(--wic-btn-secondary-bg, #f1f5f9);
        color: var(--wic-btn-secondary-text, #374151);
        border: 1.5px solid #e2e6ee;
}

.wic-btn--secondary:hover {
        filter: brightness(0.95);
}

.wic-status {
        margin-top: 12px;
        min-height: 20px;
        font-size: 13px;
        font-weight: 600;
}

.wic-status.is-success {
        color: #15803d;
}

.wic-status.is-error {
        color: #b91c1c;
}

.wic-status.is-loading {
        color: #6b7280;
}

form.cart.wic-product-form {
        margin-top: 0 !important;
}

form.cart.wic-product-form .single_add_to_cart_button.wic-hidden-until-saved,
form.cart.wic-product-form input.qty.wic-hidden-until-saved,
form.cart.wic-product-form .quantity:has(input.qty.wic-hidden-until-saved) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
}

.wic-color-modal {
        position: fixed;
        inset: 0;
        z-index: 10060;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-sizing: border-box;
        pointer-events: none; /* allow clicks to reach the canvas */
}

.wic-color-modal[hidden] {
        display: none !important;
}

.wic-color-modal__backdrop {
        display: none; /* removed – clicking outside closes via backdrop gone */
}

.wic-color-modal__dialog {
        position: relative;
        z-index: 1;
        width: min(100%, 460px);
        background: #ffffff;
        border-radius: 20px;
        box-shadow: 0 24px 80px rgba(15, 23, 42, 0.30);
        padding: 18px;
        pointer-events: all; /* dialog itself stays interactive */
        user-select: none;
}

.wic-color-modal__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 14px;
        cursor: grab;
}

.wic-color-modal__close {
        width: 40px;
        height: 40px;
        border-radius: 999px;
        border: 0;
        background: #111827;
        color: #ffffff;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
}

.wic-color-modal__body {
        display: flex;
        flex-direction: column;
        gap: 0;
}

.wic-color-picker-native {
        height: 52px;
        padding: 6px !important;
        cursor: pointer;
}

.wic-color-modal__preview-wrap {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-top: 6px;
        padding: 12px 0 4px;
        font-weight: 700;
        color: #374151;
}

.wic-color-modal__preview {
        display: inline-block;
        width: 64px;
        height: 36px;
        border-radius: 12px;
        border: 1px solid #dfe3ea;
        background: #111111;
}

.wic-color-modal__footer {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 18px;
}

/* body.wic-color-modal-open scroll lock removed – modal is now non-blocking */

.wic-design-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
        margin-top: 18px;
}

.wic-design-card {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 18px;
        border-radius: 18px;
        border: 1px solid #e8e8ee;
        background: #fff;
        text-decoration: none;
        color: #111827;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wic-design-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
        color: #111827;
}

.wic-design-card__eyebrow {
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #6b7280;
}

@media (max-width: 1280px) {
        .wic-stage-layout,
        .wic-stage-layout.is-post-purchase {
                grid-template-columns: 1fr 2fr 1fr;
                grid-template-areas: "left canvas right";
                gap: 16px;
        }

        .wic-stage {
                min-height: 760px;
        }

        .wic-canvas {
                max-width: 600px;
        }
}

@media (max-width: 980px) {
        /* Move FAB above the Opcije button on mobile */
        .wic-history-fab {
                top: auto;
                transform: none;
                bottom: calc(16px + 56px + 10px); /* above fixed Opcije pill */
                right: 16px;
                flex-direction: column;
                gap: 6px;
        }

        .wic-hist-btn {
                font-size: 12px;
                padding: 9px 13px;
        }

        /* ── Mobile toolbar (static bar above canvas) ─────────── */
        /* Toolbar bar compact on mobile */
        .wic-toolbar-bar {
                padding: 6px 8px;
                margin-bottom: 8px;
                position: relative;
                justify-content: center;
        }

        /* Hidden state: collapses the whole bar to just the close button line */
        .wic-toolbar-bar--closed {
                display: none !important;
        }

        /* Close (X) button — absolute top-right of the toolbar on mobile */
        .wic-toolbar-close-btn {
                display: flex !important;
                position: absolute !important;
                top: 4px !important;
                right: 4px !important;
                align-items: center;
                justify-content: center;
                width: 26px;
                height: 26px;
                background: rgba(255,255,255,0.10);
                border: 1px solid rgba(255,255,255,0.22);
                border-radius: 6px;
                font-size: 18px;
                line-height: 1;
                color: rgba(255,255,255,0.75);
                cursor: pointer;
                padding: 0;
                z-index: 2;
        }
        .wic-toolbar-close-btn:hover {
                background: rgba(255,255,255,0.20);
                color: #fff;
        }
        /* Row wraps; padding-right reserves space so buttons don't slide under the X */
        .wic-field-toolbar__row {
                flex-wrap: wrap !important;
                row-gap: 2px !important;
                padding-right: 30px;
        }

        /* Row-break: invisible spacer only — no separator line
           Needs .wic-root prefix to win over the higher-specificity desktop rule */
        .wic-root .wic-field-toolbar__break,
        .wic-field-toolbar__break {
                flex-basis: 100% !important;
                width: 0 !important;
                height: 0 !important;
                background: transparent !important;
                border: none !important;
                margin: 0 !important;
                flex-shrink: 0 !important;
        }

        /* Hide vertical separators — not needed when wrapped */
        .wic-root .wic-field-toolbar__sep,
        .wic-field-toolbar__sep {
                display: none !important;
        }

        /* Hide text-formatting buttons when an image field is active (mobile only) */
        .wic-field-toolbar.wic-toolbar--image [data-mobile-text-only] {
                display: none !important;
        }

        .wic-field-toolbar__btn {
                width: 26px !important;
                height: 24px !important;
        }

        .wic-field-toolbar__btn svg {
                width: 13px !important;
                height: 13px !important;
        }

        .wic-mobile-sidebar-toggle {
                display: inline-flex !important;
                align-items: center;
                gap: 8px;
                position: fixed;
                right: 16px;
                bottom: 16px;
                z-index: 10010;
                background: #111827;
                color: #fff;
                border: 0;
                border-radius: 999px;
                padding: 12px 16px;
                font-weight: 700;
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
        }

        .wic-mobile-sidebar-overlay {
                display: block !important;
                position: fixed;
                inset: 0;
                background: rgba(17, 24, 39, 0.42);
                opacity: 0;
                pointer-events: none;
                transition: opacity 0.25s ease;
                z-index: 10000;
        }

        .wic-mobile-sidebar-overlay.is-open {
                opacity: 1;
                pointer-events: auto;
        }

        .wic-stage-layout,
        .wic-stage-layout.is-post-purchase {
                grid-template-columns: 1fr;
                grid-template-areas: none;
        }

        /* Restore sidebar as a real block — overrides display:contents from desktop */
        .wic-sidebar {
                display: block !important;
                position: fixed;
                top: 0;
                left: 0;
                bottom: 0;
                width: min(92vw, 420px);
                background: #f8fafc;
                z-index: 10020;
                transform: translateX(-102%);
                transition: transform 0.28s ease;
                box-shadow: 20px 0 50px rgba(0, 0, 0, 0.15);
                overflow: auto;
                padding: 14px;
                box-sizing: border-box;
        }

        /* Left and right panels stack vertically inside the mobile drawer */
        .wic-left-panel,
        .wic-right-panel {
                display: block;
        }

        .wic-left-panel__inner,
        .wic-right-panel__inner {
                position: static;
                max-height: none;
                overflow-y: visible;
                gap: 14px;
        }

        .wic-sidebar.is-open {
                transform: translateX(0);
        }

        .wic-sidebar__header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 6px 4px 12px;
        }

        .wic-sidebar-close {
                display: inline-flex !important;
                align-items: center;
                justify-content: center;
                width: 40px;
                height: 40px;
                border-radius: 999px;
                border: 0;
                background: #111827;
                color: #fff;
                font-size: 26px;
                line-height: 1;
        }

        body.wic-sidebar-open {
                overflow: hidden;
        }

        /* Stage-wrap: remove horizontal padding so content reaches edges */
        .wic-stage-wrap {
                padding: 12px 0;
                border-radius: 0;
        }

        /* Stage: no inner padding — canvas fills edge to edge.
           min-height: 0 so the stage height is driven by the canvas's aspect-ratio,
           not a fixed pixel value. overflow: visible so pencil/handle overlays
           near canvas edges are not clipped. */
        .wic-stage {
                min-height: 0;
                padding: 0;
                border-radius: 0;
                overflow: visible;
        }

        /* Canvas fills full stage width; aspect-ratio set by JS drives the height */
        .wic-canvas {
                max-width: 100%;
                width: 100%;
                height: auto;
                display: block;
                border-radius: 0;
        }

        .wic-style-buttons,
        .wic-fill-type-buttons {
                grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .wic-align-buttons {
                grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .wic-position-buttons--3 {
                grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .wic-style-btn,
        .wic-align-btn,
        .wic-pos-btn,
        .wic-fill-type-btn {
                min-height: 52px;
                font-size: 15px;
        }

        .wic-color-modal__dialog {
                width: min(100%, 420px);
        }
}

@media (max-width: 640px) {
        .wic-field-toolbar {
                white-space: normal !important;
                padding: 2px 3px !important;
        }

        .wic-field-toolbar__sep {
                height: 12px !important;
                margin: 0 1px !important;
        }

        .wic-stage-wrap {
                padding: 8px 0;
                border-radius: 0;
        }

        .wic-stage {
                padding: 0;
                min-height: 0;
                overflow: visible;
        }

        .wic-canvas {
                max-width: 100%;
                width: 100%;
                height: auto;
                border-radius: 0;
        }

        .wic-preview-click-hint {
                top: 10px;
                right: 10px;
                font-size: 11px;
                padding: 7px 9px;
                max-width: calc(100% - 20px);
        }

        .wic-mobile-sidebar-toggle {
                right: 12px;
                bottom: 12px;
                padding: 11px 14px;
        }

        .wic-color-modal {
                padding: 14px;
        }

        .wic-color-modal__dialog {
                padding: 16px;
                border-radius: 18px;
        }

        .wic-color-modal__footer {
                flex-direction: column;
        }

        .wic-color-modal__footer .button {
                width: 100%;
        }
}

/* ── Image upload panel ──────────────────────────────────────────── */

.wic-image-upload-panel {
        margin-top: 4px;
}

.wic-image-upload-preview-wrap {
        width: 100%;
        min-height: 90px;
        background: #f4f4f8;
        border: 1px dashed #c8c8d8;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        margin-bottom: 10px;
}

.wic-image-upload-preview {
        display: block;
        max-width: 100%;
        max-height: 180px;
        object-fit: contain;
        border-radius: 8px;
}

.wic-image-upload-empty {
        font-size: 12px;
        color: #9090a8;
        padding: 16px;
        text-align: center;
}

.wic-image-upload-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin-bottom: 8px;
}

.wic-image-upload-btn {
        flex: 1;
        background: #6366f1 !important;
        color: #fff !important;
        border-color: #6366f1 !important;
        font-weight: 600 !important;
        border-radius: 7px !important;
}

.wic-image-upload-btn:hover {
        background: #4f46e5 !important;
        border-color: #4f46e5 !important;
}

.wic-image-remove-btn {
        background: #fee2e2 !important;
        color: #b91c1c !important;
        border-color: #fca5a5 !important;
        border-radius: 7px !important;
}

.wic-image-remove-btn:hover {
        background: #fecaca !important;
}

.wic-image-upload-hint {
        font-size: 11px;
        color: #9090a8;
        margin: 0;
        line-height: 1.5;
}

/* ── Fixed toolbar bar above canvas ───────────────────── */
.wic-toolbar-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 12px;
        background: #ffffff;
        border: 1px solid #e8e8ee;
        border-radius: 14px;
        margin-bottom: 12px;
        flex-wrap: wrap;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.wic-toolbar-bar .wic-field-toolbar {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-wrap: wrap !important;
}

.wic-toolbar-bar .wic-field-toolbar.is-disabled {
        opacity: 0.35;
        pointer-events: none;
}

/* Close (X) button inside toolbar — desktop: hidden; mobile: visible */
.wic-toolbar-close-btn {
        display: none !important;
}

@media (max-width: 980px) {
        .wic-toolbar-close-btn {
                display: flex !important;
        }
}

/* ── Color mode buttons (Flat / Zlatotisk / Srebrnotisk) ─ */
.wic-color-mode-row {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 4px;
}

.wic-color-mode-btn {
        padding: 5px 10px;
        border: 1px solid #d1d5db;
        border-radius: 7px;
        background: #f9fafb;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        color: #374151;
        transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wic-color-mode-btn:hover {
        background: #ede9fe;
        border-color: #7c3aed;
        color: #7c3aed;
}

.wic-color-mode-btn.is-active {
        background: #7c3aed;
        border-color: #7c3aed;
        color: #ffffff;
}

.wic-color-mode-preview-group {
        margin-top: 8px;
}

.wic-gradient-swatch-preview {
        width: 100%;
        height: 24px;
        border-radius: 6px;
        border: 1px solid #e0e0e0;
        margin-top: 4px;
        display: block;
}

/* ── Field list: duplicate button + Add Image ────────────── */
.wic-field-item-row {
        display: flex;
        align-items: stretch;
        gap: 4px;
}

.wic-field-item-row .wic-field-item-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 16px;
}

/* Field name button inside row — flex fill, same height as icon buttons */
.wic-field-item-row .wic-field-item {
        flex: 1;
        width: auto;
        min-width: 0;
        padding: 0 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
}

.wic-field-dup-btn {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        padding: 0;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        background: #f3f4f6;
        cursor: pointer;
        color: #374151;
        line-height: 1;
}

.wic-field-dup-btn svg {
        width: 14px;
        height: 14px;
        pointer-events: none;
        display: block;
}

.wic-field-dup-btn:hover {
        background: #dbeafe;
        border-color: #3b82f6;
        color: #1d4ed8;
}

.wic-add-image-field-btn {
        display: block;
        width: 100%;
        margin-top: 8px;
        padding: 7px 12px;
        border: 1px dashed #a5b4fc;
        border-radius: 8px;
        background: #f5f3ff;
        color: #6366f1;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        transition: background 0.15s;
}

.wic-add-image-field-btn:hover {
        background: #ede9fe;
}

/* ── Flip buttons ──────────────────────────────────────── */
.wic-flip-btn {
        padding: 5px 9px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        background: #f9fafb;
        cursor: pointer;
        font-size: 13px;
        color: #374151;
        transition: background 0.15s;
}

.wic-flip-btn:hover {
        background: #dbeafe;
        border-color: #3b82f6;
}

.wic-flip-btn.is-active {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #fff;
}

/* ── Delete field button ───────────────────────────────── */
.wic-field-del-btn {
        background: none;
        border: 1px solid transparent;
        cursor: pointer;
        padding: 0;
        width: 32px;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #ef4444;
        transition: background 0.15s, color 0.15s, border-color 0.15s;
        flex-shrink: 0;
}

.wic-field-del-btn svg {
        width: 15px;
        height: 15px;
        pointer-events: none;
}

.wic-field-del-btn:hover {
        background: #fee2e2;
        border-color: #fca5a5;
        color: #b91c1c;
}

/* ── Lock aspect checkbox row ──────────────────────────── */
.wic-checkbox-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: #374151;
        cursor: pointer;
        margin-top: 4px;
}

.wic-checkbox-label input[type="checkbox"] {
        width: 15px;
        height: 15px;
        cursor: pointer;
        accent-color: #6366f1;
}
/* ── Color opacity slider ──────────────────────────────── */
.wic-opacity-row {
        display: flex;
        align-items: center;
        gap: 10px;
}

.wic-color-opacity-slider {
        flex: 1;
        height: 6px;
        accent-color: #6366f1;
        cursor: pointer;
        background: linear-gradient(to right, transparent, #6366f1);
        border-radius: 3px;
}

.wic-color-opacity-val {
        min-width: 38px;
        text-align: right;
        font-size: 12px;
        font-weight: 600;
        color: #6366f1;
}

/* ── Admin lock panel ─────────────────────────────────── */
.wic-lock-panel .wic-panel__title {
        color: #dc2626;
}

.wic-lock-panel .wic-checkbox-label {
        padding: 4px 6px;
        border-radius: 6px;
        transition: background 0.12s;
}

.wic-lock-panel .wic-checkbox-label:hover {
        background: #fff1f2;
}

.wic-lock-panel .wic-checkbox-label input[type="checkbox"] {
        accent-color: #dc2626;
}

/* ── Lock-changes: visually disable editor controls ──── */
.wic-controls-locked {
        position: relative;
}

.wic-controls-locked::after {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(255, 255, 255, 0.55);
        border-radius: 20px;
        z-index: 10;
        cursor: not-allowed;
        pointer-events: all;
}

.wic-controls-locked .wic-input:disabled {
        background: #f3f4f6;
        color: #9ca3af;
        cursor: not-allowed;
}

/* ── Watermark opacity slider (admin backend) ─────────── */
#wic_watermark_opacity {
        flex: 1;
        accent-color: #6366f1;
        cursor: pointer;
        height: 6px;
}
#wic_wm_opacity_val {
        min-width: 26px;
        text-align: right;
        font-weight: 600;
        color: #6366f1;
}

/* ── Zoom bar ──────────────────────────────────────────────────────── */
.wic-zoom-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 0 4px;
}

.wic-zoom-btn {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
        background: #f9fafb;
        color: #374151;
        font-size: 18px;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: background 0.15s;
}
.wic-zoom-btn:hover { background: #e5e7eb; }

.wic-zoom-display {
        min-width: 48px;
        text-align: center;
        font-size: 13px;
        font-weight: 600;
        color: #374151;
}

/* ── Admin fullscreen overlay ──────────────────────────────────────── */
#wic-admin-canvas-wrap.wic-admin-fullscreen {
        position: fixed !important;
        inset: 0 !important;
        z-index: 100000 !important;
        background: #f0f0f1 !important;
        overflow-y: auto !important;
        margin: 0 !important;
        padding: 24px !important;
        box-sizing: border-box !important;
}
