:root {
  --ink: #1a1816;
  --muted: #6f675f;
  --line: #e6ddd3;
  --bg: #f3eee8;
  --paper: #fffdf9;
  --chili: #d9480f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
input, select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.pos {
  height: 100%;
  display: grid;
  grid-template-rows: 56px 1fr 92px;
  min-height: 0;
}
.pos.list { grid-template-rows: 56px 1fr; }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: #1c1917;
  color: #fff;
}
.shop strong { font-size: 18px; margin-right: 10px; }
.shop span, .today, .clock { color: #c4bdb6; font-size: 14px; }
.today { margin-left: auto; }
.clock { font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.nav { display: flex; gap: 6px; }
.nav button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  color: #c4bdb6;
  font-weight: 600;
}
.nav button.on { background: #3f3a36; color: #fff; }
.top-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: #3f3a36;
  color: #fff;
  font-weight: 600;
}

.workspace { min-height: 0; overflow: hidden; height: 100%; }
#page-order {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
  height: 100%;
}

.settle {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.settle-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.settle-head h1 { font-size: 18px; }
.settle-actions { display: flex; gap: 8px; }
#btn-clear, #btn-hang, .ghost, .gate-link {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: #f1e8dd;
  color: var(--ink);
  font-weight: 600;
}
.lines {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 12px;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 64px 20px;
  line-height: 1.6;
}
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 12px 8px;
  border-bottom: 1px solid #f0e8dc;
  align-items: center;
  border-radius: 10px;
}
.line.on {
  background: #fff4ec;
  outline: 1px solid var(--chili);
}
.line .name { font-weight: 650; font-size: 16px; }
.line .price { font-weight: 700; color: var(--chili); }
.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f3ede4;
  border-radius: 8px;
  padding: 2px;
  justify-self: start;
}
.step button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  font-weight: 600;
}
.step b { min-width: 24px; text-align: center; font-size: 16px; }

.sum {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
  background: #fffaf4;
}
.sum-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}
.sum-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.sum-tools button {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  background: #f1e8dd;
  color: var(--ink);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disc-card { width: min(480px, 100%); }
.disc-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.disc-types label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7f1e8;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.disc-types label.on {
  background: #fff4ec;
  border-color: var(--chili);
  color: var(--chili);
}
.disc-types input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.disc-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fffaf4;
  border: 1px solid var(--line);
}
.disc-panel p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.disc-panel label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; color: var(--ink); }
.disc-preview { font-size: 15px; color: var(--muted); }
.disc-preview strong { color: var(--chili); font-size: 22px; }
.modal-actions .ghost { height: 44px; padding: 0 16px; }
.modal-actions .gate-btn { width: auto; min-width: 108px; height: 44px; padding: 0 22px; }
.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pay-row span { font-size: 16px; }
.pay-row strong { font-size: 36px; letter-spacing: -0.03em; color: var(--chili); }

.menu {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 12px 8px;
}
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  flex: none;
}
.cats button {
  flex: none;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
}
.cats button.on {
  background: var(--chili);
  border-color: var(--chili);
  color: #fff;
}
.grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px;
  align-content: start;
}
.dish {
  position: relative;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: left;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dish.on { border-color: var(--chili); box-shadow: inset 0 0 0 2px var(--chili); }
.dish img, .dish .ph {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #efe7dc;
  color: #b9aea2;
  font-size: 28px;
  font-weight: 700;
}
.dish img,
.dish .ph,
.dish .info,
.dish .badge {
  pointer-events: none;
}
.dish .info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px 10px;
}
.dish h3 { font-size: 14px; font-weight: 650; line-height: 1.25; }
.dish .fee { margin: 0; color: var(--chili); font-weight: 700; font-size: 14px; flex: none; }
.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--chili);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.numkeys {
  flex: none;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  padding-top: 10px;
}
.numkeys button {
  height: 56px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 22px;
  font-weight: 700;
}
.numkeys button:active {
  background: #fff4ec;
  border-color: var(--chili);
  color: var(--chili);
}

