:root {
    --ink: #18211d;
    --muted: #66716b;
    --line: #dfe5e1;
    --soft: #f4f7f5;
    --paper: #ffffff;
    --green: #078f49;
    --green-dark: #05733b;
    --red: #c43f3f;
    --amber: #a26809;
}

html { min-height: 100%; }
body {
    min-height: 100vh;
    background: #f7f9f8;
    color: var(--ink);
    font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button, input, textarea { letter-spacing: 0; }
a { color: inherit; }
a:hover { color: inherit; }
[hidden] { display: none !important; }

.store-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.store-header {
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    padding: 0;
    backdrop-filter: blur(10px);
}
.store-nav { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.store-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; font-weight: 750; }
.store-brand:hover { color: var(--ink); }
.store-brand img { width: 30px; height: 30px; border-radius: 6px; object-fit: contain; }
.store-nav-links { display: flex; align-items: stretch; align-self: stretch; gap: 24px; }
.store-nav-links a { display: flex; align-items: center; position: relative; color: var(--muted); font-weight: 600; }
.store-nav-links a:hover, .store-nav-links a.active { color: var(--ink); }
.store-nav-links a.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--green); }

.store-main { min-height: calc(100vh - 126px); padding: 36px 0 64px; }
.home-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.home-topbar h1, .page-heading h1, .search-intro h1 { margin: 0; color: var(--ink); font-size: 28px; font-weight: 760; line-height: 1.2; }
.home-topbar p, .search-intro p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.product-search { width: min(360px, 42vw); height: 42px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); padding: 0 13px; }
.product-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 143, 73, .1); }
.product-search i { color: var(--muted); }
.product-search input { min-width: 0; flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 14px; outline: 0; }

