/* ==========================================================================
   FRAMER-SET — premium editorial redesign
   Warm neutrals, Inter typography, confident hierarchy
   ========================================================================== */

/* --- Design tokens -------------------------------------------------------- */
.frameset-page,
.framer-modal,
#editModal {
    --fs-bg:          #f6f4f1;
    --fs-bg-canvas:   #edeae6;
    --fs-surface:     #ffffff;
    --fs-surface-alt: #faf9f7;
    --fs-ink:         #1a1a1a;
    --fs-ink-soft:    #6b6560;
    --fs-ink-muted:   #a39e98;
    --fs-border:      #e8e4e0;
    --fs-border-soft: #f0ece8;
    --fs-accent:      #c8503c;
    --fs-accent-soft: #d4725f;
    --fs-accent-bg:   #fdf2ef;

    --fs-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --fs-r-sm:   6px;
    --fs-r-md:   10px;
    --fs-r-lg:   16px;
    --fs-r-xl:   24px;
    --fs-r-full: 999px;

    --fs-shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
    --fs-shadow-md: 0 4px 16px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
    --fs-shadow-lg: 0 12px 40px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
    --fs-shadow-xl: 0 20px 60px rgba(0,0,0,.1), 0 8px 20px rgba(0,0,0,.06);

    --fs-ease:     cubic-bezier(.25, .1, .25, 1);
    --fs-ease-out: cubic-bezier(.16, 1, .3, 1);
    --fs-dur:      200ms;
}

/* --- Kill body/html scroll when frameset is active (constructor only) ----- */
html.frameset-active.frameset-constructor,
html.frameset-active.frameset-constructor body {
    overflow: hidden !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* --- Page layout ---------------------------------------------------------- */
.frameset-page {
    background: var(--fs-bg);
    font-family: var(--fs-font);
    color: var(--fs-ink);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 50;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.frameset-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 60;
}

/* Generic hide class (used by JS) */
.fs-hidden {
    display: none !important;
}

/* --- Main app area: canvas left, product card right ----------------------- */
#frameset-app {
    width: 100%;
    height: calc(100vh - 65px);
    margin-top: 65px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    padding: 0;
}

/* --- Canvas area (left, centered SVG) ------------------------------------- */
.frameset-canvas-area {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--fs-bg-canvas);
    padding: 40px;
}

/* Dot-grid pattern */
.frameset-canvas-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,.035) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

#svg-canvas-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 32px rgba(0,0,0,.10));
}

#svg-canvas-wrap svg {
    max-width: 650px;
    max-height: calc(100vh - 160px);
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--fs-r-sm);
}

#svg-canvas-wrap svg rect[data-pane] {
    cursor: pointer;
    transition: opacity .15s;
}

#svg-canvas-wrap svg rect[data-pane]:hover,
#svg-canvas-wrap svg rect[data-pane].pane-active {
    opacity: 1;
}

/* Per-pane frame borders */
.pane-frame-border {
    pointer-events: none;
}

/* Hint '+' icon */
.pane-hint {
    pointer-events: none;
    font-size: 18px;
    fill: rgba(0,0,0,.25);
    opacity: 1;
    font-family: var(--fs-font);
    font-weight: 500;
}

/* --- Legacy pane controls block (unused, kept for safety) ----------------- */
.pane-controls {
    display: none !important;
}

