:root {
    --ay0-bg: #f6f8fb;
    --ay0-surface: #ffffff;
    --ay0-surface-muted: #eef2f7;
    --ay0-text: #172033;
    --ay0-muted: #667085;
    --ay0-border: #dfe4ec;
    --ay0-primary: #2563eb;
    --ay0-primary-hover: #1d4ed8;
    --ay0-success: #0f9f83;
    --ay0-warning: #b36b00;
    --ay0-danger: #c2414b;
    --ay0-shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body.ay0-site {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--ay0-text);
    background: var(--ay0-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }
button, input, textarea, select { font: inherit; }
svg { width: 20px; height: 20px; flex: 0 0 auto; }

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1100;
    padding: 10px 14px;
    color: #fff;
    background: var(--ay0-text);
    border-radius: 6px;
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-main { flex: 1 0 auto; }
.page-section { padding: 40px 0 56px; }
.page-shell { max-width: 980px; }
.page-shell--narrow { max-width: 760px; }

.site-header {
    min-height: 72px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--ay0-border);
    backdrop-filter: blur(12px);
}

.site-header__inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand, .site-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--ay0-text);
    white-space: nowrap;
}

.brand__mark {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: var(--ay0-text);
    border-radius: 7px;
    font-size: 17px;
    font-weight: 800;
}
.brand__mark--small { width: 28px; height: 28px; font-size: 14px; }
.brand__name { font-size: 18px; }

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    margin-left: auto;
    place-items: center;
    color: var(--ay0-text);
    background: var(--ay0-surface);
    border: 1px solid var(--ay0-border);
    border-radius: 7px;
}

.site-nav {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
}
.site-nav__links { display: flex; align-items: center; gap: 4px; }
.site-nav__link {
    min-height: 44px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ay0-muted);
    border-radius: 7px;
    font-weight: 600;
}
.site-nav__link:hover, .site-nav__link.is-active {
    color: var(--ay0-primary);
    background: #edf4ff;
}

.site-search {
    width: min(320px, 34vw);
    min-height: 44px;
    padding: 0 5px 0 13px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--ay0-bg);
    border: 1px solid var(--ay0-border);
    border-radius: 7px;
}
.site-search > svg { color: var(--ay0-muted); width: 18px; }
.site-search input {
    min-width: 0;
    flex: 1;
    height: 42px;
    color: var(--ay0-text);
    background: transparent;
    border: 0;
    outline: 0;
}
.icon-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: var(--ay0-primary);
    border: 0;
    border-radius: 6px;
}
.icon-button svg { width: 17px; height: 17px; }

.site-footer {
    margin-top: auto;
    color: var(--ay0-muted);
    background: var(--ay0-surface);
    border-top: 1px solid var(--ay0-border);
}
.site-footer__inner {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.site-footer__brand { color: var(--ay0-text); }
.site-footer__meta { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.site-footer__custom p { margin: 0; }

.notice-bar {
    margin-top: 24px;
    padding: 13px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #344054;
    background: #fff8e8;
    border: 1px solid #f2d79a;
    border-radius: 7px;
}
.notice-bar > svg { margin-top: 2px; color: var(--ay0-warning); }
.notice-bar__content { min-width: 0; }
.notice-bar__content > *:last-child { margin-bottom: 0; }

.catalog-heading {
    padding: 34px 0 22px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}
.catalog-heading h1, .page-heading h1 { margin: 0; font-size: 28px; line-height: 1.3; font-weight: 750; }
.catalog-heading p, .page-heading p { margin: 7px 0 0; color: var(--ay0-muted); }
.catalog-count { color: var(--ay0-muted); font-size: 14px; white-space: nowrap; }

.category-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 18px;
    scrollbar-width: thin;
}
.category-tabs .nav-link {
    min-height: 42px;
    padding: 8px 16px;
    color: var(--ay0-muted);
    background: var(--ay0-surface);
    border: 1px solid var(--ay0-border);
    border-radius: 7px;
    white-space: nowrap;
    font-weight: 600;
}
.category-tabs .nav-link:hover, .category-tabs .nav-link.active {
    color: #fff;
    background: var(--ay0-text);
    border-color: var(--ay0-text);
}

.goods-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    padding-bottom: 56px;
}
.goods-card {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--ay0-surface);
    border: 1px solid var(--ay0-border);
    border-radius: 8px;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.goods-card:hover { transform: translateY(-2px); border-color: #c8d3e3; box-shadow: var(--ay0-shadow); }
.goods-card[hidden] { display: none !important; }
.goods-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--ay0-surface-muted);
}
.goods-card__media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.goods-card__placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #fff;
    background: #253b70;
}
.goods-card__placeholder span {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    color: #253b70;
    background: #fff;
    border-radius: 16px;
    font-size: 25px;
    font-weight: 850;
}
.goods-card__badge, .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    border-radius: 999px;
}
.goods-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 7px 9px;
    color: #fff;
    background: rgba(23, 32, 51, 0.88);
}
.goods-card__badge--auto { background: rgba(15, 159, 131, 0.94); }
.goods-card__badge svg, .status-badge svg { width: 14px; height: 14px; }
.goods-card__body { min-height: 170px; padding: 16px; display: flex; flex-direction: column; }
.goods-card__title {
    margin: 0 0 10px;
    min-height: 46px;
    overflow-wrap: anywhere;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 700;
}
.goods-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ay0-muted); font-size: 13px; }
.goods-card__price { color: var(--ay0-primary); font-size: 20px; font-weight: 750; }
.goods-card__price small { font-size: 12px; }
.goods-card__actions { margin-top: auto; padding-top: 14px; }