.announcement { display: flex; align-items: flex-start; gap: 14px; border: 1px solid #e4dcc6; border-radius: 6px; background: #fffdf5; padding: 13px 16px; margin-bottom: 24px; color: #5d543e; }
.announcement strong { flex: 0 0 auto; color: var(--amber); }
.announcement p { margin: 0; }

.category-tabs { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding-bottom: 14px; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex: 0 0 auto; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--muted); padding: 7px 15px; font-weight: 650; }
.category-tab:hover { border-color: #abb7b0; color: var(--ink); }
.category-tab.active { border-color: var(--ink); background: var(--ink); color: #fff; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.product-item { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.product-item:hover { transform: translateY(-2px); border-color: #b9c3bd; box-shadow: 0 9px 24px rgba(24, 33, 29, .08); }
.product-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--soft); }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.product-item:hover .product-media img { transform: scale(1.025); }
.delivery-tag { position: absolute; top: 9px; left: 9px; border-radius: 4px; background: rgba(6, 111, 58, .94); color: #fff; padding: 4px 7px; font-size: 11px; font-weight: 700; }
.delivery-tag.manual { background: rgba(162, 104, 9, .95); }
.product-body { padding: 14px; }
.product-body h2 { min-height: 42px; margin: 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-body p { height: 36px; margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-meta { display: flex; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.product-meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 8px 3px 0; border-radius: 50%; background: #aab3ae; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.product-bottom strong { color: var(--red); font-size: 22px; font-weight: 760; font-variant-numeric: tabular-nums; }
.product-bottom strong small { margin-right: 2px; font-size: 13px; }
.buy-arrow { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: 17px; transition: background .16s ease, color .16s ease; }
.product-item:hover .buy-arrow { background: var(--green); color: #fff; }
.empty-state { grid-column: 1 / -1; padding: 72px 20px; color: var(--muted); text-align: center; }

.checkout-page { padding-top: 24px; }
.back-link { display: inline-flex; margin-bottom: 18px; color: var(--muted); font-weight: 600; }
.back-link:hover { color: var(--ink); }
.checkout-layout { display: grid; grid-template-columns: minmax(0, .86fr) minmax(520px, 1.14fr); align-items: start; gap: 22px; }
.product-summary { position: sticky; top: 86px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.summary-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--soft); }
.summary-media img { width: 100%; height: 100%; object-fit: cover; }
.summary-copy { padding: 22px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.summary-copy h1 { margin: 7px 0 8px; color: var(--ink); font-size: 26px; font-weight: 760; line-height: 1.32; }
.summary-copy > p { margin: 0; color: var(--muted); line-height: 1.65; }
.summary-facts { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 18px; }
.summary-facts div { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; }
.summary-facts div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.summary-facts span { color: var(--muted); }
.summary-facts strong { font-size: 16px; }
.limit-note { margin-top: 12px; color: var(--amber); font-size: 12px; }
.wholesale-list { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.wholesale-list strong { width: 100%; color: var(--ink); }

.checkout-panel { border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 22px; }
.checkout-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.checkout-heading h2 { margin: 4px 0 0; font-size: 23px; font-weight: 760; }
.stock-indicator { border-radius: 4px; background: var(--soft); color: var(--muted); padding: 5px 8px; font-size: 11px; font-weight: 650; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; margin: 0; color: var(--ink); font-size: 13px; font-weight: 650; }
.field > span small { color: var(--muted); font-weight: 500; }
.field input, .delivery-text { width: 100%; min-width: 0; height: 42px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); padding: 0 12px; font-size: 14px; outline: none; }
.field input:focus, .delivery-text:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 143, 73, .1); }
.verify-field { margin-top: 12px; }
.verify-row { display: flex; align-items: center; gap: 9px; }
.verify-row input { flex: 1; }
.verify-row img { width: 112px; height: 42px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; object-fit: cover; }
.checkout-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: start; gap: 16px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.quantity-control > span, .payment-options legend { display: block; float: none; width: auto; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 650; }
.stepper { width: 144px; height: 42px; display: grid; grid-template-columns: 38px 1fr 38px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.stepper button { border: 0; background: var(--soft); color: var(--ink); font-size: 20px; }
.stepper button:hover { background: #e8eeea; }
.stepper input { width: 100%; border: 0; border-right: 1px solid var(--line); border-left: 1px solid var(--line); background: #fff; color: var(--ink); text-align: center; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.payment-options { min-width: 0; margin: 0; padding: 0; border: 0; }
.payment-option { min-height: 52px; display: grid; grid-template-columns: 32px 1fr 18px; align-items: center; gap: 10px; position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.payment-option:has(input:checked) { border-color: var(--green); box-shadow: 0 0 0 2px rgba(7, 143, 73, .08); }
.payment-option input { position: absolute; opacity: 0; pointer-events: none; }
.wechat-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: #08aa57; color: #fff; font-size: 12px; font-weight: 800; }
.payment-option > span:nth-child(3) { display: flex; min-width: 0; flex-direction: column; }
.payment-option strong { color: var(--ink); font-size: 13px; }
.payment-option small { color: var(--muted); font-size: 11px; font-weight: 500; }
.payment-option i { width: 17px; height: 17px; border: 1px solid #aeb8b2; border-radius: 50%; }
.payment-option input:checked ~ i { border: 5px solid var(--green); }
.checkout-total { display: flex; align-items: flex-end; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.checkout-total span { color: var(--muted); }
.checkout-total strong { color: var(--red); font-size: 26px; font-weight: 780; font-variant-numeric: tabular-nums; }
.checkout-total strong span { color: inherit; }
.primary-action, .secondary-action { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 5px; padding: 10px 18px; font-size: 14px; font-weight: 720; text-align: center; }
.primary-action { width: 100%; margin-top: 14px; background: var(--ink); color: #fff; }
.primary-action:hover { background: #26332d; color: #fff; }
.primary-action:disabled { opacity: .55; cursor: not-allowed; }
.secondary-action { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary-action:hover { border-color: #aeb9b2; }
.checkout-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.form-error { border-radius: 5px; background: #fff2f2; color: var(--red); padding: 12px; }
.product-description { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 25px; color: var(--muted); line-height: 1.75; }
.product-description h2 { margin: 0 0 12px; color: var(--ink); font-size: 19px; }
.product-description img { max-width: 100%; height: auto; }

.store-dialog { width: min(460px, calc(100% - 28px)); border: 0; border-radius: 7px; background: #fff; color: var(--ink); padding: 20px; box-shadow: 0 22px 70px rgba(0, 0, 0, .22); }
.store-dialog::backdrop { background: rgba(15, 21, 18, .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head button { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: 22px; }
.dialog-body { max-height: 50vh; overflow: auto; color: var(--muted); }
.store-dialog .secondary-action { width: 100%; margin-top: 17px; }

.order-page { padding-top: 40px; }
.narrow-shell { width: min(760px, calc(100% - 40px)); }
.order-step { display: grid; grid-template-columns: 24px 1fr 24px 1fr 24px; align-items: center; width: min(320px, 90%); margin: 0 auto 20px; }
.order-step span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: 11px; font-weight: 700; }
.order-step span.active { border-color: var(--green); background: var(--green); color: #fff; }
.order-step i { height: 1px; background: var(--line); }
.order-sheet { border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 24px; }
.order-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.order-sheet h1 { margin: 5px 0 0; font-size: 25px; font-weight: 760; }
.amount-due { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
.amount-due span { color: var(--muted); font-size: 11px; }
.amount-due strong { color: var(--red); font-size: 25px; font-variant-numeric: tabular-nums; }
.amount-due.centered { align-items: center; margin-top: 18px; }
.order-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 7px 0 0; }
.order-details div { min-width: 0; display: grid; grid-template-columns: 88px 1fr; gap: 10px; border-bottom: 1px solid #edf1ee; padding: 12px 0; }
.order-details dt { color: var(--muted); font-weight: 500; }
.order-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ink); text-align: right; font-weight: 650; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0; }
.discount-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; color: var(--green); font-size: 12px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-heading > a { color: var(--green); font-weight: 650; }
.order-list { display: grid; gap: 16px; }
.order-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.order-result-head .mono { color: var(--muted); font-size: 11px; }
.order-result-head h2 { margin: 5px 0 0; font-size: 18px; font-weight: 730; }
.order-status { flex: 0 0 auto; border-radius: 4px; padding: 5px 8px; font-size: 11px; font-weight: 720; }
.order-status.pending { background: #fff6df; color: #8a5900; }
.order-status.processing { background: #edf5ff; color: #2766a8; }
.order-status.completed { background: #e9f8ef; color: #08703c; }
.order-status.failed, .order-status.expired { background: #f5f5f5; color: #68716d; }
.order-details.compact { margin-bottom: 10px; }
.delivery-result { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.delivery-result > div:first-child { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.delivery-result > div span { color: var(--muted); font-size: 11px; }
.delivery-text { height: 118px; resize: vertical; padding: 11px 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.6; }
.delivery-result .secondary-action { margin-top: 9px; }
.delivery-result.waiting { color: var(--muted); }

.search-shell { width: min(880px, calc(100% - 40px)); display: grid; grid-template-columns: .75fr 1.25fr; align-items: start; gap: 52px; padding-top: 35px; }
.search-intro { padding-top: 18px; }
.search-intro h1 { margin-top: 7px; }
.search-panel { border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 20px; }
.search-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border-radius: 6px; background: var(--soft); padding: 4px; margin-bottom: 18px; }
.search-tabs button { min-height: 36px; border-radius: 4px; background: transparent; color: var(--muted); font-weight: 650; }
.search-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(24, 33, 29, .1); }
.search-pane .field + .field { margin-top: 13px; }
.search-pane p { margin: 8px 0 18px; color: var(--muted); }

.qr-sheet { text-align: center; }
.qr-sheet > p { margin: 8px 0 16px; color: var(--muted); }
.qr-frame { width: 266px; height: 266px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: #fff; margin: 0 auto; }
.qr-frame img { width: 240px; height: 240px; }
.payment-waiting { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.payment-waiting i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(7, 143, 73, .12); }
.error-sheet { text-align: center; padding: 46px 24px; }
.error-symbol { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: #fff1f1; color: var(--red); margin: 0 auto 14px; font-size: 23px; font-weight: 800; }
.error-sheet p { margin: 12px auto 4px; color: var(--muted); }
.error-sheet .primary-action { width: auto; min-width: 170px; }

.store-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
.store-footer-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.store-footer p { margin: 0; }

@media (max-width: 1000px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .checkout-layout { grid-template-columns: minmax(0, .8fr) minmax(440px, 1.2fr); }
    .field-grid { grid-template-columns: 1fr; }
    .checkout-row { grid-template-columns: 145px minmax(0, 1fr); }
}

@media (max-width: 780px) {
    .store-shell, .narrow-shell, .search-shell { width: min(100% - 28px, 620px); }
    .store-main { padding-top: 24px; padding-bottom: 42px; }
    .store-nav { min-height: 56px; }
    .store-brand { font-size: 16px; }
    .store-nav-links { gap: 17px; }
    .home-topbar { align-items: stretch; flex-direction: column; gap: 16px; }
    .home-topbar h1, .page-heading h1, .search-intro h1 { font-size: 24px; }
    .product-search { width: 100%; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-body { padding: 11px; }
    .product-body h2 { min-height: 39px; font-size: 14px; }
    .product-body p { display: none; }
    .product-meta { gap: 4px; font-size: 11px; }
    .product-bottom strong { font-size: 19px; }
    .checkout-layout { display: flex; flex-direction: column; gap: 14px; }
    .product-summary { position: static; width: 100%; display: grid; grid-template-columns: 125px 1fr; }
    .summary-media { aspect-ratio: auto; min-height: 150px; }
    .summary-copy { min-width: 0; padding: 16px; }
    .summary-copy h1 { font-size: 19px; }
    .summary-copy > p, .wholesale-list { display: none; }
    .summary-facts { margin-top: 12px; }
    .summary-facts div { padding: 9px 0; }
    .summary-facts div + div { padding-left: 10px; }
    .checkout-panel { width: 100%; padding: 17px; }
    .field-grid { grid-template-columns: 1fr; }
    .checkout-row { grid-template-columns: 1fr; }
    .stepper { width: 100%; grid-template-columns: 42px 1fr 42px; }
    .order-details { grid-template-columns: 1fr; }
    .search-shell { grid-template-columns: 1fr; gap: 20px; padding-top: 0; }
    .search-intro { padding-top: 0; }
    .store-footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding: 14px 0; }
}

@media (max-width: 430px) {
    .store-shell, .narrow-shell, .search-shell { width: calc(100% - 22px); }
    .store-nav-links { gap: 12px; font-size: 13px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .product-media { aspect-ratio: 1 / .78; }
    .delivery-tag { top: 6px; left: 6px; padding: 3px 5px; font-size: 10px; }
    .product-body { padding: 9px; }
    .product-meta { display: block; }
    .product-meta span { display: block; }
    .product-meta span + span::before { display: none; }
    .product-summary { grid-template-columns: 100px 1fr; }
    .summary-copy { padding: 13px; }
    .summary-facts { grid-template-columns: 1fr; border-bottom: 0; }
    .summary-facts div { border-bottom: 1px solid var(--line); }
    .summary-facts div + div { border-left: 0; padding-left: 0; }
    .order-sheet { padding: 18px; }
    .order-sheet-head, .order-result-head { align-items: flex-start; flex-direction: column; }
    .amount-due { align-items: flex-start; }
    .order-details div { grid-template-columns: 78px 1fr; }
    .search-tabs { grid-template-columns: 1fr; }
    .qr-frame { width: 246px; height: 246px; }
    .qr-frame img { width: 220px; height: 220px; }
}
