/* ==========================================================================
 * 环境监测业务系统 · 全局样式
 * 【全局规则 0.2 网站风格规范】—— 本文件是规范的唯一落地处
 *   主色 #1890ff ｜ 辅色 #52c41a / #faad14 / #ff4d4f
 *   背景 #f0f2f5 ｜ 卡片 #ffffff ｜ 文字 #333 / #666 / #999
 *   页面最大宽 1200px 居中 ｜ 卡片阴影 0 2px 8px rgba(0,0,0,.08) / 圆角 8px / padding 20px
 *   表格 表头 #fafafa、交替 #fafafa、hover #e6f7ff、cell 12px 16px
 *   输入框 高 32px / 边框 #d9d9d9 / 聚焦 #1890ff / 圆角 4px
 *   间距 页 24px、卡片 16px、标签-输入 8px ｜ <768px 两列转单列
 * ========================================================================== */

:root {
  /* 主色 / 辅色 */
  --primary: #1890ff;
  --primary-hover: #1682e6;   /* 主色加深 10% */
  --primary-light: #e6f7ff;   /* 主色 5% 底 */
  --success: #52c41a;
  --success-hover: #4ab017;
  --warning: #faad14;
  --warning-hover: #e19c12;
  --danger: #ff4d4f;
  --danger-hover: #e64547;

  /* 背景 / 卡片 / 文字（★ 批5：对齐企微风规范 v1.1 —— 页面底 #f5f6f8、文本 #262626/#595959/#8c8c8c） */
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #262626;
  --text-2: #595959;
  --text-3: #8c8c8c;

  /* 线框 / 表格 */
  --border: #d9d9d9;
  --border-light: #f0f0f0;
  --head-bg: #fafafa;
  --row-alt: #fafafa;
  --row-hover: #e6f7ff;

  /* 尺寸（★ 批5：控件高 36px / 手机 40px；间距基准 8px；页面左右边距与卡片间距 16/12） */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-btn: 6px;
  --radius-modal: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --page-max: 1200px;
  --gap: 12px;
  --gap-lg: 16px;
  --pad-page: 16px;
  --pad-card: 16px;
  --ctrl-h: 36px;
  --ctrl-h-m: 40px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* ★ 批5：字体栈对齐规范（含 PingFang SC / Microsoft YaHei，企微内置浏览器中文字形更统一） */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================ 布局：最大宽 1200px 居中 ============================ */
.layout {
  display: flex;
  min-height: 100vh;
  max-width: var(--page-max);
  margin: 0 auto;
  background: var(--bg);
}

/* 左侧导航 */
.sidebar {
  width: 210px;
  background: var(--panel);
  border-right: 1px solid var(--border-light);
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.brand {
  padding: 0 18px 14px;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 10px;
  line-height: 1.4;
}
.nav a {
  display: block;
  padding: 11px 18px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--row-hover); color: var(--primary); }
.nav a.active {
  background: var(--primary-light);
  border-left-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* 侧边栏底部：当前登录用户 / 退出登录（第三阶段登录态） */
.user-box {
  margin-top: 12px;
  padding: 12px 18px 0;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.9;
}
.user-box .user-name { font-weight: 600; color: var(--text); }
.user-box a { color: var(--primary); text-decoration: none; }
.user-box a:hover { text-decoration: underline; }

/* 右侧主区：页面上下留白 24px */
.main {
  flex: 1;
  padding: var(--pad-page);
  overflow: auto;
  min-width: 0;
}
.page-title { margin: 0 0 4px; font-size: 21px; color: var(--text); }
.page-sub { color: var(--text-3); margin: 0 0 18px; font-size: 13px; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); transform: translateY(-1px); }
.card h3 { margin: 0 0 6px; color: var(--primary); font-size: 16px; }
.card p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* 首页卡片网格 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--gap);
  margin-top: 8px;
}

