:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1f1d1a;
  --muted: #7b756b;
  --line: #e5dfd3;
  --accent: #2d5b4c;
  --accent-ink: #fffdf8;
  --accent-soft: #e3ece7;
  --danger: #a8432f;
  --shadow: 0 1px 2px rgba(40, 30, 10, .04), 0 8px 24px rgba(40, 30, 10, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151413; --surface: #1e1c1a; --ink: #ece7de; --muted: #9a9389; --line: #2e2b27;
    --accent: #86bba6; --accent-ink: #12201b; --accent-soft: #22302a; --danger: #e08a74;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151413; --surface: #1e1c1a; --ink: #ece7de; --muted: #9a9389; --line: #2e2b27;
  --accent: #86bba6; --accent-ink: #12201b; --accent-soft: #22302a; --danger: #e08a74;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 120px; }
.wrap.wide { max-width: 980px; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 40px; }
.brand { font-weight: 600; letter-spacing: .08em; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; }

h1 { font-size: 28px; line-height: 1.3; margin: 0 0 8px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 4px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 28px; }
.small { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
section + section { margin-top: 36px; }

input, textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.code { font-size: 20px; text-align: center; text-transform: uppercase; letter-spacing: .18em; padding: 14px; }
textarea { resize: vertical; min-height: 140px; line-height: 1.7; }

.btn {
  font: inherit; font-weight: 550; border: 1px solid transparent; border-radius: 10px;
  padding: 11px 18px; cursor: pointer; background: var(--accent); color: var(--accent-ink);
  transition: transform .06s, opacity .15s, background .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; padding: 13px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.link { background: none; border: none; padding: 0; color: var(--muted); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 预约卡片 */
.booked { border-color: var(--accent); }
.booked.ended { border-color: var(--line); }
.booked.ended .eyebrow { color: var(--muted); }
.booked.ended .big-date, .booked.ended .big-time { color: var(--muted); }
.eyebrow { font-size: 12px; letter-spacing: .12em; color: var(--accent); font-weight: 600; text-transform: uppercase; margin-bottom: 10px; }
.big-date { font-size: 26px; font-weight: 650; line-height: 1.2; }
.big-time { font-size: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hint { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }

/* 时间段选择 */
.day + .day { margin-top: 22px; }
.day-label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.day-label b { font-size: 15px; font-weight: 600; }
.day-label span { font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.slot {
  font: inherit; font-variant-numeric: tabular-nums; font-size: 15px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 12px 4px; cursor: pointer; position: relative;
  transition: border-color .12s, background .12s, color .12s;
}
.slot:hover:not(:disabled) { border-color: var(--accent); }
.slot.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slot.mine { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.slot:disabled { cursor: default; color: var(--muted); background: transparent; border-style: dashed; }
.slot small { display: block; font-size: 11px; line-height: 1.2; margin-top: 2px; opacity: .8; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* 底部确认条 */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .22s ease;
}
.bar.show { transform: none; }
.bar-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar-inner .small { line-height: 1.3; }
.bar-inner b { display: block; color: var(--ink); font-size: 15px; }

/* 弹窗 */
dialog {
  border: none; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink);
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(20, 18, 15, .45); backdrop-filter: blur(2px); }
.dlg { padding: 24px; }
.dlg h2 { font-size: 19px; margin-bottom: 4px; }
.terms { list-style: none; margin: 18px 0; padding: 0; counter-reset: t; }
.terms li { counter-increment: t; position: relative; padding: 10px 0 10px 32px; border-top: 1px solid var(--line); font-size: 14px; }
.terms li::before {
  content: counter(t); position: absolute; left: 0; top: 11px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; display: grid; place-items: center;
}
.terms b { font-weight: 600; }
.terms .key { background: var(--accent-soft); margin: 0 -10px; padding-left: 42px; padding-right: 10px; border-radius: 8px; border-top-color: transparent; }
.terms .key::before { left: 10px; background: var(--accent); color: var(--accent-ink); }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; margin-bottom: 18px; }
.agree input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -150%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: transform .25s; z-index: 50; max-width: calc(100vw - 32px);
  white-space: pre-line;
}
.toast.show { transform: translate(-50%, 0); }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; white-space: pre-line; }

/* 后台 */
.tabs { display: flex; gap: 4px; background: var(--line); padding: 3px; border-radius: 10px; width: fit-content; }
.tabs button { font: inherit; font-size: 13px; border: none; background: none; color: var(--muted); padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums; }
.chip.off { background: transparent; border: 1px solid var(--line); color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.revoked td { color: var(--muted); }
tr.revoked .mono { text-decoration: line-through; }
.tbl { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.off { background: var(--line); color: var(--muted); }
.slotlist { font-size: 14px; }
.slotlist div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.slotlist div.past { color: var(--muted); }
code.ex { font-size: 12px; background: var(--bg); padding: 1px 6px; border-radius: 5px; }
