.parts-panel .parts-workbench {
    grid-template-columns: 210px minmax(0, 1fr);
}

.parts-panel .parts-workbench > .category-rail {
    width: 210px;
    max-width: 210px;
}

.parts-panel .parts-workbench > .category-rail .subcategory-tab {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keep the composed bracelet legible in the checkout order summary. */
body.magcryst-theme.woocommerce-checkout #order_review .product-name {
    min-width: 0;
}

body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview {
    display: inline-grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
    width: 104px !important;
    height: 104px !important;
    margin: 0 12px 10px 0 !important;
    padding: 5px !important;
    overflow: hidden !important;
    vertical-align: top !important;
    background: var(--bg) !important;
    border: 1px solid var(--line) !important;
    position: relative !important;
}

body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview-live .magcryst-order-preview-ring {
    position: absolute;
    inset: 16%;
    border: 1px solid #6d6168;
    border-radius: 50%;
}

body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview-live > img {
    position: absolute !important;
    z-index: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview img,
body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview svg,
body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview-image,
body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview-svg {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
}

body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-item-name {
    display: inline-block;
    max-width: calc(100% - 122px);
    padding-top: 7px;
    vertical-align: top !important;
}

body.magcryst-theme.woocommerce-checkout #order_review .product-name::after {
    display: table;
    clear: both;
    content: "";
}

body.magcryst-theme .woocommerce-order-details .magcryst-order-preview {
    display: inline-grid !important;
    place-items: center !important;
    position: relative !important;
    box-sizing: border-box !important;
    width: 104px !important;
    height: 104px !important;
    margin: 0 12px 10px 0 !important;
    padding: 5px !important;
    overflow: hidden !important;
    vertical-align: middle !important;
    background: var(--bg) !important;
    border: 1px solid var(--line) !important;
}

body.magcryst-theme .woocommerce-order-details .magcryst-order-preview-live .magcryst-order-preview-ring {
    position: absolute;
    inset: 16%;
    border: 1px solid #6d6168;
    border-radius: 50%;
}

