/* 背塘井水豆腐 · 水墨风样式 */
:root {
  --ink: #2b2b2b;          /* 浓墨 */
  --ink-mid: #5f5a4e;      /* 中墨 */
  --ink-light: #948d7e;    /* 淡墨 */
  --paper: #f3eee2;        /* 宣纸底 */
  --card: #faf6ec;         /* 卡片 */
  --cinnabar: #b0472f;     /* 朱红（印章） */
  --cinnabar-dark: #963a26;
  --line: #e0dacb;         /* 浅墨边框 */
  --radius: 12px;
  --serif: "STKaiti", "KaiTi", "楷体", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 90% 60% at 12% 8%, rgba(100, 88, 70, 0.07), transparent 60%),
    radial-gradient(ellipse 80% 55% at 88% 32%, rgba(80, 72, 58, 0.05), transparent 62%),
    radial-gradient(ellipse 100% 70% at 50% 108%, rgba(96, 86, 68, 0.06), transparent 65%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.page { max-width: 560px; margin: 0 auto; padding: 16px; padding-bottom: 90px; }

/* 顶部 */
.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 16px 20px;
  font-size: 20px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 1px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); }
.topbar .brand .logo {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.topbar .sub { font-size: 14px; font-weight: 400; opacity: .85; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; font-family: var(--serif); letter-spacing: 1px; }
.card-title .tag { font-size: 12px; font-weight: 400; color: var(--ink-light); font-family: var(--sans); }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--ink-light); margin-bottom: 6px; }
.input {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  color: var(--ink);
}
.input:focus { border-color: var(--ink-mid); }

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 18px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  background: var(--cinnabar);
  color: #fff;
  font-family: var(--serif);
  letter-spacing: 2px;
}
.btn:active { background: var(--cinnabar-dark); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.gray { background: #eceae3; color: var(--ink-mid); }
.btn:disabled { background: #d3d0c6; color: #fff; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* 品项卡片（图片 + 信息 + 步进器） */
.product-card {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.product-card:last-child { border-bottom: none; }
.product-card .thumb {
  width: 72px; height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #ece7d9;
}
.product-card .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.product-card .name { font-size: 17px; font-weight: 600; font-family: var(--serif); letter-spacing: 1px; }
.product-card .meta { font-size: 13px; color: var(--ink-light); margin-top: 3px; line-height: 1.4; }
.product-card .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.product-card .price { color: var(--cinnabar); font-weight: 700; font-size: 18px; flex-shrink: 0; white-space: nowrap; font-family: var(--serif); }
.product-card .price small { font-size: 12px; font-weight: 400; color: var(--ink-light); font-family: var(--sans); }

/* 数量步进器 */
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ink-mid);
  background: var(--card);
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  padding: 0;
}
.stepper button.plus { background: var(--cinnabar); color: #fff; border-color: var(--cinnabar); }
.stepper .val {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper .val::-webkit-outer-spin-button,
.stepper .val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 底部结算栏 */
.footer-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  max-width: 560px;
  margin: 0 auto;
}
.footer-bar .total { font-size: 15px; color: var(--ink-light); }
.footer-bar .total b { color: var(--cinnabar); font-size: 20px; font-family: var(--serif); }
.footer-bar .submit { width: 180px; }

/* 标签/徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge.green { background: #e8e6df; color: var(--ink-mid); }
.badge.red { background: #f5e5dd; color: var(--cinnabar); }
.badge.amber { background: #f5e5dd; color: var(--cinnabar); }
.badge.gray { background: #eceae3; color: #9a948a; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0;
  background: rgba(30,28,22,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.dialog { background: var(--card); border-radius: 14px; width: 100%; max-width: 420px; padding: 24px; }
.dialog h3 { margin: 0 0 12px; font-size: 19px; font-family: var(--serif); }
.dialog .paycode {
  background: var(--paper);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  margin: 14px 0;
  color: var(--ink-light);
  font-size: 14px;
}
.dialog .paycode img { max-width: 200px; border-radius: 8px; }

/* 下单成功弹窗 · 品项小图 */
.pay-block { margin-bottom: 8px; }
.pay-date { font-weight: 600; font-family: var(--serif); font-size: 15px; margin-bottom: 6px; }
.pay-item { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.pay-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: #ece7d9; }
.pay-info { flex: 1; display: flex; align-items: center; justify-content: space-between; min-width: 0; }
.pay-name { font-size: 15px; }
.pay-amt { font-size: 15px; color: var(--cinnabar); font-weight: 600; white-space: nowrap; }
.pay-sub { text-align: right; font-size: 13px; color: var(--ink-light); margin-top: 4px; }
.pay-grand { text-align: right; font-size: 16px; font-weight: 700; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* 列表行 */
.row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .main { flex: 1; }
.row .main .t { font-size: 16px; font-weight: 500; }
.row .main .s { font-size: 13px; color: var(--ink-light); margin-top: 2px; }
.row .right { text-align: right; }
.row .right .amount { font-size: 16px; font-weight: 600; font-family: var(--serif); }
.row .right .amount.red { color: var(--cinnabar); }

/* tab */
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.tabs .tab { flex: 1; text-align: center; padding: 13px; font-size: 16px; color: var(--ink-light); cursor: pointer; font-family: var(--serif); letter-spacing: 2px; }
.tabs .tab.active { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--cinnabar); }

/* 汇总数字 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--paper); border-radius: 8px; padding: 12px; }
.stat .k { font-size: 13px; color: var(--ink-light); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; font-family: var(--serif); }

.empty { text-align: center; color: var(--ink-light); padding: 40px 0; font-size: 15px; }
.hint { font-size: 13px; color: var(--ink-light); margin-top: 8px; }
.link { color: var(--cinnabar); }
a { color: var(--cinnabar); text-decoration: none; }

/* 管理端汇总表 */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-light); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; }
td.num { font-variant-numeric: tabular-nums; }

/* 顶栏 logo 图片 */
.logo-img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.4);
}

/* 门头横幅 */
.banner {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.banner img { width: 100%; display: block; aspect-ratio: 3 / 1; object-fit: cover; }

/* 明日配送 · 品项备料大数字 */
.prep-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.prep-item:last-child { border-bottom: none; }
.prep-name { font-family: var(--serif); font-size: 17px; letter-spacing: 1px; }
.prep-right { text-align: right; }
.prep-qty { font-size: 28px; font-weight: 700; font-family: var(--serif); line-height: 1.1; color: var(--ink); }
.prep-qty span { font-size: 14px; font-weight: 400; color: var(--ink-light); font-family: var(--sans); }
.prep-amt { font-size: 14px; color: var(--cinnabar); margin-top: 2px; }

/* 联系方式条（商户端） */
.contact-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 15px;
}
.contact-bar .contact-label { color: var(--ink-light); font-size: 13px; margin-bottom: 4px; }
.contact-bar .contact-tels { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.contact-bar a { color: var(--cinnabar); font-weight: 600; }
.contact-bar a:active { opacity: .7; }
.contact-bar .contact-wx { color: var(--ink-light); font-size: 12px; }
