/* ==========================================================================
   打印机借用登记表 · 样式
   品牌主色：橙   设备状态色：绿=可用 红=已借出 灰=故障
   ========================================================================== */

:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --text: #332c2b;
  --text-2: #5c524e;
  --text-3: #9c918b;
  --line: #eee8e2;

  /* 品牌橙（取自公司 LOGO） */
  --brand: #f08519;
  --brand-deep: #cf6a0c;
  --brand-bg: #fff6ec;
  --brand-line: #ffd3a6;
  --brand-soft: #fffaf4;

  --green: #067647;
  --green-bg: #ecfdf3;
  --green-line: #75e0a7;

  --red: #b42318;
  --red-bg: #fef3f2;
  --red-line: #fda29b;

  --grey: #667085;
  --grey-bg: #f2f4f7;
  --grey-line: #d0d5dd;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* 整页固定一屏，不出现滚动 */
.screen { height: 100%; }

#app {
  display: flex;
  flex-direction: column;
}

/* ---------- 加载 ---------- */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 头部 ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

/* 顶部品牌橙线 */
header::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, #ffa94d 55%, #ffcf9c 100%);
}

/* 品牌行：LOGO + 三个统计 */
.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

/* 公司 LOGO 图形（裁自品牌原图） */
.brand-logo {
  height: 26px;
  width: auto;
  flex: none;
  display: block;
}

.brand-txt { display: block; }
.brand-txt b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.15;
  color: #332c2b;
}
.brand-txt i {
  display: block;
  font-style: normal;
  font-size: 7.5px;
  letter-spacing: .7px;
  color: var(--text-3);
  margin-top: 1px;
}

/* 有真 LOGO 图片时，整块换成图片 */
.brand-img {
  display: block;
  height: 28px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

.titlebar { padding: 7px 14px 2px; }

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.25;
}