.pane-ctrl-btn {
    border: 0;
    border-radius: var(--fs-r-full);
    padding: 6px 12px;
    background: var(--fs-ink);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

/* ==========================================================================
   PER-PANE OVERLAY CONTROLS (edit/delete on each image)
   ========================================================================== */
.pane-overlay-controls {
    pointer-events: none;
}

.pane-controls-row {
    position: absolute;
    left: 8px;
    top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 1;
    pointer-events: auto;
}

.pane-ctrl-round-btn {
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    border: none;
    border-radius: var(--fs-r-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 9px;
    transition: background var(--fs-dur) var(--fs-ease), transform var(--fs-dur) var(--fs-ease);
    pointer-events: auto;
    color: #fff;
}

.pane-ctrl-round-btn:hover {
    background: rgba(0, 0, 0, .75);
    transform: scale(1.05);
}

.pane-ctrl-round-btn svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* ---- Low-resolution warning badge (below edit/delete buttons) ---- */
.pane-controls-row .pane-low-res-warn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(245, 166, 35, 0.95);
    color: #fff;
    cursor: help;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    margin-top: 2px;
}
.pane-controls-row .pane-low-res-warn svg { display: block; }
.pane-controls-row .pane-low-res-warn .pane-low-res-tip {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 60;
}
.pane-controls-row .pane-low-res-warn:hover .pane-low-res-tip,
.pane-controls-row .pane-low-res-warn:focus .pane-low-res-tip {
    opacity: 1;
}

/* ==========================================================================
   PRODUCT INFO CARD — right side panel
   ========================================================================== */
.product-info-card {
    flex-shrink: 0;
    width: 380px;
    background: var(--fs-surface);
    border-left: 1px solid var(--fs-border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* Scrollable inner content (title, sizes, price, progress, options) */
.product-info-card__inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 36px 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.product-info-card__inner::-webkit-scrollbar {
    width: 6px;
}

.product-info-card__inner::-webkit-scrollbar-thumb {
    background: var(--fs-border);
    border-radius: 999px;
}

.product-info-card__inner::-webkit-scrollbar-thumb:hover {
    background: var(--fs-ink-muted);
}

/* Sticky footer: upload prompt OR order button */
.product-info-card__footer {
    flex-shrink: 0;
    padding: 16px 24px 24px;
    background: var(--fs-surface);
    border-top: 1px solid var(--fs-border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-info-card__eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--fs-accent);
    margin-bottom: 8px;
}

.product-info-card__title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--fs-ink);
    margin: 0 0 8px;
    line-height: 1.2;
}

.product-info-card__sizes {
    font-size: 13px;
    color: var(--fs-ink-soft);
    margin: 0;
    line-height: 1.55;
}

.product-info-card__sizes strong {
    color: var(--fs-ink);
    font-weight: 600;
}

.product-info-card__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 16px 0 20px;
    padding-top: 14px;
    border-top: 1px solid var(--fs-border);
}

.product-info-card__price .price-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--fs-ink);
    line-height: 1;
    letter-spacing: -.03em;
}

.product-info-card__price .price-currency {
    font-size: 16px;
    font-weight: 500;
    color: var(--fs-ink-soft);
}

/* --- Spacer pushes CTA to card bottom ------------------------------------- */
.product-info-card__spacer {
    flex: 1 1 auto;
    min-height: 16px;
}

/* ==========================================================================
   PROGRESS INDICATOR — "X of N photos uploaded"
   ========================================================================== */
.fs-progress {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 0 0 20px;
    background: var(--fs-surface-alt);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-r-md);
    transition: background var(--fs-dur) var(--fs-ease),
                border-color var(--fs-dur) var(--fs-ease);
}

.fs-progress__ring {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    position: relative;
}

.fs-progress__ring svg {
    display: block;
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}

.fs-progress__bg {
    fill: none;
    stroke: var(--fs-border);
    stroke-width: 3.5;
}

.fs-progress__fill {
    fill: none;
    stroke: var(--fs-accent);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 100.53;      /* 2π × 16 */
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 400ms var(--fs-ease-out),
                stroke var(--fs-dur) var(--fs-ease);
}

.fs-progress__text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fs-progress__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--fs-ink);
    line-height: 1.3;
    letter-spacing: -.01em;
}

.fs-progress__sub {
    font-size: 11px;
    color: var(--fs-ink-muted);
    line-height: 1.3;
}

/* Complete state — success green */
.fs-progress--complete {
    background: #f0faf3;
    border-color: #d1f1db;
}

.fs-progress--complete .fs-progress__fill {
    stroke: #2ecc71;
}

.fs-progress--complete .fs-progress__title {
    color: #1b7a3e;
}

.fs-progress--complete .fs-progress__sub {
    color: #2ecc71;
}

/* ==========================================================================
   INLINE SIDEBAR SECTIONS — Template / Frame / Glass / Passepartout
   ========================================================================== */
.fs-section {
    padding: 16px 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--fs-border-soft);
}

.fs-section:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.fs-section__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--fs-ink-muted);
    margin-bottom: 12px;
}

