/* ============================================================================
 * 设计令牌 · Neo Kinpaku（光模式分支）
 * 来源：pbakaus/impeccable 的 DESIGN.md（黑漆 + 金箔 + 铜绿三锚色系统）。
 * 本系统是白天在厨房/办公室用的管理台，因此取它的**光模式**：暖纸底、
 * 墨色文字、铜绿承担交互、金只做"品牌重量"（主按钮、重点数字）。
 * 依据它的三条硬规则落地：
 *   · 纸上小字不用金（对比不足）→ 链接/激活态一律用铜绿；
 *   · 发丝线优先于阴影 → 边框 1px 半透明墨，只有浮层保留极淡投影；
 *   · 圆角小、卡片扁、不嵌套 → 卡片 4px、按钮 2px、输入 4px。
 * 旧变量名（--bg/--card/--line/--text/--dim/--primary…）全部保留为别名，
 * 全站既有规则无需改动即可跟随新色板。
 * ==========================================================================*/
:root {
  /* 版面与墨色 */
  --paper:        oklch(97% .012 95);      /* 页面底：暖纸 */
  --paper-deep:   oklch(94% .014 95);      /* 下沉区、表头、hover */
  --paper-raised: oklch(99% .008 95);      /* 卡片面（近白，但不是纯白）*/
  --ink:          oklch(18% .02 95);       /* 最深墨：标题、主按钮文字 */
  --ink-body:     oklch(25% .018 95);      /* 正文 */
  --ink-muted:    oklch(45% .015 95);      /* 次要说明 */
  --ink-faint:    oklch(55% .012 95);      /* 表头、弱化标签 */
  --ink-disabled: oklch(65% .01 95);
  --rule:         oklch(25% .02 95 / .13); /* 发丝线（默认）*/
  --rule-strong:  oklch(25% .02 95 / .24); /* 强调分隔线 */

  /* 金（品牌锚，只给"有重量"的元素）*/
  --gold:      oklch(84% .19 80.46);
  --gold-rich: oklch(77% .13 82);
  --gold-pale: oklch(86% .07 84);
  --gold-deep: oklch(61% .085 78);
  --gold-veil: oklch(84% .19 80.46 / .16);

  /* 铜绿（交互与状态锚：链接、激活、焦点环）*/
  --patina:      oklch(70% .12 188);
  --patina-deep: oklch(49% .08 188);
  --patina-ink:  oklch(45% .09 190);
  --patina-pale: oklch(95% .03 190);

  /* 语义色（克制使用）*/
  --vermilion: oklch(52% .16 35);
  --ok-ink:    oklch(40% .10 145);

  /* ---- 旧变量别名（兼容全站既有规则）---- */
  --bg: var(--paper);
  --card: var(--paper-raised);
  --line: var(--rule);
  --text: var(--ink-body);
  --dim: var(--ink-muted);
  --primary: var(--patina-deep);
  --primary-2: oklch(42% .085 190);
  --primary-soft: var(--patina-pale);
  --ok: var(--ok-ink);
  --ok-bg: oklch(95% .05 145);
  --bad: var(--vermilion);
  --bad-bg: oklch(96% .03 35);
  --warn: oklch(52% .13 60);
  --warn-bg: oklch(96% .04 75);
  --sidebar: oklch(12% .012 95);           /* 侧栏：黑漆，不是纯黑也不是冷蓝黑 */
  --radius: 4px;                            /* 卡片圆角（原 14px）*/

  /* 圆角刻度（对齐规范的 rounded 表：2/4/6/8/999）*/
  --r-xs: 2px; --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-pill: 999px;
  /* 间距刻度（8 基数）*/
  --sp-1: 8px; --sp-2: 16px; --sp-3: 24px; --sp-4: 32px; --sp-5: 48px;
  /* 字号刻度（严格级差，不新增"差不多大"的尺寸）*/
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px;
  --fs-16: 16px; --fs-18: 18px; --fs-20: 20px; --fs-24: 24px; --fs-28: 28px;

  /* 左侧功能栏宽度：栏宽和内容区左边距都引用它，改一处即可，不会两边对不上 */
  --sidebar-w: 224px;
}

/* 老设备兜底：厨房旧手机 / 老 Android WebView 可能不支持 oklch()，
   一旦不支持，令牌会整体失效（背景变透明、文字变黑），界面直接崩。
   这里用等值的 sRGB 十六进制覆盖一遍，支持 oklch 的浏览器不会走到这个分支。 */
