/* hidden 属性必须真的能关掉元素。
   下面 button 那条规则写了 display:block，会**顶掉** [hidden]——
   于是 el.hidden = true 之后按钮照样露在外面。踩过两次（.grid2、.cam-bar 的按钮），
   与其每次单独处理，不如在这里一次说死。 */
[hidden] { display: none !important; }

:root {
  --ground: #F5F7F6;
  --surface: #FFFFFF;
  --surface-2: #EBF0EF;
  --ink: #15201F;
  --muted: #5D6C6A;
  --line: #DCE3E1;
  --line-strong: #C3CFCC;
  --accent: #0B6B65;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEDEA;
  --warn: #8A5207;
  --warn-soft: #F7EBD6;
  --danger: #A8281F;
  --danger-ink: #FFFFFF;
  --danger-soft: #F9E2DF;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
          "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F1413;
    --surface: #171E1D;
    --surface-2: #1E2725;
    --ink: #E7EEEC;
    --muted: #94A29F;
    --line: #27322F;
    --line-strong: #3A4642;
    --accent: #3FAEA3;
    --accent-ink: #06201E;
    --accent-soft: #10312E;
    --warn: #D9A441;
    --warn-soft: #2E2411;
    --danger: #E8867C;
    --danger-ink: #2A0F0C;
    --danger-soft: #331A17;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700; text-decoration: none; color: var(--ink); font-size: 16px;
  flex: 0 0 auto; white-space: nowrap;      /* 不许被挤成一字一行 */
}
.bar nav {
  display: flex; align-items: center; gap: 16px; font-size: 14px;
  /* 项目多了宁可横向滑，也不能换行、更不能一个字一行。
     加了「扫码」之后 420px 的手机上正好超宽，就是这么发现的。 */
  overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
}
.bar nav::-webkit-scrollbar { display: none; }
.bar nav > * { flex: 0 0 auto; white-space: nowrap; }
.bar nav a { text-decoration: none; }

/* 窄屏上先靠收紧间距把七项塞下，实在塞不下才滑 */
@media (max-width: 440px) {
  .bar { padding: 10px 12px; gap: 10px; }
  .brand { font-size: 15px; }
  .bar nav { gap: 11px; font-size: 13.5px; }
  .linkish { font-size: 13.5px; }
}
.bar nav form { margin: 0; display: flex; align-items: center; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 14px;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; }

/* ---------- 通用 ---------- */
h1 { font-size: 22px; margin: 4px 0 14px; line-height: 1.35; }
h2 { font-size: 17px; margin: 26px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 15px; }
.flash.ok  { background: var(--accent-soft); color: var(--accent); }
.flash.bad { background: var(--danger-soft); color: var(--danger); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin-bottom: 14px;
}

/* ---------- 状态 ---------- */
.pill {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .02em;
}
.p-idle { background: var(--accent-soft); color: var(--accent); }
.p-out  { background: var(--warn-soft);   color: var(--warn); }
.p-late { background: var(--danger-soft); color: var(--danger); }
.p-off  { background: var(--surface-2);   color: var(--muted); }

/* ---------- 扫码页大标题 ---------- */
.scan-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 16px; border-radius: 12px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line);
}
.scan-head.late { background: var(--danger-soft); border-color: var(--danger); }
.scan-head .code {
  font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: .02em;
}
.scan-head.late .code { color: var(--danger); }

/* ---------- 首页最上面那个编号框 ---------- */
.jump-big { margin: 0 0 16px; }
.jump-big input {
  width: 100%; padding: 18px 16px;
  font-family: var(--mono); font-size: 34px; font-weight: 700;
  letter-spacing: .12em; text-align: center; text-transform: uppercase;
  color: var(--ink); background: var(--surface);
  border: 2px solid var(--accent); border-radius: 12px;
  -webkit-appearance: none; appearance: none;
}
.jump-big input::placeholder { color: var(--line-strong); font-weight: 700; }
.jump-big input:focus { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.jump-hint {
  display: block; text-align: center; font-size: 13px;
  color: var(--muted); margin-top: 7px;
}

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; text-align: center;
}
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.alert { background: var(--danger-soft); border-color: var(--danger); }
.stat.alert .n, .stat.alert .l { color: var(--danger); }