/* --- Order / Add to cart button ------------------------------------------- */
.product-info-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--fs-ink);
    color: #fff;
    border: none;
    border-radius: var(--fs-r-lg);
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--fs-dur) var(--fs-ease),
                transform var(--fs-dur) var(--fs-ease),
                box-shadow var(--fs-dur) var(--fs-ease);
    white-space: nowrap;
    letter-spacing: -.01em;
    margin-top: 0;
    width: 100%;
}

.product-info-card__btn:hover {
    background: #2a2a2a;
    transform: translateY(-1px);
    box-shadow: var(--fs-shadow-md);
}

.product-info-card__btn:active {
    transform: translateY(0);
}

.product-info-card__btn:disabled,
.product-info-card__btn.disabled {
    opacity: .35;
    pointer-events: none;
}

.product-info-card__btn svg {
    flex-shrink: 0;
}

/* Cart loading spinner */
.product-info-card__btn.btn-add-to-cart--loading svg {
    display: none;
}

.product-info-card__btn.btn-add-to-cart--loading span::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin .7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.price-label {
    font-size: 11px;
    color: var(--fs-ink-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.price-value.price-updating {
    color: var(--fs-ink-muted);
}

/* ==========================================================================
   UPLOAD PROMPT — shown in product card when panes are empty
   ========================================================================== */
.upload-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fd3;
    color: #000;
    padding: 16px 28px;
    border-radius: var(--fs-r-lg);
    cursor: pointer;
    transition: background var(--fs-dur) var(--fs-ease),
                transform var(--fs-dur) var(--fs-ease),
                box-shadow var(--fs-dur) var(--fs-ease);
    white-space: nowrap;
    margin-top: 0;
    width: 100%;
}

.upload-prompt:hover {
    background: #ffd91a;
    transform: translateY(-1px);
    box-shadow: var(--fs-shadow-md);
}

.upload-prompt__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-prompt__icon svg path {
    stroke: #000;
}

.upload-prompt__text {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    letter-spacing: -.01em;
}

/* ==========================================================================
   NOTIFICATIONS
   ========================================================================== */
.notification-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

/* Lift above mobile bottom-bar (tabs ~64px + CTA ~68px + safe area) */
@media (max-width: 900px) {
    .notification-container {
        bottom: calc(150px + env(safe-area-inset-bottom, 0px));
    }
}

.framer-notification {
    padding: 12px 20px;
    border-radius: var(--fs-r-md);
    margin-bottom: 0;
    font-size: 14px;
    color: #fff;
    box-shadow: var(--fs-shadow-md);
    font-family: var(--fs-font);
    font-weight: 500;
    pointer-events: auto;
    text-align: center;
}

.framer-notification--success { background: #2ecc71; }
.framer-notification--error   { background: var(--fs-accent); }
.framer-notification--info    { background: var(--fs-ink); }

/* ==========================================================================
   FRAMER-STYLE MODALS (legacy — kept for safety; modals removed from DOM)
   ========================================================================== */
.framer-modal {
    display: none !important;
    position: fixed;
    z-index: 1050;
    inset: 0;
    background: rgba(26, 26, 26, .15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: flex-end;
    font-family: var(--fs-font);
}

.framer-modal-content {
    background: var(--fs-surface);
    padding: 24px 28px;
    border-radius: var(--fs-r-xl);
    max-width: 640px;
    width: auto;
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: var(--fs-shadow-xl);
    border: 1px solid var(--fs-border-soft);
}

.framer-modal-content h5 {
    color: var(--fs-ink);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 18px;
    padding-right: 30px;
    letter-spacing: -.01em;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--fs-ink-muted);
}

.framer-modal-close {
    color: var(--fs-ink-muted);
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color var(--fs-dur) var(--fs-ease);
    z-index: 1;
}

.framer-modal-close:hover {
    color: var(--fs-ink);
}

/* ==========================================================================
   OPTION GRID — glass / passepartout (inline chip layout)
   ========================================================================== */
.option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.option-grid-item {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1.5px solid var(--fs-border);
    border-radius: var(--fs-r-full);
    padding: 6px 12px 6px 6px;
    text-align: left;
    transition: all var(--fs-dur) var(--fs-ease);
    background: var(--fs-surface-alt);
    min-width: 0;
}

.option-grid-item:hover {
    border-color: var(--fs-ink-muted);
    background: var(--fs-surface);
}

.option-grid-item.selected {
    border-color: var(--fs-ink);
    background: var(--fs-surface);
    box-shadow: var(--fs-shadow-sm);
}

.option-grid-item .option-preview {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--fs-border);
    background: #fff;
}

.option-grid-item .option-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--fs-ink-soft);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.option-grid-item.selected .option-name {
    color: var(--fs-ink);
}

