* {
    box-sizing: border-box;
}

:root {
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #e5e7eb;
    --text: #111827;
    --muted: #64748b;
    --shadow: 0 18px 44px rgba(15, 23, 42, .08);
}

body.storefront {
    margin: 0;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--theme-primary), transparent 88%), transparent 34%),
        #f6f8fb;
    color: var(--text);
    font-family: var(--theme-font), Arial, sans-serif;
    line-height: 1.55;
}

body.storefront:before {
    content: "";
    display: block;
    height: 5px;
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
}

body.storefront > h1,
body.storefront > h2,
body.storefront > nav:not(.store-header__nav),
body.storefront > p,
body.storefront > ul,
body.storefront > table,
body.storefront > form,
body.storefront > div,
body.storefront > section {
    width: min(100% - 36px, 1180px);
    margin-left: auto;
    margin-right: auto;
}

body.storefront > h1 {
    margin-top: 32px;
    margin-bottom: 14px;
    font-size: 34px;
    line-height: 1.15;
    letter-spacing: 0;
}

body.storefront > h2 {
    margin-top: 30px;
    color: #1f2937;
}

.store-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid rgba(226, 232, 240, .92);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 15px max(18px, calc((100vw - 1180px) / 2 + 18px));
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
    backdrop-filter: blur(14px);
}

.store-header__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #111827;
    text-decoration: none;
}

.store-header__brand img,
.store-header__mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.store-header__brand img {
    object-fit: cover;
    border: 1px solid var(--line);
}

.store-header__mark {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.store-header__nav,
body.storefront > nav:not(.store-header__nav) {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

body.storefront > nav:not(.store-header__nav) {
    padding: 12px 0;
}

.store-header__nav a,
body.storefront nav a,
body.storefront a {
    color: var(--theme-primary);
}

.store-header__nav a {
    color: #334155;
    background: #f1f5f9;
    padding: 8px 11px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
}

.store-header__nav a:hover {
    color: #fff;
    background: var(--theme-primary);
}

body.storefront nav a {
    font-weight: 800;
    text-decoration: none;
}

body.storefront button,
body.storefront a[href*="payment/request"],
body.storefront a[href*="cart"],
body.storefront a[href*="checkout"],
.product-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: var(--theme-primary);
    color: #fff;
    text-decoration: none;
    padding: 10px 15px;
    font-weight: 900;
    cursor: pointer;
}

body.storefront table {
    width: min(100% - 36px, 1180px);
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

body.storefront th,
body.storefront td {
    border: 0;
    border-bottom: 1px solid #eef2f7;
    padding: 13px 14px;
    text-align: left;
}

body.storefront th {
    background: #f1f5f9;
    color: #334155;
}

body.storefront form {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    margin-top: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.product-detail,
.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 26px;
    align-items: start;
}

.product-detail__media {
    margin-top: 0;
    margin-bottom: 0;
}

.product-detail__summary {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.product-detail__summary h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.18;
}

.product-detail__eyebrow {
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 800;
}

.product-purchase {
    width: 100%;
    margin: 18px 0 0;
    box-shadow: none;
    background: #f8fafc;
}

.product-description,
.empty-state,
.order-summary,
.alert-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.alert-box--danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}

.lookup-form {
    display: grid;
    gap: 14px;
    max-width: 560px;
}

.lookup-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 900;
}

.lookup-form input {
    width: 100%;
}

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

.address-card {
    display: grid;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 17px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.address-card span,
.address-card small {
    color: var(--muted);
}

.account-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.checkbox-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.checkbox-row input {
    width: auto;
}

.empty-state {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.empty-state strong {
    color: var(--text);
    font-size: 18px;
}

.empty-state a,
.cart-actions a {
    width: fit-content;
}

.cart-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.order-summary {
    position: sticky;
    top: 94px;
    display: grid;
    gap: 8px;
}

.order-summary strong {
    color: var(--muted);
}

.order-summary span {
    font-size: 28px;
    font-weight: 900;
    color: var(--theme-primary);
}

.checkout-items li strong,
.checkout-items li b {
    color: var(--text);
}

.checkout-items li b {
    font-size: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 900;
    font-size: 13px;
}

.status-paid,
.status-ready {
    background: #dcfce7;
    color: #166534;
}

.status-failed,
.status-canceled,
.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.alert-box {
    display: grid;
    gap: 4px;
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

body.storefront label {
    display: block;
    font-weight: 800;
    color: #334155;
    margin-bottom: 12px;
}

body.storefront input,
body.storefront select,
body.storefront textarea {
    width: 100%;
    max-width: 560px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 10px 12px;
    margin-top: 6px;
    background: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 18px;
    padding-top: 8px;
}

.product-card,
.cart-card,
.checkout-items li {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
}

.product-card {
    transition: transform .15s ease, box-shadow .15s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.product-card__image,
.product-detail__media {
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2f7, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    overflow: hidden;
}

.product-card__image {
    height: 176px;
}

.product-detail__media {
    min-height: 360px;
    margin-top: 14px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.product-card__image img,
.product-detail__media img,
.product-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-gallery,
.checkout-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    list-style: none;
    padding-left: 0;
}

.checkout-items {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.product-gallery li {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
}

.product-gallery img {
    height: 96px;
    border-radius: 9px;
    background: #eef2f7;
}

.cart-cards {
    display: none;
}

.price {
    font-weight: 900;
    color: var(--theme-primary);
    font-size: 19px;
}

.sold-out {
    color: #b91c1c;
    font-weight: 900;
}

.badge-stock {
    display: inline-flex;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
}

.store-footer {
    margin-top: 54px;
    padding: 30px max(18px, calc((100vw - 1180px) / 2 + 18px));
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.store-footer strong {
    color: #fff;
}

.store-footer small {
    color: #9ca3af;
}

.theme-premium { background: #f8f5ef; }
.theme-minimal { background: #fff; }
.theme-fashion { background: #fff5f7; }
.theme-beauty { background: #fff7fb; }
.theme-food { background: #fffaf0; }
.theme-digital { background: #f5f9ff; }
.theme-b2b { background: #f7f9fb; }
.theme-lifestyle { background: #f7fbf7; }

@media (max-width: 720px) {
    body.storefront > h1 {
        font-size: 25px;
    }

    .store-header {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .store-header__nav {
        width: 100%;
        justify-content: space-between;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card__image {
        height: 230px;
    }

    .product-detail__media {
        min-height: 230px;
    }

    .product-detail,
    .checkout-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .product-detail__summary h1 {
        font-size: 24px;
    }

    .order-summary {
        position: static;
    }

    .cart-table {
        display: none !important;
    }

    .cart-cards {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body.storefront table {
        display: block;
        overflow-x: auto;
        width: calc(100% - 24px);
    }

    body.storefront form {
        margin-left: 12px;
        margin-right: 12px;
        padding: 15px;
    }

    body.storefront input,
    body.storefront select,
    body.storefront textarea {
        max-width: none;
    }

    body.storefront button,
    body.storefront a[href*="payment/request"],
    body.storefront a[href*="cart"],
    body.storefront a[href*="checkout"],
    .cart-actions a,
    .empty-state a {
        width: 100%;
        margin-top: 6px;
    }

    .checkout-items {
        grid-template-columns: 1fr;
    }
}
