/* ===== 社区上报系统 · 样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg: #f5f6f8;
  --c-card: #ffffff;
  --c-line: #e3e6eb;
  --c-text: #1f2430;
  --c-sub: #6b7280;
  --c-primary: #1b5fd9;
  --c-primary-light: #e8f0fe;
  --c-ok: #15803d;
  --c-ok-bg: #e9f7ef;
  --c-warn: #b45309;
  --c-warn-bg: #fef6e7;
  --c-err: #b91c1c;
  --c-err-bg: #fdecec;
  --radius: 10px;
}

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; min-height: 58px;
}
.brand {
  font-size: 16px; font-weight: 700; letter-spacing: .3px;
  /* 长系统名不要撑破顶栏：允许在窄屏折行 */
  white-space: nowrap; flex-shrink: 0;
  max-width: 420px; overflow: hidden; text-overflow: ellipsis;
}
.brand small {
  font-weight: 400; color: var(--c-sub); font-size: 12px;
  margin-left: 8px; white-space: nowrap;
}
.nav {
  display: flex; gap: 2px; flex: 1 1 auto; min-width: 0;
  align-items: center; overflow: visible; flex-wrap: nowrap;
}
.nav a {
  padding: 7px 11px; border-radius: 8px; text-decoration: none;
  color: var(--c-sub); font-size: 14px; white-space: nowrap; transition: .15s;
}
.nav a:hover { background: #f0f2f5; color: var(--c-text); }
.nav a.active { background: var(--c-primary-light); color: var(--c-primary); font-weight: 600; }

/* 窄屏（≤1400px）隐藏分组文字标签，只留分隔线，防止导航溢出。
   分组语义靠链接之间的竖线区分，不影响使用。 */
.nav-group {
  display: flex; gap: 3px; align-items: center; position: relative;
  padding-right: 13px; flex-shrink: 0;
}
.nav-group + .nav-group { padding-left: 13px; }
.nav-group + .nav-group::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%); width: 1px; height: 16px; background: #e3e6eb;
}
.nav-group-label {
  font-size: 12px; color: #6b7280; margin-right: 4px;
  white-space: nowrap; letter-spacing: .02em; user-select: none;
}
.nav-group:last-child { padding-right: 0; }

/* 阶段 Tab / 审核 Tab 通用 */
.stage-tabs, .review-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.stage-tab, .review-tab {
  padding: 7px 16px; border-radius: 8px; font-size: 13.5px;
  background: #f5f6f8; color: var(--c-sub); cursor: pointer;
  border: 1px solid transparent; user-select: none;
}
.stage-tab.on, .review-tab.on {
  background: var(--c-primary-light); color: var(--c-primary);
  font-weight: 600; border-color: #d6e2fb;
}
.hidden { display: none !important; }

/* 导航下拉（系统设置折叠） */
.nav-dropdown { position: relative; }
.nav-drop-toggle { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.nav-drop-toggle .caret { font-size: 11px; opacity: .6; }
.nav-drop-menu {
  display: none; position: absolute; left: 0; top: calc(100% + 6px);
  min-width: 220px; background: #fff; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(20,40,80,.14); padding: 6px;
  z-index: 200; border: 1px solid var(--c-line);
}
/* 靠右的组让菜单右对齐，避免超出视口 */
.nav-dropdown:last-of-type .nav-drop-menu,
.nav-group:last-child .nav-drop-menu { left: auto; right: 0; }
.nav-dropdown.open .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: block; padding: 9px 12px; border-radius: 7px;
  color: var(--c-text); font-size: 13.5px; text-decoration: none;
  white-space: nowrap;
}
.nav-drop-menu a:hover { background: #f5f7fa; }
.nav-drop-menu a small {
  display: block; color: #6b7280; font-size: 12px;
  margin-top: 3px; font-weight: 400; line-height: 1.5;
}
.nav-drop-menu a.active { background: var(--c-primary-light); color: var(--c-primary); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1560px; margin: 0 auto; padding: 22px 20px 80px; }
.page { display: none; }
.page.show { display: block; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--c-sub); font-size: 13px; margin-top: 4px; }
/* 填报页首屏要留给表格：标题区与说明压到最小 */
.page-head.compact { margin-bottom: 10px; }
.page-head.compact p { font-size: 12.5px; margin-top: 2px; }

