/* 猪事鲜供应链 — 组件样式。依赖 tokens.css 的变量；类名前缀 hpw-。 */
.hpw, .hpw *, .hpw *::before, .hpw *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); background: var(--surface); color: var(--ink); font-size: 15px; line-height: 22px; -webkit-font-smoothing: antialiased; }
.hpw-screen { position: relative; width: var(--screen-w); max-width: var(--screen-max-w); margin: 0 auto; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.hpw-screen-frame { border: 1px solid var(--line); border-radius: var(--radius-lg); }
.hpw-row { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-4); flex-wrap: wrap; }
.hpw-stack { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.hpw-num { font-variant-numeric: tabular-nums; }

/* Icon */
.hpw-icon { display: inline-block; vertical-align: middle; flex: none; }

/* Button */
.hpw-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); font-family: inherit; font-size: 15px; line-height: 22px; font-weight: 500; height: var(--control-h); padding: 0 var(--space-5); border-radius: var(--radius-full); border: 1px solid transparent; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: background-color .12s; }
.hpw-btn-primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.hpw-btn-primary:active { background: var(--red-deep); border-color: var(--red-deep); }
.hpw-btn-secondary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.hpw-btn-secondary:active { background: var(--green-deep); border-color: var(--green-deep); }
.hpw-btn-outline { background: var(--surface-raised); border-color: var(--green-text); color: var(--green-text); }
.hpw-btn-outline:active { background: var(--green-soft); }
.hpw-btn-quiet { background: var(--surface-raised); border-color: var(--line-strong); color: var(--ink); }
.hpw-btn-quiet:active { background: var(--surface-sunken); }
.hpw-btn-sm { height: var(--control-h-sm); padding: 0 var(--space-4); font-size: 13px; line-height: 18px; }
.hpw-btn-lg { height: 48px; font-size: 16px; }
.hpw-btn-block { display: flex; width: 100%; }
.hpw-btn-square { border-radius: var(--radius-md); }
.hpw-btn-round { width: 28px; height: 28px; padding: 0; border-radius: var(--radius-full); position: relative; }
.hpw-btn-round::after { content: ""; position: absolute; inset: -8px; }
.hpw-btn:disabled { background: var(--surface-sunken); border-color: var(--surface-sunken); color: var(--ink-3); cursor: not-allowed; }
.hpw-btn:focus-visible, .hpw-stepper-btn:focus-visible, .hpw-check:focus-visible, .hpw-seg-item:focus-visible, .hpw-cat:focus-visible, .hpw-sidenav-item:focus-visible, .hpw-spec:focus-visible, .hpw-tab:focus-visible, .hpw-navbar-btn:focus-visible, .hpw-sheet-close:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* Tag */
.hpw-tags { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.hpw-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2); font-size: 12px; line-height: 16px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-2); white-space: nowrap; }
.hpw-tag-red { background: var(--red-soft); color: var(--red-text); }
.hpw-tag-green { background: var(--green-soft); color: var(--green-text); }
.hpw-tag-amber { background: var(--amber-soft); color: var(--amber); }
.hpw-tag-outline { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.hpw-tag-unit { background: var(--green); color: var(--on-green); font-weight: 600; }

/* Price */
.hpw-price { display: inline-flex; align-items: baseline; color: var(--price); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hpw-price-cur { font-size: 13px; line-height: 18px; font-weight: 600; margin-right: 1px; }
.hpw-price-int { font-size: 18px; line-height: 24px; }
.hpw-price-dec { font-size: 13px; line-height: 18px; }
.hpw-price-unit { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.hpw-price-lg .hpw-price-int { font-size: 24px; line-height: 30px; }
.hpw-price-lg .hpw-price-cur, .hpw-price-lg .hpw-price-dec { font-size: 15px; }
.hpw-price-sm .hpw-price-int { font-size: 15px; line-height: 22px; }
.hpw-price-sm .hpw-price-cur, .hpw-price-sm .hpw-price-dec { font-size: 12px; }
.hpw-price-muted { color: var(--ink-2); font-weight: 500; }

/* Stepper */
.hpw-stepper { display: inline-flex; align-items: center; gap: var(--space-2); }
.hpw-stepper-btn { width: var(--control-h-sm); height: var(--control-h-sm); border-radius: var(--radius-full); border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; position: relative; }
.hpw-stepper-btn::after { content: ""; position: absolute; inset: -6px; }
.hpw-stepper-plus { background: var(--red); border-color: var(--red); color: var(--on-red); }
.hpw-stepper-plus:active { background: var(--red-deep); border-color: var(--red-deep); }
.hpw-stepper-btn:disabled { color: var(--ink-3); border-color: var(--line); background: var(--surface-sunken); cursor: not-allowed; }
.hpw-stepper-value { width: 36px; text-align: center; font-size: 15px; line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; border: 0; background: transparent; color: var(--ink); font-family: inherit; padding: 0; -moz-appearance: textfield; }
.hpw-stepper-value::-webkit-outer-spin-button, .hpw-stepper-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hpw-stepper-sm .hpw-stepper-btn { width: 28px; height: 28px; }
.hpw-stepper-sm .hpw-stepper-value { width: 30px; font-size: 14px; }

/* Checkbox */
.hpw-check { width: 22px; height: 22px; border-radius: var(--radius-full); border: 1.5px solid var(--line-strong); background: var(--surface-raised); display: inline-flex; align-items: center; justify-content: center; color: var(--on-red); cursor: pointer; padding: 0; flex: none; position: relative; }
.hpw-check::after { content: ""; position: absolute; inset: -11px; }
.hpw-check[aria-checked="true"], .hpw-check-on { background: var(--red); border-color: var(--red); }

/* SearchBar */
.hpw-search { display: flex; align-items: center; height: var(--control-h); padding: 0 var(--space-1) 0 var(--space-4); gap: var(--space-2); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-full); margin: 0; }
.hpw-search:focus-within { box-shadow: var(--focus-ring); }
.hpw-search-icon { color: var(--ink-3); }
.hpw-search-input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none; }
.hpw-search-input::placeholder { color: var(--ink-3); }
.hpw-search .hpw-btn { height: 36px; padding: 0 var(--space-4); font-size: 15px; }

/* SegmentedTabs */
.hpw-seg { display: inline-flex; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-full); height: var(--control-h); }
.hpw-seg-item { flex: 1; min-width: 96px; border: 0; background: transparent; border-radius: var(--radius-full); font: inherit; font-size: 15px; font-weight: 500; color: var(--ink-2); padding: 0 var(--space-4); cursor: pointer; }
.hpw-seg-item[aria-selected="true"] { background: var(--surface-raised); color: var(--red-text); box-shadow: var(--shadow-sm); }