/* ---------- 列表行 ---------- */
.rows { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.row .code { font-family: var(--mono); font-weight: 700; font-size: 16px; min-width: 62px; }
.row .body { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .sub { font-size: 13px; color: var(--muted); }
.row .right { text-align: right; font-size: 13px; white-space: nowrap; }
.row.late { background: var(--danger-soft); margin: 0 -8px; padding-left: 12px; padding-right: 12px; }
.row.late .right { color: var(--danger); font-weight: 700; }

.empty { padding: 34px 10px; text-align: center; color: var(--muted); }

/* ---------- 表单 ---------- */
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 5px; }
input[type=text], input[type=tel], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 12px 13px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 72px; resize: vertical; }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 14px 0; font-size: 15px; font-weight: 400; line-height: 1.5;
}
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

button, .btn {
  display: block; width: 100%; padding: 15px 16px; margin-top: 18px;
  font: inherit; font-size: 17px; font-weight: 700; text-align: center;
  border: 0; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
button.danger, .btn.danger { background: var(--danger); color: var(--danger-ink); }
.ghost, button.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line-strong); font-size: 15px; font-weight: 600;
}
.small-btn, button.small-btn { width: auto; padding: 7px 14px; font-size: 14px; margin: 0; }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1; }
.inline-form button { width: auto; margin-top: 0; padding: 0 18px; font-size: 15px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 快选 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 20px; padding: 7px 13px; font-size: 14px;
  cursor: pointer; color: var(--ink); width: auto; margin: 0; font-weight: 500;
}
.chip:hover, .chip:focus-visible { border-color: var(--accent); color: var(--accent); }
.chip .late-flag { color: var(--danger); font-weight: 700; }

#results { margin-top: 8px; }
#results .hit {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 8px;
}
#results .hit-who { flex: 1 1 100%; font-weight: 600; }
#results .hit-meta { flex: 1 1 100%; font-size: 13px; color: var(--muted); margin-top: -4px; }
#results .hit form { margin: 0; }

.src {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  font-size: 11px; font-weight: 700; border-radius: 3px;
  background: var(--surface-2); color: var(--muted); vertical-align: 1px;
}

/* ---------- 待确认申请 ---------- */
.pending { border-color: var(--accent); border-width: 2px; }
.pending-tag {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); margin-bottom: 6px;
}
.pending-who { font-size: 22px; font-weight: 700; line-height: 1.3; }
.pending-phone { font-size: 19px; letter-spacing: .04em; margin-top: 2px; }
.pending form { margin: 0; }

.p-tier { background: var(--warn-soft); color: var(--warn); }

