/* 扫码工作台 · 移动优先样式
   设计约束：
   1. 微信内置浏览器（iOS X5/WKWebView）下 position:fixed 会随键盘弹起跳动，
      因此顶部导航用 sticky，底部导航用 flex 布局 + safe-area 内边距。
   2. 二维码图片必须保持纯色高对比背景，不加滤镜/圆角遮罩，否则影响长按识别。 */

:root {
  --brand: #07c160;
  --brand-dark: #06ad56;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #6b6b6b;
  --text-hint: #9a9a9a;
  --line: #ebedf0;
  --danger: #fa5151;
  --warn: #ff8f1f;
  --info: #576b95;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }

/* ---------------------------------------------------------------- 结构 */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
}
.appbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.appbar .sub { font-size: 12px; color: var(--text-hint); font-weight: 400; }

.page { flex: 1; padding: 12px 14px 20px; }
.page.no-pad { padding: 0; }

.tabbar {
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  position: sticky;
  bottom: 0;
  z-index: 30;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 9px 0 8px;
  font-size: 12px;
  color: var(--text-sub);
  display: block;
}
.tabbar a.on { color: var(--brand); font-weight: 600; }
.tabbar a .ico { display: block; font-size: 16px; line-height: 1.2; }

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }

.sec-title {
  font-size: 13px;
  color: var(--text-hint);
  margin: 16px 2px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-title:first-child { margin-top: 4px; }

/* -------------------------------------------------------------- 统计块 */

.stat-row { display: flex; gap: 8px; }
.stat-row.cols-3 > * { flex: 1; }
.stat-row.cols-2 > * { flex: 1; }

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.stat .num { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat .lab { font-size: 11px; color: var(--text-hint); margin-top: 3px; }
.stat .num.green { color: var(--brand); }
.stat .num.warn { color: var(--warn); }
.stat .num.info { color: var(--info); }
.stat .num.danger { color: var(--danger); }

/* -------------------------------------------------------------- 二维码 */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 620px) { .qr-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .qr-grid { grid-template-columns: repeat(4, 1fr); } }

.qr-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  transition: transform .12s ease, opacity .2s ease;
}
.qr-card:active { transform: scale(.97); }
.qr-card.fresh { border-color: var(--brand); }
.qr-card.leaving { opacity: 0; transform: scale(.9); }

.qr-card .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  display: block;
  object-fit: contain;
  padding: 6px;
  border-bottom: 1px solid var(--line);
}
.qr-card .meta { padding: 7px 9px 9px; }
.qr-card .meta .who {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qr-card .meta .when { font-size: 11px; color: var(--text-hint); margin-top: 1px; }
.qr-card .badge {
  position: absolute;
  margin: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
}
.qr-card .wrap { position: relative; }

/* --------------------------------------------------------------- 浮层 */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet-mask.show { display: flex; }
@media (min-width: 620px) { .sheet-mask { align-items: center; } }

.sheet {
  background: #fff;
  width: 100%;
  max-width: 460px;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b));
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 620px) { .sheet { border-radius: 16px; } }

.sheet h3 { margin: 0 0 4px; font-size: 16px; }
.sheet .hint { font-size: 12px; color: var(--text-hint); margin-bottom: 12px; }

