:root {
  color-scheme: light dark;
  --brand-blue: light-dark(#087bb5, #62bde8);
  --brand-blue-deep: light-dark(#066a9b, #85cdef);
  --ink: light-dark(#123f54, #e2f2fa);
  --muted: light-dark(#607b8a, #abc3cf);
  --surface: light-dark(#ffffff, #102a39);
  --wash: light-dark(#f1f8fc, #0b2230);
  --pale-blue: light-dark(#e5f3fa, #1a3c4e);
  --line: light-dark(#d8e7ee, #305063);
  --on-blue: light-dark(#ffffff, #092c3f);
  --mint: light-dark(#7fd7c1, #6ac8b0);
  --mint-wash: light-dark(#e8f8f1, #173f39);
  --mint-ink: light-dark(#17644f, #ace9d7);
  --error: light-dark(#9a3d2a, #ffb09c);
  --error-wash: light-dark(#fff1eb, #422f2a);
  --shadow: light-dark(#123f5410, #00000030);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink); background: var(--wash); font-size: 14px; line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { border: 0; background: transparent; color: inherit; min-height: 42px; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
#shopping-app { max-width: 1240px; margin: 0 auto; min-height: 100dvh; background: var(--surface); }
.brand-header { display: flex; gap: 16px; align-items: center; padding: 20px 28px; background: var(--wash); }
.brand-logo { width: 80px; height: 80px; object-fit: contain; border-radius: 12px; flex-shrink: 0; }
.brand-header h1 { font-size: 24px; font-weight: 700; }
.brand-header p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.brand-context { margin-left: auto; color: var(--brand-blue); font-size: 12px; }
.top-nav { display: flex; align-items: center; gap: 26px; padding: 0 28px; border-bottom: 1px solid var(--line); }
.top-nav button { padding: 13px 0; color: var(--muted); position: relative; }
.top-nav button[aria-current="page"] { color: var(--brand-blue); font-weight: 600; }
.top-nav button[aria-current="page"]::after { position: absolute; content: ""; height: 3px; background: var(--brand-blue); left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; }
.top-nav .header-cart { margin-left: auto; }
#app-message:empty { display: none; }
#app-message { padding: 12px 28px; background: var(--pale-blue); color: var(--brand-blue-deep); overflow-wrap: anywhere; }
#app-message.error { color: var(--error); background: var(--error-wash); }
.loading-screen, .empty { padding: 45px 20px; text-align: center; color: var(--muted); }
.loading-screen h2, .empty h3 { color: var(--ink); font-size: 18px; font-weight: 500; margin-bottom: 9px; }
.shop-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr) 304px; align-items: start; }
.categories { display: flex; flex-direction: column; gap: 6px; padding: 25px 12px 25px 18px; }
.categories h2 { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 10px 5px; }
.category { text-align: left; padding: 9px 12px; border-radius: 9px; overflow-wrap: anywhere; }
.category[aria-pressed="true"] { background: var(--pale-blue); color: var(--brand-blue); font-weight: 600; }
.products-section { padding: 25px 24px; min-width: 0; border-left: 1px solid var(--line); }
.search { display: flex; gap: 12px; align-items: center; padding: 0 13px; border: 1px solid var(--line); background: var(--wash); border-radius: 10px; }
.search label { font-size: 13px; color: var(--brand-blue); white-space: nowrap; flex-shrink: 0; }
.search input { width: 100%; min-width: 0; min-height: 45px; font-size: 16px; border: 0; color: var(--ink); background: transparent; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 20px 0 0; }
h2 { font-size: 21px; font-weight: 650; }
.small, .hint { font-size: 12px; color: var(--muted); }
.hint { margin-top: 10px; }
.product { padding: 20px 0; border-bottom: 1px solid var(--line); }
.product h3 { font-size: 17px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.unit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.unit > span:first-child { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.available-stock { margin-left: auto; white-space: nowrap; color: light-dark(#526e7d, #abc3cf); }
.product-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 13px; }
.price { font-size: 24px; color: var(--brand-blue); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price small { font-size: 12px; font-weight: 500; margin-right: 4px; }
.price .price-unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.price.unknown { font-size: 17px; }
.add { display: flex; align-items: center; gap: 6px; border-radius: 9px; background: var(--brand-blue); color: var(--on-blue); padding: 7px 13px; white-space: nowrap; }
.add span { font-size: 20px; }
.quantity { display: flex; align-items: center; flex-shrink: 0; }
.quantity button { width: 38px; min-height: 38px; height: 38px; border-radius: 9px; background: var(--pale-blue); color: var(--brand-blue); font-size: 21px; }
.quantity button:last-child { color: var(--on-blue); background: var(--brand-blue); }
.quantity input { width: 48px; min-width: 0; padding: 4px 0; text-align: center; color: var(--ink); background: transparent; border: 0; font-size: 16px; appearance: textfield; }
.quantity input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.side-cart { padding: 24px 20px; background: var(--wash); border-left: 1px solid var(--line); position: sticky; top: 0; max-height: 100dvh; overflow-y: auto; }
.side-cart h2 { font-size: 19px; }
.cart-subtitle { margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.cart-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-item h3 { font-size: 14px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.line-price { color: var(--brand-blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-utility { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.remove { text-decoration: underline; padding: 0; font-size: 12px; min-height: 28px; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 20px 0 16px; }
.total strong { color: var(--brand-blue); font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fees { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.field { display: block; margin-top: 17px; font-size: 13px; }
.field > span { display: block; margin-bottom: 7px; font-weight: 500; }
.field select, .field textarea, .field input { width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); padding: 10px 11px; font-size: 16px; }
.field textarea { min-height: 75px; resize: vertical; }
.primary { background: var(--brand-blue); color: var(--on-blue); border-radius: 10px; padding: 11px 18px; min-height: 46px; font-weight: 600; }
.secondary { background: var(--pale-blue); color: var(--brand-blue); border-radius: 10px; padding: 10px 17px; min-height: 44px; }
.full { width: 100%; margin-top: 15px; }
.quiet { color: var(--brand-blue); padding: 8px 0; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.pagination { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-top: 20px; }
.page { padding: 24px 28px 40px; }
.page-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.narrow { max-width: 660px; margin: 0 auto; }
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 35px; align-items: start; }
.checkout-panel { padding: 22px; border-radius: 12px; background: var(--wash); }
.review-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.review-line h3 { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.review-line p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.review-line strong { color: var(--brand-blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.success-stamp { display: inline-block; background: var(--mint-wash); color: var(--mint-ink); padding: 6px 11px; border-radius: 8px; font-size: 13px; margin-bottom: 13px; }
.order-summary { padding: 17px 19px; background: var(--wash); border-left: 4px solid var(--mint); margin: 18px 0; }
.order-summary p + p { margin-top: 7px; }
.order-text { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; font: inherit; font-size: 13px; color: var(--ink); background: var(--wash); border-radius: 9px; }
.order-card { padding: 20px 0; border-bottom: 1px solid var(--line); }
.order-card h3 { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.order-card p { font-size: 13px; color: var(--muted); margin-top: 7px; overflow-wrap: anywhere; }
.order-card-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 12px; }
.order-card-footer strong { color: var(--brand-blue); font-size: 19px; font-variant-numeric: tabular-nums; }
.pending-panel { padding: 22px; background: var(--pale-blue); border-radius: 12px; margin: 20px 0; }
.pending-panel h2 { margin-bottom: 10px; }
.pending-panel p { color: var(--muted); }
.mobile-cart { display: none; }
.copy-fallback { position: fixed; left: -9999px; top: 0; }
@media (max-width: 1000px) and (min-width: 721px) {
  .shop-layout { grid-template-columns: 120px minmax(0, 1fr) 270px; }
  .products-section { padding: 20px 18px; }
  .side-cart { padding: 20px 16px; }
}
@media (max-width: 720px) {
  #shopping-app { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .brand-header { padding: 15px 18px; gap: 12px; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-header h1 { font-size: 20px; }
  .brand-header p { font-size: 12px; margin-top: 2px; }
  .brand-context { display: none; }
  .top-nav { padding: 0 19px; gap: 22px; }
  #app-message { padding: 12px 19px; }
  .shop-layout { display: flex; flex-direction: column; }
  .categories { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 5px; padding: 14px 17px 0; }
  .categories h2 { display: none; }
  .category { font-size: 13px; padding: 7px 12px; min-height: 38px; }
  .products-section { width: 100%; border: 0; padding: 15px 19px 22px; }
  .side-cart { display: none; }
  .product { padding: 18px 0; }
  .price { font-size: 23px; }
  .page { padding: 19px 19px 30px; }
  .checkout-layout { display: block; }
  .checkout-panel { margin-top: 22px; padding: 17px; }
  .cart-item h3 { font-size: 16px; }
  .mobile-cart { display: flex; position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; align-items: center; gap: 12px; padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px var(--shadow); }
  .mobile-cart strong { font-size: 21px; color: var(--brand-blue); font-variant-numeric: tabular-nums; }
  .mobile-cart p { color: var(--muted); font-size: 12px; }
  .mobile-cart .primary { margin-left: auto; min-height: 44px; padding: 10px 16px; }
  .review-line { gap: 10px; }
}
@media (pointer: coarse) {
  button, .quantity button { min-height: 44px; }
  .quantity button { width: 40px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