/* CategoryChip */
.hpw-cat { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); width: 64px; max-width: 100%; flex: none; scroll-snap-align: start; background: transparent; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink); border-radius: var(--radius-md); }
.hpw-cat-thumb { width: var(--category-thumb); height: var(--category-thumb); border-radius: var(--radius-full); background: var(--surface-sunken); display: flex; align-items: center; justify-content: center; color: var(--ink-3); overflow: hidden; box-shadow: 0 0 0 2px transparent; }
.hpw-cat-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hpw-cat-label { font-size: 13px; line-height: 18px; padding: 2px 6px; border-radius: var(--radius-full); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hpw-cat[aria-pressed="true"] .hpw-cat-thumb { box-shadow: 0 0 0 2px var(--red); }
.hpw-cat[aria-pressed="true"] .hpw-cat-label { background: var(--red); color: var(--on-red); font-weight: 500; }
.hpw-cat-strip { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-3) var(--space-4); scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-left: var(--space-4); }
.hpw-cat-strip::-webkit-scrollbar { display: none; }
.hpw-cat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3) 0; padding: var(--space-3) var(--space-2); justify-items: center; }
.hpw-cat-grid .hpw-cat { width: 100%; max-width: 64px; }
.hpw-cat-panel { background: var(--surface-raised); border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow-sm); }
.hpw-cat-panel-title { font-size: 16px; line-height: 24px; font-weight: 600; padding: var(--space-3) var(--space-4) 0; }
.hpw-cat-panel-foot { text-align: center; font-size: 14px; line-height: 20px; color: var(--ink-2); padding: var(--space-2) 0 var(--space-3); }