/* 区块卡片（表单/表格外层） */
.card-block {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: var(--gap);
}
.card-block > h2,
.card-block > .card-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  line-height: 1.2;
}

/* ============================ 工具栏 / 搜索 ============================ */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search {
  height: var(--ctrl-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 300px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: var(--panel);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24, 144, 255, .12); }
.count { color: var(--text-3); font-size: 13px; }

/* ============================ 表格 ============================ */
.table-wrap {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 72vh;
  background: var(--panel);
  box-shadow: var(--shadow);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--head-bg);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-2);
  font-size: 13px;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  color: var(--text);
}
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); }
.main tbody tr:hover { background: var(--row-hover); }
.empty { padding: 28px; text-align: center; color: var(--text-3); }

/* 行状态：无效（父级或自身被软删除） */
tr.row-invalid { background: #fafafa; color: var(--text-3); }
tr.row-invalid:hover { background: var(--row-hover); }

/* ============================ 表单 ============================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}
.form-item { display: flex; flex-direction: column; }
.form-item.full { grid-column: 1 / -1; }
.form-item > label,
.form-label {
  margin-bottom: 8px;            /* 标签与输入框间距 8px */
  font-weight: 500;
  color: var(--text-2);
  font-size: 13px;
}
.form-label .req { color: var(--danger); margin-right: 4px; }
.form-hint { margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* —— 报告号组合控件：WXHB字 + 年份 + 第 + 编号 + 号 —— */
.report-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.report-wrap .report-fixed {
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}
.report-wrap select.report-year {
  width: auto;
  min-width: 96px;
  flex: 0 0 auto;
}
.report-wrap input.report-code {
  flex: 1 1 160px;
  min-width: 120px;
  width: auto;
}

.input,
select.input,
textarea.input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="tel"],
textarea,
select {
  width: 100%;
  min-height: var(--ctrl-h);
  height: var(--ctrl-h);
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea,
textarea.input {
  height: auto;
  min-height: 80px;
  padding: 6px 11px;
  resize: vertical;
}
select.input,
select { cursor: pointer; }
.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, .12);
}
.input:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  background: #f5f5f5;
  color: var(--text-3);
  cursor: not-allowed;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

/* 表单底部操作条 */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: var(--pad-page);
  padding-top: var(--gap);
  border-top: 1px solid var(--border-light);
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ctrl-h);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
/* 主操作：蓝色实心 */
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
/* 次操作：白色底 + 边框 */
.btn-default { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-default:hover { background: #fff; border-color: var(--primary); color: var(--primary); }
/* 危险操作：红色实心 */
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
/* 成功 / 警告（辅助） */
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); border-color: var(--success-hover); }
/* 纯文字按钮 */
.btn-text { background: transparent; border-color: transparent; color: var(--primary); padding: 0 6px; }
.btn-text:hover { color: var(--primary-hover); }