.option-grid-item .option-price {
    font-size: 10px;
    color: var(--fs-ink-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================================================
   BOTTOM BAR — mobile-only CTA container (hidden on desktop, legacy styles kept)
   ========================================================================== */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    align-items: stretch;
    flex-direction: column;
    z-index: 100;
    font-family: var(--fs-font);
    background: var(--fs-surface);
    border-top: 1px solid var(--fs-border);
}

/* Legacy .bottom-controls (kept for safety if any code reaches for it) */
.bottom-controls {
    background: var(--fs-surface);
    display: none;
    gap: 4px;
}

/* Base .control-item — used in sidebar AND legacy bottom-bar */
.control-item {
    color: var(--fs-ink-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: var(--fs-r-md);
    transition: background var(--fs-dur) var(--fs-ease),
                color var(--fs-dur) var(--fs-ease);
    min-width: 68px;
    gap: 4px;
}

.control-item:hover {
    background: var(--fs-surface-alt);
    color: var(--fs-ink);
}

.control-item.active {
    background: var(--fs-ink);
    color: #fff;
}

.control-item svg {
    display: block;
    margin: 0;
    flex-shrink: 0;
    stroke: currentColor;
}

.control-item img {
    margin-bottom: 5px;
}

.control-item span {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 0;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   TEMPLATE — inline sidebar (horizontal scroll)
   ========================================================================== */
.templater {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.templater::-webkit-scrollbar {
    height: 4px;
}

.templater::-webkit-scrollbar-thumb {
    background: var(--fs-border);
    border-radius: 999px;
}

.templater-item {
    cursor: pointer;
    border: 1.5px solid var(--fs-border);
    border-radius: var(--fs-r-md);
    padding: 8px 8px 6px;
    background: var(--fs-surface-alt);
    text-align: center;
    transition: all var(--fs-dur) var(--fs-ease);
    user-select: none;
    width: 80px;
    flex-shrink: 0;
    scroll-snap-align: start;
}

.templater-item:hover {
    border-color: var(--fs-ink-muted);
    background: var(--fs-surface);
}

.templater-item.active {
    border-color: var(--fs-ink);
    background: var(--fs-surface);
    box-shadow: var(--fs-shadow-sm);
}

.templater-item svg {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

.templater-label {
    font-size: 9px;
    color: var(--fs-ink-muted);
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.templater-item.active .templater-label {
    color: var(--fs-ink);
}

/* ==========================================================================
   FRAME — inline sidebar color swatches
   ========================================================================== */
.frame-color-options {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.frame-color-option {
    cursor: pointer;
    text-align: center;
    border-radius: var(--fs-r-md);
    transition: all var(--fs-dur) var(--fs-ease);
    border: 1.5px solid var(--fs-border);
    padding: 6px 6px 4px;
    background: var(--fs-surface-alt);
    width: 88px;
}

.frame-color-option:hover {
    border-color: var(--fs-ink-muted);
    background: var(--fs-surface);
}

.frame-color-option.active {
    border-color: var(--fs-ink);
    background: var(--fs-surface);
    box-shadow: var(--fs-shadow-sm);
}

.frame-color-option img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--fs-r-sm);
    display: block;
    margin: 0 auto;
}

.frame-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--fs-r-sm);
    border: 1px solid var(--fs-border);
    margin: 0 auto;
}

.frame-color-name {
    display: block;
    font-size: 10px;
    color: var(--fs-ink-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 4px 2px 2px;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
}

.frame-color-option.active .frame-color-name {
    color: var(--fs-ink);
}

/* ==========================================================================
   CROP MODAL (fullscreen)
   ========================================================================== */
#editModal .modal-dialog {
    max-width: 100% !important;
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
}

#editModal .modal-content {
    height: 100vh;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    background: var(--fs-bg);
    font-family: var(--fs-font);
}

/* Crop header */
.crop-modal-header {
    flex-shrink: 0;
    text-align: center;
    padding: 18px 20px 10px;
    border-bottom: none;
    position: relative;
    background: var(--fs-bg);
}

.crop-close-btn {
    position: absolute;
    left: 16px;
    top: 18px;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--fs-ink-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
    transition: color var(--fs-dur) var(--fs-ease);
}

.crop-close-btn:hover {
    color: var(--fs-ink);
}

.crop-header-text {
    padding-top: 4px;
}

.crop-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--fs-ink);
    margin: 0;
    letter-spacing: -.01em;
}

