/* ===========================================================
 *  模板中心样式
 * =========================================================== */

/* ---------- 工具条 ---------- */
.tpl-toolbar{
  display:flex; align-items:center; gap:12px; padding:12px 16px; margin-bottom:14px;
  flex-wrap:wrap;
}
/* 分类较多时允许换行，避免最后一个分类（如采购表单）被横滚藏住 */
.chips-scroll{ display:flex; gap:8px; flex:1; min-width:0; flex-wrap:wrap; }
.chip-btn{
  height:32px; padding:0 13px; border-radius:999px; border:1px solid var(--line);
  background:#fff; color:var(--ink2); font-size:13px; white-space:nowrap;
  display:inline-flex; align-items:center; gap:6px; transition:.16s;
}
.chip-btn i{ font-style:normal; font-size:11.5px; color:var(--muted); }
.chip-btn:hover{ border-color:#C9D3E4; }
.chip-btn.on{ background:var(--primary); border-color:var(--primary); color:#fff; }
.chip-btn.on i{ color:rgba(255,255,255,.75); }
.tpl-tools{ display:flex; gap:8px; align-items:center; }

/* ---------- 模板卡片 ---------- */
.tpl-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
.tpl-card{ padding:16px; display:flex; flex-direction:column; gap:10px; transition:.16s; }
.tpl-card:hover{ box-shadow:var(--shadow); transform:translateY(-1px); }
.tpl-card.off{ opacity:.62; }
.tpl-card-hd{ display:flex; gap:11px; align-items:flex-start; }
.tpl-ico{
  width:40px; height:40px; flex:0 0 40px; border-radius:11px; background:var(--primary-soft);
  display:flex; align-items:center; justify-content:center; font-size:20px;
}
.tpl-ico.sm{ width:32px; height:32px; flex:0 0 32px; font-size:16px; border-radius:9px; }
.tpl-name{ font-weight:600; font-size:14.5px; display:flex; align-items:center; flex-wrap:wrap; }
.tpl-meta{ font-size:12px; color:var(--muted); margin-top:2px; }
.tpl-desc{
  font-size:12.5px; color:var(--ink2); line-height:1.62; min-height:38px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.tpl-vars{ display:flex; gap:6px; flex-wrap:wrap; }
.tpl-vars .chip{ font-size:11.5px; padding:2px 8px; }
.req-dot{ color:var(--red); font-weight:700; margin-left:1px; }
.tpl-card-ft{ display:flex; gap:6px; align-items:center; padding-top:10px; border-top:1px dashed var(--line); flex-wrap:wrap; }
.tpl-card-ft .btn{ padding:0 10px; }
.btn-ghost.danger{ color:var(--red); }
.btn-ghost.danger:hover{ background:var(--red-soft); border-color:#F6C9C9; }

/* ---------- 选模板列表 ---------- */
.tpl-pick-list{ display:flex; flex-direction:column; gap:8px; }
.tpl-pick{
  display:flex; gap:11px; align-items:center; padding:11px 13px; border:1px solid var(--line);
  border-radius:11px; cursor:pointer; transition:.14s;
}
.tpl-pick:hover{ border-color:var(--primary); background:var(--primary-soft); }

/* ---------- 套用弹窗 ---------- */
.sub-hint{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.use-wrap{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; }
.use-form{ min-width:0; }
.use-preview{ min-width:0; }
.tpl-preview{
  background:#FBFCFE; border:1px solid var(--line); border-radius:12px; padding:14px 16px;
  font-family:"SFMono-Regular",Menlo,Consolas,"PingFang SC",monospace; font-size:12.5px; line-height:1.85;
  color:var(--ink2); white-space:pre-wrap; word-break:break-word; max-height:52vh; overflow:auto;
}
.tpl-preview.raw{ background:#F6F8FC; color:var(--muted); }
.auto-field .input, .auto-field .select{ background:#FBFCFE; }
.use-wrap .section-title{ margin-top:0; }

/* ---------- 模板编辑器 ---------- */
.icon-pick{ display:flex; gap:6px; flex-wrap:wrap; }
.icon-opt{
  width:34px; height:34px; border-radius:9px; border:1px solid var(--line); background:#fff;
  font-size:16px; display:flex; align-items:center; justify-content:center;
}
.icon-opt.on{ border-color:var(--primary); background:var(--primary-soft); box-shadow:0 0 0 2px rgba(37,99,235,.12); }
.tf-head, .tf-row{
  display:grid; grid-template-columns:1.4fr 110px 52px 1fr 34px; gap:8px; align-items:center;
}
.tf-head{ font-size:12px; color:var(--muted); padding:0 2px 6px; }
.tf-row{ margin-bottom:8px; }
.tf-row .input, .tf-row .select{ height:34px; font-size:13px; }
.tf-req{ display:flex; align-items:center; justify-content:center; }
.tf-req input{ width:15px; height:15px; accent-color:var(--primary); }
.code-area{ font-family:"SFMono-Regular",Menlo,Consolas,monospace; font-size:12.5px; line-height:1.8; height:auto; padding:12px; }

/* ---------- 使用说明 ---------- */
.tpl-help{ display:flex; flex-direction:column; gap:14px; }
.tpl-help .step{ display:flex; gap:12px; align-items:flex-start; }
.tpl-help .step b{
  width:24px; height:24px; flex:0 0 24px; border-radius:50%; background:var(--primary-soft);
  color:var(--primary); font-size:12.5px; display:flex; align-items:center; justify-content:center; margin-top:1px;
}
.tpl-help .t{ font-weight:600; font-size:13.5px; }
.tpl-help p{ font-size:12.5px; color:var(--muted); line-height:1.7; margin-top:2px; }

/* ---------- 文件正文预览（详情弹窗内） ---------- */
.doc-body{
  background:#FBFCFE; border:1px solid var(--line); border-radius:12px; padding:16px 18px;
  white-space:pre-wrap; word-break:break-word; font-size:13px; line-height:1.9; color:var(--ink2);
  max-height:46vh; overflow:auto;
}
.doc-body-meta{ font-size:12px; color:var(--muted); margin:0 0 8px; }

/* ===========================================================
 *  移动端
 * =========================================================== */
@media (max-width: 900px){
  .use-wrap{ grid-template-columns:1fr; gap:14px; }
  .tpl-preview{ max-height:32vh; }
  .tpl-grid{ grid-template-columns:1fr; }
  .tpl-toolbar{ padding:10px 12px; }
  .tpl-tools{ width:100%; }
  .tpl-tools .input, .tpl-tools .select{ flex:1; width:auto !important; }
  .tf-head, .tf-row{ grid-template-columns:1fr 96px 44px 34px; }
  .tf-head span:nth-child(4), .tf-row .input[data-tf="def"]{ display:none; }
  .icon-opt{ width:38px; height:38px; }
}

/* ============ 国标红头公文（参考 GB/T 9704-2012） ============ */
.gz-paper { font-family: "FangSong", "仿宋", "STFangsong", "SimSun", serif; color: #1A1A1A; background: #fff; border: 1px solid #E8ECF2; border-radius: 6px; padding: 40px 46px 28px; line-height: 2; }
.gz-head { font-family: "STZhongsong", "华文中宋", "SimSun", "Songti SC", serif; color: #D0021B; font-size: 38px; font-weight: 700; letter-spacing: 6px; text-align: center; line-height: 1.4; }
.gz-head.sm { font-size: 28px; letter-spacing: 3px; }
.gz-docno-row { display: flex; align-items: baseline; justify-content: center; margin: 18px 0 0; font-size: 15px; }
.gz-docno-row .gz-signer { margin-left: auto; font-size: 15px; color: #1A1A1A; }
.gz-redline { border-bottom: 2.5px solid #D0021B; margin: 14px 0 26px; }
.gz-redline.thin { border-bottom-width: 1.5px; }
.gz-title { font-family: "STZhongsong", "华文中宋", "SimSun", "Songti SC", serif; font-size: 24px; font-weight: 700; text-align: center; line-height: 1.6; margin: 6px 0 20px; }
.gz-to { font-size: 16px; margin-bottom: 6px; }
.gz-text { font-size: 16px; text-indent: 2em; margin-bottom: 6px; white-space: pre-wrap; }
.gz-h1 { font-family: "Heiti SC", "SimHei", "黑体", sans-serif; font-size: 16px; font-weight: 700; margin: 14px 0 6px; text-indent: 2em; }
.gz-h2 { font-family: "Kaiti SC", "KaiTi", "楷体", serif; font-size: 16px; font-weight: 700; text-indent: 2em; }
.gz-attach { font-size: 15px; margin: 16px 0 6px; }
.gz-meta { font-size: 14.5px; color: #333; background: #F8FAFC; border: 1px solid #EEF2F7; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; line-height: 1.9; }
.gz-contact { font-size: 14.5px; margin-top: 14px; color: #444; }
.gz-sign { margin: 34px 4em 8px auto; width: fit-content; text-align: center; position: relative; padding: 10px 6px; }
.gz-org { font-size: 16px; }
.gz-date { font-size: 15px; margin-top: 4px; }
.gz-seal { position: absolute; right: -26px; top: -14px; width: 74px; height: 74px; border: 2.5px solid rgba(208, 2, 27, .55); border-radius: 50%; color: rgba(208, 2, 27, .55); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; transform: rotate(-14deg); font-family: "Songti SC", "SimSun", serif; }
.gz-note { margin-top: 30px; border-top: 2px solid #1A1A1A; border-bottom: 2px solid #1A1A1A; font-size: 13.5px; padding: 8px 0; color: #333; }
.gz-note .gz-note-row { display: flex; justify-content: space-between; border-top: 1px solid #1A1A1A; margin-top: 6px; padding-top: 6px; color: #555; }
/* 预览容器内缩小整体 */
.tpl-preview-rich .gz-paper { padding: 22px 26px 16px; }
.tpl-preview-rich .gz-head { font-size: 26px; }
.tpl-preview-rich .gz-title { font-size: 18px; }
.tpl-preview-rich .gz-text, .tpl-preview-rich .gz-to, .tpl-preview-rich .gz-h1, .tpl-preview-rich .gz-h2 { font-size: 14px; line-height: 1.9; }
.tpl-preview-rich .gz-seal { width: 54px; height: 54px; font-size: 19px; right: -18px; top: -10px; }
/* 移动端公文纸 */
@media (max-width: 640px) {
  .gz-paper { padding: 22px 16px 16px; }
  .gz-head { font-size: 24px; letter-spacing: 3px; }
  .gz-title { font-size: 17px; }
  .gz-text, .gz-to, .gz-h1 { font-size: 14.5px; }
  .gz-seal { width: 52px; height: 52px; font-size: 18px; }
}


/* ============ 国标校准（GB/T 9704-2012 条款对照） ============ */
/* 份号/密级/紧急程度：版心左上角顶格自上而下（7.2.1-7.2.3），密级与紧急程度用黑体 */
.gz-marks { min-height: 1px; }
.gz-marks span { display: block; text-align: left; font-size: 15px; line-height: 1.7; }
.gz-marks .gz-copyno { font-family: "SimSun", "Songti SC", serif; }
.gz-marks .gz-secret, .gz-marks .gz-urgent { font-family: "Heiti SC", "SimHei", "黑体", sans-serif; font-weight: 700; }
/* 发文字号 3 号仿宋；年份用六角括号〔〕、不加"第"、不编虚位（7.2.5） */
.gz-docno { font-family: "FangSong", "仿宋", "STFangsong", serif; font-size: 15px; }
/* 签发人："签发人"三字 3 号仿宋、姓名 3 号楷体（7.2.6） */
.gz-signer { margin-left: auto; font-size: 15px; color: #1A1A1A; }
.gz-signer-name { font-family: "Kaiti SC", "KaiTi", "楷体", serif; font-weight: 400; }
/* 信函格式：红色双线，第一条上粗下细，页脚第二条上细下细→上细下粗（10.1） */
.gz-dline { border-top: 3px solid #D0021B; border-bottom: 1px solid #D0021B; height: 3px; margin: 12px 0 22px; }
.gz-dline.rev { border-top-width: 1px; border-bottom-width: 3px; margin: 30px 0 0; }
.gz-letter .gz-docno-row.right { justify-content: flex-end; }
/* 纪要"出席/列席/记录"标签用黑体，名单用仿宋（10.3） */
.gz-att { font-size: 15px; margin-top: 8px; text-indent: 0; }
.gz-att b { font-family: "Heiti SC", "SimHei", "黑体", sans-serif; font-weight: 700; margin-right: 8px; }
/* 页码：4 号半角宋体，一字线，单页码居右空一字（7.5） */
.gz-pageno { font-family: "SimSun", "Songti SC", serif; font-size: 13.5px; color: #333; text-align: right; padding-right: 1.5em; margin-top: 18px; }
/* 预览容器内缩放 */
.tpl-preview-rich .gz-marks span { font-size: 11px; }
.tpl-preview-rich .gz-docno, .tpl-preview-rich .gz-signer { font-size: 11.5px; }
.tpl-preview-rich .gz-att { font-size: 12px; }
.tpl-preview-rich .gz-pageno { font-size: 10.5px; }
@media (max-width: 640px) {
  .gz-marks span { font-size: 13px; }
  .gz-docno, .gz-signer, .gz-att { font-size: 13px; }
}
