/* ========== 变量与基础重置 ========== */
:root { --brand:#8f301e; --brand-dark:#6d2418; --cream:#f8f4ed; --line:#eadcd1; --ink:#251a16; --muted:#786a63; }
* { box-sizing:border-box; }
body { margin:0; background:var(--cream); color:var(--ink); font:16px/1.55 system-ui,-apple-system,"Microsoft YaHei",sans-serif; -webkit-font-smoothing:antialiased; }
button,input,textarea,select { font:inherit; }
button,a { -webkit-tap-highlight-color:transparent; }
a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }

/* ========== 移动优先：默认样式（手机） ========== */
.site-header { display:flex; align-items:center; gap:12px; min-height:56px; padding:0 16px; border-bottom:1px solid var(--line); background:#fffdf9; }
.brand { display:flex; align-items:center; gap:8px; font-size:17px; font-weight:800; white-space:nowrap; }
.brand-mark { display:grid; width:30px; height:30px; place-items:center; border-radius:9px; color:#fff; background:var(--brand); font-size:14px; flex-shrink:0; }
nav { display:none; }
#header-actions { display:flex; align-items:center; gap:8px; margin-left:auto; white-space:nowrap; }
.account { color:var(--brand); font-weight:700; max-width:120px; overflow:hidden; text-overflow:ellipsis; }

/* 移动端导航：改为底部固定 tab-bar */
.mobile-nav { display:flex; position:fixed; bottom:0; left:0; right:0; z-index:20; background:#fffdf9; border-top:1px solid var(--line); padding:4px 0 env(safe-area-inset-bottom,0); }
.mobile-nav a { flex:1; text-align:center; padding:8px 4px; font-size:12px; color:var(--muted); display:flex; flex-direction:column; align-items:center; gap:3px; }
.mobile-nav a.active { color:var(--brand); font-weight:700; }
.mobile-nav svg { width:22px; height:22px; }

.shell { width:100%; margin:16px auto 72px; padding:0 16px; }

/* Hero 区域 */
.platform-hero,.shop-hero { display:grid; grid-template-columns:1fr; gap:22px; min-height:0; padding:28px 22px; border-radius:18px; color:#fff; background:linear-gradient(115deg,#702719,#a9492f 57%,#d67e50); }
.platform-hero { display:block; background:linear-gradient(115deg,#33231e,#8f301e 57%,#d67e50); }
.platform-hero > p { max-width:720px; }
.eyebrow { margin:0 0 8px; letter-spacing:3px; font-size:12px; opacity:.88; }
.shop-hero h1,.platform-hero h1 { max-width:700px; margin:0 0 15px; font-size:32px; line-height:1.15; }
.shop-hero > div > p:not(.eyebrow),.platform-hero > p:not(.eyebrow) { max-width:680px; font-size:16px; }
.hero-actions { display:flex; gap:12px; margin-top:24px; }
.shop-hero aside { display:grid; align-content:center; gap:14px; }
.shop-hero aside article { display:grid; gap:6px; padding:18px 20px; border:1px solid #ffffff45; border-radius:14px; background:#ffffff12; }
.shop-hero aside h2 { margin:0; font-size:18px; }
.shop-hero aside p { margin:0; white-space:pre-wrap; }
.shop-hero aside strong { font-size:28px; }
.hotline { font-weight:700; letter-spacing:1px; }
.feature-grid,.admin-grid { display:grid; grid-template-columns:1fr; gap:14px; margin-top:28px; }
.feature-grid article { display:grid; gap:8px; padding:18px; border:1px solid #ffffff3b; border-radius:14px; background:#ffffff10; }
.feature-grid b { font-size:17px; }

/* 卡片与表单 */
.page-card { padding:20px 16px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 8px 24px #5d39210d; }
.narrow { width:100%; max-width:700px; margin:auto; }
.page-card h1 { margin:0; font-size:26px; }
.muted,.section-title p { color:var(--muted); }
.section-title { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.section-title h1 { font-size:24px; }
.section-title h1,.section-title h2,.section-title p { margin:0; }
.section-title p { margin-top:4px; }
.form-grid,.stack { display:grid; gap:14px; }
.form-grid { grid-template-columns:1fr; margin-top:18px; }
.form-grid .full { grid-column:1/-1; }
.form-grid label,.stack label { display:grid; gap:6px; color:var(--muted); font-size:14px; }
.form-grid button { width:100%; }
.form-grid input,.form-grid textarea,.form-grid select,.stack input,.stack textarea,.stack select { width:100%; min-height:46px; padding:12px 14px; border:1px solid #dbc9bc; border-radius:10px; outline:none; color:var(--ink); background:#fffdfb; font-size:16px; }
.form-grid textarea,.stack textarea { min-height:80px; resize:vertical; }
.form-grid input:focus,.form-grid textarea:focus,.form-grid select:focus,.stack input:focus,.stack textarea:focus,.stack select:focus { border-color:var(--brand); box-shadow:0 0 0 3px #8f301e18; }
.form-grid select { width:100%; min-height:46px; padding:12px 14px; border:1px solid #dbc9bc; border-radius:10px; outline:none; color:var(--ink); background:#fffdfb; }

.checkbox-row { display:flex !important; align-items:center; gap:8px; color:var(--muted); font-size:14px; margin-top:4px; }
.checkbox-row input { width:auto !important; min-height:auto !important; margin:0; }

.forgot-link { margin:10px 0 0; text-align:right; font-size:14px; }
.forgot-link a { color:var(--brand); font-weight:600; }
.forgot-link a:hover { text-decoration:underline; }

/* 按钮 */
.primary,.secondary,.text,.danger { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 16px; border:1px solid transparent; border-radius:10px; cursor:pointer; font-weight:700; }
.primary { color:#fff; background:var(--brand); }
.primary:hover { background:var(--brand-dark); }
.secondary { border-color:#d9bcae; color:var(--brand); background:#fffaf7; }
.danger { color:#fff; background:#c0392b; border-color:#c0392b; }
.danger:hover { background:#922b1f; }
.text { min-height:auto; padding:4px 8px; color:var(--muted); background:transparent; }
.wide { width:100%; }
.cart-button { display:inline-flex; gap:8px; align-items:center; padding:10px 14px; border:1px solid var(--line); border-radius:10px; color:var(--brand); background:#fff; }
.cart-button b { display:grid; width:22px; height:22px; place-items:center; border-radius:50%; color:#fff; background:var(--brand); }

/* 商品区 */
#products { margin-top:36px; }
.product-grid { display:grid; grid-template-columns:1fr; gap:14px; }
.product-card { display:grid; grid-template-columns:72px 1fr; gap:14px; min-height:0; padding:14px; border:1px solid var(--line); border-radius:15px; background:#fff; }
.product-photo { display:grid; width:72px; height:72px; place-items:center; border-radius:12px; color:#fff; background:linear-gradient(140deg,#9c3d28,#df8959); font-size:28px; font-weight:800; overflow:hidden; flex-shrink:0; }
.product-photo img { width:100%; height:100%; object-fit:cover; display:block; }
.product-photo.small { width:52px; height:52px; border-radius:10px; font-size:20px; }
.product-card h3 { margin:4px 0 10px; font-size:17px; }
.product-card small { color:var(--muted); }
.product-row { display:flex; justify-content:space-between; align-items:center; gap:10px; color:var(--brand); }
.admin-grid article.product-row { grid-template-columns:auto 1fr; align-items:flex-start; gap:12px; }
.product-row .secondary { min-height:36px; padding:6px 12px; }
.product-actions { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.product-actions button { min-height:34px; padding:5px 12px; font-size:13px; }
.empty { padding:30px 20px; color:var(--muted); text-align:center; border:1px dashed #d8c6b7; border-radius:14px; background:#fff; }

/* 弹窗 */
.dialog { width:min(480px,calc(100vw - 24px)); max-height:calc(100vh - 48px); padding:24px 20px; border:0; border-radius:16px; color:var(--ink); box-shadow:0 16px 48px #0004; overflow-y:auto; }
.dialog::backdrop { background:#1b120a88; }
.dialog h2 { margin:0 0 16px; font-size:20px; }
.dialog-close { position:absolute; top:8px; right:10px; border:0; color:var(--muted); background:transparent; font-size:28px; cursor:pointer; z-index:1; }
.cart-list { display:grid; gap:10px; }
.cart-line { display:flex; justify-content:space-between; gap:10px; padding-bottom:10px; border-bottom:1px solid var(--line); }
.cart-line div:first-child { display:grid; }
.cart-line small { color:var(--muted); }
.quantity { display:flex; align-items:center; gap:8px; }
.quantity button { width:34px; height:34px; border:1px solid #dcc8bb; border-radius:8px; color:var(--brand); background:#fff; }
.quantity span { min-width:24px; text-align:center; font-weight:700; }
.cart-total { display:flex; justify-content:space-between; margin:16px 0; font-size:18px; }
.cart-total strong { color:var(--brand); }

/* Toast */
.toast { position:fixed; z-index:30; bottom:70px; left:50%; max-width:calc(100vw - 24px); padding:12px 16px; border-radius:10px; color:#fff; background:#2c211b; opacity:0; transform:translate(-50%,20px); pointer-events:none; transition:.2s; font-size:14px; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.toast.error { background:#a52e22; }

/* 管理后台 */
.admin-tabs { display:flex; gap:8px; margin-bottom:20px; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:thin; }
.admin-tabs button { padding:9px 13px; border:1px solid #dcc8bb; border-radius:9px; color:var(--brand); background:#fff; cursor:pointer; white-space:nowrap; font-size:14px; flex-shrink:0; }
.admin-tabs button.active { color:#fff; background:var(--brand); }
.admin-grid { grid-template-columns:1fr; margin:10px 0 24px; }
.admin-grid article,.order { display:grid; gap:5px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#fffdfb; }
.admin-grid span,.admin-grid small,.order span,.order small { color:var(--muted); }
.admin-grid a { margin-top:6px; color:var(--brand); font-weight:700; }
.order-list { display:grid; gap:12px; }

/* 订单状态 */
.order-status { display:inline-flex; align-items:center; padding:2px 10px; border-radius:999px; font-size:13px; font-weight:700; margin-left:8px; }
.order-status.status-PENDING { color:#9a6413; background:#fbe9c4; }
.order-status.status-CONFIRMED { color:#1a6e3a; background:#cfeedd; }
.order-status.status-CANCELLED { color:#8a2a2a; background:#f5cfcf; }
.status-capsule { display:inline-flex; align-items:center; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:700; letter-spacing:.5px; }
.status-capsule.status-green { color:#1a6e3a; background:#cfeedd; }
.status-capsule.status-yellow { color:#9a6413; background:#fbe9c4; }
.status-capsule.status-red { color:#8a2a2a; background:#f5cfcf; }
.merchant-row-top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.merchant-row-top b { font-size:16px; }
.merchant-row-meta { display:flex; flex-wrap:wrap; gap:8px 16px; font-size:13px; color:var(--muted); }
.merchant-row-stats { display:flex; gap:14px; }
.merchant-row-stats small { color:var(--brand); font-weight:600; font-size:13px; }
.merchant-row-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
.merchant-row-actions > * { min-height:36px; padding:6px 14px; font-size:13px; text-decoration:none; }
.order > div:first-child { display:flex; align-items:center; flex-wrap:wrap; gap:4px; }
.order .primary { width:max-content; margin-top:6px; }

/* 平台登录页 */
.admin-login-page { display:grid; place-items:center; min-height:calc(100vh - 56px); padding:30px 20px 80px; background:linear-gradient(135deg,#33231e,#6d2418 60%,#8f301e); }
.admin-login-card { width:100%; max-width:400px; padding:32px 28px; border-radius:18px; background:#fff; box-shadow:0 16px 48px #0004; }
.admin-login-card h1 { margin:0 0 6px; font-size:24px; text-align:center; }
.admin-login-card p { text-align:center; margin:0 0 24px; }
.admin-login-logo { display:grid; width:52px; height:52px; place-items:center; margin:0 auto 16px; border-radius:14px; color:#fff; background:var(--brand); font-size:22px; font-weight:800; }

/* 图片上传 */
.image-uploader { display:grid; grid-template-columns:100px 1fr; gap:12px; align-items:center; padding:12px; border:1px dashed #dcc8bb; border-radius:12px; background:#fffdfb; }
.image-uploader .image-preview { display:grid; width:100px; height:100px; place-items:center; border-radius:10px; color:var(--muted); background:#f5ece5; overflow:hidden; }
.image-uploader .image-preview img { width:100%; height:100%; object-fit:cover; display:block; }
.image-uploader > div:last-child { display:grid; gap:8px; }

/* 优惠券 */
.coupon-grid { display:grid; grid-template-columns:1fr; gap:12px; margin:10px 0 24px; }
.coupon-card { display:grid; grid-template-columns:auto 1fr; gap:14px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:13px; background:#fffdfb; }
.coupon-card.disabled { opacity:.5; }
.coupon-value { display:grid; place-items:center; min-width:64px; height:64px; border-radius:10px; color:#fff; background:linear-gradient(140deg,#9c3d28,#df8959); font-size:16px; font-weight:800; text-align:center; }
.coupon-card > div:last-child { display:grid; gap:4px; }
.coupon-card b { font-size:15px; }
.coupon-card small { color:var(--muted); }
.coupon-card .secondary,.coupon-card .primary { min-height:34px; padding:5px 10px; width:max-content; }
.coupon-select { display:grid; gap:10px; padding:12px; border:1px dashed #e5d1c1; border-radius:12px; background:#fffaf4; }
.coupon-check { display:flex !important; align-items:center; gap:10px; padding:10px 12px; border:1px solid #ead9c9; border-radius:10px; background:#fff; cursor:pointer; color:var(--ink); font-size:14px; }
.coupon-check input { width:auto; margin:0; }
.coupon-check b { color:var(--brand); }
.coupon-check small { color:var(--muted); font-size:12px; margin-left:auto; }
.tag-rebate { display:inline-flex; padding:1px 8px; border-radius:999px; color:#8b5a12; background:#fbe9c4; }

/* ========== 分页 ========== */
.pagination { margin-top:22px; display:flex; flex-direction:column; gap:10px; align-items:center; }
.pagination-info { font-size:13px; color:var(--muted); }
.pagination-buttons { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; }
.pagination-buttons button { padding:6px 12px; font-size:13px; border:1px solid var(--line); background:#fff; border-radius:8px; cursor:pointer; color:var(--ink); min-width:36px; }
.pagination-buttons button:hover:not(:disabled) { border-color:var(--brand); color:var(--brand); }
.pagination-buttons button.active { background:var(--brand); color:#fff; border-color:var(--brand); }
.pagination-buttons button:disabled { opacity:.45; cursor:not-allowed; }
.page-ellipsis { padding:6px 4px; color:var(--muted); font-size:13px; }

/* 邀请 */
.invite-code-box { display:flex; align-items:center; gap:12px; padding:16px 18px; margin:18px 0; border:1px solid var(--line); border-radius:13px; background:#fffdfb; flex-wrap:wrap; }
.invite-code-box small { color:var(--muted); }
.invite-code-box strong { font-size:22px; color:var(--brand); }
.stats-row { display:flex; gap:12px; margin:18px 0; }
.stats-row > div { flex:1; display:grid; gap:4px; padding:16px 18px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.stats-row b { font-size:24px; color:var(--brand); }
.stats-row small { color:var(--muted); }

/* ========== 平板 (≥768px) ========== */
@media (min-width:768px) {
  :root { --header-h:64px; }
  .site-header { min-height:var(--header-h); gap:20px; padding:0 24px; }
  .brand { font-size:19px; }
  .brand-mark { width:32px; height:32px; }
  .mobile-nav { display:none; }
  nav { display:flex; gap:18px; color:var(--muted); }
  nav a:hover { color:var(--brand); }
  .account { max-width:160px; }
  .shell { width:min(100% - 48px,760px); margin:28px auto 56px; }
  .platform-hero,.shop-hero { grid-template-columns:1.4fr .9fr; gap:32px; min-height:360px; padding:40px; border-radius:22px; }
  .shop-hero h1,.platform-hero h1 { font-size:44px; }
  .shop-hero > div > p:not(.eyebrow),.platform-hero > p:not(.eyebrow) { font-size:17px; }
  .feature-grid,.admin-grid { grid-template-columns:repeat(2,1fr); }
  .product-grid { grid-template-columns:repeat(2,1fr); gap:16px; }
  .page-card { padding:28px 24px; border-radius:18px; }
  .page-card h1 { font-size:30px; }
  .section-title h1 { font-size:28px; }
  .coupon-grid { grid-template-columns:repeat(2,1fr); }
  .dialog { padding:28px; }
  .dialog h2 { font-size:22px; }
  .toast { bottom:24px; }
  .form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .form-grid .full { grid-column:1/-1; }
  .form-grid button { width:max-content; }
  .image-uploader { grid-template-columns:112px 1fr; }
  .image-uploader .image-preview { width:112px; height:112px; }
  .product-card { grid-template-columns:82px 1fr; min-height:152px; }
  .product-photo { width:82px; height:82px; }
  .product-photo.small { width:56px; height:56px; }
  .stats-row { gap:18px; }
  .stats-row b { font-size:28px; }
}

/* ========== 桌面 (≥1024px) ========== */
@media (min-width:1024px) {
  .site-header { padding:0 max(24px,calc((100vw - 1240px)/2)); min-height:74px; }
  .brand { font-size:21px; gap:9px; }
  .brand-mark { width:34px; height:34px; }
  .shell { width:min(1240px,calc(100% - 40px)); margin:38px auto 70px; padding:0; }
  .platform-hero,.shop-hero { min-height:420px; padding:52px; border-radius:26px; }
  .shop-hero h1,.platform-hero h1 { font-size:54px; }
  .shop-hero > div > p:not(.eyebrow),.platform-hero > p:not(.eyebrow) { font-size:18px; }
  .shop-hero aside article { padding:22px 24px; border-radius:17px; }
  .shop-hero aside h2 { font-size:20px; }
  .shop-hero aside strong { font-size:34px; }
  .feature-grid,.admin-grid,.product-grid,.coupon-grid { grid-template-columns:repeat(3,1fr); }
  .feature-grid { margin-top:34px; }
  .feature-grid article { padding:20px; border-radius:16px; }
  .feature-grid b { font-size:18px; }
  .product-grid { gap:18px; }
  .product-card { min-height:152px; padding:15px; border-radius:17px; }
  .product-card h3 { font-size:18px; }
  .page-card { padding:30px; border-radius:20px; box-shadow:0 12px 28px #5d39210d; }
  .page-card h1 { font-size:32px; }
  .section-title h1 { font-size:30px; }
  .coupon-grid { gap:14px; }
  .coupon-card { padding:16px; border-radius:14px; }
  .coupon-value { min-width:72px; height:72px; font-size:18px; }
  .coupon-card b { font-size:16px; }
  .dialog { padding:28px; border-radius:18px; box-shadow:0 22px 60px #0004; }
  .dialog h2 { font-size:22px; }
  .admin-grid { margin:12px 0 30px; }
  .admin-grid article,.order { padding:16px; border-radius:12px; }
  .invite-code-box { padding:18px 22px; }
  .invite-code-box strong { font-size:24px; }
  .stats-row { gap:20px; }
  .stats-row b { font-size:28px; }
}

/* ========== 超宽屏 (≥1440px) ========== */
@media (min-width:1440px) {
  .platform-hero,.shop-hero { padding:60px; }
}