.crop-subtitle {
    font-size: 12px;
    color: var(--fs-ink-muted);
    margin: 4px 0 0;
    font-weight: 500;
}

/* Crop body */
#editModal .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--fs-bg);
}

#editModal .modal-body > img {
    max-height: 100%;
    max-width: 100%;
    display: block;
}

#editModal .cropper-container {
    max-height: calc(100vh - 260px) !important;
    height: calc(100vh - 260px) !important;
    width: 100% !important;
}

.cropper-modal {
    background-color: var(--fs-bg);
    opacity: 1;
}

#cropper-image.loading {
    opacity: 0;
}

#crop-loader .spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto;
    border: 3px solid var(--fs-border);
    border-top: 3px solid var(--fs-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Crop footer */
.crop-modal-footer {
    flex-shrink: 0;
    padding: 16px 24px 28px;
    border-top: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: var(--fs-bg);
}

.crop-zoom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.crop-zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--fs-r-full);
    border: 1.5px solid var(--fs-border);
    background: var(--fs-surface);
    font-size: 20px;
    color: var(--fs-ink-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: border-color var(--fs-dur) var(--fs-ease),
                color var(--fs-dur) var(--fs-ease);
    font-family: var(--fs-font);
    font-weight: 500;
}

.crop-zoom-btn:hover {
    border-color: var(--fs-ink-muted);
    color: var(--fs-ink);
}

.crop-zoom-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 3px;
    border-radius: var(--fs-r-full);
    background: var(--fs-border);
    outline: none;
}

.crop-zoom-range::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: var(--fs-r-full);
    background: var(--fs-border);
}

.crop-zoom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--fs-surface);
    border: 2px solid var(--fs-accent);
    cursor: pointer;
    margin-top: -9px;
    box-shadow: var(--fs-shadow-sm);
}

.crop-zoom-range::-moz-range-track {
    height: 3px;
    border-radius: var(--fs-r-full);
    background: var(--fs-border);
}

.crop-zoom-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--fs-surface);
    border: 2px solid var(--fs-accent);
    cursor: pointer;
    box-shadow: var(--fs-shadow-sm);
}

.crop-done-btn {
    display: block;
    width: 100%;
    max-width: 360px;
    padding: 14px 0;
    background: var(--fs-ink);
    color: #fff;
    border: none;
    border-radius: var(--fs-r-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--fs-font);
    letter-spacing: -.01em;
    transition: background var(--fs-dur) var(--fs-ease),
                transform var(--fs-dur) var(--fs-ease);
}

.crop-done-btn:hover {
    background: #2a2a2a;
    transform: translateY(-1px);
}

.crop-done-btn:disabled {
    opacity: .5;
    cursor: default;
}

/* ==========================================================================
   GALLERY — сторінка вибору шаблонів (kept)
   ========================================================================== */
.gallery-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 60px;
    font-family: var(--fs-font);
}

.gallery-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--fs-ink);
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: -.03em;
}

.gallery-subtitle {
    font-size: 15px;
    color: var(--fs-ink-muted);
    text-align: center;
    margin: 0 0 40px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.gallery-card {
    display: block;
    background: var(--fs-surface);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-r-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--fs-dur) var(--fs-ease),
                transform var(--fs-dur) var(--fs-ease),
                border-color var(--fs-dur) var(--fs-ease);
}

.gallery-card:hover {
    box-shadow: var(--fs-shadow-lg);
    transform: translateY(-4px);
    border-color: var(--fs-border-soft);
    text-decoration: none;
    color: inherit;
}

