:root {
    --page: #f2f3f7;
    --surface: #ffffff;
    --surface-soft: #f7f8fb;
    --ink: #0d0e12;
    --muted: #747782;
    --line: #e7e9ef;
    --accent: #6046f6;
    --accent-2: #8a78ff;
    --success: #0d7f6b;
    --danger: #b42318;
    --shadow: 0 22px 55px rgba(20, 24, 34, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(220px, 440px) 1fr auto;
    align-items: center;
    gap: 28px;
    min-height: 76px;
    padding: 14px 34px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    color: var(--ink);
    font-size: 30px;
    font-weight: 950;
    letter-spacing: -3px;
}

.brand strong {
    font-size: 15px;
    letter-spacing: -.2px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0 18px;
    background: #eef0f5;
    color: var(--muted);
}

.search-field input {
    width: 100%;
    min-height: 42px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--ink);
    outline: 0;
}

.nav-list {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.nav-button,
.cart-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0 10px;
    background: transparent;
    color: var(--ink);
    font-weight: 750;
}

.nav-button:hover,
.nav-button.is-active {
    color: var(--accent);
}

.favorite-nav-button strong {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
}

.icon {
    font-size: 20px;
    line-height: 1;
}

.cart-button strong {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ff512f;
    color: #fff;
    font-size: 12px;
}

.main {
    padding: 28px 34px 42px;
}

.view-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.store-layout {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.filter-panel {
    position: sticky;
    top: 104px;
    display: grid;
    gap: 10px;
}

.filter-block {
    border-radius: 24px;
    padding: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.filter-block h2,
.catalog-head h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: -.3px;
}

.filter-block p,
.state-line,
.meta {
    color: var(--muted);
}

.filter-block p {
    margin: 6px 0 18px;
}

.filter-title button {
    border: 0;
    background: transparent;
    color: #a0a2aa;
    font-weight: 750;
}

.range-visual {
    display: flex;
    align-items: end;
    gap: 6px;
    height: 92px;
    margin-top: 12px;
    padding: 0 8px;
}

.range-visual span {
    flex: 1;
    border-radius: 999px 999px 4px 4px;
    background: linear-gradient(180deg, rgba(96, 70, 246, .24), rgba(96, 70, 246, .72));
}

.range-line {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.range-line strong {
    border-radius: 999px;
    padding: 8px 10px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
}

.price-filter-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.price-filter-fields label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.price-filter-fields input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    background: #f7f8fb;
    color: var(--ink);
    outline: 0;
}

.price-filter-fields input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(96, 70, 246, .14);
}

.check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    color: #4d505a;
    font-size: 17px;
    font-weight: 700;
}

.filter-category-list {
    display: grid;
    gap: 2px;
    margin-top: 10px;
}

.check-row input {
    width: 24px;
    height: 24px;
    accent-color: var(--accent);
}

.catalog-panel {
    min-width: 0;
}

.catalog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0 18px;
    font-weight: 850;
}

.button.primary {
    background: var(--accent);
    color: #fff;
}

.button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 24px;
    margin-top: 14px;
}

.product-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(260px, 1fr) auto;
    min-height: 410px;
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.favorite-button {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--accent);
    font-size: 28px;
    box-shadow: 0 12px 28px rgba(20, 24, 34, .08);
}

.favorite-button.is-active {
    background: var(--accent);
    color: #fff;
}

.product-media {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 28px;
    background: radial-gradient(circle at 50% 35%, #ffffff 0, #f3f4f6 62%, #eceef2 100%);
}

.product-image {
    width: 100%;
    height: 100%;
    max-height: 250px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.product-info {
    display: grid;
    gap: 14px;
    padding: 24px;
    background: var(--surface);
}

.product-card h3 {
    margin: 0;
    min-height: 54px;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -.4px;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.price {
    font-weight: 900;
}

.price-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border: 2px solid var(--accent);
    border-radius: 999px;
    padding: 0 16px;
    background: #fff;
    color: var(--accent);
    font-weight: 900;
}

.empty-store {
    border-radius: 24px;
    padding: 32px;
    background: var(--surface);
    color: var(--muted);
}

.ai-layout,
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 18px;
}

.work-panel,
.controls-panel,
.auth-card,
.profile-card {
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.image-drop {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 420px;
    border: 1px dashed #b9bdc6;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface-soft);
}

.image-drop input {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0;
    cursor: pointer;
}

.image-drop img {
    display: none;
    width: 100%;
    height: 100%;
    max-height: 560px;
    object-fit: contain;
}

.image-drop.has-image img {
    display: block;
}

.empty-preview {
    display: grid;
    gap: 6px;
    text-align: center;
    color: var(--muted);
}

.processing-overlay {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(255, 255, 255, .72);
    font-weight: 800;
}

.processing-overlay.is-active {
    display: grid;
}

.preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.color-button {
    display: grid;
    justify-items: center;
    gap: 7px;
    min-height: 78px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 9px 6px;
    background: #fff;
    color: var(--ink);
    font-size: 12px;
}

.color-button.is-active {
    border-color: var(--accent);
    outline: 3px solid rgba(96, 70, 246, .14);
}

.color-dot {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.custom-color {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.custom-color input {
    min-height: 48px;
    padding: 5px;
}

.auth-card input,
.auth-form input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0 14px;
    background: #fff;
    color: var(--ink);
}

.auth-card form {
    display: grid;
    gap: 12px;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.account-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.auth-tabs button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 850;
}

.auth-tabs button.is-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

dl {
    display: grid;
    gap: 14px;
    margin: 0;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.dialog {
    width: min(720px, calc(100vw - 28px));
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 0;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 22px 80px rgba(15, 23, 42, .22);
}

.dialog::backdrop {
    background: rgba(15, 23, 42, .34);
}

.dialog-body {
    padding: 22px;
}

.dialog-body > .product-image {
    height: 280px;
    margin-bottom: 18px;
    border-radius: 18px;
    background: var(--surface-soft);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 16px 22px;
}

.dialog-header h2 {
    margin: 0;
}

.close-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
}

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.cart-item img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 14px;
    background: var(--surface-soft);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 18px;
    font-weight: 900;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 36px));
    border-radius: 16px;
    padding: 12px 14px;
    background: var(--ink);
    color: #fff;
    transition: .18s ease;
}

.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1180px) {
    .site-header {
        grid-template-columns: auto 1fr auto;
    }

    .nav-list {
        grid-column: 1 / -1;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(210px, 1fr));
    }
}

@media (max-width: 900px) {
    .site-header {
        position: static;
        grid-template-columns: 1fr auto;
        gap: 14px;
        padding: 14px 16px;
    }

    .search-field,
    .nav-list {
        grid-column: 1 / -1;
    }

    .main {
        padding: 18px 16px 32px;
    }

    .store-layout,
    .ai-layout,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        position: static;
        grid-template-columns: 1fr;
    }

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

    .image-drop {
        min-height: 300px;
    }
}

@media (max-width: 520px) {
    .brand strong {
        display: none;
    }

    .filter-panel {
        display: none;
    }

    .catalog-head {
        align-items: stretch;
        flex-direction: column;
    }

    .product-card {
        min-height: 390px;
    }

    .cart-item {
        grid-template-columns: 56px 1fr;
    }

    .cart-item .price {
        grid-column: 2;
    }
}