.btn-sm { height: 26px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 兼容旧类名（历史页面使用） */
.btn-outline { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

/* ============================ 标签 / 徽标 ============================ */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}
.badge-active { background: #f6ffed; color: var(--success); }
.badge-deleted { background: #fff1f0; color: var(--danger); }
.badge-warning { background: #fffbe6; color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* ============================ 提示条 ============================ */
.alert {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: var(--gap);
  border: 1px solid transparent;
}
.alert-info { background: var(--primary-light); border-color: #91d5ff; color: #0050b3; }
.alert-warning { background: #fffbe6; border-color: #ffe58f; color: #874d00; }
.alert-success { background: #f6ffed; border-color: #b7eb8f; color: #237804; }
.alert-danger { background: #fff1f0; border-color: #ffa39e; color: #a8071a; }

/* ============================ 表单锁定（保存后只读置灰） ============================ */
.form-area { position: relative; }
.form-area.form-locked::before {
  content: '🔒 已保存 · 已锁定';
  position: absolute; top: -6px; right: 8px;
  font-size: 12px; color: #874d00;
  background: #fffbe6; border: 1px solid #ffe58f;
  border-radius: 10px; padding: 0 8px; line-height: 18px;
  z-index: 3;
}
.form-area.form-locked::after {
  content: '';
  position: absolute; inset: -6px;
  background: rgba(0, 0, 0, .045);
  border-radius: var(--radius);
  pointer-events: all;
  cursor: not-allowed;
  z-index: 2;
}
.after-save-panel {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 16px; margin-top: var(--gap);
  background: var(--primary-light); border: 1px solid #91d5ff;
  border-radius: var(--radius);
}

/* ============================ 单选组 / 标签 / 模态框 ============================ */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; min-height: var(--ctrl-h); }
.radio-group label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.radio-group input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: #0050b3;
  border: 1px solid #91d5ff; border-radius: 12px;
  padding: 2px 10px; font-size: 12px; line-height: 20px;
}
.tag .tag-x { cursor: pointer; color: var(--text-3); font-weight: 700; }
.tag .tag-x:hover { color: var(--danger); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
  width: 100%; max-width: 760px; max-height: 84vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-x { background: transparent; border: none; font-size: 20px; line-height: 1; color: var(--text-3); cursor: pointer; padding: 2px 8px; border-radius: var(--radius-sm); }
.modal-x:hover { color: var(--danger); background: #fff1f0; }
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border-light); background: var(--head-bg); }
.grp-title { font-size: 13px; font-weight: 600; color: var(--primary); margin: 14px 0 6px; padding-left: 8px; border-left: 3px solid var(--primary); }
.grp-title:first-child { margin-top: 0; }
.m-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.m-item:hover { background: var(--row-hover); }
.m-item input { margin-top: 2px; accent-color: var(--primary); }
.m-item .m-txt { color: var(--text); }
.m-item .m-txt .m-method { color: var(--text-3); }

/* ============================ 点位录入组件（point-common.js） ============================
 * 供 ① pages/manage/point-manage.html（独立页）与
 *    ② pages/manage/form.html（项目信息新增/编辑保存后内联展开）
 * 共用 —— 两处结构/类名完全一致，样式只在此处维护。
 * ============================================================================ */
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pt-table { table-layout: fixed; width: 100%; }
.pt-table th, .pt-table td { padding: 10px 8px; font-size: 13px; word-break: break-all; }
.pt-table th:nth-child(1), .pt-table td:nth-child(1) { width: 20%; }
.pt-table th:nth-child(2), .pt-table td:nth-child(2) { width: 13%; }
.pt-table th:nth-child(3), .pt-table td:nth-child(3) { width: 14%; }
.pt-table th:nth-child(4), .pt-table td:nth-child(4) { width: 8%; }
.pt-table th:nth-child(5), .pt-table td:nth-child(5) { width: 8%; }
.pt-table th:nth-child(6), .pt-table td:nth-child(6) { width: 12%; }
.pt-table th:nth-child(7), .pt-table td:nth-child(7) { width: 25%; }
.ops { display: flex; gap: 6px; flex-wrap: nowrap; }
td.muted-cell { color: var(--text-3); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--primary-light); color: var(--primary); }
.modal-search { margin-bottom: 10px; }

/* 内联点位管理区（form.html 保存成功后展开） */
.pm-area { margin-top: var(--gap); }
.pm-area::before {
  content: '';
  display: block; height: 1px; margin-bottom: var(--gap);
  background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 12px);
}
.pm-area .card-block:first-child { margin-top: 0; }

/* ============================ 响应式：<768px 两列转单列 ============================ */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 10px 0;
  }
  .brand { padding: 0 14px 10px; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav a {
    padding: 8px 12px;
    border-left: none;
    border-bottom: 3px solid transparent;
    font-size: 13px;
  }
  .nav a.active { border-left: none; border-bottom-color: var(--primary); }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-item.full { grid-column: auto; }
  .search { width: 100%; }
  .card-block, .card { padding: 16px; }
  table { min-width: 520px; }
}

/* ============================ 通用 iframe 弹层（modal.js）============================
 * 第二十七轮：合同列表「查看 / 打印」由新标签页改为弹层。
 * 半透明遮罩 + 内容区(iframe) + 右上角「× 关闭 / ⛶ 最大化还原」；打开时禁止背景滚动。 */
.wx-modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.wx-modal {
  position: relative;   /* ★ 批8.12z：作为右下角调整手柄的绝对定位基准 */
  display: flex; flex-direction: column;
  width: 100%; max-width: 1000px; height: 88vh;
  background: var(--panel); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  overflow: hidden;
}
/* 最大化：铺满视口、去圆角 */
.wx-modal-mask.is-max { padding: 0; }
.wx-modal-mask.is-max .wx-modal { max-width: none; width: 100vw; height: 100vh; border-radius: 0; }

.wx-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  background: var(--head-bg);
}
.wx-modal-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wx-modal-headtools { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.wx-modal-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 17px; line-height: 1; color: var(--text-3);
  padding: 4px 10px; border-radius: var(--radius-sm);
}
.wx-modal-btn:hover { color: var(--primary); background: var(--primary-light); }

/* ★ 批8.12z：弹层头部可拖动（非最大化 / 非小屏）；右下角手柄可调整大小 */
.wx-modal-head { cursor: move; }
.wx-modal-mask.is-max .wx-modal-head { cursor: default; }
.wx-modal-resize {
  position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px;
  cursor: se-resize; z-index: 3; opacity: .55;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  border-bottom-right-radius: 4px;
}
.wx-modal-resize:hover { opacity: 1; }
.wx-modal-mask.is-max .wx-modal-resize { display: none; }

/* 打印弹层：头部下方工具栏（🖨 打印 + 兜底链接） */
.wx-modal-tools {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border-light);
  background: var(--panel);
}
.wx-modal-link { font-size: 12px; color: var(--text-3); text-decoration: underline; margin-left: auto; }
.wx-modal-link:hover { color: var(--primary); }

.wx-modal-body { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #f0f2f5; }
.wx-modal-iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* loading / 错误遮罩（覆盖在 iframe 上） */
.wx-modal-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: #fafbfc; color: var(--text-3); font-size: 14px;
}
.wx-modal-errmsg { max-width: 70%; text-align: center; color: var(--danger); }
.wx-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #e3e6ea; border-top-color: var(--primary);
  animation: wx-spin .8s linear infinite;
}
@keyframes wx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wx-spinner { animation: none; } }