.tier-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 0 16px;
}
.tier-label { font-size: 13px; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.pending-row { padding: 12px 0; border-top: 1px solid var(--line); }
.pending-row:first-of-type { border-top: 0; padding-top: 0; }

.verify-ok {
  margin-top: 4px; font-size: 13px; color: var(--accent); font-weight: 600;
}
.verify-todo {
  margin-top: 6px; padding: 9px 11px; border-radius: 6px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 13.5px; line-height: 1.6;
}
.verify-todo a { color: inherit; font-weight: 700; }
a.pending-phone { text-decoration: none; display: inline-block; }

.danger-card { border: 2px solid var(--danger); background: var(--danger-soft); }
.rename-card { border: 2px solid var(--warn); background: var(--warn-soft); }
.rename-flag {
  margin-top: 6px; padding: 7px 10px; border-radius: 6px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
.rename-flag a { color: inherit; }
.warn-row { padding: 10px 0; border-top: 1px solid var(--line); }
.warn-row:first-of-type { border-top: 0; }
.warn-who { font-weight: 700; font-size: 16px; margin-right: 8px; }
.warn-flag {
  margin-top: 6px; padding: 7px 10px; border-radius: 6px;
  background: var(--danger-soft); color: var(--danger);
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
.warn-flag a { color: inherit; }
a.chip { text-decoration: none; display: inline-block; }

/* ---------- 一键借出 chip ---------- */
.chip-form { margin: 0; display: inline-flex; }
.chip-meta { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.chip:hover .chip-meta, .chip:focus-visible .chip-meta { color: inherit; }

/* ---------- 定义列表 ---------- */
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 15px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; }

.terms {
  background: var(--surface-2); border-radius: 8px; padding: 11px 13px;
  font-size: 13.5px; color: var(--muted); line-height: 1.65; margin-top: 16px;
}

.center-note { text-align: center; padding: 48px 16px; }
.center-note .big { font-size: 44px; font-family: var(--mono); font-weight: 700; margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 超时严重程度：6 级 ----------
   颜色只是一路信号。太阳底下看手机、色弱的人，颜色都靠不住，
   所以每一行同时印一个文字徽章（「已超 2 天」），两路并行。
   第 6 级直接反白成整块深红——那是「基本要不回来了」的意思。 */
:root {
  --lv1-bg:#FDF3E2; --lv1-ink:#8A5207; --lv1-line:#E9C87E;
  --lv2-bg:#FBE8D3; --lv2-ink:#8F4A10; --lv2-line:#E2A971;
  --lv3-bg:#F9DECB; --lv3-ink:#973C13; --lv3-line:#DC8F63;
  --lv4-bg:#F9E0DC; --lv4-ink:#A8281F; --lv4-line:#D98E86;
  --lv5-bg:#F0CFCC; --lv5-ink:#8A1C15; --lv5-line:#C4706A;
  --lv6-bg:#8A1C15; --lv6-ink:#FFF3F1; --lv6-line:#5E120D;
}
@media (prefers-color-scheme: dark) {
  :root {
    --lv1-bg:#2C2411; --lv1-ink:#E7BE63; --lv1-line:#5B4A1E;
    --lv2-bg:#31220F; --lv2-ink:#EDA95F; --lv2-line:#66421B;
    --lv3-bg:#351E11; --lv3-ink:#F0955F; --lv3-line:#6E3A1E;
    --lv4-bg:#361A16; --lv4-ink:#F0897C; --lv4-line:#70302A;
    --lv5-bg:#431712; --lv5-ink:#FF9A8E; --lv5-line:#8A2C22;
    --lv6-bg:#B22C21; --lv6-ink:#FFF1EE; --lv6-line:#DC5B4C;
  }
}
.row.lv1 { background: var(--lv1-bg); }
.row.lv2 { background: var(--lv2-bg); }
.row.lv3 { background: var(--lv3-bg); }
.row.lv4 { background: var(--lv4-bg); }
.row.lv5 { background: var(--lv5-bg); }
.row.lv6 { background: var(--lv6-bg); }
.row.lv1 .right, .row.lv1 .name { color: var(--lv1-ink); }
.row.lv2 .right, .row.lv2 .name { color: var(--lv2-ink); }
.row.lv3 .right, .row.lv3 .name { color: var(--lv3-ink); }
.row.lv4 .right, .row.lv4 .name { color: var(--lv4-ink); }
.row.lv5 .right, .row.lv5 .name { color: var(--lv5-ink); }
.row.lv6 .right, .row.lv6 .name, .row.lv6 .code, .row.lv6 .sub, .row.lv6 .muted {
  color: var(--lv6-ink);
}
.row.lv1, .row.lv2, .row.lv3, .row.lv4, .row.lv5, .row.lv6 {
  margin: 0 -8px; padding-left: 12px; padding-right: 12px;
}
.row.lv5 { box-shadow: inset 3px 0 0 var(--lv5-line); }
.row.lv6 { box-shadow: inset 4px 0 0 var(--lv6-line); }

.lvtag {
  display: inline-block; font-size: 12px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 2px;
  white-space: nowrap;
}
.lvtag.lv1 { background: var(--lv1-line); color: #2A1D05; }
.lvtag.lv2 { background: var(--lv2-line); color: #2A1706; }
.lvtag.lv3 { background: var(--lv3-line); color: #2A1206; }
.lvtag.lv4 { background: var(--lv4-line); color: #2A0C09; }
.lvtag.lv5 { background: var(--lv5-line); color: #FFF1EF; }
.lvtag.lv6 { background: var(--lv6-line); color: #FFF1EF; }

.lv-legend { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; }
.lv-legend .lvtag { margin: 0; }

/* ---------- 排队 ---------- */
.qno {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 700; margin-right: 8px;
}
.qno.first { background: var(--danger); }
.q-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.q-row:last-of-type { border-bottom: 0; }
.q-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px;
          flex-wrap: wrap; }
.q-name { font-size: 19px; font-weight: 700; }
.q-phone { font-size: 16px; letter-spacing: .03em; color: var(--accent);
           text-decoration: none; }
.q-right { text-align: right; white-space: nowrap; line-height: 1.35; }
.q-right form { margin: 0; }
.q-wait { font-size: 12px; color: var(--muted); display: block; }
.q-stale .q-wait { color: var(--warn); font-weight: 700; }
.q-drop { background: none; border: 0; color: var(--muted); font-size: 12px;
          text-decoration: underline; padding: 2px; cursor: pointer; }

/* ---------- 新申请横幅 ---------- */
#newreq {
  position: fixed; left: 8px; right: 8px; top: 8px; z-index: 99;
  background: var(--danger); color: var(--danger-ink);
  border-radius: 12px; padding: 14px 16px; font-size: 17px; font-weight: 700;
  box-shadow: 0 6px 24px rgba(0,0,0,.28); border: 0; width: auto;
  text-align: left; display: none;
}
#newreq.show { display: block; animation: nrpop .28s ease-out; }
@keyframes nrpop { from { transform: translateY(-14px); opacity: 0 } to { transform: none; opacity: 1 } }
#newreq .nr-sub { display: block; font-size: 13px; font-weight: 500; opacity: .9; margin-top: 3px; }

/* ---------- 近乎空白的页面 ----------
   陌生人扫到别人借着的宝、停用的宝、不存在的编号，看到的就是这一页。
   不给编号、不给摊主名字、不给联系方式、不给管理员入口 —— 一个字都不泄露。
   底下那行认领入口淡到几乎看不见：真客人低头找得到，路过的人不会注意。 */
.blank { min-height: 68vh; display: flex; align-items: flex-end; justify-content: center; }
.claim { width: 100%; max-width: 320px; text-align: center; }
.claim > summary {
  list-style: none; cursor: pointer; display: inline-block;
  font-size: 12px; color: var(--line-strong); padding: 10px 14px;
  -webkit-tap-highlight-color: transparent;
}
.claim > summary::-webkit-details-marker { display: none; }
.claim[open] > summary { color: var(--muted); }
.claim label { text-align: left; }
.claim input {
  text-align: center; font-size: 26px; letter-spacing: .5em;
  text-indent: .5em; font-family: var(--mono);
}
.claim button {
  width: 100%; margin-top: 12px; padding: 14px; font: inherit; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 10px; cursor: pointer;
}
.claim-err {
  margin: 10px 0 0; padding: 9px 11px; border-radius: 7px; font-size: 14px;
  background: var(--danger-soft); color: var(--danger); text-align: left;
}
.claim-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- 设置页 ---------- */
.set-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
            margin-bottom: 4px; }
.set-head h3 { margin: 0; font-size: 17px; }
.set-row { padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row label { margin: 0 0 5px; }
.set-help { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.set-help code { font-family: var(--mono); font-size: .9em; }
.chg-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; vertical-align: middle;
}
/* 危险区要一眼看出来跟别的不一样 */
.danger-zone { border-color: var(--danger); border-width: 2px; }
.danger-zone .set-head h3 { color: var(--danger); }
button.big { width: 100%; padding: 16px; font-size: 17px; font-weight: 700; margin-top: 6px; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0;
                 border-radius: 10px; cursor: pointer; font-family: inherit; }

/* ---------- 二维码 / 导出页 ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.grid3 label { margin-top: 8px; }
.cmdline {
  font-family: var(--mono); font-size: 13px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
  overflow-x: auto; margin: 10px 0 0;
}
.poster-row {
  display: flex; align-items: center; gap: 12px; margin: 0;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.poster-row:first-of-type { border-top: 0; }
.poster-row > span { flex: 1 1 auto; min-width: 0; line-height: 1.5; }
/* 全站的 button 是 width:100% 的整块按钮，这里必须显式覆盖，
   否则按钮会把文字挤成一列一个字。 */
.poster-row button {
  flex: 0 0 auto; width: auto; margin-top: 0;
  padding: 10px 18px; font: inherit; font-weight: 700; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: 8px; cursor: pointer;
}
.btn-block {
  display: block; text-align: center; padding: 14px; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
  border-radius: 10px; text-decoration: none;
}

/* ---------- 全屏扫码 ---------- */
/* 固定全屏，**不依赖任何布局计算**。
   上一版把摄像头塞进 aspect-ratio 的方块里，微信内置浏览器算不出高度，
   权限给了、流也拿到了，画面就是不出来。这版没有这个问题。 */
.scan-full {
  position: fixed; inset: 0; z-index: 60; background: #000;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.scan-full video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000;
}
.scan-ui {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; color: #fff;
}
.scan-dead .scan-ui { display: none; }

.scan-top {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
}
.scan-x {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff; text-decoration: none;
  font-size: 26px; line-height: 36px; text-align: center;
}
.scan-title { font-size: 17px; font-weight: 700; }

/* 取景框。
   **必须正对屏幕中心** —— 人是照着屏幕中间去对的，
   框偏上 100px，扫到的就是上面那张贴纸。所以这里用绝对定位钉死在正中，
   不跟旁边那些文字抢位置。 */
.scan-box {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(72vw, 300px); height: min(72vw, 300px);
  border: 2px solid rgba(255,255,255,.9); border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); overflow: hidden;
}
.scan-line {
  position: absolute; left: 6%; right: 6%; height: 2px; top: 0;
  background: linear-gradient(90deg, transparent, #3ddc84, transparent);
  box-shadow: 0 0 10px 2px rgba(61,220,132,.7);
  animation: scan-sweep 2.2s ease-in-out infinite;
}
@keyframes scan-sweep { 0%,100% { top: 4%; } 50% { top: 94%; } }
@media (prefers-reduced-motion: reduce) { .scan-line { animation: none; top: 50%; } }

/* 提示语挂在取景框下面，别去挤它的位置 */
.scan-say {
  position: absolute; left: 0; right: 0;
  top: calc(50% + min(36vw, 150px) + 18px);
  margin: 0; padding: 0 24px; font-size: 15px; line-height: 1.5;
  text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.scan-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: 100%; display: flex; justify-content: center; gap: 34px;
  padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 22px);
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.6));
}
.scan-round {
  width: auto; margin: 0; padding: 0; background: none; border: 0;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: #fff; font-size: 12.5px; font-weight: 400;
}
.scan-ico {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 23px;
}

/* 摄像头这条路走不通时盖上来的那一块 */
.scan-fail {
  position: absolute; inset: 0; z-index: 2; overflow-y: auto;
  background: var(--ground); color: var(--ink);
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px 40px;
}
.scan-fail h3 { margin: 0 0 8px; font-size: 20px; }
.scan-fail-why { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.scan-fail-note { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.scan-manual { margin-top: 26px; }
.scan-manual input { font-size: 22px; text-align: center; }

/* 首页那两个大扫码按钮 —— 扫码只在借出和归还时用，入口就该在这儿 */
.doit { display: flex; gap: 12px; margin: 0 0 16px; }
.doit a {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 17px 10px; border-radius: 11px; text-decoration: none;
  font-size: 18px; font-weight: 700; line-height: 1.25;
}
.doit .d-sub { font-size: 12.5px; font-weight: 400; opacity: .85; }
.doit .d-out { background: var(--accent); color: var(--accent-ink); }
.doit .d-in { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }

/* ---------- 老客户快速借出 ---------- */
.quick-card { border: 1px solid var(--accent); }
.quick-card > label:first-child { font-size: 16px; }
#q { font-size: 19px; }
.hit-blocked { opacity: .62; }
.hit-bad {
  margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--danger);
}

/* ---------- 老客户免填 ---------- */
.same-card { border: 1px solid var(--accent); }
.same-who { margin: 0 0 14px; font-size: 21px; font-weight: 700; }

/* ---------- 超时前科提醒 ---------- */
/* 这一条要**扎眼**：忙起来眼睛会滑过去，所以给它整块红底 */
.late-card { border: 2px solid var(--danger); }
.late-big {
  margin: 0 0 10px; font-size: 19px; line-height: 1.45;
}
.late-big strong { color: var(--danger); }
.late-flag-row {
  margin-top: 8px; padding: 8px 10px; border-radius: 7px;
  background: rgba(200, 40, 40, .09); color: var(--danger);
  font-size: 13.5px; line-height: 1.55;
}

/* ---------- 借还履历卡（三处共用一份） ---------- */
.rec {
  margin-top: 8px; padding: 9px 11px; line-height: 1.55;
  border-radius: 8px; border-left: 4px solid transparent;
}
.rec-line { font-size: 14px; font-weight: 700; }
.rec-sub { margin-top: 3px; font-size: 12.5px; opacity: .88; }

/* 没超时过的：安静。这一条是「顺带告诉你」，不是警报 */
.rec-ok { background: var(--surface-2); color: var(--muted); }
.rec-ok .rec-line { color: var(--ink); font-weight: 400; }

/* 超时过的：要扎眼。
   这里踩过一个坑 —— 原来只是加了个**很淡的粉底 + 深砖红字**，
   手机上一眼看过去跟旁边的黑字几乎一样，等于白做。
   量过才明白：字对底的对比度有 6:1，够看清；
   问题是**它不像红的** —— #A8281F 太暗，和正文的近黑色差得不够远。
   所以靠三样一起：整块实底、左边一道粗red杠、更亮一点的红字。
   杠这一道尤其要紧：色弱的人看不出红，但看得出左边多了一条。 */
.rec-late {
  background: var(--danger-soft);
  border-left-color: var(--danger);
  color: #C0271B;                 /* 比 --danger 亮一档，仍有 4.8:1 */
}
.rec-late .rec-line { font-size: 15px; }
.rec-late a { color: inherit; }
.rec-big { padding: 13px 14px; }
.rec-big .rec-line { font-size: 17px; }

@media (prefers-color-scheme: dark) {
  /* 深色下反过来：底已经够深，字要更亮才跳得出来 */
  .rec-late { color: #FF9A8F; }
}
.rec-live-tag { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }

/* ---------- 柜台上那张会变的登记码 ---------- */
.jc-wrap { text-align: center; margin: 4px 0 18px; }
.jc-code {
  position: relative; display: inline-block; width: min(86vw, 420px);
  background: #fff; border-radius: 14px; padding: 10px;
  box-shadow: 0 2px 14px rgba(0,0,0,.13);
}
.jc-code canvas { display: block; width: 100%; height: auto; }
.jc-off {
  position: absolute; inset: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center;
  background: rgba(255,255,255,.93); border-radius: 10px; padding: 20px;
}
.jc-off p { margin: 0; }
.jc-tip { margin: 14px 0 2px; font-size: 19px; font-weight: 700; }
.jc-left { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- 超时清单 ---------- */
.od-row {
  padding: 13px 14px; border-bottom: 1px solid var(--line);
  border-left: 5px solid transparent;
}
.od-row:last-child { border-bottom: 0; }
/* 越拖越红，一眼分得出该先催谁 */
.od-row.lv1 { border-left-color: #E9B949; }
.od-row.lv2 { border-left-color: #E08A3C; }
.od-row.lv3 { border-left-color: #D9663B; }
.od-row.lv4 { border-left-color: #C2452F; }
.od-row.lv5 { border-left-color: #A62B25; }
.od-row.lv6 { border-left-color: #7A1D1A; }
/* 第一行横排、允许换行；详情另起一行占满宽度 —— 挤成一行两三个字的教训 */
.od-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; }
.od-late { font-size: 15px; font-weight: 700; color: var(--danger); }
.od-code { font-size: 15px; font-weight: 700; }
.od-name { font-size: 15px; }
.od-call {
  margin-left: auto; flex: 0 0 auto; padding: 6px 10px; border-radius: 7px;
  background: var(--surface-2); font-size: 13px; text-decoration: none;
  white-space: nowrap;
}
.od-rec { margin-top: 5px; font-size: 12.5px; color: var(--danger); line-height: 1.5; }
.od-when { margin-top: 3px; line-height: 1.55; }
/* 备案号：要看得见、点得到，但不抢戏 —— 它是合规信息，不是内容 */
.beian {
  margin: 26px auto 18px; padding: 0 16px 12px;
  text-align: center; font-size: 12px; line-height: 1.9; color: var(--muted);
}
.beian a { color: inherit; text-decoration: none; margin: 0 8px; }
.beian a:hover { text-decoration: underline; }

.offsite-warn {
  background: var(--danger-soft); color: #C0271B;
  border-left: 4px solid var(--danger);
}
@media (prefers-color-scheme: dark) { .offsite-warn { color: #FF9A8F; } }

.jc-mini {
  margin: 0 0 12px; padding: 8px 11px; border-radius: 8px;
  background: var(--surface-2); color: var(--muted); font-size: 13px;
}
