/* ============================================================
   作业上交统计平台 · 样式表
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1b2333;
  --ink-2: #5a6478;
  --ink-3: #8d97a9;
  --line: #e7ebf3;
  --line-2: #eef1f7;
  --primary: #4f7cff;
  --primary-d: #3a63e0;
  --violet: #7c5cff;
  --green: #12b886;
  --green-l: #e7f8f1;
  --red: #f0503c;
  --red-l: #feecea;
  --amber: #f59f00;
  --amber-l: #fff6e5;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-h: 0 2px 6px rgba(16, 24, 40, .06), 0 16px 40px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
img { display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 226px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #4f7cff, #7c5cff);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(79, 124, 255, .32);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-txt b { display: block; font-size: 15px; line-height: 1.25; letter-spacing: -.2px; }
.brand-txt span { font-size: 11px; color: var(--ink-3); letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; color: var(--ink-3); padding: 14px 10px 6px; letter-spacing: .6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-s);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: #f6f8fe; color: var(--ink); }
.nav a.active {
  background: linear-gradient(135deg, #eef3ff, #f3efff);
  color: var(--primary-d); font-weight: 600;
}
.nav a.active svg { opacity: 1; }
.nav a .pill {
  margin-left: auto; font-size: 11px; background: var(--primary); color: #fff;
  border-radius: 999px; padding: 1px 7px; font-weight: 600;
}

.sidebar-foot {
  margin-top: auto; padding: 12px 10px; font-size: 11px; color: var(--ink-3);
  border-top: 1px dashed var(--line); line-height: 1.7;
}

.main { margin-left: 226px; flex: 1; min-width: 0; padding: 22px 26px 70px; max-width: 1460px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; letter-spacing: -.4px; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid rgba(231, 235, 243, .9);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 15px; }
.card-head .hint { font-size: 12px; color: var(--ink-3); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 14px; }
.mt-l { margin-top: 22px; }

/* ---------------- KPI ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.kpi {
  background: #fff; border-radius: var(--radius); padding: 16px 18px;
  border: 1px solid rgba(231, 235, 243, .9); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .k-num { font-size: 27px; font-weight: 700; letter-spacing: -.6px; margin-top: 6px; line-height: 1.15; }
.kpi .k-num small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.kpi .k-foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.kpi .k-ico {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px;
  border-radius: 10px; display: grid; place-items: center; opacity: .9;
}
.kpi .k-ico svg { width: 18px; height: 18px; }
.ico-blue { background: #eef3ff; color: #4f7cff; }
.ico-green { background: #e7f8f1; color: #12b886; }
.ico-amber { background: #fff6e5; color: #f59f00; }
.ico-violet { background: #f2eeff; color: #7c5cff; }
.ico-red { background: #feecea; color: #f0503c; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 37px; padding: 0 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: .15s ease; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: #cfd8ea; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #4f7cff, #7c5cff); color: #fff; border: none;
  box-shadow: 0 6px 16px rgba(79, 124, 255, .3); font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(135deg, #4570f5, #7150f5); }
.btn-ghost { background: #f6f8fd; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef2fb; }
.btn-danger { color: var(--red); border-color: #f7d5d0; background: #fff; }
.btn-danger:hover { background: var(--red-l); }
.btn-green { background: var(--green); color: #fff; border: none; font-weight: 600; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.input, .select, textarea.input {
  height: 38px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: #fff; outline: none;
  transition: border .15s, box-shadow .15s; width: 100%;
}
.input:focus, .select:focus {
  border-color: #a9c0ff; box-shadow: 0 0 0 3px rgba(79, 124, 255, .12);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d97a9' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 160px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }
.search-box .input { padding-left: 33px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; cursor: pointer; color: var(--ink-2);
  transition: .15s; user-select: none;
}
.chip:hover { border-color: #c5d2f2; }
.chip.on { background: #eef3ff; border-color: #b9cbf7; color: var(--primary-d); font-weight: 600; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px;
  padding: 11px 14px; background: #fafbfe; border-bottom: 1px solid var(--line);
  white-space: nowrap; letter-spacing: .3px;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; }
.t-right { text-align: right; }
.t-center { text-align: center; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #f2f4f9; color: var(--ink-2); white-space: nowrap;
}
.badge-green { background: var(--green-l); color: #0b9c72; }
.badge-red { background: var(--red-l); color: #d93b27; }
.badge-amber { background: var(--amber-l); color: #b57500; }
.badge-blue { background: #eef3ff; color: var(--primary-d); }
.badge-violet { background: #f2eeff; color: #6741e0; }

.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.progress { height: 6px; border-radius: 999px; background: #eef1f7; overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f7cff, #7c5cff); }
.progress.warn > i { background: linear-gradient(90deg, #f59f00, #ffb84d); }
.progress.bad > i { background: linear-gradient(90deg, #f0503c, #ff7a68); }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty .e-ico {
  width: 58px; height: 58px; border-radius: 18px; background: #f2f5fc;
  display: grid; place-items: center; margin: 0 auto 14px; color: #a9b4c9;
}
.empty .e-ico svg { width: 26px; height: 26px; }
.empty h4 { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { margin: 0 0 14px; font-size: 13px; }

/* ---------------- 提示 ---------------- */
.alert {
  padding: 11px 14px; border-radius: var(--radius-s); font-size: 13px;
  display: flex; gap: 9px; align-items: flex-start; line-height: 1.55;
}
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.alert-info { background: #eef3ff; color: #2f52b8; }
.alert-warn { background: var(--amber-l); color: #9a6500; }
.alert-ok { background: var(--green-l); color: #0a8a65; }
.alert-err { background: var(--red-l); color: #c0301e; }

/* ---------------- 图表 ---------------- */
.chart { width: 100%; height: 260px; }
.chart-sm { height: 220px; }
.chart-lg { height: 320px; }

/* ---------------- 二维码页 ---------------- */
.qr-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.qr-item {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff; text-align: center; transition: .18s; position: relative;
}
.qr-item:hover { box-shadow: var(--shadow-h); transform: translateY(-2px); }
.qr-item img { width: 100%; height: auto; }
.qr-item .qr-name { font-size: 12.5px; padding: 6px 8px 9px; color: var(--ink-2); }
.qr-item .qr-name b { color: var(--ink); }
.qr-item .qr-dl {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px;
  border-radius: 8px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-2); opacity: 0; transition: .18s;
}
.qr-item:hover .qr-dl { opacity: 1; }
.qr-item .qr-dl svg { width: 14px; height: 14px; }

/* ---------------- 扫码页 ---------------- */
body.scan-body { background: #0e1424; }
.scan-wrap { max-width: 560px; margin: 0 auto; padding: 0 0 90px; min-height: 100vh; }

.scan-top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 20, 36, .96); backdrop-filter: blur(10px);
  padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 10px;
}
.scan-top .st-title { color: #fff; font-weight: 600; font-size: 15px; flex: 1; }
.scan-top .st-title span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .5); font-weight: 400; }
.scan-top .icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.scan-top .icon-btn svg { width: 17px; height: 17px; }

.setup-card {
  margin: 16px; background: #fff; border-radius: 18px; padding: 18px;
}
.setup-card .sc-h { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.setup-card .sc-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }

.scan-stage { position: relative; margin: 0; background: #000; }
#reader { width: 100%; }
#reader video { width: 100% !important; height: auto !important; display: block; border-radius: 0; }
#reader img[alt="Info icon"] { display: none !important; }
#reader__dashboard { display: none !important; }
#reader__scan_region { background: #000; }
#reader__scan_region img { display: none !important; }

.scan-overlay {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; place-items: center;
}
.scan-frame {
  width: 66%; aspect-ratio: 1 / 1; max-width: 300px;
  border-radius: 18px; position: relative;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .42);
}
.scan-frame::before, .scan-frame::after,
.scan-frame span::before, .scan-frame span::after {
  content: ""; position: absolute; width: 34px; height: 34px;
  border: 3px solid #5ce1a6; border-radius: 4px;
}
.scan-frame::before { left: -2px; top: -2px; border-right: none; border-bottom: none; border-radius: 14px 0 0 0; }
.scan-frame::after { right: -2px; top: -2px; border-left: none; border-bottom: none; border-radius: 0 14px 0 0; }
.scan-frame span::before { left: -2px; bottom: -2px; border-right: none; border-top: none; border-radius: 0 0 0 14px; }
.scan-frame span::after { right: -2px; bottom: -2px; border-left: none; border-top: none; border-radius: 0 0 14px 0; }
.scan-line {
  position: absolute; left: 8%; right: 8%; height: 2px; top: 10%;
  background: linear-gradient(90deg, transparent, #5ce1a6, transparent);
  box-shadow: 0 0 12px #5ce1a6; animation: scanmove 2.2s ease-in-out infinite;
}
@keyframes scanmove { 0%, 100% { top: 8%; } 50% { top: 90%; } }

.scan-hint {
  position: absolute; bottom: 14px; left: 0; right: 0; text-align: center;
  color: rgba(255, 255, 255, .78); font-size: 12.5px; padding: 0 20px;
}

.result-flash {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 16px; display: flex; justify-content: center;
  transform: translateY(120%); transition: transform .32s cubic-bezier(.2, .9, .3, 1.2);
}
.result-flash.show { transform: translateY(0); }
.result-card {
  width: 100%; max-width: 520px; border-radius: 18px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
}
.result-card.ok { background: linear-gradient(135deg, #12b886, #0ea371); color: #fff; }
.result-card.dup { background: linear-gradient(135deg, #f59f00, #e08e00); color: #fff; }
.result-card.err { background: linear-gradient(135deg, #f0503c, #d93b27); color: #fff; }
.result-card .rc-ico {
  width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .2);
  display: grid; place-items: center; flex: none;
}
.result-card .rc-ico svg { width: 24px; height: 24px; }
.result-card .rc-name { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.result-card .rc-sub { font-size: 12.5px; opacity: .9; }
.result-card .rc-count { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.result-card .rc-count b { font-size: 20px; }
.result-card .rc-count span { font-size: 11px; opacity: .85; display: block; }

.scan-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(14, 20, 36, .97); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
}
.scan-bar .sb-num { color: #fff; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.scan-bar .sb-num span { font-size: 12px; color: rgba(255, 255, 255, .55); font-weight: 400; }
.scan-bar .sb-prog { flex: 1; }
.scan-bar .sb-prog .bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.scan-bar .sb-prog .bar i { display: block; height: 100%; background: linear-gradient(90deg, #5ce1a6, #12b886); }
.scan-bar .btn { height: 40px; border-radius: 11px; }

.scan-list { padding: 14px 16px; }
.scan-list h4 { color: rgba(255, 255, 255, .55); font-size: 12px; margin-bottom: 8px; font-weight: 500; }
.scan-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(255, 255, 255, .05); border-radius: 11px; margin-bottom: 6px;
  color: #fff; animation: rowin .25s ease;
}
@keyframes rowin { from { opacity: 0; transform: translateY(6px); } }
.scan-row .sr-avatar {
  width: 30px; height: 30px; border-radius: 9px; background: rgba(92, 225, 166, .18);
  color: #5ce1a6; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
}
.scan-row .sr-name { font-size: 14px; font-weight: 500; }
.scan-row .sr-time { margin-left: auto; font-size: 11.5px; color: rgba(255, 255, 255, .45); font-variant-numeric: tabular-nums; }
.scan-row .sr-del { background: none; border: none; color: rgba(255, 255, 255, .35); cursor: pointer; padding: 4px; }
.scan-row .sr-del svg { width: 15px; height: 15px; }

.manual-bar { display: flex; gap: 8px; padding: 12px 16px; }
.manual-bar .input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.manual-bar .input::placeholder { color: rgba(255, 255, 255, .35); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .28); animation: modalin .2s ease;
}
@keyframes modalin { from { opacity: 0; transform: scale(.96) translateY(8px); } }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 13px; }
.modal-foot { padding: 0 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 14px; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink-2); border: 1px solid var(--line); background: #fff;
}
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ---------------- 工具类 ---------------- */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.bold { font-weight: 600; }
.nums { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.tabbar { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 14px 88px; }
  .page-head h1 { font-size: 19px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .k-num { font-size: 22px; }
  .kpi .k-ico { width: 28px; height: 28px; right: 10px; top: 10px; }
  .kpi .k-ico svg { width: 15px; height: 15px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--ink-3); padding: 5px 0; border-radius: 10px;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a.scan-tab {
    color: #fff; position: relative; top: -14px;
  }
  .tabbar a.scan-tab .stb {
    width: 48px; height: 48px; border-radius: 16px;
    background: linear-gradient(135deg, #4f7cff, #7c5cff);
    display: grid; place-items: center;
    box-shadow: 0 8px 20px rgba(79, 124, 255, .4);
  }
  .tabbar a.scan-tab .stb svg { width: 24px; height: 24px; }
  .table th, .table td { padding: 10px 11px; }
  .card-pad { padding: 15px 14px; }
  .qr-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}

@media (max-width: 420px) {
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 打印（二维码页 A4） ---------------- */
@media print {
  .sidebar, .tabbar, .page-head, .no-print, .toolbar { display: none !important; }
  .main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .qr-item { break-inside: avoid; border-color: #ccc; }
  .qr-item .qr-dl { display: none; }
  @page { size: A4; margin: 10mm; }
}

/* ============================================================
   细节修正
   ============================================================ */
.table td .btn + .btn { margin-left: 5px; }

.qr-item {
  border: none;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 6px 16px rgba(16, 24, 40, .05);
}
.qr-item img { border-radius: 10px; }
.qr-item .qr-name { display: none; }

.grid-import { grid-template-columns: 1.35fr 1fr; }

@media (max-width: 980px) {
  .grid-import { grid-template-columns: 1fr; }
  .table-wide { min-width: 640px; }
}

/* 扫码结果浮层：抬到底部操作栏上方，并且整体（含内边距）推出屏幕
   注意不能只写 translateY(120%)，加上 bottom 偏移后那样推不干净 */
.result-flash {
  bottom: calc(62px + env(safe-area-inset-bottom));
  padding: 0 12px 12px;
  transform: translateY(calc(100% + 80px));
  opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.2), opacity .25s ease;
}
.result-flash.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.scan-top .st-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 扫码枪模式 ---------------- */
.scan-top .icon-btn.on {
  background: rgba(79, 124, 255, .28);
  border-color: rgba(79, 124, 255, .65);
  color: #fff;
}

.gun-panel {
  margin: 14px 16px;
  padding: 22px 18px 18px;
  border-radius: 18px;
  background: rgba(79, 124, 255, .1);
  border: 1px solid rgba(79, 124, 255, .28);
  text-align: center;
}
.gun-panel .gp-ico {
  width: 52px; height: 52px; border-radius: 15px;
  background: rgba(79, 124, 255, .2); color: #8ba7ff;
  display: grid; place-items: center; margin: 0 auto 12px;
}
.gun-panel .gp-ico svg { width: 26px; height: 26px; }
.gun-panel .gp-t { color: #fff; font-size: 15.5px; font-weight: 600; }
.gun-panel .gp-s {
  color: rgba(255, 255, 255, .5); font-size: 12.5px;
  line-height: 1.75; margin-top: 6px;
}
.gun-panel .gp-buf {
  margin-top: 16px; min-height: 40px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 19px; letter-spacing: 1.5px; color: #5ce1a6;
}
.gun-panel .gp-caret {
  width: 2px; height: 19px; background: #5ce1a6;
  animation: gpblink 1.1s step-end infinite;
}
@keyframes gpblink { 50% { opacity: 0; } }
.gun-panel .gp-last {
  margin-top: 8px; min-height: 18px; font-size: 12.5px;
  color: rgba(255, 255, 255, .45); font-variant-numeric: tabular-nums;
}

/* ---------------- 摄像头切换 ---------------- */
.cam-bar { display: flex; gap: 8px; padding: 10px 16px 0; align-items: center; }
.cam-bar .cam-hint { font-size: 11.5px; color: rgba(255, 255, 255, .4); flex: none; }
.cam-bar select {
  flex: 1; height: 36px; border-radius: 10px; padding: 0 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; font-size: 12.5px; font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.cam-bar select option { background: #17203a; color: #fff; }

/* 提示块里的行内代码 */
.alert code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px; padding: 1px 5px; border-radius: 5px;
  background: rgba(0, 0, 0, .06); color: #b35c00;
}
.alert strong { font-weight: 600; }
