/* ================= 整体布局 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* 通用隐藏：JS 里大量 classList.add('hidden')，此前只有 .modal/.toast 等个别元素有对应规则，
   导致 #overview-wrap 等元素加了 hidden 仍显示（内容残留在其他页面下方） */
.hidden { display: none; }

:root {
  --primary: #1e6fd9;
  --primary-dark: #1757ab;
  --sidebar-bg: #1f2d3d;
  --sidebar-text: #b7c3d0;
  --sidebar-active: #1e6fd9;
  --border: #e3e7ee;
  --bg: #f3f5f8;
  --text: #2f3542;
  --text-light: #7a8494;
  --danger: #e0483e;
  --success: #2fa84f;
}

html, body {
  height: 100%;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

#app { display: flex; flex-direction: column; height: 100vh; }
/* 手机浏览器地址栏伸缩时 100vh 会把底部分页栏顶出可视区；dvh 跟随实际可视高度。
   不支持的浏览器（含 Electron/Chromium 旧版）自动忽略这行，仍用上面的 100vh。 */
@supports (height: 100dvh) {
  #app { height: 100dvh; }
}

/* ================= 顶部栏 ================= */
#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 58px;
  padding: 0 16px;
  background: linear-gradient(90deg, #16324f, #1e6fd9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
  flex-shrink: 0;
}

/* 侧边栏折叠按钮 */
.hamburger {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.hamburger:hover { background: rgba(255,255,255,0.22); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; }

.brand-logo {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }
.brand-title {
  font-size: 16px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-sub { font-size: 11px; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#top-nav {
  display: flex;
  gap: 4px;
  height: 100%;
  flex: 1;
  min-width: 0;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}

.tab:hover { background: rgba(255,255,255,0.08); color: #fff; }
.tab.active {
  color: #fff;
  border-bottom-color: #ffd166;
  background: rgba(255,255,255,0.12);
  font-weight: 600;
}

/* 帮助标签不参与均分，固定在标签栏最右 */
.tab-help { flex: none; min-width: 64px; }

/* 顶栏右侧：连接状态 + 退出按钮 */
.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.conn-badge {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #2fa84f;
  box-shadow: 0 0 6px rgba(47,168,79,0.8);
  display: inline-block;
}
.conn-badge.off { background: #e0483e; box-shadow: 0 0 6px rgba(224,72,62,0.8); }

/* 顶栏项目切换器（当前项目） */
.proj-switch {
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.proj-switch option { color: #222; background: #fff; }
.proj-switch:focus { border-color: #fff; }

.quit-btn {
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.quit-btn:hover { background: var(--danger); border-color: var(--danger); }

/* 修改密码页：限宽居中，输入框不跟着表格铺满一整行 */
.pwd-box { max-width: 420px; padding: 8px 0 0; }
.pwd-box .form-field { margin-bottom: 14px; }
.pwd-actions { margin: 18px 0 12px; }

.cur-user {
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
}

/* ================= 主体区域 ================= */
#body { display: flex; flex: 1; overflow: hidden; }

/* 侧边栏折叠状态：隐藏侧边栏，内容区自动占满 */
.sidebar-collapsed #sidebar { display: none; }

/* ================= 顶部模块下拉菜单 ================= */
#dropdown {
  position: fixed;
  z-index: 180;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow-y: auto;
}

#dropdown.hidden { display: none; }

.dd-item {
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}

.dd-item:hover { background: #eef4fd; color: var(--primary); }
.dd-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.dd-item.active:hover { background: var(--primary-dark); color: #fff; }

/* ================= 帮助弹窗 ================= */
.modal-box.help-box { width: 680px; }

/* ================= 导出弹窗 ================= */
.modal-box.export-box { width: 460px; }
.export-body { padding: 6px 24px 14px; }
.export-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #eef0f3; }
.export-row:last-of-type { border-bottom: 0; }
.export-label { width: 68px; flex: none; color: var(--text-light); font-size: 13px; padding-top: 4px; }
.export-opts { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.export-opts.export-formats { flex-direction: row; gap: 10px; }
.export-opt {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 5px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.export-opt:hover { border-color: var(--primary); }
.export-opt input { margin: 0; cursor: pointer; }
.export-opt.is-off { color: #aab2bd; cursor: not-allowed; background: #fafbfc; }
.export-opt.is-off:hover { border-color: var(--border); }
.export-count { margin-left: auto; color: var(--text-light); font-size: 12px; }
.export-soon { margin-left: auto; font-size: 11px; color: #b8bfc8; }
.export-hint { margin-top: 8px; font-size: 12px; color: var(--text-light); line-height: 1.6; min-height: 18px; }
/* 有勾选时导出按钮高亮，提示「再点只导这几条」 */
#toolbar #btn-export.has-sel { border-color: var(--primary); color: var(--primary); font-weight: 600; }
/* 打印所选与导出同款高亮：两者都表示「只作用于勾出来的那几条」 */
#toolbar #btn-print-sel.has-sel { border-color: var(--primary); color: var(--primary); font-weight: 600; }

.help-content {
  padding: 20px 24px;
  max-height: 62vh;
  overflow-y: auto;
  line-height: 1.8;
  font-size: 13.5px;
  color: var(--text);
}

.help-content h4 {
  font-size: 14.5px;
  color: #1d2634;
  margin: 18px 0 6px;
}

.help-content h4:first-child { margin-top: 0; }

.help-content ul { padding-left: 22px; margin: 4px 0; }
.help-content li { margin: 3px 0; }
.help-content code {
  background: #f0f2f5;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: #d6336c;
}

.help-content .kbd {
  background: #eef2f7;
  border: 1px solid #d3dae3;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

.help-content .req { color: #e0483e; }

/* 系统版本更新记录 */
.help-content .muted { color: var(--text-light); font-size: 12.5px; margin: 2px 0 10px; }
.ver-item {
  border-left: 3px solid #d3dae3;
  padding: 2px 0 2px 12px;
  margin: 0 0 12px;
}
.ver-item:first-child { border-left-color: var(--primary); }
.ver-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 2px;
}
.ver-head strong { font-size: 14px; color: #1d2634; }
.ver-date { color: var(--text-light); font-size: 12px; }
.ver-item ul { padding-left: 20px; margin: 2px 0; }
.ver-item li { margin: 2px 0; }

/* ---------- 关于系统 / 版本更新 ---------- */
.link-btn {
  background: none; border: none; padding: 0 4px;
  color: var(--primary); font-size: inherit; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}
.link-btn:hover { color: #1656b0; }
.link-btn:disabled { color: #9aa4b2; cursor: default; text-decoration: none; }

.about-hint { color: #78828f; font-size: 12.5px; margin: 6px 0; }
.ok-text { color: #1f9254; }

/* 版权声明：与上方功能列表拉开距离，末行居中弱化 */
.about-copyright { margin-top: 6px; }
.about-copyright p { margin: 6px 0; }
.about-copyright .copyright-line {
  margin-top: 12px;
  color: #78828f;
  font-size: 12.5px;
  text-align: center;
}

/* 证书即将过期（剩余不足 20 天）：用告警色让它在「关于系统」里一眼可见 */
.cert-warn { color: #c0392b; font-weight: 600; }

/* 登录页公告编辑区（系统管理 → 登录页公告，仅管理员可见） */
.notice-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.notice-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.notice-row input[type="text"]:focus { border-color: var(--primary); }
/* 通知日期：登录页公告栏左侧那一列显示的就是它。定宽不伸缩，
   否则和正文输入框抢空间时日期会被挤成两位数看不清 */
.notice-row input[type="date"].notice-date-in {
  flex: none;
  width: 140px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.notice-row input[type="date"].notice-date-in:focus { border-color: var(--primary); }
/* 阅读量只读展示：不是输入框，别让人以为能改（它由登录页打开详情的次数累加） */
.notice-row .notice-views-ro {
  flex: none;
  min-width: 62px;
  text-align: right;
  font-size: 12px;
  color: #78828f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.notice-row .link-btn { flex: none; }
.notice-row button[disabled] { opacity: 0.35; cursor: default; }
.notice-row-on { flex: none; display: flex; align-items: center; }
.notice-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.notice-actions .notice-save { width: auto; padding: 6px 20px; font-size: 13px; }

/* 公告编辑区在 #data-table 里（借用它的表体容器）。
   #data-table td 默认是 nowrap + overflow:hidden + max-width:340px，那是给
   业务表的单元格用的；公告行里是一排输入框和按钮，套用这些样式会被直接截断，
   表现为「公告行右边的一大半看不见」。这里整格放开。 */
#table-body td:has(> #notice-rows) {
  padding: 14px 16px;
  max-width: none;
  overflow: visible;
  white-space: normal;
}
/* 公告页只有一行，悬停变色反而让人以为整片都能点 */
#data-table tbody tr:has(> td > #notice-rows):hover { background: transparent; }

.progress {
  height: 8px; border-radius: 4px; background: #e6eaef;
  overflow: hidden; margin: 10px 0 6px;
}
.progress > div {
  height: 100%; width: 0; border-radius: 4px;
  background: var(--primary); transition: width 0.2s ease;
}

#update-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; padding-bottom: 16px; }

/* 左侧栏 */
#sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-head {
  padding: 14px 16px 10px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #6d7b8c;
  text-transform: uppercase;
}

#side-nav { list-style: none; padding-bottom: 20px; }

.side-item {
  padding: 11px 20px;
  cursor: pointer;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background 0.12s;
  user-select: none;
}

.side-item:hover { background: rgba(255,255,255,0.06); color: #e6edf3; }
.side-item.active {
  background: rgba(30,111,217,0.22);
  border-left-color: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

/* 内容区 */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--bg);
}

#page-header { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#page-header h2 { font-size: 20px; color: #1d2634; }
/* 打印模板页右上角「操作说明」：和标题同一行、贴右 */
#btn-tpl-guide { flex: 0 0 auto; }

#toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

#search {
  flex: 1;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

#search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,111,217,0.15); }

button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.12s;
}

button:hover { border-color: var(--primary); color: var(--primary); }
button:disabled, button:disabled:hover {
  opacity: .5; cursor: not-allowed;
  border-color: var(--border); color: var(--text);
}
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.primary:disabled, button.primary:disabled:hover {
  background: var(--primary); border-color: var(--primary); color: #fff; opacity: .45;
}
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: #fef1f0; }

/* 表格 */
#table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

#data-table { width: 100%; border-collapse: collapse; min-width: 720px; }

#data-table th {
  position: sticky; top: 0;
  background: #f7f9fb;
  color: #4a5568;
  font-size: 12.5px;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 1;
}

#data-table th.ops-col { width: 150px; }

/* 勾选列：窄、居中、不参与排序；整列 sticky 左侧会让表格横向滚动时丢失，这里保持普通列 */
#data-table th.sel-col, #data-table td.sel-col { width: 34px; padding-left: 12px; padding-right: 0; text-align: center; }
#data-table td.sel-col input, #data-table th.sel-col input { cursor: pointer; }
/* 选中行底色要区分于 hover 色（hover 是 #f4f8fe，偏蓝），这里用浅绿 */
#data-table tbody tr.row-picked { background: #eefaf1; }
#data-table tbody tr.row-picked:hover { background: #e4f6e9; }

#data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 13px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#data-table tbody tr:hover { background: #f4f8fe; }

#data-table .ops button { padding: 4px 10px; font-size: 12px; margin-right: 6px; }

.empty-row { text-align: center; color: var(--text-light); padding: 36px 0 !important; }

/* 分页 */
#pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-light);
}

#pagination button { padding: 5px 12px; }

/* ================= 弹窗 ================= */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-box {
  background: #fff;
  width: 680px;
  max-width: 96vw;
  max-height: 88vh;
  border-radius: 10px;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);

  /* 弹窗可拖动缩放（右下角手柄），内容随宽度自适应 */
  position: relative;
  overflow: hidden;
  container-type: inline-size;
}

/* 右下角拖拽手柄 */
.modal-box::after {
  content: '';
  position: absolute;
  right: 2px; bottom: 2px;
  width: 14px; height: 14px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 45%, #c4ccd6 45% 55%, transparent 55% 70%, #c4ccd6 70% 80%, transparent 80%);
  opacity: 0.55;
  pointer-events: none;
  border-radius: 0 0 8px 0;
}

.modal-foot { padding-right: 30px; }

.modal-foot-left { display: flex; gap: 8px; margin-right: auto; align-items: center; }

/* 自动保存状态：低存在感的小字，不打断输入 */
#autosave-hint { font-size: 12px; color: var(--muted, #888); white-space: nowrap; }
#autosave-hint.error { color: #c0392b; }
#autosave-hint:empty { display: none; }

/* 弹窗变窄时内部自适应（member-row / unit-row 的回退规则已移至其基础定义之后） */
@container (max-width: 620px) {
  .modal-body, .sect-body { grid-template-columns: 1fr; }
  .form-field.full, .section-units, .member-editor { grid-column: 1 / -1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16px; }

.close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: var(--text-light);
  padding: 2px 6px;
}
.close:hover { color: var(--danger); }

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px 16px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }

.form-field label { font-size: 12.5px; color: #55617a; font-weight: 500; }
.form-field label .req { color: var(--danger); margin-left: 2px; }

.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

.form-field textarea { min-height: 84px; resize: vertical; }

/* 录入提速：长文本框上方的常用短语胶囊（点击插入光标处） */
.quick-fill { display: flex; flex-wrap: wrap; gap: 6px; }
.qf-chip {
  padding: 3px 9px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f7f9fc;
  color: #55617a;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qf-chip:hover { border-color: var(--primary); color: var(--primary); background: #eef4fd; }

/* 多选字段（质量证明文件）：已选 chips + 手填框 + 常用选项胶囊 */
.multi-select { display: flex; flex-direction: column; gap: 6px; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-chips:empty { display: none; }
.ms-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 6px 3px 10px;
  font-size: 12px; line-height: 1.5;
  border-radius: 12px;
  border: 1px solid var(--primary);
  background: #eef4fd; color: var(--primary);
}
.ms-chip .ms-chip-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--primary); font-size: 13px; line-height: 1; padding: 0 2px;
}
.ms-chip .ms-chip-x:hover { color: var(--danger); }
.multi-select .ms-input { width: 100%; }
.ms-options { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-opt {
  padding: 3px 9px;
  font-size: 12px; line-height: 1.5;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f7f9fc;
  color: #55617a;
  cursor: pointer;
}
.ms-opt:hover { border-color: var(--primary); color: var(--primary); background: #eef4fd; }
.ms-opt.active { border-color: var(--primary); color: #fff; background: var(--primary); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30,111,217,0.12);
}

.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* 打印预览：靠左单独一档，与「取消/保存」区隔开，避免误点是保存 */
.modal-foot .ghost-left { margin-right: auto; }

/* 通用确认框：替代原生 alert/confirm/prompt */
/* 层级要高于登录页(300)、文件弹窗(200)，否则「登录失效」这类提示会被盖住 */
#confirmDlg { z-index: 400; }
/* 上面那条 #id 选择器的优先级高于 .modal.hidden，会把 .hidden 的 display:none 压掉，
   结果是「隐藏」的确认框仍铺满全屏，挡住下面所有表单——点输入框点到的全是它。
   因此这里必须用同等优先级单独关掉。 */
#confirmDlg.hidden { display: none; }
.modal-box.confirm-box { width: 420px; }
.modal-box.confirm-box::after { display: none; }   /* 不需要拖拽手柄 */
.confirm-body { display: block; }
.confirm-body p {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  line-height: 1.7;
}
.confirm-body input { width: 100%; margin-top: 12px; }
/* 单选列表（附表选择这类七选一）：选项多时自身滚动，撑不高弹窗 */
.confirm-radio { max-height: 46vh; overflow: auto; margin-top: 10px; }
.confirm-radio label {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 4px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.confirm-radio label:hover { background: #f2f3f5; }
.confirm-radio input[type="radio"] { width: auto; margin: 0; flex: 0 0 auto; }
/* 危险操作的主按钮用实心红，避免批量删除时误点 */
.modal-box.confirm-box button.primary.danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.modal-box.confirm-box button.primary.danger:hover { background: #c0392b; }

/* ================= 附表类型选择（旁站记录 detail_table） ================= */
.detail-table-field .dt-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.detail-table-field .dt-picked { flex: 1 1 auto; font-size: 13px; }
.detail-table-field .dt-name { font-weight: normal; }
.detail-table-field .dt-name.muted { color: var(--muted, #888); }
.detail-table-field button { padding: 4px 12px; font-size: 12px; }

/* ================= 现场照片（水印设置弹窗 + 表单缩略图网格） ================= */
/* #photoDlg 有自己的 z-index，比 .modal.hidden 优先级高，必须单独关掉
   （同 #confirmDlg.hidden 的坑：不写就会铺满全屏挡住表单） */
#photoDlg { z-index: 350; }
#photoDlg.hidden { display: none; }
.modal-box.photo-box { width: 820px; max-width: 96vw; }
.photo-body { display: flex; gap: 16px; align-items: flex-start; }
.photo-preview {
  flex: 0 0 auto; width: 420px; max-width: 46vw;
  background: #1b1b1b; border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; min-height: 200px;
}
.photo-preview canvas { max-width: 100%; max-height: 380px; display: block; }
.photo-opts { flex: 1 1 auto; min-width: 240px; }
.photo-opts label {
  display: block; font-size: 12px; color: var(--muted, #666); margin: 10px 0 4px;
}
.photo-opts input[type="text"],
.photo-opts select { width: 100%; box-sizing: border-box; }
.photo-fixed input[readonly] { background: #f2f3f5; color: #555; }
.photo-row { display: flex; gap: 12px; }
.photo-row > div { flex: 1 1 0; min-width: 0; }
.photo-row input[type="range"] { width: 100%; }
.photo-row input[type="color"] { width: 100%; height: 32px; padding: 2px; }
.photo-check {
  display: flex; align-items: center; gap: 6px;
  margin-top: 14px; font-size: 13px; color: var(--text, #333);
}
/* 表单里的照片网格 */
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin-top: 6px;
}
.photo-cell { position: relative; border-radius: 6px; overflow: hidden; background: #eef0f2; }
.photo-cell img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-name {
  display: block; padding: 2px 4px; font-size: 11px; color: #555;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; padding: 0;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; line-height: 20px; cursor: pointer;
}
.photo-del:hover { background: rgba(200,40,40,.9); }
.photo-empty {
  grid-column: 1 / -1; padding: 14px; text-align: center;
  font-size: 12px; color: #888; border: 1px dashed #ccd0d5; border-radius: 6px;
}
.photo-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.photo-hint { font-size: 12px; color: #888; }
#modal-form [data-photo-add]:disabled { cursor: not-allowed; }

/* ================= 分区折叠长表单（工程项目） ================= */
.modal-box.sectioned { width: 900px; max-width: 96vw; }
.modal-box.sectioned .modal-body { display: block; }

.form-sect {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}

.sect-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #f7f9fb;
  cursor: pointer;
  font-size: 14px; font-weight: 600; color: #1d2634;
  user-select: none;
  transition: background 0.12s;
}
.sect-head:hover { background: #eef2f7; }

.sect-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sect-arrow { margin-left: auto; color: var(--text-light); transition: transform 0.15s; }
.form-sect.collapsed .sect-arrow { transform: rotate(-90deg); }
.form-sect.collapsed .sect-body { display: none; }

.sect-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px 18px;
  padding: 14px 16px;
}

/* 参建单位：每方一行 */
.section-units { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }

.unit-row {
  display: grid;
  grid-template-columns: 92px 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}

/* 同 member-row：允许轨道收缩，窄弹窗下不溢出 */
.unit-row > * { min-width: 0; }

.unit-title { font-size: 13px; color: #55617a; font-weight: 500; }

.unit-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.unit-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,111,217,0.12); }

/* 项目部成员编辑器 */
.member-editor { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.member-editor #add-member { align-self: flex-start; padding: 6px 16px; margin-top: 4px; }

.member-row {
  display: grid;
  grid-template-columns: 0.85fr 1.4fr 1.1fr 126px 1.05fr 126px 1fr 46px;
  gap: 8px;
  align-items: center;
}

/* 允许 fr 轨道收缩：input 固有最小宽度(~198px)否则会把行撑破，
   导致表头与输入框错位（列被挤出容器） */
.member-row > * { min-width: 0; }

.member-row input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.member-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,111,217,0.12); }

.member-row .del-member { padding: 5px 0; }

.member-row.mh {
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

/* 表头文字与输入框内的文字左对齐：输入框 padding 10px + border 1px = 11px */
.member-row.mh > span { padding: 0 11px; }

/* 窄弹窗回退：改自动换列并隐藏表头。
   ⚠ 必须放在上方基础规则之后 —— 同优先级下后者胜，放前面会被覆盖成死代码 */
@container (max-width: 820px) {
  .member-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .member-row.mh { display: none; }
  .unit-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 1100px) {
  .member-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .member-row.mh { display: none; }
  .unit-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* 更窄窗口下内容继续自适应 */
@media (max-width: 860px) {
  .ov-grid { grid-template-columns: 1fr 1fr; }
  .brand-sub { display: none; }
  #toolbar { flex-wrap: wrap; }
  #search { max-width: none; flex: 1 1 100%; }
}

/* ================= 手机竖屏（≤ 640px） =================
   目标：手机浏览器打开网页版时可用，不改变桌面端任何表现。
   桌面窗口最窄一般也在 800px 以上，下面这些规则实际只对手机生效。 */
@media (max-width: 640px) {
  /* 顶栏：品牌文字让位给导航，项目下拉与退出按钮缩小，避免挤成一条 */
  #topbar { height: 52px; padding: 0 10px; gap: 8px; }
  .brand-text { display: none; }
  .brand { flex-shrink: 0; }
  /* 模块标签：桌面是 11 个 flex:1 平分，手机上会各剩 12px 宽、文字全被截掉。
     窄屏改成固定最小宽度 + 横向滚动，每个标签保持可读。
     flex:1 1 auto 让标签栏吃掉顶栏剩余宽度：不写的话它只按内容收缩到 120px 左右，
     而右侧「项目下拉+连接状态+退出」反而占掉 154px，主入口比次要按钮还窄。 */
  #top-nav {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;           /* Firefox */
    -webkit-overflow-scrolling: touch;
  }
  #top-nav::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    min-width: 68px;
    padding: 0 10px;
    font-size: 13px;
  }
  .tab-help { flex: 0 0 auto; min-width: 56px; }
  /* 右侧这组不参与收缩（flex-shrink:0），它每多占 1px，模块标签栏就少 1px。
     项目下拉 88px + 连接状态 + 退出 44px 实测吃掉 154px，标签栏只剩 120px。
     手机上项目下拉压到 76px、去掉内层左右内边距，标签栏能多回 ~20px。 */
  .top-right { gap: 4px; }
  .proj-switch { max-width: 76px; padding: 6px 2px; font-size: 11.5px; }
  .cur-user { display: none; }
  /* 「退出登录」只有顶栏这一处入口（侧边栏没有），手机上不能隐藏，
     只能把文字缩到最小，把宽度尽量让给模块标签栏。 */
  .quit-btn { padding: 5px 4px; font-size: 11px; line-height: 1.2; max-width: 42px; }

  /* 侧边栏：桌面是 220px 常驻的 flex 列，手机上会把内容区挤到只剩 140px。
     窄屏改成「浮层抽屉」——脱离文档流、盖在内容上，内容区始终占满宽度；
     点顶栏汉堡按钮（toggleSidebar）仍能展开/收起，行为与桌面一致。
     抽屉默认是收起的（见 renderer.js 的 init：窄屏且用户没手动选过时加
     sidebar-collapsed），收起时 display:none。 */
  #body { position: relative; }
  #sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    /* 必须高于所有 .modal（100）、#photoDlg（350）、#confirmDlg（400）：
       登录后若存在未恢复的草稿，checkPendingDrafts() 会先弹 #confirmDlg，
       它铺满全屏且带 45% 深色底。抽屉层级压在它下面时，用户点汉堡展开后
       看到的是那层遮罩，表现就是「功能菜单看不见」。抽屉本身是全屏最高的浮层。 */
    z-index: 500;
    width: 220px;
    box-shadow: 4px 0 18px rgba(0,0,0,0.28);
  }
  /* 抽屉展开时，右侧内容区变暗，点一下即可收起（靠 body 类名控制，不额外加遮罩节点） */
  .sidebar-collapsed #sidebar { display: none; }

  /* 手机抽屉是唯一的导航入口：顶栏模块标签要横向滚动才点得到，用户不会知道还有别的模块。
     所以抽屉里把所有模块分组列出（见 renderer.js renderSideNav 的窄屏分支），
     分组标题可点：切到该模块并展开其功能，已在该模块时只做折叠/展开。 */
  .side-group { list-style: none; margin-bottom: 2px; }
  .side-group-head {
    padding: 10px 20px 6px;
    font-size: 11.5px;
    letter-spacing: 1.5px;
    color: #6d7b8c;
    cursor: pointer;
    user-select: none;
  }
  .side-group.active > .side-group-head { color: #9fb6cd; }
  .side-group-head::before {
    content: '▸';
    display: inline-block;
    width: 12px;
    margin-left: -12px;
    transform: rotate(90deg);
    transition: transform 0.12s;
  }
  /* 子列表收起时箭头朝右，给用户「可以展开」的暗示 */
  .side-group:has(> .side-sub.hidden) > .side-group-head::before { transform: rotate(0deg); }
  .side-sub { list-style: none; }
  /* 分组里的功能项比桌面多一层缩进，读起来是「模块 → 功能」两级 */
  .side-sub .side-item { padding-left: 32px; }

  /* 内容区：收窄内边距，把宽度还给表格 */
  #content { padding: 12px; }
  #page-header { margin-bottom: 10px; }
  #page-header h2 { font-size: 17px; }

  /* 工具栏：按钮会自动换行（见 860px 断点），这里只压缩间距与内边距 */
  #toolbar { gap: 6px; margin-bottom: 10px; }
  #toolbar button { padding: 7px 10px; font-size: 12.5px; }

  /* 表格：保持横向滚动（#table-wrap 已有 overflow:auto）。
     桌面端给单元格的 340px 上限在手机上会把一行撑得过宽，按视口放宽。 */
  #data-table { min-width: 640px; }
  #data-table td { max-width: 180px; padding: 8px 10px; }
  #data-table th { padding: 9px 10px; }

  /* 概览卡片：两列并排在手机上太挤，改单列 */
  .ov-grid { grid-template-columns: 1fr; }
  .ov-lists { grid-template-columns: 1fr; }

  /* 弹窗：基础 .modal-box 已有 max-width:96vw，这里补内边距与高度的收放 */
  .modal-box { max-height: 88vh; }
}

/* 手机横屏介于两者之间时，概览保持两列即可，无需额外规则 */

/* ================= Toast ================= */
.toast {
  position: fixed;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.hidden { display: none; }

/* ================= 附件管理弹窗 ================= */
.modal-box.file-box { width: 640px; }

.file-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.file-tip { font-size: 12px; color: var(--text-light); }
.file-req { color: var(--primary); font-weight: 600; }

.file-list {
  padding: 10px 20px 18px;
  overflow-y: auto;
  max-height: 46vh;
}

.file-empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
  font-size: 13px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  border-bottom: 1px solid #f0f2f5;
}

.file-item:hover { background: #f7fafd; }

.file-info { min-width: 0; }
.file-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--text-light); margin-top: 3px; }

.file-ops { display: flex; gap: 6px; flex-shrink: 0; }
.file-ops button { padding: 5px 12px; font-size: 12px; }

/* ================= 项目绑定弹窗 ================= */
.modal-box.bind-box { width: 520px; }

.bind-body {
  padding: 18px 20px;
  max-height: 52vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.bind-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.bind-item:hover { border-color: var(--primary); }
.bind-item input { accent-color: var(--primary); }

.bind-empty { grid-column: 1 / -1; text-align: center; color: var(--text-light); padding: 30px 0; }

/* ================= 工作台今日概览 ================= */
#overview-wrap { padding: 2px 0 10px; }

.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.ov-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.ov-card.warn { border-left-color: #f5a623; }
.ov-card.danger { border-left-color: var(--danger); }
.ov-card.ok { border-left-color: var(--success); }

.ov-num { font-size: 30px; font-weight: 700; color: #1d2634; line-height: 1.2; }
.ov-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.ov-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

@media (max-width: 1100px) { .ov-lists { grid-template-columns: 1fr; } }

.ov-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.ov-block h4 { font-size: 14px; color: #1d2634; margin-bottom: 8px; }

.ov-empty { color: var(--text-light); font-size: 13px; padding: 12px 0; text-align: center; }

.ov-todo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  font-size: 13px;
}
.ov-todo:hover { background: #f4f8fe; }

.ov-todo .pri {
  flex-shrink: 0;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
}
.p-high { background: #fde8e7; color: var(--danger); }
.p-mid { background: #fff3e0; color: #e08a00; }
.p-low { background: #e8f5e9; color: var(--success); }

.ov-todo .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-todo .pm { color: var(--text-light); font-size: 12px; flex-shrink: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-todo .dued { color: var(--text-light); font-size: 12px; flex-shrink: 0; }
.ov-todo .src-auto { flex-shrink: 0; font-size: 11px; color: #1e6fd9; background: #eaf1fd; padding: 1px 6px; border-radius: 8px; }
.ov-todo .src-man { flex-shrink: 0; font-size: 11px; color: #7a8494; background: #f0f2f5; padding: 1px 6px; border-radius: 8px; }

.ov-go {
  width: 100%;
  margin-top: 10px;
  padding: 7px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.ov-go:hover { background: #eef4fd; border-radius: 6px; }

/* 待办状态列标签 */
#data-table td .tag { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 12px; }
#data-table td .tag.t-done { background: #e8f5e9; color: var(--success); }
#data-table td .tag.t-doing { background: #eaf1fd; color: var(--primary); }
#data-table td .tag.t-open { background: #fff3e0; color: #e08a00; }
#data-table td .tag.t-cancel { background: #f0f2f5; color: var(--text-light); }

/* 完成按钮 */
button.ok { color: var(--success); border-color: var(--success); }
button.ok:hover { background: #e8f5e9; }

/* ================= 登录页 ================= */
/* 布局：左列通高是公告栏（宽度 = 登录框的 2 倍 = 800），右列上=登录框、下=应用下载。
   用 grid-template-areas 而不是挪 DOM：三块的文档顺序保持「公告 → 登录 → 下载」，
   Tab 键和读屏顺序就还是自然的。
   列宽固定（左 800 / 右 400），中间留 gap，整块靠 justify-content 横居中 ——
   用 1fr 两列的话窗口一宽，两块会各自被撑到一半屏宽、越宽越难看。
   两列等高：右列两块叠在同一个网格区域（登录框 start、下载区 end），
   行高按两块总和算；左列公告栏 stretch 占满这一行，于是两列同高同顶同底。 */
.login-page {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 800px 400px;
  /* 两列是第一行，页脚整行铺满第二行 */
  grid-template-rows: auto auto;
  grid-template-areas:
    "notice login"
    "foot   foot";
  column-gap: 56px;
  row-gap: 16px;
  justify-content: center;
  /* 内容超过一屏时靠纵向滚动兜住（窗口矮、公告多、下载区展开旧版本有 600 多像素）。
     必须用 safe center：plain center 会把超出部分的上下两端各裁一半、滚都滚不到 */
  align-content: safe center;
  background: linear-gradient(135deg, #16324f 0%, #1e6fd9 60%, #3a9be8 100%);
  z-index: 300;
}

.login-page.hidden { display: none; }

/* 左列：公告栏整列通高 */
.login-page > .login-notice { grid-area: notice; align-self: stretch; }
/* 右列：登录框在上、下载区在下，纵向 flex 依次排开。
   两块必须在**不同的**盒子里上下排 —— 1.1.63 起试过把它们「叠在同一个 grid 区域」、
   靠 align-self: start/end 一上一下分居，那只是摆上去，格子行高只按登录框算，
   下载区贴底时整块落在登录框的高度范围内。窗口够高时被公告栏撑住看不出来，
   窗口一矮（实测 1380×720：登录框 186..534、下载区 426..534）就压住「登录」按钮。
   flex 容器的自然高度 = 两口之和，才是真的不重叠。
   下载区**紧贴登录框下方**（不再用 margin-top:auto 推到右列底部）：右列高度就等于
   「登录框 + 14 + 下载区」，公告栏 stretch 跟它等高 —— 两个数字严格对得上，
   不会出现「公告栏比右列多出一截、下载区悬在半空」的观感。
   gap 给 14px：两块之间必须有缝，否则看着像连成一体。 */
.login-page > .login-side {
  grid-area: login;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  /* 别写 min-height: 0 —— flex 项在「单列、行高 auto」时会被 grid 压到内容以下，
     下载区就被挤到视口外面（实测 1280×600：容器 391 高，里面两块要 470）。
     被子撑高就让它撑高，超高交给 .login-page 的 overflow-y 滚。 */
}
.login-side > .login-box,
.login-side > .login-download { flex: none; }

/* ================= 登录页页脚 =================
   整行铺满两列（grid-area: foot），不跟着某一列走：
   友情链接、应用下载、运行时间、备案号、维护电话挤在一列 400px 里会换好几行。
   内容少时靠 justify/align 居中，不用留白撑高 —— 页脚的高度就是内容高度。 */
.login-page > .login-foot {
  grid-area: foot;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12.5px;
  /* 别写 min-height: 0 —— 和 .login-side 同一个坑：会被 grid 压到内容以下 */
}

.login-foot a { color: #eaf2ff; text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* 友情链接：一行「友情链接：分类▾ 分类▾ …」
   align-items 用 flex-start 而不是 center：某个分类展开后它自己变高，
   用 center 会把同一行的其它分类一起推到中间，整行跟着上下跳。 */
.login-foot .foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 6px 14px;
  max-width: 100%;
}

/* 「友情链接：」标签，用伪元素挂在容器上，省一个 DOM 节点 */
.login-foot .foot-links:not(.hidden)::before {
  content: '友情链接：';
  opacity: 0.72;
  line-height: 24px;
}

.login-foot .foot-cat { position: relative; }

.login-foot .foot-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.login-foot .foot-cat-btn:hover { background: rgba(255, 255, 255, 0.2); }
.login-foot .foot-cat-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.26); }

/* 箭头：和下载区的收起箭头同一套画法（不受字体影响） */
.login-foot .foot-cat-btn::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.85;
  transform: rotate(0deg);
  transition: transform 0.15s;
}

.login-foot .foot-cat-btn[aria-expanded="true"]::after { transform: rotate(180deg); }

/* 展开的分类列表：**向上**弹（bottom: calc(100% + 6px)）。
   页脚在页面最底部，向下弹会直接出视口、滚都滚不到。 */
.login-foot .foot-cat-list {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 320;
  min-width: 140px;
  max-width: 260px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.login-foot .foot-cat-list.hidden { display: none; }

.login-foot .foot-cat-list li { margin: 0; }

.login-foot .foot-cat-list a {
  display: block;
  padding: 6px 14px;
  color: #1f3b5c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-foot .foot-cat-list a:hover { background: #eef5ff; text-decoration: none; }

/* 一行信息：应用下载 | 已稳定运行 | 备案号 | 网站维护 */
.login-foot .foot-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
}

/* 分隔符统一由 CSS 挂在每一项前面（除第一项），这样某一项隐藏时不会留下孤零零的竖线 —— 
   比在 HTML 里摆 <span>|</span> 再逐个隐藏可靠。 */
.login-foot .foot-meta > * + *::before {
  content: '|';
  margin-right: 10px;
  opacity: 0.4;
}

/* 每一项前面都带竖线，某一项 hidden 后它的竖线也就跟着不渲染了（display:none 的元素没有伪元素），
   不会出现「连着两条竖线」—— 所以不需要给隐藏项的下一项单独擦线。 */
.login-foot .foot-meta > .hidden { display: none; }

.login-foot .foot-maint { opacity: 0.78; }


/* 登录页公告栏：宽度 = 登录框的 2 倍（800px），一条一行的纵向列表。
   1.1.63 之前是单行横向滚动：滚得快时来不及读完、文字还会从鼠标底下滑走点不中，
   公告一多就只能等它一圈圈转。改成静态列表后每条都能看清、点得准。 */
.login-notice {
  display: flex;
  flex-direction: column;
  width: 800px;
  max-width: calc(100vw - 40px);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 10px;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
}

.login-notice.hidden { display: none; }

/* 栏头：左边「通知」标签，右边条数。标题栏和列表同宽，视觉上像一块面板 */
.login-notice .notice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 0;
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  height: 38px;
  flex: none;
}

.login-notice .notice-tag {
  flex: none;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.login-notice .notice-sum { margin-left: auto; font-size: 12px; opacity: 0.7; }

/* 列表本身占满剩余高度：公告多时在这里滚，栏头不动。
   用 flex:1 + min-height:0 而不是固定高度 —— 固定高度在「只有一两条」时会留一大块空白，
   面板会显得空心。 */
.login-notice .notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;   /* 滚到列表尽头不要把整个登录页一起带着滚 */
}

/* 一行 = 日期 | 主要内容 | 阅读量。三列用 grid：日期和阅读量定宽，
   内容吃掉剩余宽度，行与行之间三列严格对齐（用 flex 时日期宽的会被挤开）。 */
.login-notice .notice-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.16);
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  color: inherit;
  font: inherit;
}
.login-notice .notice-item:last-child { border-bottom: 0; }
.login-notice .notice-item:hover { background: rgba(255, 255, 255, 0.09); }
.login-notice .notice-item:focus-visible { outline: 1px dashed rgba(255, 255, 255, 0.8); outline-offset: -3px; }

.login-notice .notice-date {
  font-size: 12px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;   /* 数字等宽，一列日期看起来才齐 */
  white-space: nowrap;
}

/* 主要内容一行显示、超出用「…」，不换行 —— 一条一行是这个列表的前提，
   换行了行高就参差，读起来比滚动还乱。全文点开详情看。 */
.login-notice .notice-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 「详情」小标：这条点开还有附件、或正文被截断了，提示一下 */
.login-notice .notice-more {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  font-size: 11px;
  font-style: normal;
  line-height: 17px;
  opacity: 0.9;
}

.login-notice .notice-views {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 12px;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 眼睛用纯字符：不引图标字体，省一个字体文件 */
.login-notice .notice-views::before { content: '👁'; font-size: 11px; }
/* 公告详情小窗 */
/* 层级必须高于登录页(.login-page 是 z-index:300)。
   公告是从登录页点开的，而 .modal 默认只有 100 —— 弹窗其实已经打开了，
   只是整块被登录页压在下面，用户看到的是「点了没反应」。
   和 #confirmDlg(400) / #photoDlg(350) 拉开一档，免得两组弹窗打架。 */
#noticeDlg { z-index: 340; }
/* 同理：#id 选择器的优先级高于 .modal.hidden，不单独写 .hidden 这条，
   关掉之后弹窗仍铺满全屏，且透明遮罩会吃掉登录框上的点击。 */
#noticeDlg.hidden { display: none; }
.modal-box.notice-box { width: 520px; max-width: 92vw; }
.modal-box.notice-box::after { display: none; }   /* 内容是只读的，不需要拖拽手柄 */
.notice-dlg-body { display: block; }               /* 继承的 grid 会把正文和附件排成两列 */
.notice-dlg-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;   /* 公告里的换行要保留：管理员可能分行写多条要点 */
  word-break: break-word;
}
.notice-dlg-atts {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notice-dlg-att { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.notice-dlg-img {
  max-width: 100%;
  max-height: 46vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: zoom-in;
  object-fit: contain;
  background: #f7f9fb;
}
.notice-dlg-cap { font-size: 12px; color: #78828f; word-break: break-all; }
.notice-dlg-dl { font-size: 13px; text-align: left; word-break: break-all; }

/* 管理员编辑区的附件条 */
.notice-row { flex-direction: column; align-items: stretch; }
.notice-main { display: flex; align-items: center; gap: 6px; }
.notice-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 0 26px; }
.notice-att {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 8px;
  background: #eef3fa;
  border-radius: 6px;
  font-size: 12px;
  max-width: 100%;
}
.notice-att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.notice-att-size { color: #78828f; flex: none; }
.notice-att-del { flex: none; padding: 0 4px; line-height: 1; }


.login-box {
  width: 400px;
  max-width: calc(100vw - 32px);   /* 手机竖屏（360/390px）不溢出，桌面不受影响 */
  background: #fff;
  border-radius: 12px;
  padding: 40px 38px 28px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #1e6fd9, #3a9be8);
  color: #fff;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}

.login-box h1 { font-size: 20px; color: #1d2634; margin-bottom: 26px; }

.login-box input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.login-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,111,217,0.12); }

.login-box button.primary {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  font-size: 15px;
  border-radius: 8px;
}

.login-err {
  background: #fef1f0;
  color: var(--danger);
  border: 1px solid #f5c6c2;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* 升级后需重登的提示：用提示色而不是错误色 —— 这不是出错，只是升了一次级 */
.login-upgraded {
  text-align: left;
  background: #fff8e6;
  border: 1px solid #f0d491;
  border-left: 3px solid #e0a52a;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #7a5a12;
}
.login-upgraded strong { display: block; color: #8a5a00; margin-bottom: 2px; }
.login-upgraded .link-btn { padding: 0; margin-top: 4px; font-size: 12.5px; }

/* 登录页内容可能超过一屏（窗口矮 + 下载区展开旧版本）：允许纵向滚动，
   否则底部的下载区会被裁掉、连滚都滚不到。
   留 32px 而不是上下各 24px：公告条贴顶、下载区贴底，不留白就顶到屏幕边了 */
.login-page { overflow-y: auto; padding: 32px 24px; }

/* 登录页左下角的桌面应用下载区：和公告条同宽，半透明底，白色文字 */
.login-download {
  width: 400px;
  max-width: calc(100vw - 40px);
  padding: 12px 14px 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
}

.login-download.hidden { display: none; }

.login-download .dl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

/* 收起箭头：靠旋转变方向，比换字符更稳（不受字体影响） */
.login-download .dl-title::after {
  content: '';
  display: inline-block;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.8;
  transform: translateY(-1px) rotate(0deg);
  transition: transform 0.15s;
}
.login-download.collapsed .dl-title::after { transform: translateY(-1px) rotate(-90deg); }
.login-download .dl-head:hover .dl-title::after { opacity: 1; }
.login-download .dl-body.hidden { display: none; }
/* 收起时标题下方不要留白 */
.login-download.collapsed .dl-head { margin-bottom: 0; }

.login-download .dl-title { font-weight: 600; letter-spacing: 1px; }
.login-download .dl-sum { font-size: 12px; opacity: 0.75; }

.login-download .dl-list { list-style: none; margin: 0; padding: 0; }
.login-download .dl-group { list-style: none; }
.login-download .dl-old { list-style: none; margin-top: 8px; }
.login-download .dl-old.hidden { display: none; }
.login-download .dl-old .dl-group + .dl-group { margin-top: 8px; }

.login-download .dl-ver {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.login-download .dl-vno { font-weight: 600; font-size: 13px; }
.login-download .dl-vtag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #ffd66b;
  color: #6b4a00;
}
.login-download .dl-vdate { margin-left: auto; font-size: 11.5px; opacity: 0.7; }

.login-download .dl-vers { list-style: none; margin: 0 0 4px; padding: 0; }

.login-download .dl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.login-download .dl-row:last-child { margin-bottom: 0; }

/* 下载按钮：撑满剩余宽度，右侧「下载」两个字固定
   用 #id 提高优先级：全局 button 样式会把这里盖掉 */
.login-download button.dl-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  color: #16324f;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.login-download button.dl-btn:hover { background: #fff; }
.login-download button.dl-btn:disabled { opacity: 0.6; cursor: default; }
.login-download button.dl-btn .dl-os { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-download button.dl-btn .dl-go { flex: none; color: var(--primary); font-weight: 600; }
.login-download button.dl-btn.busy .dl-go::after { content: '…'; }

.login-download .dl-cnt { flex: none; font-size: 11.5px; opacity: 0.8; white-space: nowrap; }
.login-download .dl-cnt b { font-weight: 600; }

.login-download button.dl-more {
  width: 100%;
  margin-top: 8px;
  padding: 5px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.login-download button.dl-more:hover { background: rgba(255, 255, 255, 0.1); }
.login-download button.dl-more.hidden { display: none; }

/* 展开旧版本后列表有 600 多像素，用户往下看旧版本时必须还能点「收起」。
   光靠 scrollIntoView 只在展开那一刻管用，用户一滚动按钮又跑出去了 ——
   钉在滚动容器底部，滚到哪都在手边。
   1.1.63 起右列两块叠在同一 grid 区域、由登录页整体滚动，
   不再需要 .login-scroll 那套「展开时改行高 + 归零 margin」的补丁。 */
.login-page:has(.dl-old:not(.hidden)) .login-download button.dl-more {
  position: sticky;
  bottom: 8px;
  z-index: 1;
  background: rgba(20, 45, 75, 0.85);
  backdrop-filter: blur(4px);
}

/* ================= 监理人员考勤（月度日历网格） ================= */
.att-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.att-toolbar button { padding: 5px 10px; font-size: 13px; }
.att-toolbar input[type="month"] {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.att-sum { margin-left: auto; color: var(--text-light); font-size: 12px; }
.att-legend { display: inline-flex; align-items: center; font-size: 12px; color: var(--text-light); }
.att-legend .att-lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin: 0 4px 0 10px; }
.att-lg-none { background: #eef0f3; border: 1px solid var(--border); }
.att-lg-in { background: #eaf1fd; border: 1px solid #bcd6f7; }
.att-lg-done { background: #e8f5e9; border: 1px solid #bfe3c4; }

.att-tip { font-size: 12px; color: var(--text-light); margin: 0 2px 10px; }
.att-tip strong { color: var(--primary); }

.att-hint {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-light);
  line-height: 1.9;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.att-scroll {
  overflow: auto;
  max-height: calc(100vh - 250px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.att-table { border-collapse: separate; border-spacing: 0; min-width: max-content; font-size: 12px; }
.att-table th, .att-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

/* 表头（纵向冻结） */
.att-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 34px;
  background: #f6f8fb;
  font-weight: 600;
  color: var(--text);
}
.att-day-h .att-d { display: block; line-height: 1.15; }
.att-day-h .att-w { display: block; font-size: 10px; font-weight: 400; color: var(--text-light); }
.att-day-h.att-weekend { background: #eef1f6; }
.att-day-h.att-today { background: #eaf1fd; color: var(--primary); }

/* 前两列（横向冻结） */
.att-table .att-name {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 108px; min-width: 108px; max-width: 108px;
  padding: 0 8px;
  text-align: left;
  background: #fff;
}
.att-table .att-count {
  position: sticky;
  left: 108px;
  z-index: 2;
  width: 72px; min-width: 72px; max-width: 72px;
  font-weight: 600;
  color: var(--primary);
  background: #fff;
}
.att-table th.att-name, .att-table th.att-count { z-index: 3; background: #f6f8fb; }
.att-table tfoot td.att-name, .att-table tfoot td.att-count { z-index: 3; background: #f6f8fb; }
.att-table tfoot td { height: 28px; color: var(--text-light); }

.att-name .att-nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name .att-role {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 日期格 */
.att-day { position: relative; cursor: pointer; width: 54px; min-width: 54px; height: 42px; }
.att-day:hover { background: #f4f8fe; }
.att-day.att-weekend { background: #f7f8fa; }
.att-day.att-weekend:hover { background: #eef1f6; }
.att-day.att-in-only { background: #eaf1fd; }
.att-day.att-done { background: #e8f5e9; }
.att-day.att-today { box-shadow: inset 0 0 0 2px var(--primary); }
.att-day.att-readonly { cursor: default; }
.att-day.att-foot, .att-day.att-foot:hover { cursor: default; background: #f6f8fb; }
.att-day.att-foot.att-weekend { background: #eef1f6; }

.att-in { display: block; font-weight: 600; line-height: 1.35; color: var(--primary); }
.att-out { display: block; line-height: 1.35; color: var(--success); }
.att-out.att-none { font-weight: 400; color: var(--text-light); }
.att-dot { color: #c9d0da; }

.att-clear {
  display: none;
  position: absolute;
  top: 1px; right: 1px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 15px;
  border: none;
  border-radius: 4px;
  background: rgba(224, 72, 62, .92);
  color: #fff;
  cursor: pointer;
}
.att-day:hover .att-clear { display: block; }

/* ================= 表单内附件上传 / 工作流按钮 ================= */
#modal-form .attach-existing { margin-top: 6px; }
#modal-form .attach-line { font-size: 12px; color: #55617a; line-height: 1.9; }
#modal-form .attach-line.muted { color: var(--text-light); }
#data-table .ops button.wf { font-weight: 500; }

/* ================= 自动汇总面板（监理月报 / 监理日志） ================= */
.sum-panel {
  border: 1px solid #cfe0f5;
  background: #f5f9ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  grid-column: 1 / -1;   /* #modal-form 是网格容器，面板要横跨整行 */
}
.sum-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.sum-title { font-size: 13px; font-weight: 600; color: var(--primary-dark); }
.sum-head .sum-hint { font-size: 12px; color: var(--text-light); }
.sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.sum-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
}
.sum-k { font-size: 12px; color: var(--text-light); }
.sum-v { font-size: 15px; font-weight: 600; color: var(--text); }
.sum-v .sum-u { font-size: 12px; font-weight: 400; color: var(--text-light); margin-left: 2px; }
.sum-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.sum-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.sum-btn:disabled { opacity: .5; cursor: not-allowed; }
.sum-btn[disabled]:hover { background: var(--primary); border-color: var(--primary); }
.sum-note { font-size: 12px; color: var(--text-light); line-height: 1.7; margin-top: 8px; }

/* ================= 资料台账：从业务记录生成 ================= */
.modal-box.arc-box { width: 760px; }
.arc-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.arc-all { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.arc-tip { font-size: 12px; color: var(--text-light); flex: 1; min-width: 200px; }
.arc-list { padding: 10px 20px 18px; overflow-y: auto; max-height: 52vh; }
.arc-group { margin-bottom: 12px; }
.arc-group-title {
  font-size: 12.5px; font-weight: 600; color: var(--primary-dark);
  padding: 4px 0; border-bottom: 1px dashed var(--border); margin-bottom: 6px;
}
.arc-row {
  display: grid; grid-template-columns: 22px 1fr 108px;
  gap: 8px; align-items: center;
  padding: 5px 0; font-size: 13px;
  border-bottom: 1px solid #f2f5f9;
  cursor: pointer;
}
.arc-row:hover { background: #f8fbff; }
.arc-row .arc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-row .arc-date { font-size: 12px; color: var(--text-light); }
.arc-row.arc-done { opacity: .5; }
.arc-empty { padding: 18px 0; text-align: center; color: var(--text-light); font-size: 13px; }

/* ================= 旁站附表：Excel 式多行明细网格 ================= */
.modal-box.detail-box { width: 1080px; max-width: 97vw; }

.detail-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.detail-picker {
  min-width: 260px; max-width: 46vw;
  padding: 6px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text);
}
.detail-picker:focus { outline: none; border-color: var(--primary); }
/* 附表锁定显示：本记录只用这一张，不可切 */
.detail-picker:disabled { background: #f2f3f5; color: var(--text); opacity: 1; cursor: default; }
.detail-tip { font-size: 12px; color: var(--text-light); flex: 1; min-width: 180px; }

/* 表头参数区（甬统表-B-25 上半部分：设计水泥掺入比…机号）
   这些是整张附表共用的固定参数，不是「一行一桩」的列，画在明细表上方 */
.detail-head { padding: 12px 20px 4px; }
.detail-head.hidden { display: none; }
/* 版头（表样 r1/r4/r5）：左表号、中工程名称、右编号 */
.dh-band {
  display: flex; align-items: baseline; gap: 20px;
  font-size: 12.5px; color: var(--text); padding: 0 2px 6px;
}
.dh-no { font-weight: 500; white-space: nowrap; }
.dh-meta { color: var(--text-light); }
.dh-meta b { color: var(--text); font-weight: 500; }
.dh-band .dh-meta:last-child { margin-left: auto; }
.dh-title {
  text-align: center; font-size: 15px; font-weight: 600; letter-spacing: 2px;
  padding: 6px 0 8px; color: var(--text);
}
/* 表样 r6 是 4 格、r7 是 5 格。列数走 class 而不是内联 style ——
   index.html 的 CSP 是 style-src 'self'，style 属性整体被拦，写了也不生效 */
.dh-row {
  display: grid; gap: 0; margin-bottom: 0;
  border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0;
}
.dh-row.dh-c1 { grid-template-columns: minmax(0, 1fr); }
.dh-row.dh-c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dh-row.dh-c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dh-row.dh-c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dh-row.dh-c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dh-row:last-of-type { border-bottom: 1px solid var(--border); border-radius: 0 0 6px 6px; }
.dh-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px 8px; }
.dh-cell + .dh-cell { border-left: 1px solid var(--border); }
.dh-label {
  font-size: 12px; color: var(--text-light); line-height: 1.25;
  text-align: center; word-break: break-all;
}
.dh-cell input {
  width: 100%; box-sizing: border-box; min-width: 0; height: 26px;
  padding: 3px 8px; font-size: 12.5px; text-align: center;
  border: 1px solid var(--border); border-radius: 5px;
  background: #fff; color: var(--text);
}
.dh-cell input:focus { outline: none; border-color: var(--primary); }

/* 网格容器：横向滚动 + 纵向限高，表头 sticky 常驻 */
.detail-grid {
  flex: 1;
  overflow: auto;
  max-height: 58vh;
  padding: 0 20px 4px;
}

.detail-table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.detail-table th,
.detail-table td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
  white-space: nowrap;
}
.detail-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #eef2f7;
  font-weight: 600; color: #475569;
  padding: 7px 8px;
  white-space: normal; word-break: break-all;
  min-width: 88px; max-width: 150px;
}
.detail-table tbody tr:nth-child(even) { background: #fafcfe; }
.detail-table tbody tr:hover { background: #f1f7ff; }

.detail-table td input {
  width: 100%; min-width: 80px;
  border: 0; background: transparent;
  padding: 6px 8px; font-size: 12.5px; color: var(--text);
  font-family: inherit;
}
.detail-table td input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #fff;
  border-radius: 3px;
}
/* 日期/数字列稍窄 */
.detail-table td input[type="date"] { min-width: 130px; }
.detail-table td input[type="number"] { min-width: 72px; text-align: right; }

.detail-table th.ops-col,
.detail-table td.ops {
  position: sticky; right: 0;
  background: #fff;
  box-shadow: -1px 0 0 var(--border);
  width: 58px;
}
.detail-table thead th.ops-col { background: #eef2f7; z-index: 3; }
.detail-table td.ops .del-row { padding: 4px 8px; font-size: 12px; }
.detail-table .empty-row { color: var(--text-light); padding: 30px 0 !important; }

/* ================= 附表 Excel 导入：字段映射确认框 ================= */
/* 层级要高于附表弹窗（两者都是 .modal，z-index 100），
   不加的话映射框会被附表弹窗盖住，看起来像「点了导入没反应」 */
#mapDlg { z-index: 150; }
#mapDlg.hidden { display: none; }
.modal-box.map-box { width: 900px; max-width: 96vw; }

.map-body { padding: 12px 20px; overflow: auto; flex: 1; }
.map-meta { font-size: 12.5px; color: var(--text-light); margin-bottom: 10px; }

.map-table-wrap {
  border: 1px solid var(--border); border-radius: 8px;
  overflow: auto; max-height: 46vh;
}
.map-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.map-table th, .map-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle;
}
.map-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f1f5f9; font-weight: 600; color: #1d2634;
  font-size: 12.5px;
}
.map-table tbody tr:last-child td { border-bottom: none; }
.map-table tbody tr:hover { background: #f7fbff; }
.map-col-src { width: 30%; }
.map-src-text { font-weight: 500; word-break: break-all; }
.map-col-arrow { width: 36px; text-align: center; color: var(--text-light); }
.map-col-dst { width: 34%; }
.map-col-dst select { width: 100%; padding: 5px 8px; font-size: 13px; }
.map-col-sample { color: var(--text-light); font-size: 12px; word-break: break-all; }
/* 表头参数列：整张附表共用、不是每行的列，默认不导入 */
.map-row-head { background: #fbfaf3; }
.map-src-head {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  font-size: 11px; line-height: 16px; border-radius: 3px;
  background: #efe6c8; color: #7a6320; font-weight: 400;
}
/* 两个 Excel 列选了同一个字段：后改的不生效，标红让用户当场看到 */
.map-table tr.dup { background: #fff5f5; }
.map-table tr.dup .map-col-dst select { border-color: var(--danger); }

.map-firstrow {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 12.5px; color: #334155; cursor: pointer;
}
.map-firstrow.hidden { display: none; }

.map-summary { margin-right: auto; font-size: 12.5px; color: var(--text-light); }

/* ================= 打印模板：单元格映射配置 ================= */
/* 层级压在附表映射框之上：模板配置里也可能弹别的框 */
#tplMapDlg, #tplCellDlg { z-index: 160; }
#tplMapDlg.hidden, #tplCellDlg.hidden { display: none; }
.modal-box.tplmap-box {
  width: 1100px; max-width: 96vw;
  height: 78vh; display: flex; flex-direction: column;
}
.modal-box.tplcell-box { width: 460px; max-width: 92vw; }

.tplmap-body { padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.tplmap-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: #334155;
}
.tplmap-bar label { display: inline-flex; align-items: center; gap: 6px; }
.tplmap-bar select, .tplmap-bar input[type="number"], .tplmap-bar input[type="text"] {
  padding: 4px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 5px;
}
.tplmap-bar input[type="number"] { width: 92px; }
.tplmap-hint { color: var(--text-light); font-size: 12px; }
.tplmap-hint.warn { color: var(--danger); font-weight: 500; }

.tplmap-cols { display: flex; gap: 12px; flex: 1; min-height: 0; }
.tplmap-pane {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.tplmap-cells { flex: 1.45; min-width: 0; }
.tplmap-binds { flex: 1; min-width: 0; }
.tplmap-pane-head {
  padding: 6px 10px; background: #f1f5f9; font-size: 12.5px; font-weight: 600;
  color: #1d2634; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.tplmap-sub { font-weight: 400; color: var(--text-light); font-size: 12px; }
.tplmap-cells-wrap, .tplmap-binds-wrap { flex: 1; overflow: auto; }

.tplmap-grid { border-collapse: collapse; width: 100%; font-size: 12px; }
.tplmap-grid th, .tplmap-grid td {
  border-bottom: 1px solid #eef2f7; border-right: 1px solid #f3f6fa;
  padding: 0; white-space: nowrap;
}
.tplmap-grid thead th {
  position: sticky; top: 0; z-index: 2; background: #f8fafc;
  font-weight: 600; color: #475569; padding: 4px 6px; text-align: center;
}
.tplmap-grid tbody th {
  position: sticky; left: 0; z-index: 1; background: #f8fafc;
  padding: 2px 6px; color: #64748b; font-weight: 500; text-align: right;
}
.tplmap-grid td.cell {
  padding: 3px 6px; max-width: 190px; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; color: #0f172a;
}
.tplmap-grid td.cell:hover { background: #e8f2ff; }
.tplmap-grid td.cell.empty { color: #cbd5e1; cursor: default; }
.tplmap-grid td.cell.empty:hover { background: transparent; }
.tplmap-grid td.cell.bound-field { background: #e8f6ea; }
.tplmap-grid td.cell.bound-fixed { background: #fdf5e3; }
.tplmap-grid td.cell.start-row { box-shadow: inset 0 2px 0 #f59e0b; }
.tplmap-grid.picking td.cell { cursor: crosshair; }
.tplmap-grid.picking td.cell:hover { outline: 2px solid #2563eb; outline-offset: -2px; }
/* 按模板列对齐后：缺列留空、空白格淡显、每格上方标地址 */
.tplmap-grid td.cell.gap { background: #fbfcfd; cursor: default; }
.tplmap-grid td.cell.gap:hover { background: #fbfcfd; }
.tplmap-grid td.cell.blank { color: #cbd5e1; }
.tplmap-grid td.cell .tpl-cell-addr {
  display: block; font-size: 10px; line-height: 1.1; color: #94a3b8;
  font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .2px;
}
.tplmap-grid td.cell.bound-field .tpl-cell-addr { color: #15803d; }
.tplmap-grid td.cell.bound-fixed .tpl-cell-addr { color: #b45309; }
.tplmap-grid td.cell .tpl-cell-text { display: block; line-height: 1.3; }
.tplmap-showempty { font-weight: 400; font-size: 12px; color: var(--text-light); margin-left: 8px; cursor: pointer; }
.tplmap-showempty input { vertical-align: -1px; margin-right: 3px; }
#tplmap-goto { width: 74px; text-transform: uppercase; }

.tplmap-bind-table td { padding: 5px 8px; font-size: 12.5px; }
.tplmap-bind-table .b-cell { width: 74px; font-family: ui-monospace, Menlo, monospace; font-weight: 600; color: #1e40af; }
.tplmap-bind-table .b-kind { width: 74px; }
.tplmap-bind-table .b-kind .tag {
  display: inline-block; padding: 0 6px; line-height: 18px; border-radius: 3px; font-size: 11.5px;
}
.tplmap-bind-table .b-kind .tag.field { background: #dcf3e1; color: #166534; }
.tplmap-bind-table .b-kind .tag.fixed { background: #fbeecd; color: #8a5a00; }
.tplmap-bind-table .b-text { word-break: break-all; color: #334155; }
.tplmap-bind-table .b-ops { width: 46px; text-align: right; }
.tplmap-bind-table .b-ops button { padding: 1px 7px; font-size: 12px; }
.tplmap-empty { padding: 18px 10px; text-align: center; color: var(--text-light); font-size: 12.5px; }

.tplcell-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.tplcell-preview {
  padding: 8px 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; color: #475569; word-break: break-all; max-height: 96px; overflow: auto;
}
.tplcell-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.tplcell-row > span { width: 64px; flex: none; color: #334155; }
.tplcell-row select, .tplcell-row input[type="text"] {
  flex: 1; padding: 5px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 5px;
}
.tplcell-row.hidden { display: none; }
.tplcell-ph { font-size: 12px; color: var(--text-light); line-height: 2; }
.tplcell-ph.hidden { display: none; }
.tplcell-ph-btn {
  padding: 1px 7px; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
  border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer;
}
.tplcell-ph-btn:hover { background: #e8f2ff; }

/* 模板管理列表里的「映射」摘要列 */
.tpl-map-sum { font-size: 12px; color: var(--text-light); }
.tpl-map-sum b { color: #1e40af; font-weight: 600; }

/* ================= 登录页窄屏（单列） =================
   两列布局需要 400 + 56 + 400 = 856px 才放得下；平板竖屏（768）和手机（360/390）
   都会横向溢出、右半边登录框被裁掉。窄屏一律退回单列、按原来的上下顺序排：
   公告 → 登录框 → 下载。写在文件末尾而不是塞进上面那个 @media (max-width: 640px)，
   是因为登录页的基础规则在它后面，塞进去会被后者按同优先级覆盖掉。 */
@media (max-width: 1300px) {
  /* 两列需要 800（公告）+ 56（gap）+ 400（登录框）= 1256px，再留 24+24 的内边距
     才不横向溢出。断点取 1300px 而不是 1256px：窄一点点就退单列，不会出现
     「刚好卡在边界上、差几像素就出一根横向滚动条」。
     单列后右列（`.login-side`）整块占一行，内部登录框在上、下载区在下，
     DOM 顺序「公告 → 登录 → 下载」正好就是从上到下的阅读顺序，不用调 order。 */
  .login-page {
    grid-template-columns: minmax(0, 400px);
    grid-template-rows: auto;
    grid-template-areas:
      "notice"
      "login"
      "foot";
    row-gap: 14px;
    align-content: safe center;
    padding: 24px 16px;
  }
  /* 公告栏跟着登录框收窄到 400px：单列时两者同宽才像一组，
     800px 的公告条会把 400px 的登录框衬得又窄又长。
     align-self 统一回 auto —— 双列时公告栏靠 stretch 跟右列等高，单列没有「同一行」可言。 */
  .login-page > .login-notice {
    align-self: auto;
    width: auto;
    max-width: 100%;
  }
  /* 单列时 `.login-side` 自己占一行，内部仍是纵向排（登录框在上、下载区在下），
     行高按内容算；取消拉伸，别让它在还有富余时被拉长。 */
  .login-page > .login-side { align-self: auto; }
  /* 单列窄屏下日期和阅读量各占 96/64 太挤，内容只剩两百来像素。
     日期列收到 82px（YYYY-MM-DD 在 12px 字号下刚好），阅读量列 52px。 */
  .login-notice .notice-item { grid-template-columns: 82px minmax(0, 1fr) 52px; gap: 8px; padding: 8px 12px; }
  .login-notice .notice-head { padding-right: 12px; }

  /* 页脚跟着单列走。分类下拉不能在窄屏上「向上弹浮层」：手机上页脚本身就贴着视口底，
     浮层会盖住登录框。改成点开后在页脚内就地展开（position: static），整页往下长。 */
  .login-page > .login-foot { align-self: auto; }
  /* 就地展开时不留横向居中：left/transform 是给浮层的，静态定位下只会把列表推歪 */
  .login-foot .foot-cat-list {
    position: static;
    left: auto;
    transform: none;
    margin: 6px 0 0;
    padding: 4px 0;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
  }
  .login-foot .foot-cat-list a { color: #fff; }
  .login-foot .foot-cat-list a:hover { background: rgba(255, 255, 255, 0.18); }
  .login-foot .foot-links { gap: 6px 10px; }
}

/* ================= 独立下载页（/download，download.html） =================
   和登录页同一套渐变背景，但整页可滚动：安装包列表可能很长（3 个版本 × 多个平台）。
   页面不引 renderer.js，只用 styles.css 的这一段，所以类名统一带 dlpage- 前缀，
   避免和业务表单里的样式串味。 */
body.dlpage {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #16324f 0%, #1e6fd9 60%, #3a9be8 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  color: #1f3b5c;
}

.dlpage-box {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 28px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.dlpage-head { position: relative; }

.dlpage-back {
  display: inline-block;
  margin-bottom: 10px;
  color: #1e6fd9;
  font-size: 13px;
  text-decoration: none;
}

.dlpage-back:hover { text-decoration: underline; }

.dlpage-head h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 1px;
}

.dlpage-sub {
  margin: 0 0 18px;
  color: #5a6b7d;
  font-size: 13px;
  line-height: 1.7;
}

.dlpage-status {
  padding: 18px 0;
  color: #5a6b7d;
  font-size: 13.5px;
}

.dlpage-status.hidden, .dlpage-note.hidden { display: none; }

.dlpage-note {
  margin: 16px 0 4px;
  padding: 14px 16px;
  background: #fff8e6;
  border: 1px solid #f0dca8;
  border-radius: 8px;
  color: #7a5a12;
  font-size: 13px;
  line-height: 1.7;
}

.dlpage-group + .dlpage-group { margin-top: 18px; }

.dlpage-ver {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.dlpage-new {
  padding: 2px 8px;
  border-radius: 10px;
  background: #e6f2ff;
  color: #1e6fd9;
  font-size: 11.5px;
  font-weight: 500;
}

.dlpage-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid #e3e9f0;
  border-radius: 8px;
  overflow: hidden;
}

/* 每行：文件名（可省略） / 平台 / 大小 / 下载次数 / 下载按钮。
   文件名那一列用 minmax(0, 1fr)：不写 min-width:0 的话长文件名会把整行撑宽、
   把「下载」按钮顶出卡片。 */
.dlpage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 76px 96px 68px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.dlpage-row + .dlpage-row { border-top: 1px solid #eef2f7; }
.dlpage-row:nth-child(even) { background: #fafcff; }

.dlpage-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.dlpage-plat { color: #33475b; }
.dlpage-size { color: #5a6b7d; text-align: right; }
.dlpage-cnt { color: #8a97a6; font-size: 12px; text-align: right; }

.dlpage-btn {
  display: inline-block;
  padding: 6px 0;
  border-radius: 6px;
  background: #1e6fd9;
  color: #fff;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}

.dlpage-btn:hover { background: #1a62c2; }

/* 窄屏：一行放不下 5 列，改成「文件名独占一行 + 其余挤在第二行」 */
@media (max-width: 640px) {
  body.dlpage { padding: 16px 10px; }
  .dlpage-box { padding: 18px 14px 14px; }
  .dlpage-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "name name name"
      "plat size btn";
    row-gap: 6px;
  }
  .dlpage-name { grid-area: name; }
  .dlpage-plat { grid-area: plat; }
  .dlpage-size { grid-area: size; }
  .dlpage-btn { grid-area: btn; padding: 6px 16px; }
  /* 次数在手机上让位：位置不够，四个信息挤一行会折成两行反而更乱 */
  .dlpage-cnt { display: none; }
}

.dlpage-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #eef2f7;
  color: #8a97a6;
  font-size: 12px;
}

/* ================= 系统管理 → 页脚设置 =================
   友情链接一行：名称 / 网址 / 分类 / 上移 / 下移 / 删除。
   网址那一列最宽，名称给 1fr —— 管理员更常改网址，名称短，挤窄一点也能看清。 */
.foot-icp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

.foot-icp-row label { font-size: 13px; color: var(--text-light); }
.foot-icp-row input { width: 300px; max-width: 100%; }

.foot-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) 130px auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.foot-row + .foot-row { border-top: 1px solid var(--border); }
.foot-row input { width: 100%; }

@media (max-width: 900px) {
  .foot-row { grid-template-columns: 1fr 1fr; row-gap: 6px; }
  .foot-row input[data-act="url"] { grid-column: 1 / -1; }
}