/* SideNav */
.hpw-sidenav { width: var(--sidenav-w); flex: none; background: var(--surface-sunken); display: flex; flex-direction: column; padding: 0; margin: 0; }
.hpw-sidenav-group { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-2); text-align: center; padding: var(--space-3) var(--space-2) var(--space-1); }
.hpw-sidenav-item { position: relative; display: block; width: 100%; text-align: center; border: 0; background: transparent; font: inherit; font-size: 14px; line-height: 20px; color: var(--ink); padding: var(--space-3) var(--space-1); cursor: pointer; }
.hpw-sidenav-item[aria-current="true"] { background: var(--surface-raised); color: var(--red-text); font-weight: 600; }
.hpw-sidenav-item[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: var(--space-2); bottom: var(--space-2); width: 3px; border-radius: 0 2px 2px 0; background: var(--red); }

/* SectionHeader */
.hpw-section { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); background: var(--surface); color: var(--ink); font-size: 15px; line-height: 22px; font-weight: 600; }
.hpw-section-extra { font-size: 13px; font-weight: 400; color: var(--ink-2); display: inline-flex; align-items: center; gap: 2px; }

/* Thumb */
.hpw-thumb { flex: none; border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink-3); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hpw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ProductRow */
.hpw-product { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.hpw-product-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.hpw-product-name { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hpw-product-desc { font-size: 13px; line-height: 20px; color: var(--ink-2); }
.hpw-product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: var(--space-1); }

/* ProductTile */
.hpw-tile { width: 112px; flex: none; display: flex; flex-direction: column; gap: var(--space-1); }
.hpw-tile-name { font-size: 14px; line-height: 20px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpw-tile-foot { display: flex; align-items: center; justify-content: space-between; }
.hpw-tile-strip { display: flex; gap: var(--space-3); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.hpw-tile-strip::-webkit-scrollbar { display: none; }

/* StoreCard */
.hpw-store { background: var(--surface-raised); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.hpw-store-head { display: flex; align-items: center; gap: var(--space-3); }
.hpw-store-logo { width: 56px; height: 56px; border-radius: var(--radius-md); background: #ffffff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink-3); overflow: hidden; flex: none; }
.hpw-store-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hpw-store-info { flex: 1; min-width: 0; }
.hpw-store-name { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpw-store-meta { font-size: 13px; line-height: 20px; color: var(--ink-2); }

/* SpecSheet */
.hpw-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 19; }
.hpw-sheet { background: var(--surface-raised); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg); padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-4); width: 100%; }
.hpw-sheet-fixed { position: fixed; left: 0; right: 0; bottom: 0; max-width: var(--screen-max-w); margin: 0 auto; z-index: 20; }
.hpw-sheet-head { display: flex; gap: var(--space-3); align-items: flex-start; }
.hpw-sheet-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.hpw-sheet-title { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ink); }
.hpw-sheet-close { margin-left: auto; border: 0; background: transparent; color: var(--ink-2); width: 32px; height: 32px; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex: none; }
.hpw-sheet-label { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); margin-bottom: var(--space-2); display: flex; align-items: baseline; gap: var(--space-2); }
.hpw-sheet-label .hpw-product-desc { font-weight: 400; }
.hpw-spec-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hpw-spec { border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font: inherit; font-size: 14px; line-height: 20px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 96px; text-align: left; }
.hpw-spec-price { font-size: 13px; line-height: 18px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hpw-spec[aria-checked="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-text); }
.hpw-spec[aria-checked="true"] .hpw-spec-price { color: var(--red-text); }
.hpw-spec:disabled { color: var(--ink-3); border-color: var(--line); background: var(--surface-sunken); cursor: not-allowed; }
.hpw-spec:disabled .hpw-spec-price { color: var(--ink-3); }
.hpw-sheet-row { display: flex; align-items: center; justify-content: space-between; }
.hpw-sheet-row .hpw-sheet-label { margin-bottom: 0; }
.hpw-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }

/* CartItem */
.hpw-cart-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.hpw-cart-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hpw-cart-name { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpw-cart-spec { font-size: 13px; line-height: 18px; color: var(--ink-2); }
.hpw-cart-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-1); }

/* CartBar */
.hpw-cartbar { display: flex; align-items: center; gap: var(--space-3); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 var(--space-3) env(safe-area-inset-bottom) var(--space-4); background: var(--surface-raised); box-shadow: var(--shadow-up); }
.hpw-cartbar-all { display: inline-flex; align-items: center; gap: var(--space-2); font: inherit; font-size: 14px; color: var(--ink); border: 0; background: transparent; padding: 0; cursor: pointer; }
.hpw-cartbar-total { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.hpw-cartbar-total-label { font-size: 12px; line-height: 16px; color: var(--ink-2); }
.hpw-cartbar .hpw-btn { padding: 0 var(--space-6); }
.hpw-fixed-bottom { position: fixed; left: 0; right: 0; bottom: 0; max-width: var(--screen-max-w); margin: 0 auto; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }

/* TabBar */
.hpw-tabbar { display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface-raised); box-shadow: var(--shadow-up); }
.hpw-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; font: inherit; font-size: 11px; line-height: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; position: relative; padding: 0; }
.hpw-tab[aria-current="page"] { color: var(--red-text); }
.hpw-tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full); background: var(--red); color: var(--on-red); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }

