/* 会员码 · 设计语言「麦穗票」— 暖白底 + 票纸白 + 麦金，无蓝紫渐变 */
:root {
  --page: #f5f2eb;
  --surface: #fffdf8;
  --surface-2: #ece5d7;
  --paper: #ffffff;
  --paper-edge: #e7e0d2;
  --wheat: #d4af37;
  --wheat-deep: #8a6a16;
  --wheat-soft: rgba(212, 175, 55, 0.3);
  --on-wheat: #2a2114;
  --line: rgba(42, 33, 20, 0.1);
  --line-strong: rgba(42, 33, 20, 0.18);
  --metro-line: #0054a4;
  --text-main: #241f18;
  --text-muted: #6f675a;
  --text-on-paper: #1c1915;
  --text-sub: #6b6560;
  --danger: #b0472f;
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-ticket: 0 20px 46px rgba(70, 55, 25, 0.14), 0 2px 6px rgba(70, 55, 25, 0.06);
  --shadow-soft: 0 10px 26px rgba(70, 55, 25, 0.08);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", "Consolas", "PingFang SC", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--page);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 纸张颗粒层 */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.028;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(10) infinite;
}
@keyframes grainShift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
}

/* 顶部麦线装饰 */
.wheat-line {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 5;
  background: linear-gradient(90deg, transparent, var(--wheat) 20%, var(--wheat-deep) 50%, var(--wheat) 80%, transparent);
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  /* minmax(0,1fr)：轨道宽度由容器定，避免票券 max-content 把整列撑出视口 */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  padding: calc(14px + var(--safe-t)) clamp(14px, 4vw, 32px) calc(16px + var(--safe-b));
  width: min(640px, 100%);
  max-width: 640px;
  margin: 0 auto;
}
.shell > * { min-width: 0; }

/* ── Header ── */
.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.head-brand { display: flex; flex-direction: column; gap: 4px; }
.head-brand h1 {
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.head-brand p { font-size: 13px; color: var(--text-muted); }
.head-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.head-count {
  display: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--wheat-soft);
  border-radius: 8px;
  color: var(--wheat-deep);
  background: rgba(212, 175, 55, 0.08);
  font-variant-numeric: tabular-nums;
}
.shell.viewing .head-count { display: block; }

/* header 操作按钮 */
.head-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--wheat-soft);
  background: var(--surface);
  color: var(--wheat-deep);
  box-shadow: var(--shadow-soft);
  transition: background 0.16s, border-color 0.16s, transform 0.12s;
}
.head-btn:hover { background: rgba(212, 175, 55, 0.12); }
.head-btn:active { transform: scale(0.96); }
.head-btn.ghost {
  border-color: var(--line-strong);
  color: var(--text-muted);
  box-shadow: none;
  background: transparent;
}
.head-btn.ghost:hover { color: var(--text-main); border-color: var(--text-muted); background: rgba(42, 33, 20, 0.04); }

/* ── 票券卡片（QR 主体）── */
.ticket {
  width: 100%;
  background: var(--paper);
  color: var(--text-on-paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-ticket);
  border: 1px solid var(--paper-edge);
  position: relative;
  overflow: visible;
}
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--paper-edge) 0 6px, transparent 6px 12px);
}
.ticket::before { top: 0; }
.ticket::after { bottom: 0; }

.ticket-notch {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  background: var(--page);
  border-radius: 50%;
  transform: translateY(-50%);
}
.ticket-notch.left { left: -7px; }
.ticket-notch.right { right: -7px; }

.ticket-body { padding: clamp(22px, 5vw, 32px) clamp(18px, 4vw, 28px); text-align: center; }

.ticket-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  margin-bottom: 20px;
  gap: 10px;
}
.ticket-meta .who { font-size: clamp(16px, 3.5vw, 20px); font-weight: 700; color: var(--text-on-paper); }
.ticket-meta .sub { font-size: 12px; color: var(--text-sub); margin-top: 5px; }
.ticket-level {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border: 1.5px solid var(--metro-line);
  color: var(--metro-line);
  border-radius: 6px;
  text-transform: uppercase;
}

