* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif; font-size: 14px; color: #222; background: #f5f5f5; }

#app { min-height: 100vh; padding-bottom: 56px; }
.page { display: block; }
.hidden { display: none !important; }

/* Toast */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,0.72); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 14px; z-index: 9999; pointer-events: none; }

/* Login */
.login-box { max-width: 360px; margin: 80px auto 0; background: #fff; border-radius: 12px; padding: 32px 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 28px; letter-spacing: 2px; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; transition: border 0.2s; background: #fafafa; }
.form-group input:focus, .form-group textarea:focus { border-color: #333; background: #fff; }
.form-group textarea { height: 72px; resize: none; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }

/* Buttons */
.btn { border: none; border-radius: 8px; padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
.btn:active { opacity: 0.75; }
.btn-primary { background: #222; color: #fff; }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-outline { background: #fff; border: 1px solid #222; color: #222; }
.btn-danger { background: #d9534f; color: #fff; }

/* Top Bar */
.top-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.search-wrap { flex: 1; }
.search-wrap input { width: 100%; border: 1px solid #e0e0e0; border-radius: 20px; padding: 8px 14px; font-size: 14px; outline: none; background: #f5f5f5; }
.cart-btn { position: relative; background: #222; color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.badge { position: absolute; top: -6px; right: -6px; background: #e74c3c; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; display: flex; align-items: center; justify-content: center; }

/* Content layout */
.content-wrap { display: flex; min-height: calc(100vh - 110px); }
.sidebar { width: 80px; background: #fff; border-right: 1px solid #eee; flex-shrink: 0; overflow-y: auto; }
.sidebar-item { padding: 14px 6px; text-align: center; font-size: 12px; cursor: pointer; border-left: 3px solid transparent; color: #555; line-height: 1.4; }
.sidebar-item.active { border-left-color: #222; color: #222; font-weight: 600; background: #f5f5f5; }
.product-area { flex: 1; overflow-x: hidden; }

/* Sort bar */
.sort-bar { padding: 8px 12px; background: #fff; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 8px; font-size: 12px; color: #888; }
.sort-btn { border: 1px solid #ddd; background: #fff; border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: #666; }
.sort-btn.active { background: #222; color: #fff; border-color: #222; }

/* Product list */
.product-list { padding: 10px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,0.06); cursor: pointer; transition: box-shadow 0.2s; }
.product-card:active { box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
.product-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f0f0f0; display: block; }
.product-img-placeholder { width: 100%; aspect-ratio: 1; background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 12px; }
.product-info { padding: 8px 10px; }
.product-name { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-price { font-size: 15px; font-weight: 700; color: #d0021b; }
.product-stock { font-size: 11px; color: #aaa; margin-top: 2px; }
.product-add-btn { width: 28px; height: 28px; border-radius: 50%; background: #222; color: #fff; border: none; font-size: 18px; line-height: 28px; text-align: center; cursor: pointer; float: right; margin-top: -4px; }

/* Nav bar */
.nav-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 100; font-size: 15px; font-weight: 600; }
.back-btn { background: none; border: 1px solid #ddd; border-radius: 6px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: #333; }

/* Detail */
.detail-content { background: #fff; }
.detail-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f0f0f0; }
.detail-info { padding: 16px; }
.detail-name { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.detail-price { font-size: 22px; font-weight: 700; color: #d0021b; margin-bottom: 8px; }
.detail-meta { font-size: 13px; color: #888; margin-bottom: 16px; }
.qty-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.qty-btn { width: 32px; height: 32px; border-radius: 50%; background: #f0f0f0; border: none; font-size: 18px; cursor: pointer; }
.qty-num { font-size: 16px; font-weight: 600; min-width: 28px; text-align: center; }

/* Activity area */
.activity-area { background: #fff; margin-bottom: 8px; padding: 12px 14px; }
.activity-area h4 { font-size: 13px; color: #555; margin-bottom: 10px; }
.activity-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.activity-item:last-child { border-bottom: none; }
.activity-item input[type=radio] { accent-color: #222; }
.activity-name { font-size: 13px; font-weight: 600; }
.activity-desc { font-size: 11px; color: #888; }

/* Cart */
.cart-items { background: #fff; margin-bottom: 8px; }
.cart-item { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid #f5f5f5; gap: 10px; }
.cart-item-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; background: #f0f0f0; flex-shrink: 0; }
.cart-item-img-ph { width: 60px; height: 60px; border-radius: 8px; background: #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #bbb; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cart-item-price { font-size: 13px; color: #d0021b; }
.cart-item-gift { font-size: 12px; color: #e67e22; font-weight: 600; }
.cart-item-ops { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #ddd; background: #fff; font-size: 16px; cursor: pointer; }
.qty-ctrl span { min-width: 20px; text-align: center; font-size: 14px; }
.del-btn { font-size: 12px; color: #999; background: none; border: none; cursor: pointer; padding: 2px 6px; }

/* Cart footer */
.cart-footer { background: #fff; padding: 12px 14px; border-top: 1px solid #eee; position: sticky; bottom: 56px; z-index: 50; }
.delivery-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.delivery-row label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.address-area { margin-bottom: 10px; }
.address-select-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.price-summary { font-size: 13px; color: #555; margin-bottom: 12px; }
.price-row { display: flex; justify-content: space-between; padding: 4px 0; }
.price-row.total { font-size: 16px; font-weight: 700; color: #d0021b; border-top: 1px solid #eee; padding-top: 8px; margin-top: 4px; }

/* Address */
.address-list { background: #fff; margin-bottom: 8px; }
.address-card { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; }
.address-card.default { border-left: 3px solid #222; }
.address-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.address-card-name { font-size: 14px; font-weight: 600; }
.address-card-phone { font-size: 12px; color: #888; }
.address-card-addr { font-size: 13px; color: #555; margin-bottom: 6px; }
.address-card-region { font-size: 11px; color: #aaa; }
.address-form-wrap { background: #fff; padding: 14px; }
.address-form-wrap h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }

/* Orders */
.tab-bar { display: flex; background: #fff; border-bottom: 1px solid #eee; overflow-x: auto; }
.tab-btn { flex: 1; padding: 12px 0; background: none; border: none; font-size: 13px; cursor: pointer; color: #888; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn.active { color: #222; font-weight: 700; border-bottom-color: #222; }
.order-list { padding: 10px; }
.order-card { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 5px rgba(0,0,0,0.06); cursor: pointer; }
.order-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-no { font-size: 12px; color: #aaa; }
.order-status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.status-pending { background: #fff3cd; color: #856404; }
.status-completed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }
.order-amount { font-size: 16px; font-weight: 700; color: #d0021b; }
.order-meta { font-size: 12px; color: #aaa; margin-top: 4px; }
.order-detail-wrap { background: #fff; padding: 14px; }
.order-detail-section { margin-bottom: 16px; }
.order-detail-section h4 { font-size: 13px; color: #888; margin-bottom: 8px; border-bottom: 1px solid #f0f0f0; padding-bottom: 4px; }
.order-item-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.gift-tag { font-size: 11px; color: #e67e22; font-weight: 600; margin-left: 6px; }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 56px; background: #fff; border-top: 1px solid #eee; display: flex; z-index: 200; }
.nav-item { flex: 1; background: none; border: none; font-size: 13px; cursor: pointer; color: #888; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.nav-item.active { color: #222; font-weight: 700; }

/* Admin link */
.admin-link { text-align: center; padding: 10px; font-size: 12px; color: #ccc; }