.qr-view {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.qr-view img { width: 100%; max-width: 280px; display: block; margin: 0 auto; }

.tip-box {
  background: #fff9e6;
  border: 1px solid #ffe08a;
  color: #8a6100;
  font-size: 12.5px;
  border-radius: 9px;
  padding: 9px 11px;
  margin: 11px 0;
  line-height: 1.6;
}

/* --------------------------------------------------------------- 表单 */

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-sub);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.field .help { font-size: 11.5px; color: var(--text-hint); margin-top: 4px; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 13px;
  font-size: 16px;
  font-weight: 500;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { background: var(--brand-dark); }
.btn:disabled { opacity: .5; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.sm { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 7px; }
.btn.danger { background: var(--danger); }
.btn.block-2 { display: flex; gap: 10px; }
.btn.block-2 > * { flex: 1; }

.uploader {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  color: var(--text-hint);
  background: #fff;
  font-size: 13.5px;
}
.uploader:active { border-color: var(--brand); color: var(--brand); }
.uploader .big { font-size: 26px; display: block; margin-bottom: 6px; }

/* --------------------------------------------------------------- 列表 */

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.list .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.list .row:last-child { border-bottom: none; }
.list .row .grow { flex: 1; min-width: 0; }
.list .row .name { font-size: 14.5px; }
.list .row .sub { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.list .row .val { font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; }

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--brand);
}

.tag {
  font-size: 10.5px;
  padding: 1.5px 7px;
  border-radius: 999px;
  background: #f0f0f0;
  color: var(--text-sub);
  white-space: nowrap;
}
.tag.on { background: #e6f9ee; color: var(--brand-dark); }
.tag.off { background: #f0f0f0; color: var(--text-hint); }
.tag.warn { background: #fff4e5; color: #b26b00; }

/* --------------------------------------------------------------- 状态 */

.empty {
  text-align: center;
  color: var(--text-hint);
  padding: 48px 20px;
  font-size: 13.5px;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-hint);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #ccc; }
.live.ok .dot { background: var(--brand); }
.live.poll .dot { background: var(--warn); }
.live.off .dot { background: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 9px;
  z-index: 200;
  max-width: 84vw;
  text-align: center;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.login-wrap { max-width: 380px; margin: 0 auto; padding: 8px 0 24px; }
.login-logo {
  text-align: center;
  padding: 30px 0 22px;
}
.login-logo .mark {
  width: 56px; height: 56px; line-height: 56px;
  border-radius: 15px;
  background: var(--brand);
  color: #fff;
  font-size: 26px;
  display: inline-block;
  margin-bottom: 10px;
}
.login-logo h2 { margin: 0; font-size: 19px; }
.login-logo p { margin: 5px 0 0; font-size: 12.5px; color: var(--text-hint); }

.note { font-size: 12px; color: var(--text-hint); line-height: 1.7; }
.hide { display: none !important; }

/* ------------------------------------------------------------- 分段控件 */

.seg {
  display: flex;
  background: #fff;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px;
  font-size: 14px;
  color: var(--text-sub);
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
}
.seg button.on { background: var(--brand); color: #fff; font-weight: 500; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-sub);
  user-select: none;
}
.switch input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

/* --------------------------------------------------------- 引导参考图 */

.guide-box {
  background: #f7f8fa;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.guide-box .gt {
  font-size: 12.5px;
  color: #8a6100;
  background: #fff9e6;
  border: 1px solid #ffe08a;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.guide-box .gi {
  text-align: center;
}
.guide-box .gi img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.ev-preview {
  margin-bottom: 12px;
  text-align: center;
}
.ev-preview img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.progress {
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .15s linear;
}

.mini-thumb {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
  flex: none;
}

/* ------------------------------------------------------- 当前领取 */

.qr-card .claim-btn {
  width: 100%;
  margin-top: 7px;
  padding: 6px 0;
  font-size: 12.5px;
  border-radius: 7px;
}

.claim-card {
  border: 1px solid var(--warn);
  background: #fffaf2;
}

.claim-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.claim-body > img {
  width: 116px;
  height: 116px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 4px;
  flex: none;
}
.claim-actions { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.claim-actions .note { margin-bottom: 2px; }
.claim-actions .btn { padding: 9px; font-size: 14px; }

.countdown {
  text-align: center;
  font-size: 13px;
  color: var(--warn);
  margin: 10px 0 12px;
  font-weight: 500;
}

/* --------------------------------------------------- 凭证缩略图 */

.ev-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.ev-thumb {
  position: relative;
  width: 76px;
  height: 76px;
}
.ev-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.ev-thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

