/* 顾客端 H5 样式：移动优先，无第三方 UI 依赖 */
:root {
  --brand: #1a936f;
  --brand-dark: #137a5a;
  --brand-light: #e8f5ef;
  --text: #1f2421;
  --text-2: #6b7570;
  --line: #ecefed;
  --bg: #f6f8f7;
  --danger: #d94f4f;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(23, 58, 44, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
#app { min-height: 100vh; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--brand), #2fb083);
  color: #fff; padding: 14px 16px 12px;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.topbar .back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; opacity: .95; cursor: pointer; margin-bottom: 4px;
}

/* 分类 tab */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 4px; background: #fff; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 7px 16px; border-radius: 999px; background: #f0f3f1;
  color: var(--text-2); font-size: 14px; border: none; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--brand); color: #fff; }

/* 商品网格 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px 90px; }
.card {
  background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; cursor: pointer;
}
.thumb {
  aspect-ratio: 1/1; background: var(--brand-light); display: flex; align-items: center; justify-content: center;
  color: var(--brand-dark); font-size: 26px; font-weight: 700; letter-spacing: 1px; position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; left: 8px; top: 8px; background: rgba(26, 147, 111, .95); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 500; letter-spacing: 0;
}
.card .body { padding: 9px 10px 11px; }
.card .name { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.price { color: var(--danger); font-weight: 700; }
.price small { font-size: 11px; font-weight: 500; }
.price .unit { color: var(--text-2); font-weight: 400; font-size: 11px; }

/* 底部栏 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { text-align: center; padding: 9px 0 8px; font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav .ico { font-size: 19px; line-height: 1.1; }

/* 详情 */
.sheet { background: #fff; border-radius: 14px; margin: 12px 14px; padding: 14px; box-shadow: var(--shadow); }
.sheet h2 { margin: 0 0 8px; font-size: 17px; }
.desc { color: var(--text-2); font-size: 13px; white-space: pre-wrap; }
.spec-group { margin: 14px 0 4px; }
.spec-group .label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 8px; background: #f3f5f4; border: 1px solid transparent;
  font-size: 13px; cursor: pointer; color: var(--text);
}
.chip.active { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.chip.disabled { opacity: .4; text-decoration: line-through; cursor: not-allowed; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 34px; height: 34px; background: #f7f9f8; border: none; font-size: 18px; color: var(--text-2); cursor: pointer; }
.qty button:disabled { opacity: .4; }
.qty input { width: 48px; height: 34px; border: none; text-align: center; font-size: 14px; }

/* 操作条 */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.action-bar .total { flex: 1; font-size: 13px; color: var(--text-2); }
.action-bar .total b { color: var(--danger); font-size: 19px; }
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer;
}
.btn:active { background: var(--brand-dark); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.gray { background: #f0f3f1; color: var(--text-2); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; }

/* 列表 */
.list { background: #fff; margin: 12px 14px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row { padding: 13px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 14px; font-weight: 600; }
.row .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; word-break: break-all; }
.row .right { text-align: right; font-size: 13px; color: var(--text-2); flex: 0 0 auto; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: #fafbfa; border-radius: 10px;
  padding: 11px 12px; font-size: 14px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); background: #fff; }
.field .hint { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

/* 状态 */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: #eef2f0; color: var(--text-2); }
.pill.pending_delivery { background: #fff4e5; color: #b96b09; }
.pill.shipping { background: #e8f2ff; color: #1f6fd0; }
.pill.done { background: #e8f5ef; color: var(--brand-dark); }
.pill.cancelled { background: #f5f5f5; color: #999; }
.pill.unpaid { background: #fdecea; color: #c0392b; }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; }
.mask.center { align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.mask.center .modal { border-radius: 16px; max-width: 360px; }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal .close { float: right; color: var(--text-2); font-size: 20px; line-height: 1; cursor: pointer; }

.empty { text-align: center; padding: 70px 20px; color: var(--text-2); font-size: 14px; }
.empty .ico { font-size: 40px; margin-bottom: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(25,32,28,.92); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; z-index: 80; max-width: 80vw; text-align: center;
}
.tip-bar { margin: 10px 14px 0; background: #fff8e8; color: #8a5a00; font-size: 12px; padding: 9px 12px; border-radius: 10px; }
.small-note { font-size: 12px; color: var(--text-2); text-align: center; padding: 16px; }
.map-box { height: 160px; border-radius: 10px; background: #eef2f0; margin-top: 8px; overflow: hidden; position: relative; }
.map-box .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; }
.section-title { padding: 16px 16px 6px; font-size: 13px; color: var(--text-2); }
.hidden { display: none !important; }
