/* V59 physical marketplace UX refresh.
   Uses the app design tokens so the mall stays visually aligned with the rest of 群艺馆. */

/* ---------- storefront header ---------- */
#p-mall{background:var(--surface-page)}
#p-mall .v59-mall-scroll{padding-bottom:calc(28px + env(safe-area-inset-bottom))}
#p-mall .v59-mall-pagehead{margin-bottom:8px}
.v59-mall-head-actions{margin-left:auto;display:flex;align-items:center;gap:8px}
.v59-head-icon{position:relative;width:44px;height:44px;border:1px solid var(--border-default);border-radius:50%;background:var(--surface-card);color:var(--text-primary);display:flex;align-items:center;justify-content:center;padding:0;box-shadow:0 3px 12px rgba(94,55,31,.06)}
.v59-head-icon svg{width:22px;height:22px}
.v59-cart-head i{position:absolute;right:-2px;top:-4px;min-width:19px;height:19px;padding:0 4px;border-radius:999px;display:flex;align-items:center;justify-content:center;background:var(--brand-primary);color:var(--on-brand);border:2px solid var(--surface-page);font-size:11px;font-style:normal;font-weight:900;line-height:1}
.v59-cart-head i[hidden]{display:none}

/* ---------- search ---------- */
.v59-mall-search-wrap{padding:2px 0 12px;position:sticky;top:0;z-index:8;background:linear-gradient(var(--surface-page) 74%,color-mix(in srgb,var(--surface-page) 0%,transparent))}
.v59-mall-search{height:50px;border:1px solid var(--border-default);border-radius:18px;background:var(--surface-card);display:flex;align-items:center;gap:10px;padding:0 12px 0 15px;box-shadow:0 4px 16px rgba(94,55,31,.05)}
.v59-mall-search>svg{width:21px;height:21px;color:var(--text-tertiary);flex:none}
.v59-mall-search input{min-width:0;flex:1;border:0;outline:0;background:transparent;font-size:16px;color:var(--text-primary);height:100%;padding:0}
.v59-mall-search input::placeholder{color:var(--text-tertiary)}
.v59-mall-search button{width:30px;height:30px;border:0;border-radius:50%;background:transparent;color:var(--text-tertiary);font-size:22px;line-height:1;padding:0}
.v59-mall-search:focus-within{border-color:color-mix(in srgb,var(--brand-primary) 42%,var(--border-default));box-shadow:0 0 0 3px color-mix(in srgb,var(--brand-primary) 8%,transparent)}

/* ---------- categories ---------- */
.v59-mall-tabs{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:0 0 14px;margin:0}
.v59-mall-tabs::-webkit-scrollbar{display:none}
.v59-category-pill{flex:none;min-height:38px;padding:0 17px;border:1px solid var(--border-default);border-radius:999px;background:var(--surface-card);color:var(--text-secondary);font-size:15px;font-weight:700}
.v59-category-pill.on{border-color:var(--brand-primary);background:var(--brand-primary);color:var(--on-primary);box-shadow:0 5px 14px color-mix(in srgb,var(--brand-primary) 18%,transparent)}
.v59-category-skeleton{flex:none;width:78px;height:38px;border-radius:999px;background:linear-gradient(90deg,var(--surface-muted),var(--surface-card),var(--surface-muted));background-size:220% 100%;animation:v59Shimmer 1.25s linear infinite}
.v59-mall-section-head{display:flex;align-items:end;justify-content:space-between;gap:12px;margin:2px 2px 12px}
.v59-mall-section-head b{font-size:21px;line-height:1.2;color:var(--text-primary);font-weight:900}
.v59-mall-section-head span{font-size:13px;color:var(--text-tertiary);white-space:nowrap}