/* NavBar */
.hpw-navbar { display: flex; align-items: center; height: var(--navbar-h); padding: 0 var(--space-2); background: var(--surface-raised); border-bottom: 1px solid var(--line); position: relative; flex: none; }
.hpw-navbar-title { position: absolute; left: 64px; right: 64px; text-align: center; font-size: 17px; line-height: 24px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; pointer-events: none; }
.hpw-navbar-btn { width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink); border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.hpw-navbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); font-size: 14px; color: var(--ink); padding-right: var(--space-2); }

/* Form */
.hpw-form { display: flex; flex-direction: column; gap: var(--space-5); }
.hpw-field { display: flex; flex-direction: column; gap: var(--space-2); }
.hpw-field-label { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: var(--space-1); }
.hpw-field-req { color: var(--red-text); }
.hpw-field-hint { font-size: 13px; line-height: 20px; color: var(--ink-2); }
.hpw-field-error { font-size: 13px; line-height: 20px; color: var(--red-text); }
.hpw-input { width: 100%; height: var(--control-h); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink); font: inherit; font-size: 15px; line-height: 22px; outline: none; -webkit-appearance: none; appearance: none; margin: 0; }
.hpw-input::placeholder { color: var(--ink-3); }
.hpw-input:focus-visible { border-color: var(--ink); box-shadow: var(--focus-ring); }
.hpw-input:disabled { background: var(--surface-sunken); color: var(--ink-3); }
.hpw-field-invalid .hpw-input { border-color: var(--red-text); }
textarea.hpw-input { height: auto; min-height: 88px; padding: var(--space-2) var(--space-3); resize: vertical; }
.hpw-select { position: relative; }
.hpw-select .hpw-input { padding-right: 40px; }
.hpw-select-icon { position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }

/* Page helpers */
.hpw-card { background: var(--surface-raised); border-radius: var(--radius-lg); padding: var(--space-4); }
.hpw-card-title { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); margin: 0 0 var(--space-3); }
.hpw-kv { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 14px; line-height: 20px; color: var(--ink-2); padding: var(--space-1) 0; }
.hpw-kv b { color: var(--ink); font-weight: 600; }
.hpw-page-body { flex: 1; overflow: auto; }
.hpw-empty { text-align: center; color: var(--ink-2); padding: var(--space-10) var(--space-4); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.hpw-empty .hpw-icon { color: var(--ink-3); }
