:root {
  --bg: #f4f3ef;
  --card: #ffffff;
  --text: #1f1e1b;
  --muted: #6b6a64;
  --faint: #9c9b94;
  --line: #e3e1da;
  --accent: #1f5fa8;
  --accent-bg: #e6f0fb;
  --accent-text: #0c447c;
  --ok: #2f7a1f;
  --ok-bg: #eaf3de;
  --warn: #8a5a0b;
  --warn-bg: #faeeda;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --radius: 12px;
  --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --card: #22221f;
    --text: #eeede8;
    --muted: #a9a8a1;
    --faint: #75746e;
    --line: #34332f;
    --accent: #5b9be0;
    --accent-bg: #18304d;
    --accent-text: #b5d4f4;
    --ok: #8fcf6a;
    --ok-bg: #1f3313;
    --warn: #efb45a;
    --warn-bg: #3b2a0c;
    --danger: #f09595;
    --danger-bg: #3d1717;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.top h1 { font-size: 20px; margin: 0; font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; }
.en { color: var(--faint); font-size: 12px; font-weight: 400; }
.back { border: 0; background: none; font-size: 17px; padding: 8px 8px 8px 0; display: flex; align-items: center; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.acc { background: var(--accent-bg); color: var(--accent-text); }
.pill.gray { background: var(--line); color: var(--muted); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 20px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 8px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.section-title { font-size: 13px; color: var(--muted); margin: 18px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 60px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line);
  width: 100%; background: none; text-align: left;
}
.li:last-child { border-bottom: 0; }
.li:active { background: var(--bg); }
.li.active { background: var(--accent-bg); }
.room-no { font-size: 20px; font-weight: 600; min-width: 46px; }
.li .meta { flex: 1; min-width: 0; }
.li .meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .right { text-align: right; font-size: 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  min-height: var(--tap); padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); font-size: 16px; font-weight: 500;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.big { min-height: 58px; font-size: 18px; }
.btn.link { border: 0; background: none; color: var(--accent); min-height: 40px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--bg);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.bottom-bar > div { max-width: 560px; margin: 0 auto; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 8px; }
.timer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timer .stat b { font-variant-numeric: tabular-nums; }
.item {
  display: flex; align-items: center; justify-content: space-between; min-height: 56px;
  padding: 6px 14px; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.qty {
  min-width: 64px; height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.qty.zero { color: var(--faint); font-weight: 400; }
.qty.editing { border: 2px solid var(--accent); color: var(--accent); background: var(--accent-bg); }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  font-size: 15px; padding: 6px;
}
.chip.wide { grid-column: span 3; }
.chip.half { grid-column: span 1; }
.chip.sel { border: 2px solid var(--accent); background: var(--accent-bg); color: var(--accent-text); }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.input {
  width: 100%; min-height: var(--tap); border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); padding: 10px 12px; font-size: 17px;
}
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* 数字键盘 */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card);
  border-radius: 16px 16px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; animation: up .15s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sheet .val { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  height: 58px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  font-size: 24px; font-weight: 500;
}
.key:active { background: var(--line); }
.key.ok { background: var(--accent); color: #fff; border-color: var(--accent); font-size: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 15px;
  max-width: 90vw;
}
.names { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.names .chip { min-height: 60px; font-size: 17px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.center { text-align: center; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; text-align: center; }
.muted { color: var(--muted); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 15px; }
.ico { width: 18px; height: 18px; vertical-align: -3px; }
/* 用圆点遮住密码，但不用 type=password：Mac 上搜狗、微信等第三方输入法在密码框里打不了字 */
.secret { -webkit-text-security: disc; text-security: disc; }