/* ---------- product grid ---------- */
.v59-mall-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start}
.v59-product-card{min-width:0;background:var(--surface-card);border:1px solid var(--border-default);border-radius:20px;overflow:hidden;box-shadow:0 5px 18px rgba(94,55,31,.07);transition:transform .15s ease,box-shadow .15s ease}
.v59-product-card:active{transform:scale(.985)}
.v59-product-card[hidden]{display:none!important}
.v59-product-media{position:relative;aspect-ratio:1/1;background:linear-gradient(145deg,#F8F3EA,#F2E8D9);display:flex;align-items:center;justify-content:center;overflow:hidden}
.v59-product-photo{width:100%;height:100%;display:block;object-fit:cover}
.v59-product-body{padding:12px 12px 13px}
.v59-product-body h3{margin:0;color:var(--text-primary);font-size:16px;line-height:1.4;font-weight:850;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:44px}
.v59-product-meta{margin-top:6px;color:var(--text-tertiary);font-size:12px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.v59-product-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:11px}
.v59-price{display:flex;align-items:baseline;gap:1px;color:var(--brand-primary);min-width:0}
.v59-price small{font-size:14px;font-weight:850}
.v59-price strong{font-size:23px;font-weight:950;letter-spacing:-.5px}
.v59-cart-add{width:38px;height:38px;flex:none;border:0;border-radius:50%;background:var(--brand-primary);color:var(--on-primary);display:flex;align-items:center;justify-content:center;box-shadow:0 5px 13px color-mix(in srgb,var(--brand-primary) 22%,transparent);padding:0}
.v59-cart-add svg{width:20px;height:20px}
.v59-cart-add:disabled{background:var(--surface-muted);color:var(--text-tertiary);box-shadow:none}
.v59-cart-add.loading{opacity:.58;pointer-events:none}
.v59-soldout{position:absolute;inset:auto 10px 10px auto;border-radius:999px;background:rgba(43,32,24,.78);color:#fff;padding:5px 9px;font-size:11px;font-weight:800}

/* Generic product artwork fallback. This is intentionally neutral and unbranded. */
.v59-water-pack{width:84%;height:84%;display:flex;align-items:center;justify-content:center}
.v59-water-case{width:90%;height:66%;position:relative;border-radius:14px;background:linear-gradient(145deg,#EAF6F5,#D8ECED);border:1px solid rgba(78,135,142,.18);box-shadow:0 14px 26px rgba(60,109,118,.12);display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}
.v59-water-case::before{content:"";position:absolute;width:150%;height:44%;left:-25%;top:-8%;background:linear-gradient(180deg,rgba(255,255,255,.72),rgba(255,255,255,0));transform:rotate(-7deg)}
.v59-water-case::after{content:"";position:absolute;inset:auto 0 0;height:8px;background:var(--brand-primary);opacity:.86}
.v59-water-brand{position:relative;z-index:2;font-size:13px;font-weight:900;color:#365E64;letter-spacing:.5px;margin-bottom:8px}
.v59-water-bottles{position:relative;z-index:2;display:flex;align-items:end;gap:5px;height:48px}
.v59-water-bottles i{position:relative;display:block;width:16px;height:39px;border-radius:5px 5px 7px 7px;background:linear-gradient(90deg,#A8DCE6,#E7F8FA 45%,#8FC8D4);border:1px solid rgba(65,140,154,.22)}
.v59-water-bottles i::before{content:"";position:absolute;width:8px;height:6px;border-radius:2px 2px 0 0;background:#6CAAB8;left:3px;top:-6px}
.v59-water-case small{position:relative;z-index:2;font-size:10px;color:#65868A;font-weight:750;margin-top:6px}
.v59-generic-pack{width:58%;color:var(--brand-accent-strong)}
.v59-generic-pack svg{width:100%;display:block}

.v59-product-skeleton{aspect-ratio:.72;border-radius:20px;background:linear-gradient(100deg,var(--surface-muted) 20%,var(--surface-card) 40%,var(--surface-muted) 60%);background-size:220% 100%;animation:v59Shimmer 1.25s linear infinite}
@keyframes v59Shimmer{to{background-position:-220% 0}}
.v59-mall-empty{grid-column:1/-1;background:var(--surface-card);border:1px solid var(--border-default);border-radius:20px;padding:34px 18px;text-align:center;color:var(--text-secondary)}
.v59-mall-empty b{display:block;color:var(--text-primary);font-size:18px;margin-bottom:6px}.v59-mall-empty span{font-size:14px}.v59-mall-empty button{display:inline-flex;align-items:center;justify-content:center;min-height:42px;margin-top:14px;border:0;border-radius:999px;background:var(--brand-primary);color:var(--on-primary);padding:0 22px;font-weight:800}

/* ---------- cart / checkout / order ---------- */
.v55-mall-head-actions{margin-left:auto;display:flex;gap:8px}.v55-mall-head-actions button,.v55-head-link{border:1px solid var(--border-default);background:var(--surface-card);color:var(--text-primary);border-radius:999px;padding:8px 12px;font-weight:750}
.v55-mall-head-actions i{display:inline-flex;min-width:18px;height:18px;border-radius:9px;align-items:center;justify-content:center;background:var(--brand-primary);color:#fff;font-style:normal;font-size:11px}
.v55-stock{font-size:12px;color:var(--text-secondary);margin-top:8px}
.v55-cart-list,.v55-orders-list{display:flex;flex-direction:column;gap:12px;padding:4px 0 14px}
.v55-cart-row,.v55-order-card,.v55-check-card{background:var(--surface-card);border:1px solid var(--border-default);border-radius:20px;padding:15px;box-shadow:0 5px 18px rgba(94,55,31,.06)}
.v55-cart-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}.v55-cart-main{display:flex;flex-direction:column;gap:4px}.v55-cart-main span,.v55-cart-row.unavailable span{font-size:13px;color:var(--text-secondary)}
.v55-qty{display:flex;align-items:center;gap:7px}.v55-qty button{width:34px;height:34px;border:1px solid var(--border-default);border-radius:12px;background:var(--surface-card);color:var(--text-primary)}
.v55-cart-price{font-weight:900;color:var(--brand-primary)}.v55-link{border:0;background:transparent;color:var(--text-secondary);text-align:right}.v55-link.danger{color:var(--state-danger)}
.v55-check-card{display:flex;flex-direction:column;gap:11px;margin-bottom:12px}.v55-check-card>div:not(#mall-checkout-items):not(#mall-address-list):not(.v55-address-form){display:flex;justify-content:space-between;gap:12px}.v55-check-card .total{padding-top:11px;border-top:1px solid var(--border-default);font-size:18px}.v55-section-title{font-size:17px}.v55-check-line,.v55-order-line{display:flex;justify-content:space-between;gap:12px;padding:8px 0}.v55-address-option{display:flex;gap:9px;padding:11px;border:1px solid var(--border-default);border-radius:14px;margin-bottom:8px}.v55-address-option span{display:flex;flex-direction:column;gap:3px}.v55-address-option i{font-style:normal;font-size:12px;color:var(--text-secondary)}
.v55-address-form{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important}.v55-address-form input,.v55-check-card textarea{width:100%;box-sizing:border-box;border:1px solid var(--border-default);border-radius:14px;padding:12px 13px;background:var(--surface-page);font:inherit;color:var(--text-primary)}.v55-address-form #mall-addr-detail,.v55-address-form button{grid-column:1/-1}.v55-address-form button{border:0;border-radius:14px;padding:12px;background:var(--brand-primary);color:var(--on-primary);font-weight:800}.v55-note-label{font-weight:800}.v55-check-card textarea{min-height:86px;resize:vertical}.v55-check-error{min-height:18px;color:var(--state-danger);font-size:13px;margin:4px 2px 8px}.v55-pay-note{font-size:12px;color:var(--text-secondary);line-height:1.55;padding:0 5px 18px}
.v55-order-head,.v55-order-foot{display:flex;justify-content:space-between;gap:10px;align-items:center}.v55-order-head span{font-size:12px;color:var(--brand-primary);background:var(--brand-primary-soft);border-radius:999px;padding:5px 9px;font-weight:800}.v55-order-card{display:flex;flex-direction:column;gap:9px}.v55-order-line{border-bottom:1px dashed var(--border-default);font-size:14px}.v55-order-foot{padding-top:4px}.v55-order-foot>div{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.v55-order-foot button{border:1px solid var(--border-default);background:var(--surface-card);border-radius:999px;padding:8px 12px;color:var(--text-primary)}.v55-order-foot button.primary{background:var(--brand-primary);color:var(--on-primary);border-color:var(--brand-primary)}

/* ---------- profile order center ---------- */
.v59-order-domain-tabs{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:6px!important;padding:5px!important;border-radius:18px!important;background:var(--surface-muted)!important}
.v59-order-domain-tabs button{min-width:0!important;padding:9px 6px!important;font-size:13px!important;border-radius:14px!important}
.v59-global-commerce-order{border:1px solid var(--border-default)!important;border-radius:18px!important;background:var(--surface-card)!important;box-shadow:0 4px 14px rgba(94,55,31,.05)!important}
.v59-global-order-logistics{margin-top:7px;padding:8px 10px;border-radius:11px;background:var(--state-info-soft);color:var(--state-info);font-size:12px;line-height:1.4}

@media(min-width:560px){.v59-mall-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:390px){.v59-mall-grid{gap:9px}.v59-product-body{padding:10px}.v59-product-body h3{font-size:15px;min-height:42px}.v59-price strong{font-size:21px}.v59-cart-add{width:36px;height:36px}.v59-order-domain-tabs button{font-size:12px!important;padding-left:4px!important;padding-right:4px!important}.v55-address-form{grid-template-columns:1fr}.v55-address-form>*{grid-column:1!important}}