.legend {
  display: flex;
  gap: 9px;
  font-size: 11.5px;
  color: var(--text-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lg { display: inline-flex; align-items: center; gap: 4px; }
.lg b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.dot.green { background: #12b76a; }
.dot.red { background: #f04438; }
.dot.grey { background: #9a918a; }

/* ---------- tab ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px;
}

.tab {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-2);
  padding: 8px 8px 10px;
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tab.active {
  color: var(--brand-deep);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.badge {
  background: var(--brand);
  color: #fff;
  font-size: 10.5px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
}

/* ---------- 主体 ---------- */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 9px 14px calc(8px + env(safe-area-inset-bottom));
  overflow: hidden;
}

main > section { flex: 1; min-height: 0; }

#devicesPanel, #radioPanel {
  display: flex;
  flex-direction: column;
}

#feedbackPanel {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

/* 记录页：上面的「设备 / 对讲机」切换固定，下面的列表自己滚 */
#recordsPanel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#recordList {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

/* 记录页顶部的「设备 / 对讲机」切换 */
.seg {
  flex: none;
  display: flex;
  gap: 0;
  background: #f2ede9;
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 9px;
}

.seg-btn {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  padding: 7px 0;
  border-radius: 7px;
  cursor: pointer;
  flex: 1;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.seg-btn.on {
  background: #fff;
  color: var(--brand-deep);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

.hint {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.4;
  flex: none;
}

/* ---------- 设备网格 ---------- */
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 9px;
  /* 列数 / 行数由 app.js 按设备数量写入 */
}

.cell {
  appearance: none;
  border: none;
  font-family: inherit;
  position: relative;
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
  padding: 5px 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 0;
}

.cell:active { transform: scale(.955); }

/* 简笔画图标（小，让位给编号） */
.cell .ico {
  width: 17px;
  height: 17px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .72;
  margin-bottom: 0;
}

.cell .ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cell.bad .ico { opacity: .45; }

/* 编号：主视觉，放大加重 */
.cell .no {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

/* 第三行：设备名 / 借用人 / 维修中 */
.cell .sub {
  font-size: 11px;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .82;
  margin-top: 0;
}

/* 可用 */
.cell.in {
  background: linear-gradient(180deg, #f4fdf8 0%, #eafcf2 100%);
  color: var(--green);
  box-shadow: inset 0 0 0 1.5px var(--green-line), 0 1px 3px rgba(6, 118, 71, .06);
}

/* 可用 · 非打印设备（18~21）：蓝色，表示不是同一类设备 */
.cell.in.dev {
  background: linear-gradient(180deg, #e8f0ff 0%, #d8e6ff 100%);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1.5px #8ab0f5, 0 1px 3px rgba(29, 78, 216, .12);
}

/* 已借出 */
.cell.out {
  background: linear-gradient(180deg, #fff8f7 0%, #fef0ee 100%);
  color: var(--red);
  box-shadow: inset 0 0 0 1.5px var(--red-line), 0 1px 3px rgba(180, 35, 24, .06);
}

/* 格内「转交」：贴右上角，不占流内高度 */
.cell-act {
  position: absolute;
  top: 4px;
  right: 4px;
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .2px;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  z-index: 2;
  white-space: nowrap;
  background: #fff;
  color: var(--red);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .18);
}

/* 选中后右上角换成果勾，转交按钮让位 */
.cell.sel .cell-act {
  opacity: 0;
  pointer-events: none;
}

.cell-act:active { transform: scale(.93); }

/* 故障 */
.cell.bad {
  background: #eef0f3;
  color: #8b95a5;
  box-shadow: inset 0 0 0 1.5px #d5dae1;
  cursor: default;
}

.cell.bad .no { opacity: .7; }

/* 选中 */
.cell.sel {
  box-shadow: 0 0 0 2.5px currentColor, 0 6px 16px rgba(16, 24, 40, .16);
  transform: translateY(-1px);
}

.cell.sel::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
}

.cell.sel::before {
  content: '';
  position: absolute;
  top: 9px;
  right: 10px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
  z-index: 1;
}

.cell.picking { animation: pulse .5s ease; }

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(.93); }
  100% { transform: scale(1); }
}

/* ---------- 底部操作条（参与布局，出现时挤压网格而不是盖住） ---------- */
.action-bar {
  flex: none;
  z-index: 40;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -4px 18px rgba(16, 24, 40, .07);
  animation: rise .18s ease;
}

@keyframes rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.ab-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13.5px;
  font-weight: 600;
  flex: none;
}

.ab-clear {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-3);
  text-align: left;
  cursor: pointer;
}

.ab-btns {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  transition: opacity .15s ease, transform .1s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }

.btn-green { background: var(--green); color: #fff; }
.btn-red { background: #d92d20; color: #fff; }
.btn-brand { background: var(--brand); color: #fff; }

.btn-ghost {
  background: #fff;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 10px 14px;
  font-size: 14px;
}

.btn-line {
  background: #fff;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-block { width: 100%; }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 40, .42);
  display: flex;
  align-items: flex-end;
  animation: fade .18s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--card);
  width: 100%;
  max-height: 88vh;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: up .22s cubic-bezier(.32, .72, 0, 1);
  box-shadow: var(--shadow-lg);
}

@keyframes up {
  from { transform: translateY(26px); opacity: .85; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.sheet-head .sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

.icon-btn {
  appearance: none;
  border: none;
  background: var(--grey-bg);
  color: var(--text-2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 表单 */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  line-height: 1.45;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(242, 107, 33, .12);
}

.input.err { border-color: #f04438; background: #fffbfa; }

.input::placeholder { color: var(--text-3); }

/* ---------- 选人：点名字，不用打字 ---------- */
.staff {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-radius: 12px;
}

/* 没点名字就提交：圈一下提醒，不动输入框 */
.staff.need {
  outline: 2px solid #f04438;
  outline-offset: 5px;
  animation: staffNeed .4s ease 2;
}

@keyframes staffNeed {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.sname {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.2;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}

.sname:active { transform: scale(.95); }

.sname.on {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(242, 107, 33, .3);
}

/* 名单里没有 → 手动填写 */
.sname.manual {
  border-style: dashed;
  color: var(--text-3);
  font-size: 13px;
  padding: 9px 12px;
}

.sname.manual.on {
  border-style: solid;
  border-color: var(--brand-line);
  background: var(--brand-bg);
  color: var(--brand-deep);
  font-weight: 600;
  box-shadow: none;
}

.staff-input { margin-top: 9px; }

/* ---------- 登记完成致谢 ---------- */
.thanks {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 30px;
  pointer-events: none;
}

.thanks-card {
  background: #fff;
  border-radius: 20px;
  padding: 26px 30px 22px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .2);
  max-width: 300px;
  animation: pop .3s cubic-bezier(.34, 1.42, .64, 1);
}

.thanks-check {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 13px;
  box-shadow: 0 7px 20px rgba(242, 107, 33, .35);
}

.thanks-msg {
  margin: 0;
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .3px;
}

.thanks-detail {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.55;
}

@keyframes pop {
  from { transform: scale(.86); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.thanks.out { animation: fadeOut .22s ease forwards; }

@keyframes fadeOut {
  to { opacity: 0; transform: scale(.96); }
}

/* 已选编号回显 */
.picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.pno-chip {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.pno-chip.green { background: var(--green-bg); color: var(--green); }
.pno-chip.red { background: var(--red-bg); color: var(--red); }

/* 自动时间提示 */
.auto {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--grey-bg);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.sheet-actions {
  display: flex;
  gap: 9px;
  margin-top: 4px;
}

.sheet-actions .btn { flex: 1; }

/* 借用人清单（归还弹层用） */
.who-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--grey-bg);
  border-radius: 11px;
  overflow: hidden;
  margin-bottom: 16px;
}

.who-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  background: #fff;
  font-size: 13.5px;
}

.who-row .l { font-weight: 600; font-variant-numeric: tabular-nums; }
.who-row .r { color: var(--text-2); text-align: right; font-size: 12.5px; }
.who-row .r .t { color: var(--text-3); }

/* 单选类型 */
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.cat {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.cat.on {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--brand-deep);
  font-weight: 600;
}

/* ---------- 借还记录：按机器归组、可展开 ---------- */
.rg-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-3);
  padding: 2px 3px 10px;
}

.rg-all {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-deep);
  padding: 4px 2px;
  cursor: pointer;
  flex: none;
}

.rg {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 9px;
  overflow: hidden;
  border-left: 3px solid var(--green-line);
}

.rg.out { border-left-color: var(--red-line); }
.rg.bad { border-left-color: var(--grey-line); }

.rg-head {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
}

.rg-head:active { background: var(--brand-soft); }

/* 机器编号方块 */
.rg-no {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
}

.rg-no.in { background: var(--green-bg); color: var(--green); }
.rg-no.out { background: var(--red-bg); color: var(--red); }
.rg-no.bad { background: var(--grey-bg); color: var(--grey); }

.rg-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rg-line1 {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.rg-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rg-sub {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rg-sub b { color: var(--text-2); font-weight: 600; }

.rg-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rg-count {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* 状态小标签（记录页与故障页共用） */
.rec-tag {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 5px;
  font-weight: 500;
  white-space: nowrap;
}

.rec-tag.in { background: var(--green-bg); color: var(--green); }
.rec-tag.out { background: var(--red-bg); color: var(--red); }
.rec-tag.bad { background: var(--grey-bg); color: var(--grey); }

.rg-arrow {
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--text-3);
  border-bottom: 1.8px solid var(--text-3);
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .22s ease;
  flex: none;
}

.rg.open .rg-arrow { transform: rotate(225deg) translate(-1px, -1px); }

/* 展开区：grid 行高 0fr→1fr 做高度动画 */
.rg-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .24s ease;
}

.rg.open .rg-body { grid-template-rows: 1fr; }

.rg-body-in {
  overflow: hidden;
  min-height: 0;
  padding: 0 13px;
}

.rg.open .rg-body-in { padding-bottom: 4px; }

/* 一次借还 */
.rg-item {
  border-top: 1px dashed var(--line);
  padding: 9px 0 8px;
}

.rg-item-top { margin-bottom: 4px; }

.rg-item-dur {
  display: inline-block;
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 5px;
}

.rg-item-dur.live { color: var(--red); background: var(--red-bg); }

.rg-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  line-height: 1.85;
}

.rg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.rg-dot.b { background: var(--brand); }
.rg-dot.r { background: var(--green); }
.rg-dot.w { background: transparent; box-shadow: inset 0 0 0 1.4px var(--grey-line); }

.rg-who { font-weight: 600; color: var(--text); }
.rg-who.wait { font-weight: 400; color: var(--text-3); }

.rg-act { font-size: 11.5px; color: var(--text-3); }

.rg-time {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- 故障反馈 ---------- */
.fb {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  margin-bottom: 10px;
}

.fb.done { opacity: .62; }

.fb-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fb-no { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.fb-cat { font-size: 12px; background: var(--grey-bg); color: var(--text-2); padding: 1px 7px; border-radius: 5px; }
.fb-time { font-size: 12px; color: var(--text-3); margin-left: auto; }

.fb-text {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}

.fb-foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fb-who { font-size: 12.5px; color: var(--text-3); }

.fb-fix {
  appearance: none;
  border: none;
  background: var(--green-bg);
  color: var(--green);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(51, 44, 43, .94);
  color: #fff;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 10px;
  z-index: 300;
  max-width: calc(100vw - 48px);
  text-align: center;
  line-height: 1.5;
  animation: fade .2s ease;
  pointer-events: none;
}

.toast.up { bottom: auto; top: calc(20px + env(safe-area-inset-top)); }

/* 矮屏（<780px）：网格切 4 列，格子变窄，转交改到底部整条，不跟图标抢右上角 */
@media (max-height: 779px) {
  .grid { gap: 8px; }

  .cell { padding: 4px 3px; }
  .cell .ico { width: 15px; height: 15px; }
  .cell .no { font-size: 25px; }
  .cell .sub { font-size: 10.5px; }

  .cell-act {
    top: auto;
    bottom: 3px;
    left: 3px;
    right: 3px;
    padding: 3px 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 6px;
  }

  .cell.has-act { padding-bottom: 24px; }

  .hint { margin-bottom: 6px; font-size: 12px; }
}

@media (max-width: 350px) {
  .grid { gap: 7px; }
  .cell .ico { width: 14px; height: 14px; }
  .cell .no { font-size: 24px; }
  .cell .sub { font-size: 10px; }
  .legend { gap: 8px; font-size: 11px; }
  .brand-txt i { display: none; }
}

/* ==========================================================================
   对讲机网格：按住划选
   划选时不能让浏览器把手指动作理解成滚动 / 长按选字 / 长按菜单
   ========================================================================== */

#radioGrid {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* 划选进行中：颜色变化要跟手，不能有渐变延迟 */
#radioGrid.dragging .cell {
  transition: box-shadow .08s linear;
  cursor: grabbing;
}

/* 划选时不要给按下的格子做缩小动画，看起来像被"捏"了一下 */
#radioGrid.dragging .cell:active { transform: none; }

/* 整片扫过时描边轻一点，不会闪成一片 */
#radioGrid .cell.sel {
  box-shadow: 0 0 0 2.5px currentColor, 0 4px 12px rgba(16, 24, 40, .14);
  transform: none;
}

/* 对讲机格子内容少（图标 + 大数字），数字大一号更好认 */
#radioGrid .cell .no { font-size: 28px; letter-spacing: -.5px; }

@media (max-height: 779px) {
  #radioGrid .cell .no { font-size: 25px; }
}

@media (max-width: 350px) {
  #radioGrid .cell .no { font-size: 23px; }
}

/* ==========================================================================
   底部操作条：最多同时出现「报故障 / 转交 / 归还 / 领用」四个按钮
   小屏要挤得下，所以按钮收窄、号码摘要过长时省略
   ========================================================================== */

.action-bar { gap: 9px; }

.action-bar .ab-info {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
}

.action-bar .ab-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-bar .ab-btns {
  flex: none;
  gap: 6px;
}

.action-bar .btn {
  font-size: 13.5px;
  padding: 10px 10px;
  border-radius: 9px;
}

@media (max-width: 350px) {
  .action-bar { gap: 7px; }
  .action-bar .btn { font-size: 12.5px; padding: 9px 8px; }
  .action-bar .ab-info { font-size: 12px; }
}

/* ==========================================================================
   旧内核兜底：安卓微信内置浏览器有的还不支持 CSS Grid（也缺 padStart）
   真不支持时才生效，现代浏览器走不到这里
   ========================================================================== */

@supports not (display: grid) {
  .grid {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0;
  }

  .grid .cell {
    flex: 0 0 auto;
    box-sizing: border-box;
    margin: 4px;
  }

  /* 设备页：高屏 3 列 / 矮屏 4 列，和 JS 写入的列数保持一致 */
  #printerGrid .cell { width: calc((100% - 36px) / 3); min-height: 62px; }
  #radioGrid .cell { width: calc((100% - 44px) / 4); min-height: 62px; }

  @media (max-height: 779px) {
    #printerGrid .cell { width: calc((100% - 44px) / 4); }
  }

  /* flex gap 也不支持，用子元素 margin 顶替 */
  .staff { margin: -3.5px; }
  .staff > * { margin: 3.5px; }
}

/* ==========================================================================
   身份行：这台手机已经知道是谁，只显示一行，不用每次点名单
   留「不是我？」作为纠正入口，防止别人用这台手机时记错人
   ========================================================================== */

.me-box {
  display: flex;
  align-items: center;
  padding: 11px 13px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff7f1 0%, #ffeedf 100%);
  border: 1px solid #f6d0b0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

/* 老内核没有 flex gap，用 margin-left:auto 把按钮推到右边 */
.me-switch { margin-left: auto; }

.me-name {
  font-size: 19px;
  font-weight: 800;
  color: #a83f08;
  letter-spacing: .5px;
  line-height: 1.2;
}

.me-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #c2540f;
  background: #fff;
  border: 1px solid #f2bd95;
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
}

.me-switch:active { transform: scale(.96); }

@media (max-height: 779px) {
  .me-box { padding: 9px 12px; }
  .me-name { font-size: 17px; }
  .me-switch { font-size: 12px; padding: 5px 11px; }
}