.card {
  background: var(--c-card); border: 1px solid var(--c-line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--c-line);
  background: #fff; color: var(--c-text); font-size: 14px; cursor: pointer;
  transition: .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #f7f8fa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: #174db3; }
.btn-ok { background: var(--c-ok); color: #fff; border-color: var(--c-ok); }
.btn-ok:hover { background: #116232; }
.btn-danger { color: var(--c-err); border-color: #f0c7c7; }
.btn-danger:hover { background: var(--c-err-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---------- 表单 ---------- */
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--c-sub); font-weight: 500; }
.field label .req { color: var(--c-err); margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--c-line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
  color: var(--c-text); transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(27, 95, 217, .1);
}
.field input.invalid, .field select.invalid, .field textarea.invalid {
  border-color: var(--c-err); background: #fffafa;
}
.field .hint { font-size: 12px; color: #5b6470; line-height: 1.55; }
.field .errmsg { font-size: 12px; color: var(--c-err); min-height: 0; }

/* 填报页顶部信息卡：默认只露三个必填项，把首屏让给表格 */
.meta-card { padding: 14px 18px; margin-bottom: 12px; }
.meta-card .meta-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.meta-fold { margin-top: 10px; border-top: 1px dashed var(--c-line); padding-top: 8px; }
.meta-fold > summary {
  cursor: pointer; font-size: 12.5px; color: var(--c-sub);
  list-style: none; display: flex; align-items: center; gap: 6px;
  padding: 3px 0; min-height: 28px;
}
.meta-fold > summary::-webkit-details-marker { display: none; }
.meta-fold > summary::before {
  content: '▸'; font-size: 11px; color: #9aa1ad; transition: transform .15s;
}
.meta-fold[open] > summary::before { transform: rotate(90deg); }
.meta-fold > summary:hover { color: var(--c-text); }
.meta-fold .meta-grid { margin-top: 10px; }

/* ---------- 数据表 ---------- */
/* 桌面端不再强制 min-width：列宽由 <colgroup> 的百分比分配（table-layout:fixed），
   整表铺满容器宽度，不需要左右拖动。窄屏（<980px）才回退成按内容撑开 + 横向滚动。 */
.table-scroll { overflow-x: auto; border: 1px solid var(--c-line); border-radius: 8px; }
table.grid {
  border-collapse: collapse; width: 100%; font-size: 13px;
  table-layout: fixed;
}
table.grid th {
  background: #f8f9fb; text-align: left; padding: 8px 8px;
  font-weight: 600; font-size: 12.5px; color: #4b5563;
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 2;
  /* 表头允许折行：原来 nowrap 会把「监管责任主体（行业部门）」这类长标题撑成一整行 */
  white-space: normal; line-height: 1.35; word-break: break-word;
}
table.grid th .req { color: var(--c-err); margin-left: 2px; }
table.grid th .sm-note { font-weight: 400; font-size: 11.5px; color: var(--c-sub); }
table.grid th.seq { text-align: center; color: var(--c-sub); }
table.grid col.op, table.grid th.op, table.grid td.op { width: 42px; }
table.grid td { padding: 3px 5px; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fafbfc; }
table.grid td input, table.grid td select, table.grid td textarea {
  width: 100%; padding: 6px 8px; border: 1px solid transparent;
  border-radius: 6px; font-size: 13px; font-family: inherit;
  background: transparent; color: var(--c-text);
}
/* 拖拽手柄会压住最后一行字，且自动撑高已经够用，去掉 */
table.grid td textarea { resize: none; line-height: 1.5; overflow-y: auto; }
table.grid td .ro-val { padding: 6px 8px; }
table.grid td input:hover, table.grid td select:hover, table.grid td textarea:hover {
  border-color: var(--c-line); background: #fff;
}
table.grid td input:focus, table.grid td select:focus, table.grid td textarea:focus {
  outline: none; border-color: var(--c-primary); background: #fff;
  box-shadow: 0 0 0 2px rgba(27, 95, 217, .1);
}
table.grid td input.invalid, table.grid td select.invalid, table.grid td textarea.invalid {
  border-color: var(--c-err); background: #fffafa;
}
table.grid td.rownum { text-align: center; color: var(--c-sub); width: 44px; }
table.grid td .cellerr { font-size: 12px; color: var(--c-err); display: block; padding: 0 2px; line-height: 1.45; }
.row-del {
  color: var(--c-err); cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
}
.row-del:hover { background: var(--c-err-bg); }

/* ---------- 校验结果 ---------- */
.alert { border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: 12px; }
.alert-err { background: var(--c-err-bg); color: #7f1d1d; border: 1px solid #f5c6c6; }
.alert-warn { background: var(--c-warn-bg); color: #7c4a03; border: 1px solid #f5dfb0; }
.alert-ok { background: var(--c-ok-bg); color: #14532d; border: 1px solid #b8e0c6; }
.alert-info { background: var(--c-primary-light); color: #17448f; border: 1px solid #c3d8fb; }
.alert ul { margin: 6px 0 0 18px; }
.alert li { margin: 2px 0; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-draft { background: #eef0f3; color: #4b5563; }
.badge-submitted { background: var(--c-ok-bg); color: var(--c-ok); }
/* 三级流转状态徽章：按层级由浅到深，一眼看出卡在哪一级 */
.badge-grid_submitted { background: #e8f0fe; color: #17448f; }
.badge-comm_review   { background: #fff1f0; color: #b42318; }
.badge-comm_submitted { background: #e6f4ea; color: #1e7b34; }
.badge-street_review { background: #fff7e6; color: #92600a; }
.badge-street_return { background: #fff1f0; color: #b42318; }
.badge-accepted      { background: #e6f4ea; color: #1e7b34; }
.badge-assigned      { background: #e8f0fe; color: #17448f; }
.badge-tracking      { background: #fff7e6; color: #92600a; }
.badge-closed        { background: #eceff1; color: #37474f; }
.badge-hazard { background: #e8f0fe; color: #17448f; }
.badge-ducha { background: #fef6e7; color: #92600a; }
.badge-huizong { background: #f3e9fd; color: #6b21a8; }

/* ---------- 记录列表 ---------- */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; align-items: end;
}
.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-item {
  border: 1px solid var(--c-line); border-radius: 9px; padding: 13px 16px;
  display: flex; align-items: center; gap: 14px; background: #fff;
  transition: .15s; cursor: pointer;
}
.rec-item:hover { border-color: #c3d3f0; background: #fcfdff; box-shadow: 0 2px 8px rgba(20,40,80,.05); }
.rec-main { flex: 1; min-width: 0; }
.rec-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-sub { font-size: 12.5px; color: var(--c-sub); margin-top: 3px; }
.rec-actions { display: flex; gap: 6px; flex-shrink: 0; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.stat-box { background: #fff; border: 1px solid var(--c-line); border-radius: 9px; padding: 14px 16px; }
.stat-box .k { font-size: 12.5px; color: var(--c-sub); }
.stat-box .v { font-size: 24px; font-weight: 700; margin-top: 3px; letter-spacing: -.5px; }
.stat-box .v small { font-size: 13px; font-weight: 500; color: var(--c-sub); margin-left: 3px; }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed #cfd6e2; border-radius: 10px; padding: 30px 20px;
  text-align: center; color: var(--c-sub); cursor: pointer; transition: .15s;
  background: #fbfcfe;
}
.dropzone:hover, .dropzone.drag { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary); }
.dropzone .big { font-size: 26px; margin-bottom: 6px; }

/* ---------- 通用 ---------- */
.row-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--c-sub); font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.empty { text-align: center; padding: 40px; color: #9aa1ad; font-size: 13.5px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 11px 22px; border-radius: 8px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: .25s; z-index: 999;
  max-width: 90vw; box-shadow: 0 6px 24px rgba(0,0,0,.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--c-err); }
#toast.ok { background: var(--c-ok); }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 200; padding: 40px 16px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 1080px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 5;
  border-radius: 12px 12px 0 0;
}
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--c-line);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
  border-radius: 0 0 12px 12px;
}
.close-x { cursor: pointer; font-size: 20px; color: var(--c-sub); line-height: 1; padding: 4px; }
.close-x:hover { color: var(--c-text); }

/* 回显只读视图 */
table.view { border-collapse: collapse; width: 100%; font-size: 13px; }
table.view th {
  background: #f8f9fb; padding: 8px 10px; text-align: left; font-size: 12.5px;
  border: 1px solid var(--c-line); white-space: nowrap; vertical-align: bottom;
}
table.view td {
  padding: 7px 10px; border: 1px solid #eef0f4; vertical-align: top;
  max-width: 260px; word-break: break-word;
}
table.view td:first-child { min-width: 90px; white-space: nowrap; }
table.view td.num { text-align: right; }
table.view tr.grp th { text-align: center; background: #eef2f9; font-size: 12.5px; }

/* 汇总表分组表头（23 列） */
table.grid thead tr.grp th { background: #eef2f9; text-align: center; }



/* 中等宽度：表格按内容撑开可横向滚动（列太多放不下时） */



/* ===== 响应式：窄屏隐藏分组标签，防止导航溢出 =====
   必须放在所有 .nav-group 定义之后，否则会被覆盖。 */
@media (max-width: 1500px) {
  .nav-group-label { display: none !important; }
  .nav-group { padding-right: 9px; }
  .nav-group + .nav-group { padding-left: 9px; }
}
@media (max-width: 1180px) {
  .nav { gap: 2px; }
  .nav a { padding: 6px 10px; font-size: 13.5px; }
}

/* ===== 商户联想下拉（单位输入框） ===== */
/* 原来是 td 内的 absolute + 表格容器 overflow-x:auto，会被裁掉右半截。
   改成 fixed + JS 按视口坐标放置（merchant.js 的 placeDrop），宽度至少 640px，
   商户全称、地址、社区网格一行放得下。 */
td[data-k="unit"] { position: relative; }
.mp-drop {
  position: fixed; left: 0; top: 0; width: 640px; max-width: min(780px, 96vw);
  background: #fff; border: 1px solid var(--c-line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.18);
  z-index: 320; display: none; max-height: 360px; overflow-y: auto; padding: 4px;
}
.mp-drop.open { display: block; }
.mp-item {
  padding: 9px 11px; border-radius: 8px; cursor: pointer; line-height: 1.5;
}
.mp-item:hover { background: var(--c-primary-light); }
.mp-name { font-size: 13.5px; font-weight: 600; color: var(--c-text); }
.mp-score {
  font-size: 12px; font-weight: 500; color: var(--c-ok);
  background: var(--c-ok-bg); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}
.mp-full {
  font-size: 12.5px; color: var(--c-sub); line-height: 1.5;
  /* 全称是最关键的信息，宁可折两行也不省略 */
  word-break: break-all;
}
.mp-meta { font-size: 12px; color: var(--c-sub); line-height: 1.55; }
.mp-why { font-size: 12px; color: #5b6470; }
.mp-sep { color: #b9bfc9; margin: 0 4px; }
/* 法人/负责人 + 电话：用深一点的颜色和稍重的字，方便一眼核对是不是这家店的老板 */
.mp-person { color: #374151; font-weight: 500; }
.mp-matched .mp-person { color: #374151; font-weight: 500; }
.mp-foot, .mp-empty {
  padding: 9px 10px; font-size: 12.5px; color: var(--c-sub);
  border-top: 1px solid var(--c-line); display: flex; align-items: center; gap: 6px;
}
.mp-empty { flex-direction: column; align-items: flex-start; border-top: none; }
.mp-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--c-primary); font-size: 12.5px; text-decoration: underline;
}
.mp-matched {
  margin-top: 5px; font-size: 12px; color: var(--c-sub); line-height: 1.6;
  background: var(--c-ok-bg); border-radius: 6px; padding: 4px 8px;
}
.mp-matched .mp-ok { color: var(--c-ok); font-weight: 600; margin-right: 6px; }
.mp-sug {
  position: fixed; left: 0; top: 0; width: 460px; max-width: min(620px, 96vw); z-index: 316;
  background: #fff; border: 1px solid var(--c-line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.18); padding: 6px;
}
.mp-sug-head { font-size: 12px; color: var(--c-sub); padding: 4px 6px; }
.mp-sug-row {
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1.5;
}
.mp-sug-row:hover { background: var(--c-primary-light); }
.mp-sug-foot { padding: 5px 6px 2px; border-top: 1px solid var(--c-line); margin-top: 4px; }

/* ===== 常用隐患快捷卡片 ===== */
.tpl-cards {
  border: 1px solid var(--c-line); border-radius: 10px;
  background: #fafbfd; padding: 12px 14px; margin-bottom: 12px;
}
.tpl-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.tpl-title { font-size: 14px; font-weight: 650; }
.tpl-head .muted { font-size: 12.5px; }
.tpl-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px;
}
.tpl-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; cursor: pointer; padding: 9px 11px;
  background: #fff; border: 1px solid var(--c-line); border-radius: 9px;
  transition: border-color .12s, box-shadow .12s;
}
.tpl-card:hover { border-color: var(--c-primary); box-shadow: 0 4px 14px rgba(27,95,217,.14); }
.tpl-cat {
  font-size: 12px; color: var(--c-primary); background: var(--c-primary-light);
  border-radius: 4px; padding: 1px 6px;
}
.tpl-text { font-size: 13px; color: var(--c-text); line-height: 1.5; }
.tpl-freq { font-size: 12px; color: var(--c-sub); }

/* ===== 两级分类卡片（大类 → 检查点） ===== */
.hz-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.hz-grid-sm { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
/* 大类正好 6 张：宽屏按 3 列排成 3+3，避免 5+1 那种一张孤零零掉到第二行。
   （auto-fill + minmax(240px) 在 1440 容器里会排 5 列，看着别扭） */
@media (min-width: 1101px) {
  .hz-grid { grid-template-columns: repeat(3, 1fr); }
}

.hz-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  gap: 5px; text-align: left; cursor: pointer; padding: 13px 14px;
  background: #fff; border: 1.5px solid var(--c-line); border-radius: 11px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease,
              background-color .16s ease;
}
.hz-card:hover {
  border-color: #b9cdf3; box-shadow: 0 6px 18px rgba(27,95,217,.12);
  transform: translateY(-1px);
}
.hz-card:active { transform: translateY(0); }
.hz-card:focus-visible {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(27,95,217,.16);
}

/* 大类卡片：图标当视觉锚点，右侧留白不挤字 */
.hz-ico {
  font-size: 22px; line-height: 1; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-primary-light); margin-bottom: 2px;
}
.hz-name {
  font-size: 14px; font-weight: 650; color: var(--c-text); line-height: 1.4;
}
.hz-name-sm { font-size: 13.5px; font-weight: 600; }
.hz-desc {
  font-size: 12.5px; color: var(--c-sub); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hz-desc-sm {
  font-size: 12px; color: #6b7280; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hz-foot {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: auto;
  padding-top: 7px;
}
.hz-num { font-size: 12px; color: var(--c-sub); white-space: nowrap; }
/* 频次条：用宽度直观表达「这类占多少」，不额外占一行 */
.hz-bar {
  flex: 1; height: 4px; border-radius: 2px; background: #eef1f6; position: relative;
  overflow: hidden;
}
.hz-bar::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%);
  background: linear-gradient(90deg, #7ba7f0, var(--c-primary)); border-radius: 2px;
}

/* 检查点卡片：选中高亮 + 右上勾 */
.hz-point { padding-right: 40px; }
.hz-point.sel {
  border-color: var(--c-primary); background: #f6f9ff;
  box-shadow: 0 0 0 3px rgba(27,95,217,.12);
}
.hz-check {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--c-primary);
}
.hz-point.sel .hz-check { display: flex; }
.hz-major {
  font-size: 12px; color: var(--c-warn); background: var(--c-warn-bg);
  border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}

/* 层级导航：返回 + 面包屑 */
.hz-back { flex: none; }
.hz-crumb {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--c-sub); min-width: 0;
}
.hz-crumb-a {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--c-primary); font-size: 13px; text-decoration: underline;
  text-underline-offset: 2px;
}
.hz-crumb-s { color: #c3c9d4; }
.hz-crumb-c {
  color: var(--c-text); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.hz-tip { font-size: 12px; margin-top: 9px; }

/* 层级切换的轻量过渡：只在内容块上淡入 + 上移 4px，不做缩放，避免卡片抖动 */
.hz-fade { animation: hzIn .18s ease-out both; }
@keyframes hzIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hz-card, .hz-fade { transition: none; animation: none; }
  .hz-card:hover { transform: none; }
}

/* ===== 标准条目弹层 ===== */
.tpl-modal { max-width: 900px; }
.tp-bar { display: flex; gap: 10px; padding: 14px 20px; }
.tp-bar input { flex: 1; }
.tp-bar select { width: 190px; }
.tp-list { max-height: 58vh; overflow-y: auto; padding: 0 20px 8px; }
.tp-row {
  padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 9px;
  margin-bottom: 8px; cursor: pointer;
}
.tp-row:hover { border-color: var(--c-primary); background: #fbfcfe; }
.tp-title { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.tp-measure { font-size: 12.5px; color: var(--c-sub); line-height: 1.6; margin-top: 3px; }
.tp-meta { font-size: 12px; color: #5b6470; margin-top: 3px; }

/* 一键填入的标准描述较长，这两列给个下限，否则挤成一竖条没法补充说明。
   桌面端走百分比列宽（table-layout:fixed），这里只保留竖向撑高。 */
table.grid td[data-k="hazard_desc"] textarea,
table.grid td[data-k="measure"] textarea { min-height: 46px; }
/* 单位输入框失焦后用省略号收起，悬停 title 看全称；聚焦时 JS 去掉这个类显示全文 */
table.grid td[data-k="unit"] input.ellipsis { text-overflow: ellipsis; }
.mp-matched .mp-warn { margin-top: 4px; color: var(--c-warn); font-weight: 500; }

/* 移动端吸底操作条：桌面端不显示 */
.mobile-actionbar { display: none; }

@media (max-width: 720px) {
  .topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .wrap { padding: 16px 12px 96px; }
  .card { padding: 14px; }
  .rec-item { flex-direction: column; align-items: stretch; }
  .rec-actions { justify-content: flex-end; }

  /* ---------- 移动端：表格转单列表单 ----------
     表格逐行摊成卡片，每个单元格标签上置、输入框满宽。
     用 display:block 拆掉 tr/td 的表格盒模型，避免横向滚动。 */
  .table-scroll { overflow-x: visible; border: none; border-radius: 0; }
  table.grid { display: block; table-layout: auto; font-size: 14px; }
  table.grid colgroup { display: none; }
  table.grid thead { display: none; }      /* 表头信息由每格的 data-label 承担 */
  table.grid tbody { display: block; }
  table.grid tr {
    display: block; background: #fff; border: 1px solid var(--c-line);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
    position: relative;
  }
  table.grid tr:hover td { background: transparent; }
  table.grid td {
    display: block; width: 100%; padding: 0 0 10px; border-bottom: none;
  }
  table.grid td:last-child { padding-bottom: 0; }
  /* 标签上置 */
  table.grid td[data-label]::before {
    content: attr(data-label);
    display: block; font-size: 12.5px; font-weight: 600;
    color: #374151; margin-bottom: 5px;
  }
  /* 序号列不占一整行，收成右上角的小标 */
  table.grid td[data-k="seq"] { display: none; }
  table.grid td[data-k="seq"] + td[data-label]::before { color: #374151; }
  table.grid td input, table.grid td select, table.grid td textarea {
    width: 100%; padding: 11px 12px; border: 1px solid #d7dce5;
    border-radius: 9px; font-size: 15px; background: #fff;
    /* 移动端要够大的点击热区 */
    min-height: 44px;
  }
  table.grid td textarea { min-height: 88px; }
  table.grid td input.ellipsis { text-overflow: clip; }   /* 手机上别截断 */
  table.grid td .ro-val { padding: 4px 0; font-size: 15px; }
  /* 删除按钮浮到卡片右上角，做大一点好点 */
  table.grid td.op {
    position: absolute; top: 6px; right: 6px; width: auto;
    padding: 0; border: none;
  }
  table.grid tr { padding-right: 44px; }
  .row-del { width: 36px; height: 36px; font-size: 18px; }

  /* 顶部信息卡：单列、字段少时更紧凑 */
  .meta-card { padding: 12px 12px; }
  .meta-card .meta-grid { grid-template-columns: 1fr; gap: 10px; }
  .meta-grid { grid-template-columns: 1fr; }
  /* 触控热区 */
  .field input, .field select, .field textarea { min-height: 44px; font-size: 15px; }
  .meta-fold > summary { min-height: 40px; font-size: 13px; }
  .btn { min-height: 40px; }

  /* 快捷卡片：移动端两列改一列横向滚动太费劲，直接单列 */
  .tpl-list { grid-template-columns: 1fr; }
  .tpl-card { padding: 11px 12px; }
  /* 两级分类卡片：竖屏单列，整卡可点，高度按内容走 */
  .hz-grid, .hz-grid-sm { grid-template-columns: 1fr; gap: 9px; }
  .hz-card { padding: 14px; border-radius: 12px; min-height: 56px; }
  .hz-card:hover { transform: none; }
  .hz-name { font-size: 15px; }
  .hz-name-sm { font-size: 14.5px; }
  .hz-desc, .hz-desc-sm { font-size: 12.5px; -webkit-line-clamp: 3; }
  .hz-ico { width: 42px; height: 42px; font-size: 24px; }
  .hz-crumb-c { max-width: 150px; }
  .hz-back { min-height: 36px; }
  .hz-bar { height: 5px; }
  .tpl-head { gap: 6px; }

  /* ---------- 商户下拉：底部弹层 ---------- */
  .mp-drop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto !important;
    width: auto !important; max-width: none; max-height: 72vh !important;
    border-radius: 16px 16px 0 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 32px rgba(15,23,42,.24); z-index: 400;
    border: none; border-top: 1px solid var(--c-line);
  }
  /* 弹层顶部的抓手 + 遮罩 */
  .mp-drop::before {
    content: ''; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: #d5dae3; margin: 2px auto 8px;
  }
  body.mp-sheet-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.32);
    z-index: 390; pointer-events: none;
  }
  .mp-item { padding: 12px 12px; }
  .mp-name { font-size: 15px; }
  .mp-full { font-size: 13px; }
  .mp-meta, .mp-why { font-size: 12.5px; }
  .mp-foot, .mp-empty { font-size: 13.5px; padding: 12px 10px; }
  .mp-link { font-size: 13.5px; }
  .mp-sug {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto !important;
    width: auto; max-width: none; max-height: 60vh; overflow-y: auto; z-index: 400;
  }
  .mp-matched { font-size: 12.5px; }

  /* ---------- 吸底操作条 ---------- */
  .mobile-actionbar {
    display: flex; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--c-line);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(15,23,42,.06);
  }
  .mobile-actionbar .btn { flex: 1; min-height: 46px; font-size: 15px; }
  /* 卡片顶部那排按钮在手机上重复，收起（吸底条接管） */
  #btnAddRow, #btnDraft, #btnSubmit { display: none; }
  #btnAddRow2 { width: 100%; min-height: 42px; }
}

@media (min-width: 721px) and (max-width: 1100px) {
  table.grid { table-layout: fixed; }
  .mp-drop { max-width: 96vw; }
}