.gallery-card__preview {
    padding: 24px;
    background: var(--fs-bg-canvas);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.gallery-card__preview svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
}

.gallery-card__info {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-card__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--fs-ink);
    letter-spacing: -.01em;
}

.gallery-card__meta {
    font-size: 13px;
    color: var(--fs-ink-muted);
}

.gallery-card__price {
    font-size: 20px;
    font-weight: 800;
    color: var(--fs-ink);
    margin-top: 6px;
    letter-spacing: -.02em;
}

.gallery-empty {
    text-align: center;
    color: var(--fs-ink-muted);
    font-size: 15px;
    grid-column: 1 / -1;
    padding: 60px 0;
}

@media (max-width: 490px) {
    .gallery-wrap {
        padding: 80px 12px 40px;
    }

    .gallery-title {
        font-size: 26px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .gallery-card__preview {
        padding: 16px;
        min-height: 140px;
    }

    .gallery-card__info {
        padding: 12px 14px;
    }
}

/* ==========================================================================
   RESPONSIVE — constructor (Tablet & mobile)
   ========================================================================== */
@media (max-width: 900px) {

    html.frameset-active.frameset-constructor,
    html.frameset-active.frameset-constructor body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    .frameset-page {
        position: relative;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #frameset-app {
        display: flex !important;
        flex-direction: column;
        height: calc(100vh - 55px);
        height: calc(100dvh - 55px);
        margin-top: 55px;
        /* reserve space for mobile bottom-bar: tabs (~64px) + CTA (~68px) */
        padding: 0 0 136px;
        padding-bottom: calc(136px + env(safe-area-inset-bottom, 0px));
        overflow: hidden;
    }

    /* SVG canvas — takes all remaining vertical space */
    .frameset-canvas-area {
        order: 1;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 16px 16px;
        overflow: hidden;
    }

    /* Hide the desktop sidebar entirely on mobile — options live in bottom-sheet */
    .product-info-card {
        display: none !important;
    }

    #svg-canvas-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 100%;
        overflow: hidden;
    }

    #svg-canvas-wrap svg {
        display: block;
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        margin: 0 auto;
    }

    /* All of .product-info-card (title, progress, inline sections, CTA, upload prompt)
       is hidden on mobile. Sections are presented inside the mobile bottom-sheet. */

    /* Bottom bar — mobile-only (tabs + price/CTA) */
    .bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        display: flex;
        flex-direction: column;
        gap: 0;
        background: var(--fs-surface);
        border-top: 1px solid var(--fs-border);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .bottom-controls {
        display: none;
    }

    /* ---------- Mobile tab bar (opens bottom-sheets) ---------- */
    .fs-mtabs {
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        padding: 6px 4px 4px;
        background: var(--fs-surface);
        border-bottom: 1px solid var(--fs-border-soft);
    }

    .fs-mtab {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        background: transparent;
        border: 0;
        color: var(--fs-ink-soft);
        font-family: var(--fs-font);
        cursor: pointer;
        transition: color 150ms ease, background 150ms ease;
        border-radius: 10px;
        min-width: 0;
    }

    .fs-mtab svg {
        color: currentColor;
    }

    .fs-mtab span {
        font-size: 10.5px;
        line-height: 1;
        letter-spacing: -.005em;
        font-weight: 500;
    }

    .fs-mtab:hover,
    .fs-mtab.active {
        color: var(--fs-ink);
        background: var(--fs-bg);
    }

    /* ---------- Mobile price + CTA row ---------- */
    .fs-mcta {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 12px 10px;
        background: var(--fs-surface);
    }

    .fs-mcta__price {
        display: flex;
        align-items: baseline;
        gap: 4px;
        padding-left: 6px;
        flex-shrink: 0;
    }

    .fs-mcta__value {
        font-size: 22px;
        font-weight: 800;
        letter-spacing: -.02em;
        color: var(--fs-ink);
        line-height: 1;
    }

    .fs-mcta__currency {
        font-size: 13px;
        color: var(--fs-ink-soft);
        font-weight: 500;
    }

    /* Mobile order button (now inside .fs-mcta) — pill shape, flex-expanded */
    .mobile-order-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        flex: 1 1 auto;
        width: auto;
        background: var(--fs-ink);
        color: #fff;
        padding: 14px 18px;
        cursor: pointer;
        font-size: 15px;
        font-weight: 600;
        font-family: var(--fs-font);
        border: none;
        border-radius: 14px;
        letter-spacing: -.01em;
        transition: background var(--fs-dur) var(--fs-ease), opacity 150ms ease;
    }

    .mobile-order-bar svg {
        color: #fff;
        flex-shrink: 0;
    }

    .mobile-order-bar:hover {
        background: #2a2a2a;
    }

    .mobile-order-bar.disabled {
        opacity: .4;
        pointer-events: none;
    }

    /* Upload mode: yellow CTA */
    .mobile-order-bar.mobile-order-bar--upload {
        background: #fd3;
        color: #000;
    }

    .mobile-order-bar.mobile-order-bar--upload:hover {
        background: #ffd91a;
    }

    .mobile-order-bar.mobile-order-bar--upload svg {
        color: #000;
    }

    /* ---------- Mobile bottom-sheet (options dialog) ---------- */
    .fs-msheet {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: none;
    }
    .fs-msheet[aria-hidden="false"] { display: block; }

    .fs-msheet__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(20, 22, 28, .4);
        animation: fsFade 200ms ease;
    }

    .fs-msheet__panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        max-height: 80vh;
        background: var(--fs-surface);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 28px rgba(0,0,0,.18);
        animation: fsSheetUp 280ms cubic-bezier(.22, .9, .3, 1);
    }

    @keyframes fsFade { from { opacity: 0; } to { opacity: 1; } }
    @keyframes fsSheetUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .fs-msheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px 10px;
        border-bottom: 1px solid var(--fs-border-soft);
    }

    .fs-msheet__title {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: var(--fs-ink);
        letter-spacing: -.01em;
    }

    .fs-msheet__close {
        background: transparent;
        border: 0;
        padding: 6px;
        color: var(--fs-ink-soft);
        cursor: pointer;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .fs-msheet__close:hover { background: var(--fs-bg); color: var(--fs-ink); }

    .fs-msheet__body {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 14px 18px 4px;
        min-height: 0;
    }

    /* Section moved into sheet must be visible + strip its own label (sheet has its own) */
    .fs-msheet__body .fs-section {
        display: block !important;
        padding: 0;
        margin: 0;
    }
    .fs-msheet__body .fs-section__label { display: none; }

    .fs-msheet__footer {
        padding: 10px 16px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--fs-border-soft);
    }

    .fs-msheet__apply {
        width: 100%;
        background: var(--fs-ink);
        color: #fff;
        border: 0;
        border-radius: 12px;
        padding: 14px;
        font-size: 15px;
        font-weight: 600;
        font-family: var(--fs-font);
        cursor: pointer;
        letter-spacing: -.01em;
    }
    .fs-msheet__apply:hover { background: #2a2a2a; }

    /* Framer modals — full-width bottom sheet on mobile */
    .framer-modal-content {
        max-width: 100%;
        width: 100%;
        bottom: 0;
        left: 0;
        transform: none;
        border-radius: var(--fs-r-xl) var(--fs-r-xl) 0 0;
        max-height: 60vh;
        overflow-y: auto;
        padding: 22px 20px;
    }

    .templater-item {
        width: 100px;
    }
}

@media (min-width: 901px) {
    .mobile-order-bar {
        display: none !important;
    }
}

@media (max-width: 490px) {
    .control-item {
        padding: 6px 8px;
        min-width: 54px;
    }

    .control-item span {
        font-size: 9px;
    }

    .control-item svg {
        width: 20px;
        height: 20px;
    }

    .control-item img {
        height: 20px !important;
    }

    .product-info-card__title {
        font-size: 18px;
    }

    .product-info-card__price .price-value {
        font-size: 22px;
    }

    .templater-item {
        width: 90px;
    }

    .pane-ctrl-round-btn {
        width: 30px;
        height: 30px;
        padding: 7px;
    }

    .pane-ctrl-round-btn svg {
        width: 14px;
        height: 14px;
    }

    .crop-zoom-row {
        max-width: 280px;
    }

    .crop-done-btn {
        max-width: 280px;
    }
}