/* QR 取景框 — 正方形二维码为主视觉，明显大于文字 */
.qr-stage {
  position: relative;
  width: min(420px, 78vw, 100%);
  aspect-ratio: 1;
  margin: 0 auto 14px;
}
.qr-frame {
  position: absolute;
  inset: -8px;
  pointer-events: none;
}
.qr-frame span {
  position: absolute;
  width: 22px; height: 22px;
  border: 2.5px solid var(--wheat);
}
.qr-frame span:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; }
.qr-frame span:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; }
.qr-frame span:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; }
.qr-frame span:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; }

.qr-frame.scanning span {
  animation: bracketPulse 2.4s ease-in-out infinite;
}
@keyframes bracketPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.94); }
}

.qr-canvas-wrap {
  width: 100%; height: 100%;
  padding: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--paper-edge);
  display: grid;
  place-items: center;
}
.qr-canvas-wrap img,
.qr-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
}

.ticket-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.ticket-hint {
  font-size: 13px;
  color: var(--text-sub);
  letter-spacing: 0.02em;
}

/* 当前二维码所属手机号 */
.ticket-phone {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(15px, 3.4vw, 18px);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--wheat-deep);
  font-variant-numeric: tabular-nums;
}

/* 切换动画 */
.ticket-wrap {
  perspective: 900px;
  padding: 24px;
  overflow: visible;
}
.ticket-wrap.slide-out {
  animation: ticketOut 0.38s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}
.ticket-wrap.slide-in {
  animation: ticketIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes ticketOut {
  to { opacity: 0; transform: translateX(-28px) rotateY(12deg) scale(0.96); }
}
@keyframes ticketIn {
  from { opacity: 0; transform: translateX(32px) rotateY(-10deg) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.qr-reveal .qr-canvas-wrap {
  animation: qrPop 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) 0.12s both;
}
@keyframes qrPop {
  from { transform: scale(0.82); opacity: 0; filter: blur(4px); }
  to { transform: scale(1); opacity: 1; filter: none; }
}

/* ── 编号轨 ── */
/* 外层不裁剪，横向滚动交给内层；内层留出 padding 容纳选中芯片的位移与投影 */
.num-rail-wrap {
  overflow: visible;
  margin: 0 -10px;
}
.num-rail {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 10px 22px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.num-rail::-webkit-scrollbar { display: none; }
.num-chip {
  flex: 0 0 auto;
  scroll-snap-align: center;
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.3, 0.64, 1), background 0.2s, color 0.2s, border-color 0.2s;
}
.num-chip:hover { border-color: var(--wheat); color: var(--text-main); }
.num-chip.on {
  background: var(--wheat);
  color: var(--on-wheat);
  border-color: var(--wheat-deep);
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.42);
}

/* ── 数量 + 跳转 ── */
.rail-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 2px 2px 0;
}
.rail-count {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.rail-count b {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--wheat-deep);
  margin: 0 3px;
  font-variant-numeric: tabular-nums;
}
.jump-group { display: flex; align-items: center; gap: 6px; }
.jump-input {
  width: 72px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.jump-input::-webkit-outer-spin-button,
.jump-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.jump-input:focus { border-color: var(--wheat); box-shadow: 0 0 0 3px var(--wheat-soft); }
.jump-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--wheat-soft);
  background: var(--surface);
  color: var(--wheat-deep);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, transform 0.12s;
}
.jump-btn:hover { background: rgba(212, 175, 55, 0.14); }
.jump-btn:active { transform: scale(0.96); }

/* ── 按钮 ── */
.btn-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-md);
  padding: 15px 16px;
  min-height: 52px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }
.btn-main {
  background: var(--wheat);
  color: var(--on-wheat);
  box-shadow: 0 5px 0 #a9861f, 0 10px 22px rgba(150, 118, 28, 0.24);
}
.btn-main:active { box-shadow: 0 2px 0 #a9861f; transform: translateY(2px) scale(0.98); }
.btn-side {
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
}
.btn-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.btn-tools .btn {
  font-size: 13px;
  font-weight: 600;
  padding: 11px 8px;
  min-height: 44px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-tools .btn:hover { color: var(--text-main); border-color: var(--line-strong); }

/* ── 导入区 ── */
.import-panel {
  animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.import-panel h2 {
  font-size: clamp(24px, 5.5vw, 32px);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.import-panel .lead {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
}
.paste {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-main);
  padding: 14px 16px;
  font: inherit;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.paste:focus {
  border-color: var(--wheat);
  box-shadow: 0 0 0 3px var(--wheat-soft);
}
.paste::placeholder { color: rgba(42, 33, 20, 0.34); }
.import-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); }

.main-center {
  display: grid;
  align-content: center;
  min-height: 0;
  overflow: visible;
}

.dock.on { display: block; }

.gate {
  width: min(480px, 100%);
  margin: 0 auto;
  animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.gate-card {
  border-radius: var(--radius-lg);
  padding: clamp(22px, 5vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.gate-card h2 { font-size: clamp(22px, 5vw, 28px); margin-bottom: 8px; }
.gate-card p { color: var(--text-muted); font-size: 14px; line-height: 1.65; margin-bottom: 16px; }
.gate-input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
  font-size: 16px;
  text-transform: uppercase;
}
.expire-bar {
  display: none !important;
  text-align: center;
  font-size: 12px;
  color: var(--wheat-deep);
  padding: 6px 0 10px;
  font-variant-numeric: tabular-nums;
}

.viewer { display: none; }
.viewer.on { display: block; }
.dock { display: none; padding-top: 6px; overflow: visible; }
.dock.on { display: block; }

/* ── 抽屉 / 弹层 ── */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(40, 32, 18, 0.42);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 12px 18px calc(22px + var(--safe-b));
  transform: translateY(105%);
  transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 88dvh;
  overflow: auto;
  box-shadow: 0 -18px 44px rgba(70, 55, 25, 0.16);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 99px;
  background: var(--line-strong);
  margin: 0 auto 16px;
}
.sheet h3 { font-size: 17px; margin-bottom: 12px; }

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(40, 32, 18, 0.46);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-ticket);
  animation: rise 0.35s ease both;
}
.modal-card p { color: var(--text-muted); font-size: 14px; line-height: 1.65; margin: 8px 0 14px; }
.link-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--page);
  border: 1px dashed var(--wheat-soft);
  word-break: break-all;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--wheat-deep);
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  left: 50%; bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%) translateY(12px);
  padding: 11px 20px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--wheat-soft);
  color: var(--text-main);
  box-shadow: var(--shadow-ticket);
  font-size: 14px;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spin {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(42, 33, 20, 0.18);
  border-top-color: var(--wheat-deep);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: -3px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state, .error-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.error-state { color: var(--danger); }
.error-state a { color: var(--wheat-deep); }

@media (max-width: 480px) {
  .btn-tools { grid-template-columns: 1fr 1fr; }
  .btn-tools .btn:last-child { grid-column: 1 / -1; }
}

@media (min-width: 641px) {
  .shell { padding-top: calc(24px + var(--safe-t)); }
}

/* 已导入：手机仍单列看票，宽屏才并排 */
.shell.imported .import-panel { display: none; }

/* 出示态：只留右上角计数 + QR + 底部切换 */
.shell.viewing .head-brand,
.shell.viewing .expire-bar,
.shell.viewing .import-panel {
  display: none !important;
}
.shell.viewing .head {
  justify-content: flex-end;
  align-items: center;
  border-bottom: none;
  padding-bottom: 8px;
  margin-bottom: 0;
}
.shell.viewing {
  grid-template-rows: auto 1fr auto;
}
.shell.viewing .main-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: visible;
}
.shell.viewing .viewer.on {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.shell.viewing #ticketHost {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.shell.viewing .ticket-wrap {
  width: min(100%, 560px, calc(100dvh - 300px));
  height: auto;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.shell.viewing .ticket {
  width: 100%;
  max-width: 100%;
}
.shell.viewing .ticket-body {
  padding: clamp(16px, 3vw, 24px);
}
.shell.viewing .qr-stage {
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .shell {
    width: min(920px, 96vw);
    max-width: min(920px, 96vw);
  }
  .qr-stage { width: min(420px, 78vw, 100%); }
}

@media (min-width: 1024px) {
  .shell {
    width: min(1100px, 96vw);
    max-width: min(1100px, 96vw);
  }
  .shell.imported .main-center {
    display: grid;
    grid-template-columns: minmax(260px, 0.82fr) minmax(420px, 1.38fr);
    gap: 28px 36px;
    align-items: start;
  }
  .shell.imported .import-panel {
    display: block;
    animation: none;
    position: sticky;
    top: calc(16px + var(--safe-t));
  }
  .shell.imported .import-panel h2 {
    font-size: clamp(20px, 2.2vw, 26px);
  }
  .shell.imported .import-panel .lead { margin-bottom: 14px; }
  .shell.imported .import-panel .paste { min-height: 160px; }
  .shell.imported .viewer.on { display: block; }
  .qr-stage { width: min(420px, 100%); }
  .shell.viewing .import-panel { display: none !important; }
  .shell.viewing .main-center {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: center;
  }
  .shell.viewing .ticket-wrap {
    width: min(100%, 620px, calc(100dvh - 280px));
  }
}

/* 二维码点击放大 */
.qr-zoom {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 32, 18, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.qr-zoom.open { opacity: 1; pointer-events: auto; }
.qr-zoom img {
  width: min(560px, 92vw, 82dvh);
  height: auto;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 28px 70px rgba(30, 24, 10, 0.35);
}
.qr-zoom p {
  position: absolute;
  bottom: calc(18px + var(--safe-b));
  left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
}

/* 卡密后台 */
.admin-wrap {
  width: min(1100px, 96vw);
  margin: 0 auto;
  padding: calc(20px + var(--safe-t)) 16px calc(48px + var(--safe-b));
}
.admin-head { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.admin-head h1 { font-size: 22px; margin-bottom: 4px; }
.admin-head p { color: var(--text-muted); font-size: 13px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.panel h2 { font-size: 15px; margin-bottom: 12px; color: var(--wheat-deep); }
.row2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
.admin-wrap label { display: block; font-size: 12px; color: var(--text-muted); margin: 8px 0 5px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inline label { margin: 0; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.table-wrap {
  overflow: auto;
  max-height: min(62vh, 640px);
  border-radius: 10px;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--line-strong);
}
.tag { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.tag.ok { background: rgba(212,175,55,.2); color: var(--wheat-deep); }
.tag.bad { background: rgba(176,71,47,.14); color: var(--danger); }
.tag.off { background: rgba(42,33,20,.07); color: var(--text-muted); }
.mono { font-family: var(--font-mono); letter-spacing: .02em; }
.auth-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.auth-bar input { flex: 1; min-width: 180px; }
#loginGate {
  min-height: calc(100dvh - 80px);
  display: grid;
  place-items: center;
}
#loginGate .gate { width: min(420px, 100%); }
.admin-wrap .paste { min-height: 48px; }
.flash { animation: flashOk 0.85s ease; }
@keyframes flashOk {
  0% { background: rgba(212, 175, 55, 0.32); color: var(--wheat-deep); }
  100% { background: transparent; }
}

@media (min-width: 1024px) {
  .row2 { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .grain,
  .qr-frame.scanning span,
  .ticket-wrap.slide-out,
  .ticket-wrap.slide-in,
  .qr-reveal .qr-canvas-wrap,
  .import-panel,
  .gate,
  .modal-card,
  .flash {
    animation: none !important;
  }
  .overlay, .sheet, .modal, .toast, .btn, .num-chip, .qr-zoom, .jump-btn, .jump-input, .head-btn {
    transition: none !important;
  }
}
