:root {
  --brand: #c8502e;
  --brand-dark: #a63d20;
  --brand-soft: #fbece5;
  --ink: #2b2320;
  --ink-2: #6b5d55;
  --line: #ece5dd;
  --bg: #f7f3ee;
  --card: #ffffff;
  --green: #2f7d4f;
  --green-soft: #e7f4ec;
  --amber: #b8791a;
  --amber-soft: #fdf2dc;
  --red: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(78, 45, 28, 0.07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 72px;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}
.topbar .logo { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.topbar .sub { font-size: 12px; opacity: .85; }
.topbar .spacer { flex: 1; }
.topbar .role-chip {
  background: rgba(255,255,255,.18); border-radius: 999px;
  padding: 4px 10px; font-size: 12px;
}

.container { max-width: 640px; margin: 0 auto; padding: 16px; }

.hero {
  background: linear-gradient(135deg, #d4643f, #a63d20);
  color: #fff; border-radius: var(--radius);
  padding: 22px 18px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: "🐔"; position: absolute; right: 12px; bottom: -10px;
  font-size: 92px; opacity: .18;
}
.hero h1 { margin: 0 0 6px; font-size: 24px; }
.hero p { margin: 0; opacity: .9; font-size: 13px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

.section-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 2px 10px; }

.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.cat-tab {
  white-space: nowrap; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 7px 15px; font-size: 13px; color: var(--ink-2);
}
.cat-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.product-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.product-img {
  width: 100%; height: 130px; object-fit: cover; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; font-size: 54px;
}
.product-body { padding: 10px 11px 12px; }
.product-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.product-spec { font-size: 11px; color: var(--ink-2); margin-bottom: 8px; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; }
.price { color: var(--brand); font-weight: 700; font-size: 18px; }
.price small { font-size: 12px; }
.stock { font-size: 11px; color: var(--green); }

.btn {
  border: none; border-radius: 10px; padding: 10px 16px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
}
.btn-primary { background: var(--brand); }
.btn-primary:active { background: var(--brand-dark); }
.btn-green { background: var(--green); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fdfcfa; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { min-height: 70px; resize: vertical; }
.field-hint { font-size: 11px; color: var(--ink-2); margin-top: 4px; }

.qty-row { display: flex; align-items: center; gap: 14px; }
.qty-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 18px; }
.qty-num { min-width: 26px; text-align: center; font-weight: 700; }

.cart-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item img, .cart-item .ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.cart-item .grow { flex: 1; }

.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-row.total { font-size: 17px; font-weight: 700; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }

.status-chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.s-pending { background: var(--amber-soft); color: var(--amber); }
.s-accepted { background: #e8effb; color: #2f5fa8; }
.s-delivering { background: var(--brand-soft); color: var(--brand); }
.s-delivered { background: var(--green-soft); color: var(--green); }
.s-paid { background: var(--green-soft); color: var(--green); }
.s-cancelled { background: #f0eeec; color: #8a7c73; }
.s-unpaid { background: #fbe9e7; color: var(--red); }

.order-card { cursor: pointer; }
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-items { font-size: 13px; color: var(--ink-2); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; height: 62px;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--ink-2); }
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tabbar .ico { font-size: 21px; line-height: 1; }
.badge { position: absolute; top: 6px; margin-left: 22px; background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 6px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: rgba(43,35,32,.94); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 200; opacity: 0; pointer-events: none; transition: .25s; max-width: 86%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.map-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150; display: flex; align-items: flex-end; }
.map-modal-inner { background: #fff; width: 100%; max-width: 640px; margin: 0 auto; border-radius: 18px 18px 0 0; overflow: hidden; }
.map-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 700; }
.map-search { display: flex; gap: 8px; padding: 0 16px 10px; }
.map-search input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.tmap-box { width: 100%; height: 52vh; }
.map-modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 10px; }
.coord-text { font-size: 12px; color: var(--ink-2); }
.icon-btn { border: none; background: transparent; font-size: 18px; }

.route-stop { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.route-num { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.route-line { border-left: 2px dashed var(--brand-soft); margin-left: 12px; height: 12px; }

.login-wrap { max-width: 420px; margin: 8vh auto 0; padding: 0 20px; text-align: center; }
.login-logo { font-size: 56px; }
.login-title { font-size: 22px; font-weight: 700; margin: 6px 0 4px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.code-box { background: var(--brand-soft); border-radius: 12px; padding: 16px; text-align: center; }
.invite-code { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--brand-dark); word-break: break-all; }
.qr-img { width: 190px; height: 190px; margin: 12px auto; display: block; background: #fff; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; text-align: right; }

/* 首页轮播 */
.banner-scroll { position: relative; height: 150px; border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: var(--brand-soft); }
.banner-item { position: relative; width: 100%; height: 100%; }
.banner-ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 20px; font-weight: 800; color: var(--brand-dark); background: linear-gradient(135deg, #f8e3d7, #f3cbb6); }
.banner-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; color: #fff; font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.55)); }

/* 领券条 */
.coupon-bar { display: flex; align-items: center; gap: 10px; background: #fff5f0; border: 1px solid #f3d9c9; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; overflow-x: auto; }
.coupon-bar-t { font-size: 13px; font-weight: 700; color: var(--brand-dark); white-space: nowrap; }
.coupon-bar-list { display: flex; gap: 8px; }
.coupon-chip { flex: 0 0 auto; border: 1px dashed var(--brand); background: #fff; color: var(--brand); border-radius: 8px; padding: 6px 10px; text-align: center; }
.coupon-chip b { display: block; font-size: 14px; }
.coupon-chip span { font-size: 10px; color: var(--ink-2); }

/* 地址选择 */
.addr-picker { margin-bottom: 10px; }
.addr-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.addr-item:active { background: var(--brand-soft); }
.addr-item.selected { border-color: var(--brand); background: var(--brand-soft); }

/* 配送方式选择 */
.delivery-mode { display: flex; gap: 10px; }
.delivery-mode .dm-item { flex: 1; border: 2px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; transition: .15s; }
.delivery-mode .dm-item.active { border-color: var(--brand); background: var(--brand-soft); }
.delivery-mode .dm-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.delivery-mode .dm-desc { font-size: 11px; color: var(--ink-2); line-height: 1.5; }
.addr-tag { font-weight: 700; font-size: 13px; }
.addr-detail { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.save-addr { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }

/* 富文本编辑器 */
.rich-editor { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.rich-toolbar button, .rich-toolbar select { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 4px 8px; font-size: 13px; cursor: pointer; }
.rich-toolbar button:hover { border-color: var(--brand); color: var(--brand); }
.rich-toolbar input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.rich-body { min-height: 120px; padding: 10px 12px; outline: none; font-size: 14px; line-height: 1.7; }
.rich-body img { max-width: 100%; height: auto; border-radius: 6px; }
.rich-desc { line-height: 1.7; word-break: break-word; }
.rich-desc img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
.rich-desc h1,.rich-desc h2,.rich-desc h3 { margin: 10px 0 6px; }

/* 福利鸡 */
.welfare-hero { background: linear-gradient(135deg,#f8e3d7,#f3cbb6); border-radius: 12px; padding: 16px; text-align: center; margin-bottom: 12px; }
.welfare-num { font-size: 40px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.welfare-num small { font-size: 16px; font-weight: 600; }

/* 通用弹层 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; }
.icon-btn { border: none; background: transparent; font-size: 18px; cursor: pointer; float: right; }
.img-list { display: flex; gap: 8px; flex-wrap: wrap; }
.img-list img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }

.print-only { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  .topbar, .tabbar, .no-print, #toast, .map-modal { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #999; }
  .print-only { display: block; }
}
