:root {
  --accent: #8b1a1a;
  --accent2: #b8860b;
  --bg: #f4f3f0;
  --card: #ffffff;
  --line: #e6e2da;
  --text: #22201d;
  --muted: #8a857c;
  --ok: #1f8a5b;
  --warn: #c0392b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 64px;
}
a { color: var(--accent); }
.hide { display: none !important; }

/* 登录 */
#login { padding: 12vh 22px 22px; max-width: 420px; margin: 0 auto; }
#login h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: 1px; }
#login p.sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; }
#login .field { margin-bottom: 14px; }
#login input { width: 100%; padding: 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.brand-mark { width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }

/* 顶栏 */
header {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
}
header .title { font-weight: 600; font-size: 16px; flex: 1; }
header .who { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.3; }
header .who b { color: var(--text); font-weight: 600; display: block; font-size: 13px; }

/* 底部标签栏 */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; border: 0; background: none; padding: 8px 0 7px;
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px;
}
nav.tabs button .ic { font-size: 19px; line-height: 1; }
nav.tabs button.on { color: var(--accent); font-weight: 600; }

/* 内容 */
main { padding: 12px 12px 8px; max-width: 900px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.card h3 span.act { font-size: 12px; color: var(--accent); font-weight: 400; cursor: pointer; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

input, select, textarea {
  width: 100%; padding: 11px 12px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%; user-select: none;
}
.btn:active { opacity: .85; }
.btn.ghost { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn.gray { background: #f0eee9; color: var(--text); border-color: var(--line); }
.btn.sm { padding: 7px 12px; font-size: 13px; width: auto; font-weight: 500; }
.btn.gold { background: linear-gradient(135deg, #b8860b, #d4a017); }
.btn:disabled { opacity: .5; }

/* 大扫码框（开单用） */
.scanbar { display: flex; gap: 8px; }
.scanbar input { font-size: 16px; padding: 14px; letter-spacing: .5px; }
.scanbar .btn { width: 88px; flex: 0 0 88px; }

/* 购物车 */
.cart-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item .nm { flex: 1; min-width: 0; }
.cart-item .nm b { font-weight: 600; font-size: 15px; }
.cart-item .nm div { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cart-item .pr { text-align: right; font-weight: 600; color: var(--accent); white-space: nowrap; }
.cart-item .del { color: var(--muted); font-size: 18px; padding: 0 2px; cursor: pointer; }

.totalbox { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.totalbox .line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.totalbox .line.big { font-size: 20px; font-weight: 700; color: var(--accent); padding-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px;
  background: #fff; font-size: 13px; cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--accent); background: #fff5f3; font-weight: 600; }

/* 列表行 */
.line-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .main { flex: 1; min-width: 0; }
.line-item .main b { font-size: 15px; }
.line-item .main .sub { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.line-item .right { text-align: right; white-space: nowrap; font-size: 13px; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; background: #f1efe9; color: #6b665c; }
.badge.ok { background: #e8f6ef; color: var(--ok); }
.badge.bad { background: #fdecea; color: var(--warn); }
.badge.gold { background: #fdf6e3; color: #8a6d1a; }

/* 统计 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.5px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }

table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
table.tb th:first-child, table.tb td:first-child { text-align: left; }
table.tb th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.tb tr:last-child td { border-bottom: 0; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 520px; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto;
}
.sheet h2 { margin: 0 0 12px; font-size: 17px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60;
  background: rgba(30,28,25,.92); color: #fff; padding: 10px 16px; border-radius: 20px;
  font-size: 14px; max-width: 80vw; text-align: center;
}

.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 13px; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

/* 小票（打印用） */
.receipt { font-size: 13px; }
.receipt .tp { text-align: center; font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.receipt .ct { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 3px 0; font-size: 12px; }
.receipt .r { text-align: right; }
.receipt .foot { margin-top: 10px; text-align: center; font-size: 11px; color: var(--muted); }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; padding: 0; }
  .mask, nav.tabs, header, main { display: none !important; }
}