.btn-ay0, .btn-secondary-ay0, .btn-danger-ay0 {
    min-height: 44px;
    padding: 9px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-weight: 700;
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.btn-ay0 { color: #fff; background: var(--ay0-primary); border-color: var(--ay0-primary); }
.btn-ay0:hover { color: #fff; background: var(--ay0-primary-hover); border-color: var(--ay0-primary-hover); }
.btn-secondary-ay0 { color: var(--ay0-text); background: var(--ay0-surface); border-color: var(--ay0-border); }
.btn-secondary-ay0:hover { color: var(--ay0-primary); border-color: #9bb7ee; background: #f7faff; }
.btn-danger-ay0 { color: #fff; background: var(--ay0-danger); border-color: var(--ay0-danger); }
.btn-block { width: 100%; }
.btn-ay0 svg, .btn-secondary-ay0 svg { width: 18px; height: 18px; }
.btn-ay0:disabled { opacity: .55; cursor: not-allowed; }

.empty-state {
    padding: 52px 24px;
    text-align: center;
    color: var(--ay0-muted);
    background: var(--ay0-surface);
    border: 1px dashed #c8d1df;
    border-radius: 8px;
}
.empty-state svg { width: 34px; height: 34px; margin-bottom: 10px; color: #98a2b3; }
.empty-state h2 { margin: 0 0 5px; color: var(--ay0-text); font-size: 18px; }
.empty-state p { margin: 0; }

.page-heading { margin-bottom: 24px; }
.flow-steps { margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; }
.flow-step { position: relative; display: flex; align-items: center; gap: 9px; color: #98a2b3; font-size: 13px; font-weight: 650; }
.flow-step:not(:last-child)::after { content: ""; height: 1px; flex: 1; margin: 0 10px; background: var(--ay0-border); }
.flow-step__number { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--ay0-border); border-radius: 50%; background: var(--ay0-surface); }
.flow-step.is-active { color: var(--ay0-primary); }
.flow-step.is-active .flow-step__number { color: #fff; background: var(--ay0-primary); border-color: var(--ay0-primary); }
.flow-step.is-complete { color: var(--ay0-success); }
.flow-step.is-complete .flow-step__number { color: #fff; background: var(--ay0-success); border-color: var(--ay0-success); }

.surface {
    background: var(--ay0-surface);
    border: 1px solid var(--ay0-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(23, 32, 51, 0.04);
}
.surface__header { padding: 20px 24px; border-bottom: 1px solid var(--ay0-border); }
.surface__header h1, .surface__header h2 { margin: 0; font-size: 20px; font-weight: 750; }
.surface__body { padding: 24px; }

.product-layout { display: grid; grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.3fr); overflow: hidden; }
.product-media { position: relative; min-height: 100%; padding: 32px; display: grid; place-items: center; background: var(--ay0-surface-muted); border-right: 1px solid var(--ay0-border); }
.product-media img { width: 100%; max-width: 340px; aspect-ratio: 1 / 1; object-fit: contain; }
.product-media__placeholder {
    width: min(100%, 340px);
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: #fff;
    background: #253b70;
    border-radius: 8px;
}
.product-media__placeholder span { font-size: 48px; font-weight: 850; }
.product-media__placeholder small { color: #dbe7ff; font-size: 13px; }
.product-media .goods-card__badge { top: 18px; left: 18px; }
.product-panel { padding: 30px; }
.product-title { margin: 0 0 8px; overflow-wrap: anywhere; font-size: 26px; font-weight: 750; }
.product-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--ay0-muted); }
.product-price { margin: 20px 0; padding: 15px 16px; display: flex; align-items: baseline; justify-content: space-between; background: #f7faff; border: 1px solid #dbe7ff; border-radius: 7px; }
.product-price__label { color: var(--ay0-muted); }
.product-price__value { color: var(--ay0-primary); font-size: 26px; font-weight: 800; }
.wholesale-list { margin: -8px 0 18px; display: flex; flex-wrap: wrap; gap: 7px; }
.wholesale-pill { padding: 6px 9px; color: #7a4b00; background: #fff8e8; border: 1px solid #f2d79a; border-radius: 6px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-field--wide { grid-column: 1 / -1; }
.form-label { margin-bottom: 7px; color: #344054; font-size: 14px; font-weight: 650; }
.form-control, .form-select {
    min-height: 44px;
    padding: 9px 12px;
    color: var(--ay0-text);
    background: #fff;
    border: 1px solid #cfd6e1;
    border-radius: 7px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ay0-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.form-hint { margin-top: 5px; color: var(--ay0-muted); font-size: 12px; }
.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-row img { height: 44px; width: 112px; object-fit: cover; border: 1px solid var(--ay0-border); border-radius: 6px; cursor: pointer; }
.payment-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.payment-option { position: relative; }
.payment-option input { position: absolute; opacity: 0; pointer-events: none; }
.payment-option label { min-height: 50px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #cfd6e1; border-radius: 7px; cursor: pointer; font-weight: 650; }
.payment-option label::before { content: ""; width: 17px; height: 17px; border: 2px solid #98a2b3; border-radius: 50%; box-shadow: inset 0 0 0 4px #fff; }
.payment-option input:checked + label { color: var(--ay0-primary); border-color: var(--ay0-primary); background: #f7faff; }
.payment-option input:checked + label::before { background: var(--ay0-primary); border-color: var(--ay0-primary); }
.payment-option input:focus-visible + label { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.form-actions { margin-top: 24px; display: flex; gap: 10px; }
.description-block { margin-top: 20px; }
.description-content { color: #475467; overflow-wrap: anywhere; }
.description-content img { max-width: 100%; height: auto; }

.detail-list { margin: 0; }
.detail-row { min-height: 46px; padding: 10px 0; display: grid; grid-template-columns: minmax(120px, .65fr) minmax(0, 1.35fr); gap: 20px; border-bottom: 1px solid #edf0f4; }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--ay0-muted); font-weight: 500; }
.detail-row dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 650; }
.detail-row--total dd { color: var(--ay0-primary); font-size: 24px; font-weight: 800; }
.status-badge { padding: 7px 9px; }
.status-badge--success { color: #06745f; background: #dcf8f0; }
.status-badge--warning { color: #8a5500; background: #fff3d6; }
.status-badge--info { color: #175cd3; background: #eaf2ff; }
.status-badge--danger { color: #a32b35; background: #feecef; }
.status-badge--neutral { color: #475467; background: #edf0f4; }

.search-tabs { padding: 5px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--ay0-surface-muted); border-radius: 8px; }
.search-tabs .nav-link { min-height: 42px; display: grid; place-items: center; color: var(--ay0-muted); border-radius: 6px; font-weight: 650; }
.search-tabs .nav-link.active { color: var(--ay0-text); background: #fff; box-shadow: 0 1px 3px rgba(23, 32, 51, .1); }
.search-panel { padding-top: 24px; }

.payment-center { text-align: center; }
.payment-amount { margin: 5px 0 20px; color: var(--ay0-primary); font-size: 30px; font-weight: 800; }
.qr-frame { width: 236px; height: 236px; margin: 0 auto 20px; padding: 17px; display: grid; place-items: center; background: #fff; border: 1px solid var(--ay0-border); border-radius: 8px; box-shadow: var(--ay0-shadow); }
.qr-frame img { width: 200px; height: 200px; display: block; }
.payment-status { margin: 18px auto 0; max-width: 480px; padding: 12px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #175cd3; background: #eaf2ff; border-radius: 7px; }
.payment-status.is-success { color: #06745f; background: #dcf8f0; }
.payment-status.is-error { color: #a32b35; background: #feecef; }
.payment-status svg { width: 18px; height: 18px; }
.spin { animation: ay0-spin 1.1s linear infinite; }
@keyframes ay0-spin { to { transform: rotate(360deg); } }

.order-result { margin-bottom: 18px; }
.order-result__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); }
.order-result__summary { padding: 24px; border-right: 1px solid var(--ay0-border); }
.order-result__delivery { padding: 24px; }
.delivery-box { min-height: 150px; padding: 14px; width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.error-panel { padding: 42px 30px; text-align: center; }
.error-panel__icon { width: 54px; height: 54px; margin: 0 auto 16px; display: grid; place-items: center; color: var(--ay0-danger); background: #feecef; border-radius: 50%; }
.error-panel__icon svg { width: 26px; height: 26px; }
.error-panel h1 { margin: 0 0 7px; font-size: 24px; }
.error-panel p { margin: 0 auto 24px; max-width: 520px; color: var(--ay0-muted); overflow-wrap: anywhere; }

.ay0-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1200;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    color: #fff;
    background: var(--ay0-text);
    border-radius: 7px;
    box-shadow: var(--ay0-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 150ms ease, transform 150ms ease;
}
.ay0-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.ay0-toast--success { background: #06745f; }
.ay0-toast--error { background: #a32b35; }

:focus-visible { outline: 3px solid rgba(37, 99, 235, .32); outline-offset: 2px; }

@media (max-width: 991.98px) {
    .goods-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nav-toggle { display: inline-grid; }
    .site-header__inner { flex-wrap: wrap; padding-top: 13px; padding-bottom: 13px; }
    .site-nav { display: none !important; width: 100%; align-items: stretch; flex-direction: column; gap: 12px; padding-top: 4px; }
    .site-nav.show { display: flex !important; }
    .site-nav__links { flex-direction: column; align-items: stretch; }
    .site-nav__link { width: 100%; }
    .site-search { width: 100%; }
    .product-layout { grid-template-columns: 1fr; }
    .product-media { min-height: 300px; border-right: 0; border-bottom: 1px solid var(--ay0-border); }
}

@media (max-width: 767.98px) {
    .page-section { padding: 28px 0 40px; }
    .goods-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .catalog-heading { padding-top: 26px; align-items: flex-start; flex-direction: column; gap: 6px; }
    .catalog-heading h1, .page-heading h1 { font-size: 24px; }
    .site-footer__inner { padding-top: 18px; padding-bottom: 18px; align-items: flex-start; flex-direction: column; gap: 10px; }
    .site-footer__meta { align-items: flex-start; flex-direction: column; gap: 4px; }
    .flow-step span:last-child { display: none; }
    .flow-step:not(:last-child)::after { margin: 0 7px; }
    .product-panel, .surface__body, .surface__header { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field--wide { grid-column: auto; }
    .payment-options { grid-template-columns: 1fr; }
    .order-result__grid { grid-template-columns: 1fr; }
    .order-result__summary { border-right: 0; border-bottom: 1px solid var(--ay0-border); }
}

@media (max-width: 519.98px) {
    .container { padding-left: 16px; padding-right: 16px; }
    .goods-grid { grid-template-columns: 1fr; }
    .goods-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); }
    .goods-card__media { height: 100%; min-height: 180px; aspect-ratio: auto; }
    .goods-card__body { min-height: 180px; padding: 14px; }
    .goods-card__title { min-height: auto; }
    .goods-card__meta { align-items: flex-start; flex-direction: column; }
    .goods-card__price { font-size: 18px; }
    .search-tabs { grid-template-columns: 1fr; }
    .detail-row { grid-template-columns: 1fr; gap: 2px; }
    .detail-row dd { text-align: left; }
    .form-actions { flex-direction: column; }
    .form-actions > * { width: 100%; }
    .qr-frame { width: 220px; height: 220px; padding: 9px; }
    .product-media { min-height: 250px; padding: 24px; }
    .product-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