/* 打开弹层时禁止背景滚动 */
body.wx-modal-open { overflow: hidden; }
/* ★ 手机专项A：小屏加固背景滚动锁（解决 iOS Safari 下 body{overflow:hidden} 不彻底导致的滚动穿透）。
   仅由 JS 在小屏打开弹层时添加；body 变为固定定位并保留原滚动位置，关闭弹层后由 JS 复原。 */
body.wx-modal-lock { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

/* ============================ ★ 手机专项A：小屏（≤768px）弹层自动全屏式 ============================
 * 目标：视口 ≤768px 时 WxModal 自动全屏呈现（无需用户手动点最大化），解决移动端键盘遮挡 / 滚动穿透 / 误触关闭。
 * 要点：纯 CSS 自动生效（不依赖 .is-max）；桌面端（>768px）行为完全不变。
 * 高度优先级：100vh（旧浏览器回退）→ 100dvh → var(--wx-vvh)（JS 按 visualViewport 实时高度，
 *   处理键盘弹起导致可视区域收缩，保证 iframe 内聚焦输入项可见 / 可滚动）。 */
@media (max-width: 768px) {
  .wx-modal-mask { padding: 0; }
  .wx-modal-mask .wx-modal,
  .wx-modal-mask.is-max .wx-modal {
    max-width: none;
    width: 100%;
    height: 100vh;                 /* 旧浏览器回退 */
    height: 100dvh;                /* 现代浏览器：动态视口高度 */
    height: var(--wx-vvh, 100dvh); /* ★ JS 按 visualViewport 实时高度（键盘弹起时收缩） */
    border-radius: 0;
  }
  /* 头部紧凑 + 刘海 / 圆角屏安全区（top 保证「×」不被刘海遮挡） */
  .wx-modal-head {
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .wx-modal-title { font-size: 14px; }
  .wx-modal-btn { font-size: 18px; padding: 4px 8px; }
  /* 全屏时「最大化 / 还原」无意义 → 隐藏（保留「×」关闭） */
  .wx-modal-headtools [data-wx="max"] { display: none; }
  .wx-modal-tools { padding: 6px 12px; }
  /* ★ 批8.12z：小屏全屏式 → 头部不可拖动、无调整手柄（与「小屏不拖动/不调大小」一致） */
  .wx-modal-head { cursor: default; }
  .wx-modal-resize { display: none; }
  /* 底部安全区（Home 指示条），避免内容被遮挡 */
  .wx-modal-body { padding-bottom: env(safe-area-inset-bottom); }
}

/* 列表页「合同编号」可点击链接 */
.link-contract { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; }
.link-contract:hover { text-decoration: underline; }

/* ==========================================================================
 * ★ 批5 · 企微风格规范 v1.1 收口（全局）—— 仅样式，不动结构 / 字段 / 逻辑
 *   ① 卡片：白底无阴影 + 1px 浅灰边 + 内边距 16 + 卡片间距 12（hover 轻阴影）
 *   ② 控件：按钮圆角 6px / 高 36px（手机 40px）；只读态灰底区分
 *   ③ 弹层：桌面圆角 12px（小屏全屏沿用手机专项 A，已验收，行为不变）
 *   ④ 断点：≤768 手机优先 / 769–1024 企微窄窗口（侧栏转顶部横向菜单条）
 *      / 1025–1440 / >1440 内容区限宽防空旷
 *   ⑤ 双端交互：hover:none（触屏）时操作区常驻，不依赖 hover 才显示
 *   ⑥ 打印：不套交互色、隐藏导航与操作按钮、卡片实线边框、表格防跨页截断
 * ========================================================================== */

/* ① 卡片 / 区块 / 表格容器 */
.card, .card-block {
  padding: var(--pad-card);
  box-shadow: none;
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.table-wrap { box-shadow: none; border: 1px solid var(--border-light); }
.card-block > h2,
.card-block > .card-title { margin: 0 0 12px; font-size: 16px; line-height: 1.4; }

/* ② 按钮 / 表单控件 */
.btn, .btn-sm { border-radius: var(--radius-btn); }
.btn { height: var(--ctrl-h); }
.btn-sm { height: 28px; padding: 0 12px; }
/* 只读字段：灰底区分（规范 5.8） */
.input[readonly], input[readonly], textarea[readonly] { background: #fafafa; }

/* ③ 弹层（桌面 12px 圆角；≤768 由既有规则置 0 全屏） */
@media (min-width: 769px) {
  .wx-modal { border-radius: var(--radius-modal); }
  .modal { border-radius: var(--radius-modal); }
}

/* ④ 769–1024px：企微电脑版窄窗口 —— 侧栏转顶部横向菜单条，内容紧凑 */
@media (min-width: 769px) and (max-width: 1024px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--border-light);
    padding: 8px 0;
  }
  .brand { padding: 0 16px 8px; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav a { padding: 8px 12px; border-left: none; border-bottom: 3px solid transparent; font-size: 13px; }
  .nav a.active { border-left: none; border-bottom-color: var(--primary); }
  .user-box { border-top: none; padding: 0 16px; }
  .main { padding: 12px; }
  .form-grid { gap: 12px; }
  .table-wrap { max-height: 66vh; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ④ 1025–1440px：多列卡片并排、表格保留并横滚兜底 */
@media (min-width: 1025px) and (max-width: 1440px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
/* ④ >1440px：内容区限宽，防阅读疲劳（沿用 --page-max） */
@media (min-width: 1441px) {
  .layout { max-width: var(--page-max); }
}

/* ④ ≤768px：控件/按钮加高至 40px 便于点按，表单内按钮全宽，表格横滚兜底 */
@media (max-width: 768px) {
  .input, select.input, textarea.input,
  input[type="text"], input[type="number"], input[type="date"],
  input[type="datetime-local"], input[type="tel"],
  textarea, select {
    height: var(--ctrl-h-m);
    min-height: var(--ctrl-h-m);
    font-size: 14px;
  }
  .btn { height: var(--ctrl-h-m); }
  .form-actions { flex-direction: column; }
  .form-actions .btn, .action-bar .btn, .proj-actions .btn { width: 100%; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-block > h2, .card-block > .card-title { font-size: 15px; }
}

/* ⑤ 触屏（无 hover）：操作区常驻显示，不依赖 hover 才出现 */
@media (hover: none) {
  .ops, .row-ops, .attach-actions, .proj-tools, .card-actions {
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* ⑥ 打印：黑白友好 + 隐藏导航/操作 + 卡片实线 + 表格防截断 */
@media print {
  .sidebar, .nav, .toolbar, .action-bar, .form-actions,
  .wx-modal-mask, .btn, .btn-print-title, .proj-tools { display: none !important; }
  body { background: #fff; }
  .card, .card-block, .table-wrap { border: 1px solid #000 !important; box-shadow: none !important; }
  table { page-break-inside: auto; }
  tr, .proj-card { page-break-inside: avoid; }
  .badge, .pill { border: 1px solid #000; color: #000 !important; background: #fff !important; }
}

/* ============================ ★ 批8.12be 首页视觉升级（纯样式，不影响权限/逻辑） ============================ */

/* —— 品牌横幅 hero —— */.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 26px 26px 18px;
  margin-bottom: 18px;
  color: #fff;
  background: linear-gradient(135deg, #0e63d8 0%, #1890ff 48%, #3ecfce 130%);
  box-shadow: 0 8px 24px rgba(24, 144, 255, .28);
}
.home-hero::before,
.home-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.home-hero::before {
  width: 220px; height: 220px; right: -50px; top: -90px;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.home-hero::after {
  width: 140px; height: 140px; right: 130px; bottom: -70px;
  background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 70%);
}
.home-hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 12px;
  letter-spacing: .6px;
}
.home-hero-title { margin: 12px 0 4px; font-size: 24px; font-weight: 700; line-height: 1.3; }
.home-hero-sub { margin: 0 0 14px; font-size: 13px; opacity: .9; }
.home-hero-note {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.8;
  opacity: .96;
}

/* —— 首页入口卡片：图标块 + 更精致的悬停 —— */
.card .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 21px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #e6f4ff, #d9f7ff);
  border: 1px solid #bae7ff;
}
.card h3 { margin: 0 0 6px; }
.card:hover .card-icon {
  background: linear-gradient(135deg, #bae7ff, #91d5ff);
  border-color: #69b1ff;
  transform: scale(1.06);
}
.card .card-icon { transition: transform .18s, background .18s; }
/* 悬停提升：轻抬升 + 蓝边光晕 */
.card:hover {
  box-shadow: 0 6px 18px rgba(24, 144, 255, .16);
  border-color: #91d5ff;
  transform: translateY(-2px);
}

@media print {
  .home-hero { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 1px solid #000; }
  .home-hero::before, .home-hero::after { display: none; }
  .home-hero-badge, .home-hero-note { background: #fff !important; border-color: #000; color: #000 !important; }
  .home-hero-title, .home-hero-sub { color: #000 !important; }
  .card .card-icon { background: #fff !important; border-color: #000; }
}