.pays {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.pos.list .pays { display: none; }
.pay {
  height: 68px;
  border-radius: 12px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.pay.cash { background: #3d7a58; }
.pay.wechat { background: #07c160; }
.pay.alipay { background: #1677ff; }
.pay.union { background: #e1251b; }
.pay.member { background: #d9480f; }
.pay.card { background: #7c5cbf; }
.pay.voucher { background: #c27803; }
.pay.other { background: #57534e; }

.flash {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 15, 0.4);
  display: grid;
  place-items: center;
  z-index: 20;
}
.flash-card {
  width: 320px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
}
.flash-card p { color: var(--muted); }
.flash-card strong {
  display: block;
  font-size: 40px;
  margin: 8px 0 4px;
  color: var(--chili);
}
.handover-head, .handover-cash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.handover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.handover-card {
  background: #fff;
  border: 1px solid var(--line, #eadfce);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}
.handover-card h3 { margin: 0; font-size: 16px; }
.handover-balance { margin: 0; font-size: 22px; font-weight: 700; color: var(--chili); }
.handover-card label, .check-line { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.check-line { grid-auto-flow: column; justify-content: start; align-items: center; color: inherit; }
.handover-card input, .handover-card select { width: 100%; }
.sign-label { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.sign-pad {
  width: 100%;
  height: 120px;
  background: #fff;
  border: 1px dashed #c9b59a;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}
.handover-sub { margin: 16px 0 8px; font-size: 16px; }
.handover-cash input { width: 140px; margin-left: 8px; }
.ticket-sheet {
  width: 320px;
  margin: 0 auto;
  padding: 12px 8px 24px;
  background: #fff;
  color: #111;
  font-family: "Courier New", Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre;
}
@media print {
  body * { visibility: hidden; }
  #ticket-sheet, #ticket-sheet * { visibility: visible; }
  #ticket-sheet {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  background: #1c1917;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 30;
}

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: #1c1917;
}
.gate.login {
  grid-template-columns: 1.1fr 1fr;
  place-items: stretch;
  padding: 0;
}
.gate-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
}
.gate-brand h1 { font-size: 40px; max-width: 12ch; }
.gate-brand p:last-child { color: rgba(255,255,255,.7); line-height: 1.6; }
.gate-kicker { letter-spacing: .28em; color: rgba(255,255,255,.45); font-size: 13px; margin-bottom: 12px; }
.gate-card {
  width: min(440px, 100%);
  background: var(--bg);
  border-radius: 20px;
  padding: 28px 24px;
  display: grid;
  gap: 14px;
}
.gate.login .gate-card { width: auto; height: 100%; border-radius: 0; align-content: center; }
.gate-card h1, .gate-card h2 { font-size: 24px; }
.gate-desc, .gate-card label { color: var(--muted); font-size: 14px; display: grid; gap: 8px; }
.gate-btn {
  height: 48px;
  border-radius: 12px;
  background: var(--chili);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.gate-link { background: transparent; justify-self: start; padding: 0; height: auto; color: var(--muted); }
.gate-err { color: var(--chili); font-size: 14px; }

.list-page { display: flex; flex-direction: column; padding: 12px 16px 16px; gap: 12px; min-height: 0; }
#page-handover { overflow-x: hidden; overflow-y: auto; }
#page-handover .table-wrap { flex: none; overflow: visible; }
.list-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-bar input { width: auto; min-width: 160px; flex: 1; }
.tabs { display: flex; gap: 8px; }
.tabs button {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 600;
}
.tabs button.on { background: var(--chili); border-color: var(--chili); color: #fff; }
.table-wrap { flex: 1; overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #f0e8dc; font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: #fffaf4; position: sticky; top: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.s0 { background: #fff4ec; color: var(--chili); }
.tag.s1 { background: #e8f6ee; color: #2f6b45; }
.tag.s2 { background: #f3f0ee; color: #6f675f; }
.tag.s3 { background: #fff4e5; color: #b45309; }
.gate-btn:disabled { opacity: .45; }
.refund-hint { color: var(--chili); font-weight: 700; }
.flag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  vertical-align: middle;
}
.flag.refund { background: #fde8e8; color: #b42318; }
.flag.cancel { background: #f3f0ee; color: #6f675f; }
.flag.gift { background: #fff4e5; color: #b45309; }
.line:has(.flag.gift) .price { color: #b45309; }
.line:has(.flag.cancel) { opacity: .55; }
tr.muted td { color: var(--muted); }
.modal-card small { color: var(--muted); font-size: 12px; }
.modal-card .step button:disabled { opacity: .35; }
.log-summary { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.row-btn { height: 32px; padding: 0 10px; border-radius: 8px; background: #fff4ec; color: var(--chili); font-weight: 600; margin-right: 6px; }
.row-btn.pay { background: #e8f6ee; color: #2f6b45; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 15, 0.4);
  display: grid;
  place-items: center;
  z-index: 25;
  padding: 20px;
}
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  display: grid;
  gap: 12px;
}
.modal-desc { color: var(--muted); font-size: 14px; margin: -4px 0 12px; }
.member-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.member-search input { flex: 1; }
.member-list {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.member-item {
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f1e8;
  border: 1px solid transparent;
  color: var(--ink);
}
.member-item.on {
  border-color: var(--chili);
  background: #fff4ec;
}
.member-item strong { display: block; font-size: 16px; }
.member-item span { color: var(--muted); font-size: 13px; }
.member-item b { color: var(--chili); float: right; font-size: 16px; }
.member-picked {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fffaf4;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  font-size: 14px;
}
.member-picked strong { color: var(--chili); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.45);
  display: grid;
  place-items: center;
  z-index: 40;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 820px) {
  .pos { grid-template-rows: auto 1fr 1fr 80px; }
  .pos.list { grid-template-rows: auto 1fr; }
  .gate.login { grid-template-columns: 1fr; }
  #page-order { grid-template-columns: 1fr; grid-template-rows: 42% 1fr; }
  .settle { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pay { font-size: 15px; height: 56px; }
}