body.magcryst-theme .woocommerce-order-details .magcryst-order-preview-live > img {
    position: absolute !important;
    z-index: 1;
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: contain !important;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

/* WooCommerce owns authentication and validation; the child theme supplies the account layout. */
body.magcryst-theme.woocommerce-account .woocommerce {
    width: min(1080px, calc(100% - 40px));
    margin: 60px auto 100px;
}

body.magcryst-theme.woocommerce-account .woocommerce-form-login,
body.magcryst-theme.woocommerce-account .woocommerce-form-register,
body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation,
body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-content {
    box-sizing: border-box;
    padding: 24px !important;
    color: var(--text);
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
}

body.magcryst-theme.woocommerce-account .u-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

body.magcryst-theme.woocommerce-account .u-column1,
body.magcryst-theme.woocommerce-account .u-column2 {
    float: none !important;
    width: auto !important;
}

body.magcryst-theme.woocommerce-account input.input-text {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
}

body.magcryst-theme.woocommerce-account button.button {
    min-height: 44px;
    padding: 0 22px;
    color: #1c1518;
    background: var(--pink);
    border: 0;
    border-radius: 999px;
}

body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation {
    width: 28%;
}

body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-content {
    width: 69%;
}

body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation li a {
    display: block;
    padding: 12px 4px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a {
    color: var(--pink-soft);
}

body.magcryst-theme .gallery-art-image .magcryst-gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.magcryst-theme .gallery-art-image:has(.magcryst-gallery-image)::before,
body.magcryst-theme .gallery-art-image:has(.magcryst-gallery-image)::after {
    display: none;
}

.magcryst-gallery-form {
    position: relative;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
}

.magcryst-gallery-form h2 { font-size: 32px; }
.magcryst-gallery-form p { color: var(--muted); }
.magcryst-gallery-form label { display: block; margin: 18px 0; font-size: 13px; }
.magcryst-gallery-form input:not([type="hidden"]),
.magcryst-gallery-form textarea {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 8px;
    padding: 9px 12px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
}

.magcryst-forum-card .gallery-info { display: flex; flex-direction: column; gap: 7px; }
.magcryst-forum-card .gallery-info h3 { margin: 0; font-size: 18px; }
.magcryst-forum-card .gallery-info p { min-height: 2.6em; margin: 0 0 10px; line-height: 1.45; }
.magcryst-forum-byline { color: var(--muted); font-size: 11px; }
.magcryst-forum-card .gallery-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.magcryst-discussion-button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; }
.magcryst-discussion-button svg { width: 14px; height: 14px; }
.magcryst-forum-thread { position: relative; width: min(760px, 100%); max-height: 90vh; overflow-y: auto; padding: 28px; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.magcryst-forum-thread h2 { font-size: 30px; }
.magcryst-forum-thread h3 { margin: 25px 0 12px; font-size: 18px; }
.magcryst-forum-topic { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; align-items: center; }
.magcryst-forum-topic img { width: 150px; height: 150px; object-fit: contain; background: var(--bg); }
.magcryst-forum-reply { margin: 10px 0 10px calc(var(--depth) * 24px); padding: 14px; background: var(--bg); border: 1px solid var(--line); }
.magcryst-forum-reply p { margin: 8px 0; white-space: pre-wrap; }
.magcryst-forum-reply button { padding: 4px 0; color: var(--pink-soft); background: transparent; }
.magcryst-forum-reply-form { margin-top: 24px; }
.magcryst-forum-reply-form label { display: block; font-size: 13px; }
.magcryst-forum-reply-form textarea { display: block; width: 100%; min-height: 100px; margin: 8px 0 12px; padding: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); resize: vertical; }
@media (max-width: 600px) { .magcryst-forum-thread { padding: 20px 14px; } .magcryst-forum-topic { grid-template-columns: 1fr; } .magcryst-forum-topic img { width: 100%; height: min(50vw,240px); } }

@media (max-width: 767px) {
    body.magcryst-theme .woocommerce-order-details .magcryst-order-preview {
        width: 88px !important;
        height: 88px !important;
        margin-right: 9px !important;
        padding: 4px !important;
    }

    body.magcryst-theme.woocommerce-account .woocommerce {
        width: calc(100% - 28px);
        margin: 30px auto 70px;
    }

    body.magcryst-theme.woocommerce-account .u-columns {
        grid-template-columns: 1fr;
    }

    body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-navigation,
    body.magcryst-theme.woocommerce-account .woocommerce-MyAccount-content {
        float: none !important;
        width: 100% !important;
        margin-bottom: 18px;
        padding: 18px !important;
    }

    body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-preview {
        width: 88px !important;
        height: 88px !important;
        margin-right: 9px !important;
        padding: 4px !important;
    }

    body.magcryst-theme.woocommerce-checkout #order_review .magcryst-order-item-name {
        max-width: calc(100% - 101px);
        padding-top: 4px;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench {
        display: grid !important;
        grid-template-columns: 104px minmax(0, 1fr) !important;
        align-items: stretch;
        min-height: 0 !important;
        height: calc(100% - 69px) !important;
        overflow: hidden !important;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench > .category-rail {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch;
        width: 104px !important;
        max-width: 104px !important;
        height: 100% !important;
        padding: 8px 6px !important;
        border-right: 1px solid var(--line) !important;
        border-bottom: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        white-space: nowrap;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench > .category-rail .subcategory-tab {
        display: block !important;
        width: 100% !important;
        min-height: 36px;
        flex: 0 0 auto !important;
        padding: 9px 7px !important;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.25;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench > .parts-content {
        min-width: 0;
        height: 100% !important;
        overflow: hidden !important;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench > .parts-content > .bead-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: max-content !important;
        align-content: start !important;
        height: calc(100% - 62px) !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 10px !important;
        gap: 10px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.magcryst-theme .studio-vertical .bead-grid .bead-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 8px !important;
        overflow: hidden !important;
        contain: none !important;
    }

    body.magcryst-theme .studio-vertical .bead-grid .bead-card .bead-swatch {
        display: grid !important;
        place-items: center !important;
        width: min(100%, 120px) !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        flex: 0 0 auto !important;
        margin: 0 auto 7px !important;
        overflow: visible !important;
    }

    body.magcryst-theme .studio-vertical .bead-grid .bead-card .bead-swatch img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 120px !important;
        max-height: 120px !important;
        object-fit: contain !important;
        object-position: center !important;
    }
}

@media (max-width: 420px) {
    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench {
        grid-template-columns: 90px minmax(0, 1fr) !important;
    }

    body.magcryst-theme .studio-vertical .parts-panel .parts-workbench > .category-rail {
        width: 90px !important;
        max-width: 90px !important;
    }

    body.magcryst-theme .studio-vertical .bead-grid .bead-card .bead-swatch {
        width: min(100%, 108px) !important;
    }
}
body.magcryst-managed-gallery #gallery-grid:not(.magcryst-gallery-ready) {
    visibility: hidden !important;
}

body.magcryst-managed-shop #shop-grid:not(.magcryst-shop-ready) {
    visibility: hidden !important;
}

.magcryst-shop-image { display: grid; place-items: center; overflow: hidden; }
.magcryst-shop-image img { width: 100%; height: 100%; object-fit: contain; }
.magcryst-shop-no-image { color: var(--muted); }
.magcryst-shop-view { color: var(--pink-soft); font-size: 12px; }
