:root {
  --brand: #1d4fa3;
  --brand-2: #1d4fa3;
  --gold: #d8a94e;
  --bg: #f4f7fc;
  --card: #ffffff;
  --text: #14243b;
  --muted: #607087;
  --line: #d8e2f0;
  --danger: #c04a3a;
  --ok: #1d4fa3;
  --warn: #b7791f;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--brand);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: inline-block; }
.clock { font-variant-numeric: tabular-nums; font-size: 13px; opacity: .9; }

main { flex: 1; padding: 16px 14px 24px; }
.view { display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.hero {
  background: var(--brand);
  color: #fff;
  border-radius: 20px;
  padding: 24px 18px;
}
.hero-sub { font-size: 13px; opacity: .85; margin-bottom: 6px; }
.hero h1 { font-size: 26px; font-weight: 700; }
.hero-note { margin-top: 6px; font-size: 13px; opacity: .9; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(15, 60, 50, .05);
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; gap: 10px; }
.chip { flex: 1; }
.chip input { display: none; }
.chip span {
  display: block;
  text-align: center;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  transition: all .15s;
}
.chip input:checked + span {
  border-color: var(--brand);
  background: rgba(14, 122, 111, .08);
  color: var(--brand);
  font-weight: 600;
}

input[type="tel"], input[type="password"], input[type="number"], input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  background: #fafcfb;
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--brand); background: #fff; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger-ghost { background: #fff; color: var(--danger); border: 1px solid #ecd5d0; }
.btn.warn { background: #fdf6e9; color: var(--warn); border: 1px solid #f0e0bd; }
.btn.ok { background: #eaf7f0; color: var(--ok); border: 1px solid #cde9db; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; }

.tiny { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: center; }
.info-list { font-size: 13px; color: var(--muted); padding: 0 4px; line-height: 1.8; }

.status-card { text-align: center; padding: 26px 18px 22px; }
.status-label { font-size: 14px; color: var(--muted); }
.num-xl {
  font-size: 58px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 6px 0 2px;
}
.num-xl .unit { font-size: 18px; font-weight: 500; color: var(--muted); }
.status-sub { font-size: 14px; margin-bottom: 18px; }
.ticket {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f2f8f7;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.ticket-label { font-size: 13px; color: var(--muted); }
.ticket-num { font-size: 20px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.notice-card h3 { font-size: 14px; margin-bottom: 6px; }
.notice-card p { font-size: 13px; color: var(--muted); }
.notice-card p + p { margin-top: 4px; }

.called-card, .done-card { text-align: center; padding: 34px 20px; }
.called-ring {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 40px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(216, 169, 78, .45); }
  70% { box-shadow: 0 0 0 22px rgba(216, 169, 78, 0); }
  100% { box-shadow: 0 0 0 0 rgba(216, 169, 78, 0); }
}
.called-card h1, .done-card h1 { font-size: 24px; margin-bottom: 8px; }
.called-card p, .done-card p { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.done-icon, .skip-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
}
.done-icon { background: #eaf7f0; color: var(--ok); }
.skip-icon { background: #fdf3e7; color: var(--warn); }

.footer {
  padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 25, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px 16px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.modal-box p { margin-bottom: 18px; font-size: 15px; }
.modal-btns { display: flex; gap: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(20, 30, 27, .9);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 20px;
  z-index: 60;
  max-width: 80%;
  text-align: center;
}

/* 管理台 */
.admin-body { background: #f2f5f4; }
.admin-wrap { max-width: 920px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; }
.admin-header h1 { font-size: 20px; }
.admin-header-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) {
  .admin-grid { grid-template-columns: 1fr 1fr; }
}
.admin-wrap h2 { font-size: 15px; margin-bottom: 10px; }
.current-card { text-align: center; }
.current-ticket {
  font-size: 56px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  line-height: 1.1;
}
.current-box p { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.wait-list { display: flex; flex-direction: column; gap: 10px; }
.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.row-main { display: flex; align-items: center; gap: 8px; }
.row-num { font-weight: 700; font-size: 16px; color: var(--brand); font-variant-numeric: tabular-nums; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.tag.waiting { background: #eef7f5; color: var(--brand); }
.tag.called { background: #fdf6e9; color: var(--warn); }
.tag.seated { background: #eaf7f0; color: var(--ok); }
.tag.skipped { background: #fdf1ef; color: var(--danger); }
.tag.cancelled { background: #f1f3f3; color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }
.config-card label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.config-card .btn { margin-top: 14px; }
.history-card .btn { margin-top: 12px; }

#admin-login { max-width: 340px; margin: 12vh auto 0; }
#admin-login h1 { text-align: center; margin-bottom: 16px; font-size: 20px; }
#admin-login input { margin-bottom: 14px; }

/* 叫号大屏 */
.display-body {
  background: var(--brand);
  color: #fff;
  min-height: 100vh;
}
.display-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.display-header {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 22px;
  font-weight: 600;
}
.display-clock {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .7);
}
.display-voice {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, .4);
}
.display-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}
.display-hint {
  font-size: 30px;
  color: var(--gold);
  letter-spacing: 4px;
}
.display-number {
  font-size: 34vw;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 8px;
  text-shadow: 0 0 60px rgba(216, 169, 78, .5);
}
@media (min-width: 900px) {
  .display-number { font-size: 300px; }
}
.display-number.flash { animation: flashIn .6s ease; }
@keyframes flashIn {
  0% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.display-sub, .display-rule { color: rgba(255, 255, 255, .65); font-size: 20px; }

/* 现场一体屏：左二维码 右叫号 */
.tv-body {
  background: var(--brand);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tv-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 38% 62%;
  gap: 2vw;
  padding: 2vw 3vw 0;
  min-height: 0;
}
.tv-left {
  background: #fff;
  border-radius: 24px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, .45);
}
.tv-brand {
  font-size: 32px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: 2px;
}
.tv-qr {
  width: 60%;
  max-width: 340px;
  aspect-ratio: 1;
  border-radius: 12px;
}
.tv-qr-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.tv-steps {
  text-align: left;
  font-size: 17px;
  color: var(--muted);
  line-height: 1.9;
  padding-left: 24px;
}
.tv-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}
.tv-now {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  min-height: 0;
}
.tv-hint {
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 6px;
}
.tv-number {
  font-size: clamp(72px, 17vw, 210px);
  font-weight: 800;
  line-height: 1.02;
  font-variant-numeric: tabular-nums;
  letter-spacing: 6px;
  text-shadow: 0 0 70px rgba(216, 169, 78, .55);
}
.tv-number.flash { animation: flashIn .6s ease; }
.tv-waiting {
  font-size: 22px;
  color: rgba(255, 255, 255, .75);
}
.tv-rule {
  font-size: 20px;
  color: rgba(255, 255, 255, .5);
}
.tv-queue {
  height: 32vh;
  min-height: 220px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
}
.tv-queue-head {
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 3px;
  margin-bottom: 10px;
}
.tv-queue-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.tv-queue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, .06);
  border-radius: 10px;
}
.tv-queue-num { color: #fff; font-weight: 700; letter-spacing: 1px; }
.tv-queue-party { color: rgba(255, 255, 255, .6); }
.tv-queue .empty { color: rgba(255, 255, 255, .45); font-size: 16px; }
.tv-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 3vw 16px;
  font-size: 18px;
  color: rgba(255, 255, 255, .55);
}
.tv-spacer { flex: 1; }
.tv-foot-rule { color: rgba(255, 255, 255, .45); }
.tv-voice {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, .4);
  font-size: 14px;
}

/* 打印海报 */
.poster-body {
  background: #eef3f2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  min-height: 100vh;
}
.poster {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 2px 10px rgba(15, 60, 50, .06);
}
.poster h1 {
  color: var(--brand);
  font-size: 30px;
  margin-bottom: 6px;
}
.poster-sub { color: var(--muted); margin-bottom: 24px; }
.poster-qr { width: 100%; max-width: 280px; display: block; margin: 0 auto 24px; }
.poster-steps { text-align: left; color: var(--text); font-size: 15px; line-height: 2; padding-left: 22px; }
.poster-note { margin-top: 18px; color: var(--muted); font-size: 13px; }
.poster-print { max-width: 400px; }
@media print {
  .poster-print { display: none; }
  .poster-body { padding: 0; background: #fff; }
  .poster { box-shadow: none; border-radius: 0; }
}
