/* 宿舍采购通 · 样式 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1c2530;
  --ink2: #5a6675;
  --ink3: #8b97a5;
  --line: #e3e8ee;
  --brand: #1f6feb;
  --brand-d: #1758b8;
  --brand-l: #eaf2ff;
  --ok: #12885a;
  --ok-l: #e6f6ee;
  --warn: #b06f00;
  --warn-l: #fff5e0;
  --bad: #c0392b;
  --bad-l: #fdecea;
  --r: 12px;
}

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

.wrap { max-width: 900px; margin: 0 auto; padding: 14px 14px 90px; }

/* 顶栏 */
.top {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 14px; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
}
.top h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .logo { font-size: 20px; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px;
}
.card h2 {
  font-size: 15px; margin: 0 0 10px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .sub { font-size: 12px; color: var(--ink3); font-weight: 400; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 9px 14px; font-size: 14px; font-family: inherit;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #f7f9fb; }
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.btn.pri:hover { background: var(--brand-d); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.blk { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 手机上要手指点得到。
   .btn.sm 在电脑上是 29px 高（鼠标没问题），手机上就太细了 ——
   实测 390px 宽的手机上「输入激活码」「怎么收费」「备份 / 恢复」都只有 29px。
   触屏设备一律抬到 38px 以上（Apple 建议 44，38 已经明显好转且不挤版面）。 */
@media (max-width: 560px), (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; font-size: 13.5px; }
}

/* 表单 */
label.f { display: block; font-size: 13px; color: var(--ink2); margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 15px; font-family: inherit;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* 标签页 */
.tabs {
  display: flex; gap: 4px; background: #e9edf2; padding: 4px;
  border-radius: 10px; margin-bottom: 12px; overflow-x: auto;
}
.tabs button {
  flex: 1; min-width: 78px; border: 0; background: transparent; color: var(--ink2);
  padding: 8px 6px; border-radius: 7px; font-size: 14px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: #fff; color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 表格 */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line);
  white-space: nowrap; }
th { font-size: 12px; color: var(--ink3); font-weight: 500; background: #fafbfc; }
td.num, th.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tr.done { background: var(--ok-l); }

/* 徽章 */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 20px;
  font-size: 12px; line-height: 1.7; white-space: nowrap;
}
.b-ok { background: var(--ok-l); color: var(--ok); }
.b-warn { background: var(--warn-l); color: var(--warn); }
.b-bad { background: var(--bad-l); color: var(--bad); }
.b-gray { background: #eef1f5; color: var(--ink2); }
.b-blue { background: var(--brand-l); color: var(--brand); }

/* 统计条 */
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stat {
  flex: 1; min-width: 92px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px;
}
.stat .k { font-size: 12px; color: var(--ink3); }
.stat .v { font-size: 19px; font-weight: 600; margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink3); }

/* 提示 */
.hint {
  background: var(--brand-l); border-radius: 9px; padding: 10px 12px;
  font-size: 13px; color: var(--brand-d); margin-bottom: 12px; line-height: 1.5;
}
.hint.warn { background: var(--warn-l); color: var(--warn); }
.hint.ok { background: var(--ok-l); color: var(--ok); }
.empty { text-align: center; color: var(--ink3); padding: 34px 10px; font-size: 14px; }

/* 家长端「宿舍区」上方的购买方式提示
   —— 整套买要买齐、只补买个别要点展开，这两句不说清，家长会填错数量 */
.buytip {
  background: #fff8e6; border: 1px solid #f0dfae; border-left: 4px solid #e8a020;
  border-radius: 10px; padding: 12px 13px; margin: 0 0 12px;
  font-size: 13px; line-height: 1.75; color: #6b5320;
}
.buytip .bt-t { font-weight: 700; font-size: 14px; margin-bottom: 6px; color: #8a5a00; }
.buytip .bt-l { padding: 4px 0; }
.buytip .bt-l b { color: #8a5a00; }
.buytip .bt-l + .bt-l { border-top: 1px dashed #ecd9a8; margin-top: 4px; padding-top: 7px; }

/* 提示块里的手绘示意图（内联 SVG）。
   width:100% + height:auto：跟着 viewBox 等比缩放，手机窄屏也不会溢出。
   字用页面字体（SVG text 默认继承），别让它退回落日字体。 */
.buytip .bt-art {
  display: block; width: 100%; height: auto;
  margin: 8px 0 2px; font-family: inherit;
}
.buytip .bt-art text { font-family: inherit; }

/* 弹层 */
.mask {
  position: fixed; inset: 0; background: rgba(20,28,38,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.mask.center { align-items: center; }
.sheet {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; padding: 18px 16px 26px;
  max-height: 88vh; overflow-y: auto;
}
.mask.center .sheet { border-radius: 16px; margin: 16px; max-height: 86vh; }
.sheet h3 { margin: 0 0 12px; font-size: 16px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }

/* 底部固定操作条 */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; max-width: 900px; margin: 0 auto;
}
.bottom .btn { flex: 1; }

/* 商品行 */
.item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.item-row:last-child { border-bottom: 0; }
.item-row .nm { flex: 1; min-width: 0; }
.item-row .nm b { font-weight: 500; }
.item-row .nm span { font-size: 12px; color: var(--ink3); display: block; }
.qty {
  display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden;
}
.qty button {
  width: 34px; height: 36px; border: 0; background: #f7f9fb;
  font-size: 18px; color: var(--ink2); cursor: pointer; font-family: inherit;
}
.qty button:active { background: #e9edf2; }
.qty input {
  width: 52px; border: 0; text-align: center; font-size: 16px;
  padding: 0; height: 36px; border-radius: 0;
}
.qty input:focus { box-shadow: none; }

/* 订单卡（家长复制到群里那段） */
.ordertext {
  background: #f7f9fb; border: 1px dashed #c8d2de; border-radius: 9px;
  padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; white-space: pre-wrap; word-break: break-all;
  line-height: 1.7; color: var(--ink);
}

/* 二维码 */
.qrbox { text-align: center; padding: 8px; }
.qrbox img, .qrbox canvas { max-width: 100%; border: 8px solid #fff;
  border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.09); }
.qrlink {
  word-break: break-all; font-size: 12px; color: var(--ink3);
  background: #f7f9fb; padding: 8px 10px; border-radius: 8px; margin-top: 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.link { color: var(--brand); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.muted { color: var(--ink3); font-size: 13px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; }
.mt4 { margin-top: 4px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ============================================================
   v2 新增
   ============================================================ */

/* 学校名（家长端顶部醒目显示） */
.hint .sch { font-size: 17px; font-weight: 600; margin-bottom: 2px; }

/* 首页：学校分组标题条 */
.schbar {
  display: flex; flex-direction: column; gap: 2px;
  margin: 16px 0 8px; padding-left: 10px;
  border-left: 3px solid var(--brand);
}
.schbar b { font-size: 15px; }
.schbar .muted { font-size: 12px; }

/* 卡片可点 */
.card.clickable { cursor: pointer; }
.card.clickable:active { background: #fafbfc; }

/* 宿舍卡里的分组小标题 */
.grp {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 4px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink2);
  letter-spacing: .5px;
}
.grp.clickable { cursor: pointer; }
.grp .muted { font-size: 12px; letter-spacing: 0; }
.item-row .nm .pt { color: var(--brand); font-weight: 600; }

/* 本宿舍小计 */
.sumline {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  text-align: right; font-size: 13px; color: var(--ink2);
}
.sumline b { font-size: 16px; color: var(--ink); }

/* 底部合计 */
.bottom .tot { display: flex; flex-direction: column; justify-content: center; padding-right: 6px; }
.bottom .tot b { font-size: 17px; }

/* 整套方案行（管理端） */
.pkgrow {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.pkgrow:last-child { border-bottom: 0; }
.pkgrow .nm { flex: 1; min-width: 0; }
.pkgrow .nm b { font-weight: 500; }
.pkgrow .nm span { display: block; font-size: 12px; color: var(--ink3); }
.pkgrow .pr { white-space: nowrap; font-weight: 600; color: var(--brand); }
.pkgrow .pr small { font-weight: 400; color: var(--ink3); }

/* 勾选行（整套编辑） */
.chk { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; font-size: 14px; }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }
.chk small { font-size: 12px; }

/* 表格合计行 */
tr.total td { border-top: 2px solid var(--line); background: #fafbfc; }

/* 分享卡 / 付款卡 */
.card.share1 { border-color: #cfe3ff; background: linear-gradient(180deg, #f7fbff, #fff); }
.card.pay { border-color: #cfe3ff; }

/* 分享有礼：标题下面那行说明 */
.card.share1 .share-one {
  font-size: 13.5px; line-height: 1.7; color: var(--ink2); margin-bottom: 12px;
}

/* 专属二维码。
   ★ 屏幕上真正显示出来的其实是 <img>，不是 <canvas>：
     qrcodejs 画完会把 canvas 转成 PNG 塞进 <img>，
     再给 canvas 打上内联的 display:none（库里的 makeImage 就这么干的）。
     所以下面两个元素都要给尺寸，否则量到的是那个 0×0 的隐藏 canvas。
   ★ 千万别在这条规则里写 display —— 内联的 none / block 优先级更高，
     改了也不生效；要是用 !important 硬改，会同时冒出两张二维码。
   白底 + 12px 留白：二维码旁边不能有杂色或紧贴的边框，不然识别率会掉。 */
.shareqr {
  background: #fff; border-radius: 12px; padding: 10px 10px 6px;
  border: 1px solid var(--line); text-align: center;
}
.shareqr canvas, .shareqr img {
  width: 220px !important; height: 220px !important; max-width: 100%;
  /* img 带的是内联 display:block，text-align 管不了块级元素，所以靠 margin 居中；
     万一某浏览器给的是 inline，父级那行 text-align:center 也能兜住。 */
  margin: 0 auto;
}
.shareqr .qrcap {
  margin-top: 2px; font-size: 12px; color: var(--ink3); line-height: 1.6;
}

/* ============================================================
   转发海报浮层
   ------------------------------------------------------------
   黑底是有意的：海报本身是红金两色，放在灰白页面上会显得脏，
   深底一衬，家委一眼看到的就只有那张图。
   .pov-body 撑满剩余高度（flex:1），让提示和按钮沉到底部 ——
   手机上拇指够得着，也不会挡着海报。
   ============================================================ */
.posterov {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(0,0,0,.88);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 14px 18px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.posterov .pov-body {
  flex: 1; width: 100%; min-height: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.posterov .pov-img {
  display: block; width: auto; max-width: 100%; max-height: 64vh;
  border-radius: 14px; background: #fff;
  box-shadow: 0 12px 44px rgba(0,0,0,.55);
}
.posterov .pov-load, .posterov .pov-err {
  color: #fff; text-align: center; font-size: 14px; line-height: 1.9;
}
.posterov .pov-err .muted { color: #b9c2cc; font-size: 12px; }
.pov-spin {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff; animation: povspin .8s linear infinite;
}
@keyframes povspin { to { transform: rotate(360deg); } }
.posterov .pov-tip {
  color: #ffd98a; font-size: 13px; line-height: 1.7;
  text-align: center; margin: 12px 0 0;
}
.posterov .pov-btns {
  display: flex; gap: 10px; width: 100%; max-width: 420px; margin-top: 12px;
}

/* 保存收款码之后的指引条 */
.savetip {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #f6f8fb; border: 1px solid var(--line);
  font-size: 13px; line-height: 1.85; color: var(--ink2);
}
.savetip.on { background: var(--ok-l); border-color: #b7e2c9; color: #1f6b40; }
.savetip .st2 {
  margin-top: 4px; font-size: 12px; color: var(--ink3); line-height: 1.7;
}
.savetip.on .st2 { color: #4b8b68; }

/* ============================================================
   付款页（家长端）
   ------------------------------------------------------------
   两个数字必须一眼看清：付多少钱、收款码长什么样。
   金额小了会被填错，码小了另一台手机扫不进来 —— 都是真金白银的事故，
   所以这里宁可占版面。
   ============================================================ */
.payamt {
  text-align: center; font-size: 42px; font-weight: 700;
  line-height: 1.15; letter-spacing: -1px; padding: 8px 0 2px;
}
.payamt small { font-size: 16px; font-weight: 400; color: var(--ink2); letter-spacing: 0; }

.payqr { text-align: center; padding: 6px; }
.payqr img {
  width: 100%; max-width: 300px; border-radius: 10px; background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.1); cursor: zoom-in;
}

/* 点开放大：让另一台手机能扫，也能直接长按保存 */
.payzoom {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px; text-align: center;
}
.payzoom img {
  width: auto; max-width: 92vw; max-height: 74vh;
  border-radius: 12px; background: #fff;
}