@supports not (color: oklch(0% 0 0)) {
  :root {
    --paper: #f7f5ec; --paper-deep: #eeebe1; --paper-raised: #fdfcf6;
    --ink: #141207; --ink-body: #242218; --ink-muted: #58554c; --ink-faint: #74726a;
    --ink-disabled: #9c9a92;
    --rule: rgba(36, 34, 24, .13); --rule-strong: rgba(36, 34, 24, .24);
    --gold: #ffba00; --gold-rich: #ddab46; --gold-pale: #e7ce9d; --gold-deep: #9f7d45;
    --gold-veil: rgba(255, 186, 0, .16);
    --patina: #7fc4bd; --patina-deep: #146f69; --patina-ink: #0f5f5a; --patina-pale: #d9f5f3;
    --vermilion: #b23b1d; --ok-ink: #1d5522;
    --primary-2: #0f5f5a;
    --ok-bg: #dbf8da; --bad-bg: #ffebe4;
    --warn: #9d5300; --warn-bg: #ffefd5;
    --sidebar: #070602;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 30px; width: auto; max-width: 120px; object-fit: contain; border-radius: 8px; flex: 0 0 auto; }
.brand img.brand-logo + strong { margin-left: 2px; }
.brand strong { font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.brand span { font-size: 12px; color: var(--dim); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 24px; }
.wrap.narrow { max-width: 760px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card > h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.card > h2 .sub { font-weight: 400; font-size: 12px; color: var(--dim); margin-left: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover { border-color: #c5cfdd; background: var(--paper-deep); }
.btn.primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .28);
}
.btn.primary:hover { background: linear-gradient(135deg, #2563eb, #1e40af); }
.btn.danger { color: var(--bad); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--bad-bg); border-color: #ef9a9a; }
.btn.sm { min-height: 30px; padding: 4px 11px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn-row.left { justify-content: flex-start; }

/* 菜品库分页栏（需求一）：与系统风格统一，不花哨 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager-info { color: var(--muted, #667); font-size: 13px; }
.pager-ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-ctrl .btn.sm.active { background: var(--gold-rich); border-color: var(--gold-deep); color: var(--ink); box-shadow: none; }
.pager-ellipsis { color: #9aa; padding: 0 2px; }
.pager-per { height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); padding: 0 6px; font-size: 13px; }
/* 选照片 / 选文件的自定义按钮：原生 file 输入框要藏起来，只露按钮样式
   （archive 页以前没藏，界面上会多出一个"选择文件 未选择任何文件"的原生控件） */
.srcbtn { cursor: pointer; }
.srcbtn input { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.stat .k { font-size: 12px; color: var(--dim); }
.stat .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 4px; color: var(--primary); }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--dim); }

.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.7;
  background: var(--paper-deep);
  color: var(--dim);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.list td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr:hover td { background: var(--paper-deep); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.empty { color: var(--dim); padding: 16px 0; text-align: center; }

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 16px;
  padding: 4px;
  background: #e5eaf2;
  border-radius: 11px;
}
.tabs button {
  min-height: 34px;
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
input[disabled] { background: #f1f4f9; color: var(--dim); }
textarea { min-height: 72px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 680px) { .row2, .row3 { grid-template-columns: 1fr; } }

.check-row { display: flex; align-items: flex-start; gap: 8px; }
.check-row input { width: auto; margin-top: 7px; }

.thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #eef2f7;
  cursor: pointer;
}
.thumb.empty-thumb { display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 11px; cursor: default; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 标准图多图：管理弹窗网格 + 待上传预览 + 扫码页对照图 ===== */
.std-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 2px; }
.std-cell { width: 108px; }
.std-cell > img {
  width: 108px; height: 108px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); background: #eef2f7; cursor: zoom-in; display: block;
}
.std-cell .ops { display: flex; gap: 6px; margin-top: 6px; }
.std-cell .ops .btn { flex: 1 1 auto; min-height: 28px; padding: 0 6px; font-size: 12px; }
.std-pend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 2px; }
.std-pend .pcell { position: relative; width: 88px; }
.std-pend .pcell img {
  width: 88px; height: 88px; object-fit: cover; border-radius: 9px;
  border: 1px dashed var(--primary); background: #f5f8fc; display: block;
}
.std-pend .pubx {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px;
  min-height: 24px; padding: 0; line-height: 1; border-radius: 50%;
}
/* ===== 检查表附件：图片 / 视频 / 说明文档 统一格子 + 类型色标 ===== */
.att-tile {
  position: relative; width: 108px; height: 108px; border-radius: 10px; border: 1px solid var(--line);
  background: #eef2f7; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; overflow: hidden;
}
.att-tile > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-tile .ic { font-size: 28px; line-height: 1; }
.att-tile .nm {
  font-size: 11px; color: #4b5563; padding: 0 6px; text-align: center; line-height: 1.3;
  max-height: 2.6em; overflow: hidden; word-break: break-all;
}
.att-tile.video { background: #eaf2fd; border-color: #c9dcf5; }
.att-tile.doc { background: #fbf6ec; border-color: #eadfc7; }
.att-tile.file { background: #f3f4f6; }
.att-badge {
  position: absolute; top: 5px; left: 5px; z-index: 1; font-size: 10px; line-height: 1.6;
  padding: 0 6px; border-radius: 999px; color: #fff; background: #64748b;
}
.att-badge.image { background: #12395f; }
.att-badge.video { background: #1f6feb; }
.att-badge.doc { background: #9a6b1f; }
/* ===== 附件图片预览：受限尺寸的浮层 =====
   之前这里叫 .std-preview，是 position:fixed + inset:0 + 深色底的整屏遮罩：
   点一次图片就铺满整个视口，弹窗里的标题、替换/删除按钮全被盖住，页面也点不动、滚不动。
   现在改成两级：
     ① 默认是"受限尺寸"的预览框（最多 92vw × 88vh），容器不吃点击（pointer-events:none），
        底下的弹窗内容照常可点、可滚；图片上有点"放大"提示。
     ② 再点图片才进入全屏灯箱（.zoomed），这时点任意处关闭是符合预期的。 */
.att-view {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; pointer-events: none;   /* 容器不吃点击，底层照常操作 */
}
.att-view-box {
  position: relative; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: min(1080px, 92vw); max-height: 88vh;
  padding: 12px; border-radius: 14px;
  background: rgba(11, 17, 28, .97); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.att-view-box img { display: block; max-width: 100%; max-height: 64vh; object-fit: contain; border-radius: 8px; cursor: zoom-in; }
.att-view-box video { display: block; max-width: 100%; max-height: 64vh; border-radius: 8px; background: #000; }
.att-view-close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; min-height: 32px;
  padding: 0; line-height: 1; font-size: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  color: #e8eef6; cursor: pointer;
}
.att-view-close:hover { background: rgba(239, 68, 68, .4); }
.att-view-tip { font-size: 13px; color: #cbd5e1; }
/* 放大态：全屏灯箱，点任意处关闭 */
.att-view.zoomed { pointer-events: auto; background: rgba(4, 8, 15, .93); }
.att-view.zoomed .att-view-box { max-width: 96vw; max-height: 94vh; padding: 0; background: transparent; border: none; box-shadow: none; }
.att-view.zoomed .att-view-box img { max-width: 96vw; max-height: 88vh; cursor: zoom-out; }
.std-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
/* 参考附件里的视频 / 文档条目（扫码页）：一行一条，点开由系统播放器或阅读器接管 */
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attach-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none; font-size: 15px;
}
.attach-item.video { background: #eef5fd; border-color: #cfe0f5; }
.attach-item.doc { background: #fbf7ee; border-color: #e8dcc4; }
.attach-item:active { opacity: .8; }
/* 分组折叠列表（点位与二维码等长列表用）：默认收起，点组名展开
   三级层级：频率(.pgroup) → 检查表(.psub) → 区域(.psub-area)
   缩进只在这里定义一次：区域标题与它下面表格的第一列共用同一个左边界，
   所以无论怎么调，"区域名"和"该区域的点位编号"永远对齐。 */
/* ===== L1 频率分组：页面里最重的一级——粗周期色条 + 大字标题 + 徽章统计 ===== */
.pgroup { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.pgroup-head {
  position: relative;
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 15px 18px 15px 24px; background: var(--card); border: none; font: inherit; color: inherit; cursor: pointer;
}
/* 左侧周期色条：一眼区分 每日/每周/每月 三个大组 */
.pgroup-head::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--freq, #3b82f6);
}
.pgroup-head[data-f="每日"] { --freq: #2563eb; }
.pgroup-head[data-f="每周"] { --freq: #8b5cf6; }
.pgroup-head[data-f="每月"] { --freq: #d97706; }
.pgroup-head:hover { background: #f7faff; }
.pgroup.open .pgroup-head { border-bottom: 1px solid var(--line); background: #f5f8ff; }
.pgroup-arrow { width: 16px; color: #94a3b8; font-size: 14px; flex: 0 0 auto; }
/* 频率名：三级里最大最重（17px/750），后面跟的统计做弱化小字 */
.pgroup-head b { font-size: 17px; font-weight: 750; color: var(--text); letter-spacing: .02em; }
.pgroup-head .pill {
  flex: 0 0 auto; font-size: 13px; font-weight: 700; padding: 2px 12px;
  background: color-mix(in srgb, var(--freq, #3b82f6) 12%, var(--card)); color: var(--freq, #2563eb);
  font-variant-numeric: tabular-nums;
}
.pgroup-head .hint { color: #8b9bb0; font-size: 13px; }
.pgroup .table-scroll { margin: 0; }
/* ===== L2 检查表子组：明显弱于 L1——小一号字、浅底、深缩进，区域信息最浅 ===== */
.psub { border-top: 1px dashed #e2e8f0; }
.psub-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  padding: 9px 14px 9px 46px; background: #fcfdff; border: none; font: inherit; color: inherit; cursor: default;
}
.psub-head:hover { background: #f4f8ff; }
.psub.open > .psub-head { background: var(--primary-soft); }
/* 组头左侧：可点开/收起（信息区）；右侧：编辑/替换检查表按钮 */
.psub-toggle {
  display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0;
  background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.psub-toggle:hover { color: var(--primary); }
.psub-toggle:hover .pgroup-arrow { color: var(--primary); }
/* 头部标题显示点位名称（多个用顿号连接）：超长省略号截断，悬浮 title 看全 */
.psub-toggle b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.psub-toggle .pill, .psub-toggle .hint { flex: 0 0 auto; }
.psub-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.psub-head b { font-size: 14px; font-weight: 650; color: #33415c; }
.psub-head .pill {
  flex: 0 0 auto; font-size: 12px; font-weight: 650; padding: 1px 9px;
  background: #eef2f7; color: #5a6b84; font-variant-numeric: tabular-nums;
}
.psub-head .hint { color: #9aa7ba; font-size: 12.5px; font-weight: 400; }
/* 组头的辅助文字不挤压主标题：过长时省略号收尾，不换行、不撑破一行 */
.pgroup-head b, .psub-head b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psub-head .hint, .pgroup-head .hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ===== L3 区域分组：左右留白 + 与下方表格首列同缩进（--pts-ind 是本层缩进） ===== */
.psub-area {
  --pts-ind: 44px;
  border-top: 1px dashed var(--line);
  padding: 0 16px 12px var(--pts-ind);
}
/* 区域标题：字号/颜色/字重都提上来，作为"这一块是哪些点位"的视觉锚点。
   竖条用 ::before 绝对定位放在文字左侧外边，所以文字左边界＝表格首列左边界。 */
.psub-area-h {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px;
  padding: 12px 0 8px;
  font-size: 14px; font-weight: 650; line-height: 1.45;
  color: var(--text);
}
.psub-area-h::before {
  content: '';
  position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.psub-area-h .area-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psub-area-h .hint {
  font-size: 12px; font-weight: 600; line-height: 1.7;
  color: var(--dim); background: #eef2f7;
  padding: 0 9px; border-radius: 999px; white-space: nowrap;
}
.psub-area .table-scroll { margin: 0; }

/* 区域表格：只作用于点位区（.psub-area），全局 table.list 及其它页面不受影响 */
/* ★ 统一列网格：每个区域块各自一张 <table>，默认的 auto 布局会"按各自内容"算列宽，
   全部展开时列位置会一节一节地跳（实测 18 个块里"区域"列有 14 种不同起点）。
   改成固定布局 + 百分比列宽后，所有区域块共用同一套列网格，"排列统一"才真正成立。 */
/* 列宽全部改成固定像素：原来是百分比，和"负责人120 + 二维码72 + 操作150"三根固定列混排时，
   百分比列会被挤得很窄，操作列的按钮放不下就向左溢出压住二维码。
   改成固定像素后，只有"点位名称"一列自适应，表格在常见桌面宽度下直接放得下，
   实在放不下就由 .table-scroll 横向滚动（列不会被挤扁）。 */
.psub-area table.list { table-layout: fixed; min-width: 760px; }
.psub-area table.list th:nth-child(1) { width: 68px; }   /* 编号 */
.psub-area table.list th:nth-child(2) { width: auto; }   /* 点位名称（自适应） */
.psub-area table.list th:nth-child(3) { width: 96px; }   /* 区域 */
.psub-area table.list th:nth-child(4) { width: 130px; }  /* 检查表 */
.psub-area table.list th:nth-child(5) { width: 56px; }   /* 检查项 */
.psub-area table.list th:nth-child(6) { width: 108px; } /* 负责人（姓名 + 电话） */
.psub-area table.list th:nth-child(7) { width: 72px; } /* 二维码（定宽：一张 52px 图 + 内边距） */
/* 操作列：固定宽 + 按钮允许换行。
   原来这里写的是 19%（百分比）。表格是 table-layout:fixed，窗口一窄这一列就只剩一百多像素，
   装不下"编辑/预览/删除"三个按钮；又因为按钮是 nowrap + justify-content:flex-end，
   放不下时会向左溢出，直接压在二维码上。改成固定 150px 并允许换行就彻底不会重叠。 */
.psub-area table.list th:nth-child(8) { width: 132px; }  /* 操作（编辑/预览/删除，放不下换行） */
.psub-area table.list th { padding: 0 14px 8px 0; letter-spacing: .03em; }
.psub-area table.list td {
  padding: 12px 14px 12px 0;
  /* ★ 二维码有 50+px 高，原来 top 对齐会让整行"上重下空"；统一垂直居中更整齐 */
  vertical-align: middle;
}
.psub-area table.list th:last-child, .psub-area table.list td:last-child { padding-right: 0; }
/* 编号：像序号标签，等宽数字防止各行抖位 */
.psub-area table.list td:nth-child(1) {
  font-size: 13px; font-weight: 650; color: var(--primary);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* 点位名称＝本行主信息；行高由二维码决定，所以名称/表名允许折两行而不撑高 */
.psub-area table.list td:nth-child(2) { font-weight: 600; word-break: break-word; }
/* 区域列：同一区域块内每行都重复，弱化处理让位给点位名称 */
.psub-area table.list td:nth-child(3) {
  font-weight: 500; color: #475569;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 检查表列同理弱化（已在 L2 组头显示过） */
.psub-area table.list td:nth-child(4) { font-size: 13px; color: var(--dim); word-break: break-word; }
.psub-area table.list td:nth-child(5) { font-size: 13px; font-weight: 600; color: var(--dim); }
/* 检查项是 num 列（值右对齐），表头跟着右对齐，列内不再一左一右错位 */
.psub-area table.list th:nth-child(5) { text-align: right; }
/* 二维码列：图给圆角白底，高度一致（列宽在列宽表里已定死 72px） */
.psub-area table.list td:nth-child(7) img {
  display: block; width: 52px; height: 52px;
  border-radius: 6px; background: var(--card);
}
/* 操作列：按钮成组贴右，放不下就换行（不再 nowrap，避免向左溢出压住二维码列） */
.psub-area table.list td:last-child { white-space: nowrap; }
.psub-area table.list td:last-child .btn-row { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* 窄屏：缩进和字号同步收一档，表格由全局 min-width + .table-scroll 横向滚动承接 */
@media (max-width: 780px) {
  .psub-area { --pts-ind: 24px; padding: 0 12px 12px var(--pts-ind); }
  .psub-head { padding-left: 20px; }
  /* 组头允许折行：标题不再被省略号吃掉，放不下时把"数量/区域"整块挪到第二行 */
  .pgroup-head, .psub-head { flex-wrap: wrap; row-gap: 4px; }
  .pgroup-head b, .psub-head b { white-space: normal; overflow: visible; text-overflow: clip; }
  .psub-head .hint, .pgroup-head .hint { white-space: normal; }
  .psub-area table.list th, .psub-area table.list td { padding-right: 10px; }
  .psub-area table.list td { padding-top: 10px; padding-bottom: 10px; }
  .psub-area table.list td:nth-child(7) img { width: 46px; height: 46px; }
  /* 操作列在窄屏装不下三个按钮，允许折成两行 */
  .psub-area table.list td:last-child .btn-row { flex-wrap: wrap; }
}
/* ============ 巡视记录列表：统计概览 / 标签页 / 卡片 / 分组 / 空态加载态 ============ */

/* 统计概览：做成可点的卡，点一下跳到对应标签页 */
.rec-stats { margin-bottom: 14px; }
.rec-stat { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.rec-stat:hover { border-color: #c5cfdd; box-shadow: 0 2px 8px rgba(16, 24, 40, .07); }
.rec-stat .v { color: var(--primary); }
.rec-stat.bad .v { color: var(--bad); }
.rec-stat.warn .v { color: var(--warn); }

/* 标签页：复用 .tabs 的视觉语言，但允许换行、并带计数小徽标 */
.rec-segrow { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rec-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: #e5eaf2; border-radius: 11px; }
.rec-seg button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 6px 13px; border-radius: 8px; border: none;
  background: transparent; color: var(--dim); font-family: inherit; font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.rec-seg button:hover { color: var(--text); }
.rec-seg button.on { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.rec-seg button em { font-style: normal; font-size: 11px; line-height: 1.6; padding: 0 6px; border-radius: 999px; background: #dde4ee; color: var(--dim); font-variant-numeric: tabular-nums; }
.rec-seg button.on em { background: var(--primary-soft); color: var(--primary); }

/* 工具行：5 列等宽网格 —— 搜索占 2 列，时间/位置/巡检人/结果/排序/分组/视图/清空各 1 列。
   固定列宽后两行严格对齐，不再因下拉文字长短参差不齐 */
.rec-tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: center;
  margin-bottom: 12px;
}
.rec-search {
  grid-column: span 2;
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card);
}
.rec-search span { font-size: 13px; color: var(--dim); flex: 0 0 auto; }
.rec-search input { border: none; padding: 9px 0; background: transparent; width: 100%; min-width: 0; }
.rec-search input:focus { outline: none; box-shadow: none; }
.rec-tools .rec-sel { width: 100%; min-width: 0; }
.rec-tools .btn { width: 100%; }

/* 日期范围：整行两列，仅「时间=自定义范围」时显示。
   单独用 [hidden] 规则明确隐藏，避免 .row2 的 display:grid 把 hidden 覆盖掉导致日期栏总是露出来 */
.rec-daterow {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin-bottom: 12px;
}
.rec-daterow[hidden] { display: none; }
/* 「记录列表」标题 + 视图切换按钮 横排：按钮贴在标题右侧，紧挨着它要切换的对象 */
.rec-listhead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 14px;
}
.rec-listhead h2 { margin: 0; }
.rec-listhead .btn { flex: 0 0 auto; }
.rec-fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rec-fld > span { font-size: 12px; color: var(--dim); }
.rec-fld input, .rec-fld select { width: 100%; }

/* 记录卡片：左边色条表达等级/超期，扫一眼就知道哪条要处理 */
.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-card {
  position: relative; border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 10px; padding: 12px 14px; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.rec-card:hover { border-color: #c5cfdd; box-shadow: 0 2px 10px rgba(16, 24, 40, .07); }
.rec-card.high { border-left-color: var(--warn); background: linear-gradient(90deg, color-mix(in oklab, var(--warn) 7%, var(--card)) 0%, var(--card) 42%); }
.rec-card.overdue { border-left-color: var(--bad); background: linear-gradient(90deg, color-mix(in oklab, var(--bad) 7%, var(--card)) 0%, var(--card) 42%); }
.rec-card.overdue.high { border-left-color: var(--bad); }

.rec-l1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rec-time { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-no { margin-left: auto; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
/* 等级徽标：高/中/低（纯色块，比 pill 更有"等级"感） */
.rec-lv {
  display: inline-block; min-width: 20px; text-align: center;
  padding: 0 6px; border-radius: 5px; font-size: 12px; font-weight: 700; line-height: 1.7;
  background: #e9eef5; color: var(--dim);
}
.rec-lv.bad { background: var(--bad-bg); color: var(--bad); }
.rec-lv.warn { background: var(--warn-bg); color: var(--warn); }
.rec-lv.info { background: var(--primary-soft); color: var(--primary); }
.rec-over {
  font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 999px;
  background: var(--bad-bg); color: var(--bad); white-space: nowrap;
}

.rec-l2 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; font-size: 14px; }
.rec-l2 b { color: var(--text); font-weight: 650; }
.rec-l2 i { color: var(--line); font-style: normal; }
.rec-l2 .hint { font-size: 12px; }

/* 隐患描述：卡片里最重要的一行，给它一条浅色底纹把它从其它信息里拎出来 */
.rec-desc {
  margin-top: 8px; padding: 7px 10px; border-radius: 8px; font-size: 13px; line-height: 1.6;
  background: #fdf6f5; color: #7f1d1d; border: 1px solid #f7dfdd; word-break: break-word;
}
.rec-desc.none { background: #f6f8fb; color: var(--dim); border-color: var(--line); }
.rec-desc-k {
  display: inline-block; margin-right: 7px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 700; background: var(--bad); color: #fff; vertical-align: 1px;
}
.rec-desc.none .rec-desc-k { background: #cbd5e1; color: #475569; }

.rec-l4 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; font-size: 13px; color: #475569; }
.rec-kv i { font-style: normal; color: var(--dim); font-size: 12px; margin-right: 5px; }
.rec-over-txt { color: var(--bad); font-weight: 600; }
.rec-thumbs { display: flex; align-items: center; gap: 6px; }
.rec-thumbs .rec-thumb { width: 42px; height: 42px; margin: 0; }
.rec-ops { margin-left: auto; display: flex; gap: 6px; }

.rec-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* 分组：组头做成独立条，卡片直接排在下面 —— 避免"页面卡 → 组框 → 记录卡"三层盒子嵌套 */
.rec-group { margin-bottom: 14px; }
.rec-group-h {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 14px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; color: inherit; cursor: pointer;
}
.rec-group-h:hover { background: #eef3fa; }
.rec-group-h b { font-size: 14px; font-weight: 650; }
.rec-group-b { padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.rec-group-b .table-scroll { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }

/* 加载更多 */
.rec-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 0 4px; }

/* 加载态：列表区顶部一条流动的细进度条 + 骨架屏 */
.rec-loadbar { height: 3px; margin: -2px 0 12px; border-radius: 3px; overflow: hidden; background: var(--primary-soft); }
.rec-loadbar::after { content: ''; display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #93c5fd, #2563eb, #93c5fd); animation: recflow 1.1s linear infinite; }
@keyframes recflow { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.rec-skel { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.rec-skel .sk-l { display: block; height: 12px; border-radius: 6px; margin-bottom: 9px; background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%); background-size: 400% 100%; animation: recsk 1.3s ease infinite; }
.rec-skel .sk-l.short { width: 42%; }
.rec-skel .sk-l:last-child { margin-bottom: 0; width: 68%; }
@keyframes recsk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 空状态 */
.rec-empty { text-align: center; padding: 40px 16px; }
.rec-empty-ico { font-size: 38px; line-height: 1; margin-bottom: 12px; }
.rec-empty-t { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 6px; }
.rec-empty-s { font-size: 13px; color: var(--dim); margin-bottom: 16px; }

/* 表格视图里的强调行 */
table.list tbody tr.row-overdue td { background: #fef7f6; }
table.list tbody tr.row-high td { background: #fffbf3; }
.pill.info { background: var(--primary-soft); color: var(--primary); }

/* 中窄屏：工具行退为 2 列，搜索独占整行 */
@media (max-width: 900px) {
  .rec-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-search { grid-column: 1 / -1; }
}
/* 窄屏：工具行退为单列，卡片操作按钮不贴边 */
@media (max-width: 680px) {
  .rec-tools { grid-template-columns: 1fr; }
  .rec-search { grid-column: auto; }
  .rec-daterow { grid-template-columns: 1fr; }
  .rec-l4 { gap: 6px 10px; }
  .rec-ops { margin-left: 0; width: 100%; }
  .rec-ops .btn { flex: 1 1 auto; }
  .rec-no { display: none; }
}

/* 巡视记录行内缩略图：直接看照片，不用再点"看照片" */
.rec-thumb { width: 54px; height: 54px; border-radius: 8px; margin: 2px 4px 2px 0; }
.rec-thumb:active { border-color: var(--primary); }
.thumb-more {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
  background: #f1f4f9;
  border-radius: 8px;
  padding: 4px 6px;
  vertical-align: middle;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  z-index: 60;
}
.overlay > .sheet {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 880px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .3);
}
.overlay .close { float: right; }

/* 按钮行里的小下拉（导出分类归档包时选分册维度） */
.inline-sel {
  /* 全局 select 是 width:100%，放在按钮行里会独占一整行，把后面的按钮挤下去——这里必须收窄 */
  width: auto; min-width: 128px; max-width: 200px; flex: 0 0 auto;
  height: 34px; padding: 0 8px; border-radius: 8px; font: inherit; font-size: 13px;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); cursor: pointer;
}

/* ===== 角色权限：复选框组 + 权限树 ===== */
.chkbox { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; line-height: 1.4; }
.chk input { width: 15px; height: 15px; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.ptree-wrap { max-height: 380px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.ptree { line-height: 1.7; }
.ptree .chk b { font-weight: 600; color: var(--ink); }
.ptree .hint { font-size: 12px; color: var(--muted); }

/* 图片预览浮层：独立于 #modal，关掉它不会影响底下的详情弹窗（z-index 要高于 .overlay 的 60） */
.img-viewer {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(15, 23, 42, .86);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; cursor: zoom-out;
}
.img-viewer img {
  max-width: 94vw; max-height: 84vh; border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5); background: #0b1220;
}
.img-viewer-tip { color: #cbd5e1; font-size: 13px; }

.item-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px 15px; margin-bottom: 10px; background: var(--card); }
.item-card.bad { border-color: #f3c4c4; background: var(--bad-bg); }
.item-card.ok { border-color: #c7e5d3; }
.item-title { font-weight: 600; }
.item-std { font-size: 12px; color: var(--dim); margin-top: 3px; }
.std-photo { margin-top: 8px; }
.std-photo img { max-width: 150px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer; }
.judge { display: flex; gap: 8px; margin-top: 10px; }
.judge button {
  flex: 1;
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.judge button.on-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.judge button.on-bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); font-weight: 600; }
.photo-line { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-line input[type=file] { display: none; }
/* 拍照 / 选图 永远排在同一行：两个按钮各占一半，窄屏或字号放大也不换行；提示语单独占下一行 */
.photo-btns { display: flex; gap: 10px; flex: 1 1 100%; }
.photo-btns .photo-pick { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; }
.photo-line .hint { flex: 1 1 100%; }
.photo-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 15px;
  border: 1px dashed #b8c5d8;
  border-radius: 9px;
  color: var(--dim);
  cursor: pointer;
  background: var(--card);
}
.photo-pick:hover { border-color: var(--primary); color: var(--primary); }
.note-line { margin-top: 8px; }
.req { color: var(--bad); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .3);
}
.toast.err { background: var(--bad); }

.login-box { max-width: 360px; margin: 10vh auto; }
.hint { font-size: 12px; color: var(--dim); }
.big-cta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.qr-card { border: 1px solid #ccc; border-radius: var(--radius); padding: 12px; text-align: center; break-inside: avoid; background: var(--card); }
.qr-card img { width: 100%; max-width: 220px; }
.qr-card .n { font-weight: 600; margin-top: 6px; }
.qr-card .c { font-size: 12px; color: var(--dim); }
.qr-card .t { font-size: 12px; color: var(--dim); margin-top: 6px; }

@media print {
  body { background: var(--card); }
  .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; margin-left: 0 !important; }
  .card, .stat, .qr-card { box-shadow: none; }
  .qr-card { page-break-inside: avoid; }
}

@media (max-width: 680px) {
  .wrap { padding: 14px 12px; }
  .stat .v { font-size: 23px; }
}

@media (min-width: 900px) {
  .topbar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    flex-direction: column;
    /* ★ 关键修复：基础 .topbar 是 flex-wrap:wrap。竖排之后 wrap 的含义变成"装不下就换一列"，
       窗口一矮或缩放一大，菜单就被甩到侧栏右边、超出 224px 被裁掉。竖排必须 nowrap。 */
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 20px 14px;
    /* 侧栏底色：暖黑漆（原为 #101a31→#0b1220 的冷蓝渐变，与金/铜绿系统冲突）*/
    background: var(--sidebar);
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, .06);
    /* 窗口矮、浏览器缩放比例大时，侧栏自己滚动，别把底部菜单裁掉又滚不动 */
    overflow-y: auto;
    /* ★ 兜底：万一还有元素算宽算错，也不允许横向溢出到侧栏外被遮挡 */
    overflow-x: hidden;
    /* 纵向滚动条常占位，避免"内容稍高就出现滚动条→菜单横向抖动几像素" */
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
  }
  /* flex 子项默认 min-height:auto 会顶住不收缩、overflow 不生效；这里允许滚动但别压缩菜单项 */
  .topbar .brand {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 6px 10px 18px;
    width: 100%;
    /* 品牌名/副标题不换行，窗口再窄也是一行，避免高度忽高忽低把菜单整体顶动 */
    white-space: nowrap;
    overflow: hidden;
  }
  .topbar .brand strong, .topbar .brand span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .topbar .brand strong { color: #fff; font-size: 17px; }
  .topbar .brand span { color: #8296bd; }
  .topbar .btn-row {
    /* 可伸缩：纵向空间不足时自己收缩交给侧栏滚动，而不是往外换列 */
    flex: 1 1 auto;
    flex-direction: column;
    /* ★ 关键修复：基础 .btn-row 是 wrap + justify-content:flex-end，
       竖排后会变成"装不下换列"和"从底部往上排"。侧栏里必须 nowrap + 从头排。 */
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 3px;
    min-height: 0;
    width: 100%;
  }
  .topbar .btn {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    border: none;
    color: #b7c3db;
    padding: 11px 14px;
    border-radius: 9px;
    min-height: 42px;
  }
  /* ★ 统一侧栏内所有入口的字号、行高、对齐方式：
     nav.js 生成的是 <a class="btn">（14px、行高继承 1.55），页面自带的"退出"等是
     <button class="btn sm">（13px、浏览器默认 line-height:normal）——两者混在一起就出现
     大小不一、行距不一、高低不齐。这里只改排版，不动配色（hover/primary 的样式照旧）。 */
  .topbar .btn, .topbar .btn.sm, .topbar button.btn {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 11px 14px;
    font-size: 14px;
    line-height: 20px;      /* 固定行高：1.55 这种倍数在不同缩放下舍入不同，会让行距忽大忽小 */
    text-align: left;
    justify-content: flex-start;
    white-space: nowrap;    /* 菜单名不换行，保证每项都是一行、高度一致 */
    overflow: hidden;
    text-overflow: ellipsis;/* 极端窄时截断成…，绝不溢出被遮挡 */
  }
  .topbar .btn:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
  .topbar .btn.primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    justify-content: center;
  }
  .topbar .btn.danger { color: #f3a1a1; }
  .wrap { margin-left: var(--sidebar-w); }
  .overlay > .sheet { max-width: 920px; }
}

/* 窄屏（或浏览器放大到视口不足 900px）时侧栏会收成顶部横条，
   同样统一 nav 菜单与页面自带按钮的字号行高，避免两种形态来回切时文字大小跳变。 */
@media (max-width: 899px) {
  .topbar .btn, .topbar .btn.sm, .topbar button.btn {
    font-size: 13px;
    line-height: 20px;
    white-space: nowrap;
  }
}

.topbar .nav-group { display: none; }
.topbar .nav-item { white-space: nowrap; }

@media (max-width: 899px) {
  .topbar .btn-row { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar .nav-item { flex: 0 0 auto; }
}

@media (min-width: 900px) {
  .topbar .nav-group { display: block; margin: 16px 12px 4px; font-size: 11px; letter-spacing: .1em; color: #60718f; }
  .topbar .nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; }
}

/* ---------------- 检查表：点名称改名 / 周期下拉 / 早中晚时段点选 ---------------- */
.tpl-name { cursor: pointer; border-bottom: 1px dashed transparent; }
.tpl-name:hover { border-bottom-color: var(--primary); color: var(--primary); }
.tpl-name.editing { cursor: default; border-bottom-color: transparent; color: inherit; }
.tpl-rename-input { display: inline-block; width: auto; min-width: 190px; padding: 5px 10px; font-size: 16px; font-weight: 600; }
.tpl-cycle-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-cycle-row .cycle-sel { width: auto; min-width: 132px; padding: 7px 10px; font-size: 14px; }
.slot-chips { display: inline-flex; gap: 6px; }
.chip {
  min-height: 30px; padding: 3px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--dim);
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: #c5cfdd; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.cycle-tip { font-size: 12px; color: var(--dim); }

/* ---------------- 手写签名区（巡视 / 报修 / 配送商上传共用） ---------------- */
.sig-wrap { margin: 12px 0; }
.sig-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.sig-head b { font-size: 15px; }
.sig-state { font-size: 13px; font-weight: 600; }
.sig-state.ok { color: #16a34a; }
.sig-state.warn { color: #94a3b8; }
.sig-box { position: relative; }
.sigpad {
  width: 100%;
  height: 180px;
  border: 2px solid #cfd8e3;
  border-radius: 12px;
  background: var(--card);
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.sigpad.need { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
/* 防误触：签名框默认锁定（不接手势），点「开始签名」才解锁；解锁后蓝色高亮提示可以写 */
.sigpad { pointer-events: none; }
.sigpad.armed { pointer-events: auto; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.sig-arm {
  position: absolute;
  left: 2px; right: 2px; top: 2px; height: calc(100% - 4px);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed #cfd8e3; border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  color: #2b6cb0; font-size: 18px; font-weight: 600; font-family: inherit; cursor: pointer;
  /* 签名区是操作区不是滚动区：不设这条，手机滑动会被浏览器当成滚页面并在中途发 pointercancel，
     导致"在框里划一下"完全没反应（2026-10-19 修） */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.sig-box { touch-action: none; }
.sig-arm:active { background: #eef4fb; }
.sig-arm.done { border-style: solid; border-color: #86efac; color: #15803d; background: rgba(240, 253, 244, .95); }
.sig-arm.armed {
  left: auto; right: 8px; top: 8px; height: auto; width: auto;
  padding: 7px 16px; border: none; border-radius: 999px;
  background: #2563eb; color: #fff; font-size: 15px;
}
/* 全屏手写浮层：手写时页面滑不到，从根上避免"从旁边划过把签名蹭花/签上别的」 */
.sig-modal {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(2, 6, 15, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; touch-action: none; overscroll-behavior: contain;
}
.sig-modal-card {
  width: 100%; max-width: 560px; background: var(--card); color: #0f172a;
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
}
.sig-modal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sig-modal-head b { font-size: 19px; }
.sig-modal-head .sig-state { font-size: 13px; font-weight: 600; }
.sig-modal-pad { position: relative; }
.sig-modal-pad .sigpad { height: 300px; }
.sig-modal-act { display: flex; gap: 10px; }
.sig-modal-act .btn { flex: 1; justify-content: center; min-height: 46px; font-size: 16px; }
@media (max-width: 680px) { .sig-modal-pad .sigpad { height: 240px; } }
.sig-ph {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: #b6c2d1;
  font-size: 17px;
  pointer-events: none;
}

@media (max-width: 680px) {
  .sigpad { height: 200px; }
}

/* =====================================================================
   响应式适配层（管理端 admin.html 为主要目标，规则同样惠及 stock /
   ingredient / import 等复用 app.css 的页面）
   ---------------------------------------------------------------------
   设计原则：
   1) >1024px 完全不动——桌面端 224px 固定侧栏 + 5 列统计卡的视觉一律保留；
   2) 1024px 及以下侧栏收成顶部横条，入口按钮由「单行横向滚动」改为
      「网格换行」，根治横向滚动容器首项被裁、以及用户看不到完整菜单的问题；
   3) 480px 以下进一步压缩字号与内边距，表格交由 .table-scroll 横向滚动，
      页面本身任何断点都不产生横向滚动条；
   4) 所有新增规则都写在文件末尾，只在max-width 媒体查询内生效，
      不会覆盖桌面端样式。
   ===================================================================== */

/* ---------- 通用：任何断点都不允许页面级横向滚动 ---------- */
@media (max-width: 1024px) {
  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }
  /* 顶栏是 sticky，横向滚动条会露在body 上，单独再兜一层 */
  .topbar { max-width: 100vw; }
}

/* ---- 900~1024px：仍是桌面侧栏形态，只把栏宽收窄一点，
       避免 1024宽的平板上内容区被224px 侧栏挤到不足 780px ---- */
@media (min-width: 900px) and (max-width: 1024px) {
  :root { --sidebar-w: 188px; }
  .topbar .btn { padding: 10px 11px; min-height: 38px; }
  .wrap { padding: 18px 18px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================ 平板：481px ~ 899px ============================ */
@media (min-width: 481px) and (max-width: 899px) {
  /* 顶部横条：品牌与按钮同一行排不下时，品牌独占一行、按钮另起一行 */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 10px 16px;
  }
  .topbar .brand { flex: 0 0 auto; }
  .topbar .btn-row {
    flex: 0 1 auto;
    display: grid;
    /* 固定 3 列：auto-fit 在 481~899px 会按最小内容宽算出十几列，
       每个按钮被压成单字竖排，完全不可读 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    overflow: visible;
    max-height: 152px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-right: 2px;
  }
  .topbar .btn, .topbar .btn.sm, .topbar button.btn {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    padding: 6px 4px;
    font-size: 12.5px;
    line-height: 17px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .btn-row .bell { grid-column: auto; padding: 6px 4px; }

  /* 内容区：桌面端的左边距在此区间不需要 */
  .wrap { margin-left: 0; padding: 18px 18px; }

  /* 统计卡：平板一行放 3 张，比桌面 5 张更易读，又不像手机 2 列那么挤 */
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* tabs：保持单行，超出时自身横向滚动，不把页面撑宽 */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; }
}

/* ============================== 手机：<= 480px ============================== */
@media (max-width: 480px) {
  :root { --sidebar-w: 0px; }

  body { font-size: 14px; }

  /* 顶栏：品牌一行、按钮两行网格。所有入口一次性全部可见，
     不再依赖横向滚动，也就彻底消除"第一项被切掉一半"的观感 */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar .brand { flex: 0 0 auto; }
  .topbar .btn-row {
    flex: 0 1 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    overflow: visible;
    /* 菜单项有 18 个，全铺开会把首屏内容顶到看不见。限高后自己纵向滚动——
       与桌面侧栏 overflow-y:auto 的处理一致，保证首屏始终能看到统计卡 */
    max-height: 152px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-right: 2px;
  }
  .topbar .btn, .topbar .btn.sm, .topbar button.btn {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    padding: 6px 4px;
    font-size: 12.5px;
    line-height: 17px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .btn-row .bell { grid-column: auto; padding: 6px 4px; }

  .wrap { margin-left: 0; padding: 14px 12px 28px; }
  .wrap.narrow { max-width: 100%; }

  /* 统计卡：2 列，与桌面同色同字号层级，仅数值略缩以免换行 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 11px; }
  .stat .v { font-size: 22px; }

  /* 所有多列网格在手机上收成单列（原仅 680px 断 row2/row3，这里覆盖 row3 等） */
  .row2, .row3 { grid-template-columns: minmax(0, 1fr); }

  /* tabs：单行横向滑动，长按/滑动都能切页，页面本身不出现横向滚动条 */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 10px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; padding: 7px 13px; font-size: 13px; }

  /* 卡片内边距收紧，还给内容更多宽度 */
  .card { padding: 14px 13px; border-radius: 12px; }
  .card > h2 { font-size: 15px; }

  /* 表格：容器自身横向滚动（宽表列多，强行压缩会挤成一条线） */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* 负边距让宽表"出血"到卡片边缘，视觉上像桌面端的整宽表格 */
    margin: 0 -13px;
    padding: 0 13px;
  }
  /* ★ 关键：table 默认 width:100%，在 390px 屏上会被压到几百px，
     中文逐字竖排（截图里"蔬菜摘洗干净"一行一个字）。
     给一个下限宽度，让 .table-scroll 真正产生横向滚动而不是压塌列。 */
  .table-scroll > table.list { min-width: 560px; }
  /* 巡视点位表有 8 列，固定列宽合计约 660px（68+96+130+56+108+72+132），
     560 的下限会把「点位名称」这一列压成 0 宽、中文逐字竖排（一行一个字，行高飙到 200px+）。
     给它单独的下限：宁可横向滚动，也不压塌名称列。 */
  .psub-area .table-scroll > table.list { min-width: 860px; }
  /* 点位表不做"出血"到卡片边缘：出血会让表头比上面的区域标题右移 13px，左右对不齐
     （桌面端本来就是对齐的，这里保持一致）。 */
  .psub-area .table-scroll { margin: 0; padding: 0; }
  table.list th, table.list td { padding-right: 8px; }
  /* 单元格内容不再被压成竖排：长文本允许正常换行，数字列不换行 */
  .table-scroll > table.list td,
  .table-scroll > table.list th { word-break: normal; overflow-wrap: break-word; }

  /* 表单与按钮：手机上点按目标不小于 40px */
  input[type=text], input[type=password], input[type=date],
  input[type=number], select, textarea { font-size: 16px; /* 防iOS 自动放大 */ padding: 10px 11px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }

  /* 分组折叠头：手机上加高一点，便于手指点开 */
  .pgroup-head { padding: 12px 12px; }
  .psub-head { padding: 10px 12px; }

  /* 弹窗：手机改为「贴底抽屉」，最大高度 88vh，超出内部滚动，
     不再像桌面那样居中一大块把底下内容全遮住 */
  .remind-modal-mask { align-items: flex-end; padding: 0; }
  .remind-modal {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px 16px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .remind-modal h2 { font-size: 16px; }
  .remind-od {
    /* 长名单里包含"点位名（负责人） 限X"的连续文本，必须允许在中文/括号处断行 */
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.7;
  }
  .remind-foot { flex-direction: row; gap: 8px; }
  .remind-foot .btn { flex: 1 1 0; min-width: 0; justify-content: center; }

  /* 全屏签名浮层：手机上按钮与画布都要够大 */
  .sig-modal { padding: 0; }
  .sig-modal-card { max-width: 100%; height: 100%; border-radius: 0; padding: 14px 12px; }
  .sig-modal-pad .sigpad { height: 46vh; }

  /* 附件图片预览（手机）：屏幕窄，预览框靠上放、占位控制在 60vh 以内，
     下半屏留给底下的列表与"替换/删除"按钮，保证不挡住还能操作 */
  .att-view { padding: 8px 8px 14px; align-items: flex-end; }
  .att-view-box { max-width: 92vw; max-height: 60vh; padding: 8px; border-radius: 12px; gap: 6px; }
  .att-view-box img, .att-view-box video { max-height: 50vh; }
  .att-view-close { width: 28px; height: 28px; min-height: 28px; font-size: 18px; }
  /* 放大灯箱在手机上占满，但这是主动"放大"后的状态，点任意处关闭 */
  .att-view.zoomed { align-items: center; padding: 4px; }
  .att-view.zoomed .att-view-box { max-width: 96vw; max-height: 92vh; }
  .att-view.zoomed .att-view-box img { max-height: 86vh; }
}

/* ---------- 手机横屏（宽>高 且 高度很小）：把纵向空间让给内容 ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { padding: 6px 12px; gap: 6px; }
  .topbar .btn, .topbar .btn.sm, .topbar button.btn { min-height: 34px; padding: 5px 6px; }
  .wrap { padding: 12px 12px 24px; }
  .remind-modal { max-height: 92vh; }
  .sig-modal-pad .sigpad { height: 60vh; }
}

/* =====================================================================
   表单增强组件：设备名称组合框（可下拉可手输）+ 问题现象勾选
   用于报修页；其他需要"预置项 + 自由输入"的字段也可直接复用
   ===================================================================== */

/* ---------- 组合框：输入框 + 下拉面板 ---------- */
.combo { position: relative; }
.combo > input[type=text] { padding-right: 40px; width: 100%; }
.combo-arrow {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 38px;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #7c8ba1; border-radius: 0 9px 9px 0;
}
.combo-arrow:hover { color: var(--primary); background: #f2f6fd; }
.combo-arrow svg { transition: transform .16s ease; }
.combo.open .combo-arrow svg { transform: rotate(180deg); }
.combo.open > input[type=text] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

.combo-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 60;
  background: var(--card); border: 1px solid #dbe3ef; border-radius: 11px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .16);
  max-height: 268px; overflow-y: auto; padding: 6px;
  -webkit-overflow-scrolling: touch;
  animation: comboIn .13s ease;
}
@keyframes comboIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.combo-pop[hidden] { display: none; }
/* 屏幕下方空间不足时向上展开，避免面板被视口裁掉（手机窄屏常见） */
.combo.up .combo-pop { top: auto; bottom: calc(100% + 5px); }

.combo-group { font-size: 11px; color: #94a3b8; letter-spacing: .06em; padding: 7px 9px 3px; }
.combo-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: none; background: transparent; border-radius: 7px;
  font-family: inherit; font-size: 13.5px; color: #1a2436; text-align: left;
  cursor: pointer; line-height: 1.5;
}
.combo-opt:hover, .combo-opt.active { background: #eef4ff; color: var(--primary-2); }
.combo-opt.on { font-weight: 600; color: var(--primary); }
.combo-opt .tick { margin-left: auto; font-size: 12px; color: var(--primary); }
.combo-opt mark { background: #fde9a8; color: inherit; border-radius: 2px; padding: 0 1px; }

/* 手输的自定义值：单独一行提示，点一下就确认，避免"既没选中也没取消"的模糊状态 */
.combo-custom {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 4px; padding: 9px 10px;
  border: 1px dashed #c9d6e8; background: #fbfcfe; border-radius: 8px;
  font-family: inherit; font-size: 13px; color: #33415c; text-align: left; cursor: pointer;
}
.combo-custom:hover { border-color: var(--primary); background: #f2f7ff; color: var(--primary-2); }
.combo-custom b { color: var(--primary); font-weight: 650; }
.combo-custom .ico { flex: 0 0 auto; color: #94a3b8; }
.combo-empty { padding: 14px 10px; font-size: 12.5px; color: #94a3b8; text-align: center; }

/* 当前值状态徽标：命中预置项 / 自定义，一眼能分清 */
.combo-state {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px; font-size: 11.5px; color: var(--dim);
}
.combo-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; }
.combo-state.is-preset { color: var(--ok); }
.combo-state.is-preset::before { background: var(--ok); }
.combo-state.is-custom { color: var(--warn); }
.combo-state.is-custom::before { background: var(--warn); }

/* ---------- 问题现象：可勾选胶囊 ---------- */
.sym-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 2px; }
.sym {
  position: relative; display: inline-flex; align-items: center;
  min-height: 36px; padding: 6px 13px 6px 11px;
  border: 1px solid #dbe3ef; border-radius: 999px; background: var(--card);
  font-size: 13.5px; color: #33415c; cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: border-color .13s, background .13s, color .13s;
}
.sym input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.sym > span { display: inline-flex; align-items: center; gap: 7px; }
.sym > span::before {
  content: ""; width: 15px; height: 15px; flex: 0 0 auto;
  border: 1.5px solid #c3cddd; border-radius: 4px; background: var(--card);
  transition: border-color .13s, background .13s;
}
.sym:hover { border-color: #b9c8dd; background: #fafbfe; }
.sym input:checked + span::before {
  border-color: var(--primary);
  background: var(--primary) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.2l2.6 2.6 6-6' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/13px no-repeat;
}
.sym input:checked ~ * { color: var(--primary-2); }
.sym:has(input:checked) { border-color: var(--primary); background: #eef4ff; color: var(--primary-2); font-weight: 600; }
.sym:focus-within { box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

/* 「其他」用虚线 + 金色区分：它不是一个普通选项，而是入口 */
.sym-other { border-style: dashed; color: #8a6d1f; border-color: #e2cf9a; }
.sym-other > span::before { border-color: #d9c07a; }
.sym-other:has(input:checked) { border-style: solid; border-color: var(--gold, #c9a227); background: #fdf8e8; color: #8a6d1f; }
.sym-other input:checked + span::before { background-color: var(--gold, #c9a227); border-color: var(--gold, #c9a227); }

/* 「其他」的补充输入：勾选后才出现，带一点滑入，避免整块内容突然跳动 */
.sym-extra { margin-top: 10px; }
.sym-extra[hidden] { display: none; }
.sym-extra > input { width: 100%; }
.sym-extra.show { animation: symSlide .16s ease; }
@keyframes symSlide { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.sym-extra .hint { display: block; margin-top: 5px; }

/* 列表里的症状标签 */
.symtag {
  display: inline-block; padding: 1px 7px; margin: 0 4px 3px 0;
  border-radius: 5px; background: #eef4ff; color: var(--primary-2);
  font-size: 11.5px; line-height: 1.6; white-space: nowrap;
}
.symtag.other { background: #fdf8e8; color: #8a6d1f; }
.symtag.more { background: #f1f4f9; color: var(--dim); }

/* 报修台账「问题项 / 描述」列：勾选项带 ✓ 标记，下面一行是问题描述 */
.symcell { min-width: 168px; }
.symchk {
  display: inline-block; padding: 1px 7px; margin: 0 4px 3px 0;
  border-radius: 5px; background: #eef4ff; color: var(--primary-2);
  font-size: 11.5px; line-height: 1.6; white-space: nowrap;
}
.symchk.other { background: #fdf8e8; color: #8a6d1f; }
.symdesc {
  margin-top: 1px; font-size: 11.5px; color: var(--dim); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px;
}

@media (max-width: 480px) {
  .sym { min-height: 38px; padding: 7px 12px; font-size: 13px; }
  .combo-pop { max-height: 46vh; }
  .combo-opt { padding: 10px; font-size: 14px; }
}

/* 症状区必须是 div.field（内部是 label，不能嵌套 label），补一条与 label.field 一致的排版 */
div.field { display: block; margin-bottom: 12px; }
div.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
div.field > span .opt { font-weight: 400; color: #9aa7ba; margin-left: 4px; }

/* hidden 属性被 display:inline-flex 覆盖会失效，显式兜一层（否则空状态下会留一个孤零零的圆点） */
.combo-state[hidden] { display: none; }

/* ============================================================================
 * 视觉层 · Neo Kinpaku 落地
 * 只覆盖"形态确实要变"的组件；颜色/圆角已由令牌带动，这里补的是结构性的部分。
 * ==========================================================================*/

/* 正文：15px / 1.7（原 14px / 1.55）。管理台信息密，行高略放宽更好读 */
body {
  font-size: var(--fs-15);
  line-height: 1.7;
  letter-spacing: .002em;
  background: var(--paper);
  color: var(--ink-body);
}
h1, h2, h3, h4 { letter-spacing: -.01em; color: var(--ink); }

/* 顶栏：去掉毛玻璃（规范明确"无玻璃"）。
   注意：桌面端顶栏其实是左侧深色栏（@media min-width:900px 里用 --sidebar），
   这里只能改"窄屏顶部横条"的背景，否则会把深色侧栏刷成浅色、白字全看不见。 */
.topbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 899px) {
  .topbar { background: var(--paper); }
}
.brand span { color: var(--ink-faint); }

/* 卡片：4px 圆角、无投影、发丝线 */
.card {
  border-radius: var(--r-sm);
  border-color: var(--rule);
  box-shadow: none;
  padding: 20px 24px;
}
.card > h2, .card h2 { font-size: var(--fs-18); font-weight: 600; }
.card .sub, .card h2 .sub { font-size: var(--fs-12); color: var(--ink-muted); font-weight: 400; }

/* 按钮：2px 圆角、主按钮金填充 + 深墨字（品牌锚就落在这里）*/
.btn {
  border-radius: var(--r-xs);
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  color: var(--ink-body);
  box-shadow: none;
  font-size: var(--fs-14);
  min-height: 40px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--paper-deep); border-color: var(--rule-strong); }
.btn.sm { border-radius: var(--r-xs); font-size: var(--fs-13); min-height: 30px; }
.btn.primary {
  background: var(--gold-rich);
  border-color: var(--gold-deep);
  color: var(--ink);
  box-shadow: none;
  font-weight: 600;
}
.btn.primary:hover { background: var(--gold-pale); border-color: var(--gold-deep); }
.btn.danger { color: var(--vermilion); border-color: oklch(52% .16 35 / .3); background: var(--paper-raised); }
.btn.danger:hover { background: oklch(96% .03 35); border-color: var(--vermilion); }

/* 表单：4px 圆角、纸底内凹、发丝线；焦点用铜绿（规范：4px offset 描边）*/
input, select, textarea {
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink-body);
  font-size: var(--fs-14);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--patina);
  outline-offset: 1px;
  border-color: var(--patina-deep);
}
:focus-visible { outline: 2px solid var(--patina); outline-offset: 4px; }

/* 表格：表头 11px 字距拉开（规范"tracked labels are short"），单元格用发丝线 */
table.list th {
  font-size: var(--fs-11);
  letter-spacing: .1em;
  color: var(--ink-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--rule-strong);
}
table.list td { border-bottom: 1px solid var(--rule); }
table.list tbody tr:hover td { background: var(--paper-deep); }

/* 状态徽标：小圆角方片（不再一律药丸），11px */
.pill {
  border-radius: var(--r-xs);
  font-size: var(--fs-11);
  padding: 1px 8px;
  letter-spacing: .02em;
}
.chip { border-radius: var(--r-xs); background: var(--paper-raised); font-size: var(--fs-13); }
.chip:hover { border-color: var(--rule-strong); }
.chip.on { background: var(--patina-pale); border-color: var(--patina-deep); color: var(--patina-ink); }

/* 标签页：2px 圆角、下沉底槽、激活项白面 */
.tabs { border-radius: var(--r-xs); background: var(--paper-deep); padding: 3px; gap: 2px; }
.tabs button { border-radius: var(--r-xs); }

/* 浮层：唯一允许保留投影的层级；遮罩改为实色纱（去掉模糊）*/
.overlay {
  background: oklch(18% .02 95 / .55);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.overlay > .sheet {
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 48px oklch(18% .02 95 / .18);
}

/* 桌面侧栏（黑漆）：激活项用金色细竖条 + 淡金底，不用整块高亮 */
@media (min-width: 900px) {
  /* 品牌区下方一条金色发丝缝：规范里的"gold seam"，只做结构线，不做装饰 */
  .topbar .brand {
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid oklch(74% .09 82 / .32);
  }
  .topbar .brand strong { color: oklch(96% .004 95); letter-spacing: .04em; }
  .topbar .brand span { color: oklch(64% .008 95); }
  .topbar .btn, .topbar .nav-item { color: oklch(72% .01 95); }
  .topbar .btn:hover { background: oklch(100% 0 0 / .06); color: oklch(97% 0 0); }
  .topbar .nav-group { color: oklch(58% .008 95); letter-spacing: .12em; }
  .topbar .nav-item.active {
    background: var(--gold-veil);
    color: var(--gold-pale);
    box-shadow: inset 2px 0 0 var(--gold);
  }
  .topbar .btn.primary {
    background: var(--gold-rich);
    border: 1px solid var(--gold-deep);
    color: var(--ink);
  }
}

/* 嵌套卡片压平：规范明确"不要嵌套卡片"。
   原来检查表里是「卡片里再放一张卡片」，两层白面 + 两层边框，视觉噪音大。
   现在内层改为透明、只留一条顶部发丝线，用"分节"代替"套盒"。 */
.card .card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 16px 0 4px;
  margin-bottom: 0;
  box-shadow: none;
}
.card .card:first-child { border-top: none; padding-top: 0; }
.card .card > h2, .card .card h2 { font-size: var(--fs-16); font-weight: 600; }

/* 数字一律等宽（金额、计数、时间对齐才好看）*/
.num, .rec-no, .rec-time, td.num, .kpi b { font-variant-numeric: tabular-nums; }

/* 减少动效（尊重系统设置）*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ------------------------------------------------------------------
   列表里的"附件 / 签名"直接显示，不再塞一个「看签名」「PDF1」按钮让人点进去。
   要求来自实际使用：核对台账时一眼要看到"这是哪张单、谁签的字"，
   每行都要点开一次再关掉，翻十条就要点二十次。
   ------------------------------------------------------------------ */

/* 签名缩略图：点一下仍可看原图（保留了放大能力，只是不必点）。
   白底 + 细边框：签名笔迹本来就细，去掉白底后在浅色卡片/表格上看不清（实测反馈），
   白底能把笔迹衬出来，也更接近"签在纸上"的观感。 */
.sig-link { display: inline-block; line-height: 0; }
.sig-thumb {
  display: block;
  height: 30px;              /* 与表格行高接近，不把行撑得太胖 */
  width: auto; max-width: 104px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px;
}
.sig-thumb-lg { height: 56px; max-width: 220px; }
.sig-link:hover .sig-thumb { border-color: var(--primary); }

/* 索证文件：缩略图 + 文件名（可多个，纵向排） */
.doc-files { display: flex; flex-direction: column; gap: 6px; }
.doc-file { display: flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
.doc-file:hover .doc-name { color: var(--primary); text-decoration: underline; }
.doc-thumb {
  width: 46px; height: 46px; flex: 0 0 auto;
  object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff;
}
.doc-ico {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--line); background: var(--paper-deep);
  font-size: 10px; font-weight: 700; letter-spacing: .02em; color: var(--bad);
}
.doc-name {
  font-size: 12px; line-height: 1.35; color: var(--ink-body);
  max-width: 128px; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ===== 现场扫码二维码卡片（报修 / 报损页）=====
   要求：二维码整张直接显示、不用点也不用悬停；栏目常驻不折叠。
   宽屏：码在左、说明在右；窄屏（≤640px）：上下堆叠、码居中放大，手机上也好扫。 */
.qrcard {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 16px; margin-bottom: 12px;
  background: linear-gradient(180deg, #f7fbff, #ffffff);
  border: 1px solid #cfe0f5; border-radius: 12px;
}
.qrcard-code { flex: 0 0 auto; text-align: center; }
.qrcard-code img {
  display: block; width: 132px; height: 132px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px;
}
.qrcard-cap { margin-top: 5px; font-size: 12px; color: var(--dim); white-space: nowrap; }
.qrcard-main { flex: 1 1 auto; min-width: 0; }
.qrcard-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.qrcard-tip { font-size: 12.5px; color: var(--dim); line-height: 1.6; }
.qrcard-tip b { color: var(--primary-2); }
.qrcard-link {
  margin-top: 6px; font-size: 12px; color: var(--primary-2);
  word-break: break-all; user-select: all;
}
.qrcard-btns { margin-top: 8px; }

@media (max-width: 640px) {
  .qrcard { flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 12px; }
  .qrcard-code img { width: 168px; height: 168px; }   /* 手机上放大一点，扫码更稳 */
  .qrcard-main { width: 100%; }
  .qrcard-btns { justify-content: center; }
}
/* 打印时二维码单独占位、去掉按钮，避免打印机上多出无用的按钮 */
@media print {
  .qrcard-btns, .qrcard-link { display: none !important; }
  .qrcard { border: 1px solid #999; background: #fff; }
  .qrcard-code img { width: 160px; height: 160px; }
}

/* ===== 图片查看器（多图浏览：键盘 ←/→ 切换）===== */
.imgv { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.imgv-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .82); }
.imgv-box {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 1100px); padding: 10px;
}
.imgv-stage { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-width: 0; }
.imgv-img { max-width: 100%; max-height: 78vh; object-fit: contain; background: #fff; border-radius: 6px; }
.imgv-nav {
  flex: 0 0 auto; width: 42px; height: 42px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #1f2937; font-size: 26px; line-height: 1; cursor: pointer;
}
.imgv-nav:hover { background: #fff; }
.imgv-close {
  position: absolute; top: -14px; right: -14px; width: 32px; height: 32px; border: none; border-radius: 50%;
  background: #fff; color: #1f2937; font-size: 20px; line-height: 1; cursor: pointer;
}
.imgv-bar { position: absolute; left: 50%; bottom: -66px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.imgv-count { font-size: 12.5px; color: #e5e7eb; font-variant-numeric: tabular-nums; }
.imgv-strip { display: flex; gap: 6px; max-width: 74vw; overflow: auto; padding: 4px; }
.imgv-strip img { width: 46px; height: 46px; object-fit: cover; border-radius: 4px; opacity: .55; cursor: pointer; border: 2px solid transparent; }
.imgv-strip img.on { opacity: 1; border-color: #60a5fa; }
@media (max-width: 640px) {
  .imgv-nav { width: 34px; height: 34px; font-size: 20px; }
  .imgv-img { max-height: 66vh; }
  .imgv-strip img { width: 36px; height: 36px; }
}

/* ===== 概览：还没完成的巡检点（分层：周期分组 → 组内逐行）===== */
.ov-undohint { font-size: 12px; color: var(--dim); margin: -2px 0 12px; }
.ov-undohint a { color: var(--primary); }
.ov-undogroup + .ov-undogroup { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ov-undogh { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.ov-undogh .ov-bar { width: 92px; margin: 0; flex: 0 0 auto; }
.ov-undoghn { margin-left: auto; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-undoghn i { font-style: normal; color: var(--bad); }
.ov-undorows { display: flex; flex-direction: column; gap: 4px; }
/* 一行一个点位：色条表状态，右侧表进度；编号列等宽，眼睛能顺着扫下来 */
.ov-undorow {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px;
  border-radius: 7px; background: var(--paper-deep); border-left: 3px solid #e6b23c;
  font-size: 12.5px; cursor: default;
}
.ov-undorow.bad { border-left-color: var(--bad); background: rgba(239, 68, 68, .08); }
.ov-undocode { flex: 0 0 46px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; color: var(--dim); }
.ov-undoname { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-undometa { margin-left: auto; color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.ov-undoright { flex: 0 0 auto; min-width: 36px; text-align: right; font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.ov-undorow.bad .ov-undoright { color: var(--bad); font-weight: 700; }
.ov-undook { font-size: 12px; color: var(--ok); padding: 2px 0; }
.ov-undomore { display: block; font-size: 12px; color: var(--primary); padding: 5px 2px 2px; }
.ov-undomore:hover { text-decoration: underline; }
/* 窄屏：区域列收起，只留编号 + 名称 + 进度 */
@media (max-width: 640px) {
  .ov-undometa { display: none; }
  .ov-undorow { padding: 6px 8px; }
}

/* ============================================================================
   全站轻提示（appToast）与按钮忙碌态（appBusy）
   由 public/ui.js 驱动；样式集中在这里，各页面不必重复实现。
   ============================================================================ */

.app-toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 200;            /* 高于弹窗遮罩（.overlay 60 / ui 弹窗 90）*/
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;    /* 不挡住背后的按钮 */
  max-width: min(92vw, 520px);
}

.app-toast {
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper-raised);
  font-size: var(--fs-14);
  line-height: 1.5;
  /* 两层写法：老设备（不支持 oklch）走 rgba，新浏览器用 oklch 覆盖 */
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
  box-shadow: 0 6px 24px oklch(0% 0 0 / .22);
  opacity: 0;
  transform: translateY(6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: auto;
  word-break: break-word;
}
.app-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.app-toast-ok    { background: var(--ok-ink);    color: #fff; }
.app-toast-error { background: var(--vermilion); color: #fff; }
.app-toast-warn  { background: var(--warn);      color: #fff; }

/* 按钮忙碌态：锁住点击 + 左侧转圈，避免重复提交 */
.btn.is-busy { cursor: progress; }
.btn-spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: app-spin .7s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

/* 尊重"减少动效"偏好：前庭功能敏感用户不该被滑入动画和转圈打扰 */
@media (prefers-reduced-motion: reduce) {
  .app-toast { transition: none; }
  .btn-spin { animation-duration: 2s; }
}
