:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-soft: #eff6ff;
  --ok: #059669;
  --err: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

header.site {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky; top: 0; z-index: 20;
}
.site-bar { display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 6px; background: var(--brand);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
nav.main { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
nav.main a { color: var(--muted); font-size: 14px; }
nav.main a:hover { color: var(--text); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-switch {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
  font-size: 13px; color: var(--text); background: var(--card); white-space: nowrap;
}
.lang-switch:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); cursor: pointer; padding: 0; flex: none;
}
.bar-btn:hover { border-color: var(--brand); color: var(--brand); }
.bar-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 18px; line-height: 1; padding: 0; flex: none;
}
.nav-toggle:hover { border-color: var(--brand); color: var(--brand); }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 12px);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 13px; line-height: 1.5; opacity: 0; transition: opacity .25s, transform .25s;
  z-index: 99; max-width: 86vw; text-align: center; box-shadow: 0 8px 24px rgba(15,23,42,.25);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 分享降级弹窗（系统分享失败/不支持时手动复制） */
.share-dlg {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.share-card {
  background: var(--card); border-radius: 12px; padding: 20px; width: 100%; max-width: 440px;
  box-shadow: 0 18px 40px rgba(15,23,42,.3); position: relative; text-align: left;
}
.share-card b { display: block; font-size: 15px; margin-bottom: 12px; }
.share-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  font-size: 13px; color: var(--text); background: var(--bg-soft); box-sizing: border-box;
}
.share-copy {
  margin-top: 12px; width: 100%; border: none; border-radius: 8px; padding: 10px;
  background: var(--brand); color: #fff; font-size: 14px; cursor: pointer;
}
.share-copy:hover { opacity: .9; }
.share-close {
  position: absolute; top: 8px; right: 10px; border: none; background: none;
  font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px;
}

.crumb { font-size: 13px; color: var(--muted); padding: 14px 0 0; }
.crumb a { color: var(--muted); }

.hero { padding: 34px 0 10px; }
.hero h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.35; }
.hero p.lead { color: var(--muted); margin: 0 0 6px; max-width: 760px; }

.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin: 18px 0 8px;
}
.tool-card h2, .tool-card .tool-title { font-size: 16px; margin: 0 0 14px; }
.hint { font-size: 13px; color: var(--muted); }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 16px;
  text-align: center; color: var(--muted); cursor: pointer; transition: .15s;
  background: var(--bg-soft);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop input[type=file] { display: none; }
.drop.has-file { border-style: solid; border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.drop.has-file strong { color: var(--brand); }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 16px;
}
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=number], input[type=password], textarea, select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); width: 100%;
}
textarea { min-height: 160px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
input[type=range] { width: auto; }
label.opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-right: 14px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.status { font-size: 14px; margin-top: 10px; min-height: 22px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.out { margin-top: 14px; word-break: break-all; }
.preview-img { max-width: 100%; max-height: 360px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.kv .cell { background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; }
.kv .num { font-size: 20px; font-weight: 700; }
.kv .lbl { font-size: 12px; color: var(--muted); }

article.doc { margin: 26px 0 10px; }
article.doc h2 { font-size: 19px; margin: 26px 0 10px; }
article.doc h3 { font-size: 15px; margin: 18px 0 8px; }
article.doc p, article.doc li { color: #3c4453; }
article.doc ol, article.doc ul { padding-left: 22px; }
details.faq { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 10px 0; }
details.faq summary { cursor: pointer; font-weight: 600; font-weight: 500; }
details.faq p { margin: 8px 0 2px; color: var(--muted); font-size: 14px; }

.privacy-note {
  display: flex; gap: 10px; align-items: flex-start; background: #ecfdf5;
  border: 1px solid #a7f3d0; color: #065f46; border-radius: 8px; padding: 12px 14px;
  font-size: 13px; margin: 16px 0;
}
.privacy-note .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-top: 7px; flex: none; }

/* 首页搜索框 + 下拉结果 */
.search-box { position: relative; margin: 8px 0 6px; }
.search-box input[type=search] {
  width: 100%; box-sizing: border-box; padding: 14px 18px; font-size: 16px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
  outline: none; transition: border-color .15s;
}
.search-box input[type=search]:focus { border-color: var(--brand); }
.search-pop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,.12); overflow: hidden; max-height: 420px; overflow-y: auto;
}
.search-pop.show { display: block; }
.search-pop a {
  display: block; padding: 10px 16px; border-bottom: 1px solid var(--bg-soft); color: var(--text);
}
.search-pop a:last-child { border-bottom: none; }
.search-pop a:hover { background: var(--brand-soft); text-decoration: none; }
.search-pop a b { font-size: 14px; font-weight: 600; display: block; }
.search-pop a span { font-size: 12px; color: var(--muted); }
.sp-empty { padding: 16px; font-size: 14px; color: var(--muted); text-align: center; }
.sp-more { padding: 8px 16px; font-size: 12px; color: var(--muted); background: var(--bg-soft); }

/* 首页信任区块 */
.trust { margin: 18px 0 6px; }
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.trust-cell { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.trust-cell b { color: var(--brand); font-size: 15px; display: block; margin-bottom: 4px; }
.trust-cell span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 18px 0; }

/* 首页分类入口卡片 */
.home-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 20px 0 6px; }
.home-cat {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.home-cat:hover { border-color: var(--brand); text-decoration: none; box-shadow: 0 4px 16px rgba(37,99,235,.10); }
.hc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hc-name { font-size: 18px; font-weight: 700; color: var(--brand); }
.hc-count { font-size: 12px; color: var(--muted); background: var(--bg-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.hc-lead { font-size: 13px; color: var(--muted); line-height: 1.6; }
.hc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-chips i {
  font-style: normal; font-size: 12px; color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg-soft);
}
.hc-go { font-size: 13px; font-weight: 600; color: var(--brand); margin-top: 2px; }
.tool-link {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; color: var(--text);
}
.tool-link:hover { border-color: var(--brand); text-decoration: none; box-shadow: 0 1px 6px rgba(37,99,235,.08); }
.tool-link b { font-size: 15px; font-weight: 500; }
.tool-link span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
/* 分类页工具网格卡片（PDF24 风格） */
.tool-card-grid {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .1s;
}
.tool-card-grid:hover { border-color: var(--brand); text-decoration: none; box-shadow: 0 4px 14px rgba(37,99,235,.10); transform: translateY(-1px); }
.tool-card-grid svg { width: 26px; height: 26px; color: var(--brand); margin-bottom: 4px; }
.tool-card-grid b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tool-card-grid span { font-size: 12px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 图片画廊（PDF转图片工具） */
.img-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
.img-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.img-card img { width: 100%; height: 120px; object-fit: contain; background: #f8f8f8; display: block; }
.img-card .img-name { font-size: 11px; color: var(--muted); padding: 4px 8px; word-break: break-all; }
.img-card button { width: 100%; border: none; border-top: 1px solid var(--line); background: var(--bg-soft); padding: 6px; font-size: 12px; cursor: pointer; color: var(--brand); }
.img-card button:hover { background: var(--brand); color: #fff; }
.img-card .img-meta { font-size: 11px; color: var(--muted); padding: 2px 8px; }
.img-card .img-actions { display: flex; border-top: 1px solid var(--line); }
.img-card .img-actions button, .img-card .img-actions a { flex: 1; border: none; border-top: none; border-right: 1px solid var(--line); background: var(--bg-soft); padding: 6px; font-size: 12px; cursor: pointer; color: var(--brand); text-decoration: none; text-align: center; display: block; }
.img-card .img-actions > :last-child { border-right: none; border-top: none; }
.img-card .img-actions .img-dl:hover { background: var(--brand); color: #fff; }
.img-card .img-actions .img-del { color: var(--err); max-width: 36px; }
.img-card .img-actions .img-del:hover { background: #fee2e2; }
@media (max-width: 640px) {
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool-card-grid { padding: 12px 10px; }
  .tool-card-grid svg { width: 22px; height: 22px; }
  .tool-card-grid b { font-size: 13px; }
  .tool-card-grid span { font-size: 11px; }
}
@media (max-width: 380px) {
  .cat-grid { grid-template-columns: 1fr; }
}
.cat-title { font-size: 18px; margin: 30px 0 4px; }
.cat-title .cat-more { font-size: 13px; font-weight: 500; color: var(--brand); margin-left: 10px; }
.related { margin: 26px 0; }
.related .list { display: flex; flex-wrap: wrap; gap: 8px; }
.related .list a {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--text);
}
.related .list a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

footer.site { border-top: 1px solid var(--line); margin-top: 44px; padding: 22px 0 34px; color: var(--muted); font-size: 13px; }
footer.site .links a { margin-right: 14px; }
footer.site .footer-legal a { color: var(--muted); text-decoration: underline; }
footer.site .footer-legal a:hover { color: var(--accent, #2563eb); }

/* 首页详细介绍区块（PDF24 风格） */
.feature-sec { margin: 30px 0 6px; }
.feature-sec h2 { font-size: 20px; margin: 0 0 8px; }
.feature-intro { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 0 16px; max-width: 860px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.feature-cell { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.feature-cell b { display: block; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.feature-cell b::before { content: "✓"; color: var(--brand); font-size: 13px; margin-right: 7px; }
.feature-cell span { color: var(--muted); font-size: 13px; line-height: 1.7; display: block; }

/* 首页分享 CTA */
.share-cta {
  margin: 24px 0 10px; padding: 20px 22px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(37,99,235,.08), rgba(37,99,235,.02));
  border: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.share-cta b { font-size: 16px; display: block; margin-bottom: 4px; }
.share-cta span { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.btn-share {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; border: none; border-radius: 9px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-share:hover { background: #1d4ed8; }
.btn-share svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 640px) {
  .hero h1 { font-size: 21px; }
  .site-bar { gap: 10px; }
  .brand { font-size: 15px; }
  .nav-toggle { display: inline-flex; }
  nav.main {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--card); flex-direction: column; align-items: stretch; gap: 0;
    padding: 6px 20px 12px; margin: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 24px rgba(15,23,42,.10);
  }
  nav.main.open { display: flex; }
  nav.main a.navitem { display: block; padding: 11px 0; font-size: 15px; border-bottom: 1px solid var(--bg-soft); }
  nav.main a.navitem:last-of-type { border-bottom: none; }
  .search-pop { max-height: 300px; }
  .share-cta { text-align: left; }
  .btn-share { margin-left: 0; width: 100%; justify-content: center; }
}

/* ====== 统一结果面板 ====== */
.result-panel {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.result-preview {
  background: var(--bg-soft);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  max-height: 480px;
  overflow: auto;
}
.result-iframe {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.result-img {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.result-text-preview {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  text-align: left;
  white-space: normal;
  word-break: break-word;
}
.result-text-preview p { margin: 0 0 10px; }
.result-text-preview .more { color: var(--muted, #6b7280); font-size: 12px; }
.result-info {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  border-bottom: 1px solid var(--bg-soft);
}
.result-size { color: var(--muted); font-weight: 500; }
.result-name-input {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 360px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.result-name-input:hover { border-color: var(--brand); }
.result-name-input:focus { border-color: var(--brand); background: #fff; }
.result-diff-good { color: var(--ok); font-weight: 600; }
.result-diff-bad { color: var(--err); font-weight: 600; }
.result-dim { color: var(--muted); }
.result-actions {
  display: flex;
  gap: 0;
  padding: 0;
}
.result-btn {
  flex: 1;
  border: none;
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.result-btn:not(:last-child) { border-right: 1px solid var(--line); }
.result-btn-download { background: var(--brand); color: #fff; }
.result-btn-download:hover { background: #1d4ed8; }
.result-btn-restart { background: var(--bg-soft); color: var(--text); }
.result-btn-restart:hover { background: #e0e7ff; color: var(--brand); }
.result-btn-delete { background: var(--bg-soft); color: var(--err); }
.result-btn-delete:hover { background: #fee2e2; }

@media (max-width: 640px) {
  .result-iframe { height: 320px; }
  .result-img { max-height: 320px; }
  .result-btn { font-size: 13px; padding: 12px 8px; }
}
@media (max-width: 380px) {
  .result-btn { font-size: 12px; padding: 10px 4px; }
  .result-info { font-size: 12px; }
}

/* ---- 合同协议模板 ---- */
.contract-notice {
  font-size: 12.5px; color: #92400e; background: #fef3c7;
  border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px; margin: 0 0 16px;
}
.contract-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 12px 0 4px; }
.cf-item label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.cf-item.full { grid-column: 1 / -1; }
.cf-item textarea { width: 100%; min-height: 64px; font-family: inherit; font-size: 14px; }
.contract-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---- 合同重复组（子女/房产等可增删条目） ---- */
.cf-repeat { display: flex; flex-direction: column; gap: 10px; }
.cf-repeat-item {
  display: grid; grid-template-columns: 96px 1fr 1.4fr 96px auto;
  gap: 8px 10px; align-items: end;
  border: 1px dashed #d8dce3; border-radius: 8px; padding: 10px 12px;
  background: #fafbfc;
}
.cf-cell label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.cf-cell input, .cf-cell select {
  width: 100%; padding: 7px 9px; font-size: 13.5px; font-family: inherit;
  border: 1px solid #d1d5db; border-radius: 7px; box-sizing: border-box;
}
.cf-del {
  padding: 7px 10px; font-size: 13px; border: 1px solid #fca5a5; color: #dc2626;
  background: #fef2f2; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.cf-del:hover { background: #fee2e2; }
.cf-add {
  align-self: flex-start; padding: 7px 14px; font-size: 13.5px;
  border: 1px dashed #93c5fd; color: #2563eb; background: #eff6ff;
  border-radius: 7px; cursor: pointer;
}
.cf-add:hover { background: #dbeafe; }

/* ---- 免责确认勾选 ---- */
.cf-agree {
  margin: 16px 0 0; padding: 12px 14px;
  background: #f0f7ff; border: 1px solid #bfdbfe; border-radius: 8px;
  display: flex; align-items: flex-start; gap: 10px;
}
.cf-agree input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; cursor: pointer;
  accent-color: #2563eb;
}
.cf-agree-label {
  font-size: 13px; line-height: 1.7; color: #1e3a5f; cursor: pointer;
}
.cf-agree-label b { color: #dc2626; }

/* ---- 结果页免责提示条 ---- */
.result-disclaimer {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 10px; padding: 10px 14px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  font-size: 12.5px; line-height: 1.6; color: #92400e;
}
.result-disclaimer .rd-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px;
  background: #f59e0b; color: #fff; border-radius: 50%;
  font-size: 11px; font-weight: bold; font-style: normal;
}
@media (max-width: 640px) {
  .cf-repeat-item { grid-template-columns: 1fr 1fr; }
  .cf-repeat-item .cf-cell:nth-child(3) { grid-column: 1 / -1; }
}
.draft-editor {
  width: 100%; min-height: 460px; font-family: inherit; font-size: 14px;
  line-height: 2; padding: 16px 18px; resize: vertical;
}
@media (max-width: 640px) { .contract-fields { grid-template-columns: 1fr; } }

/* ---- 格式选择器 ---- */
.fmt-select {
  padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; background: #fff; cursor: pointer; min-width: 120px;
}
.fmt-select:focus { outline: 2px solid #2563eb; border-color: #2563eb; }

/* ---- 法律页面 ---- */
.legal-page {
  max-width: 760px; margin: 0 auto; padding: 8px 0 40px;
  font-size: 14.5px; line-height: 1.9; color: #1f2937;
}
.legal-page h1 { font-size: 26px; margin: 0 0 6px; }
.legal-page > p:first-of-type { color: #6b7280; font-size: 13px; margin: 0 0 20px; }
.legal-page h2 {
  font-size: 17px; margin: 28px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}
.legal-page ul { margin: 8px 0 8px 4px; padding-left: 20px; }
.legal-page li { margin: 4px 0; }
.legal-page b { color: #111827; }
.legal-page a { color: #2563eb; }

/* ====== 左侧固定侧边栏导航（仿 toolgen.cn） ====== */
.layout { display: flex; align-items: flex-start; }
.content { flex: 1 1 auto; min-width: 0; }
.sidebar {
  flex: 0 0 256px; width: 256px; align-self: flex-start;
  position: sticky; top: 56px;
  max-height: calc(100vh - 56px); overflow-y: auto;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  padding: 14px 10px 28px;
  scrollbar-width: thin; scrollbar-color: #d7dbe2 transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #d7dbe2; border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.side-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 2px 10px 12px;
}
.side-head-ico { width: 16px; height: 16px; color: var(--brand); display: inline-flex; flex: none; }
.side-head-ico svg { width: 100%; height: 100%; }
.side-head-count {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}

.side-cat { margin-bottom: 4px; }
.side-cat-title {
  display: flex; align-items: center; gap: 9px; width: 100%;
  font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--text);
  padding: 9px 10px; margin: 0; border: none; background: transparent; cursor: pointer;
  border-radius: 9px; text-align: left; line-height: 1.2;
  transition: background .15s ease, color .15s ease;
}
.side-cat-title:hover { background: #eef1f5; }
.side-cat-title.is-active { color: var(--brand); }
.side-cat-title .cat-ico { width: 17px; height: 17px; color: var(--brand); flex: none; display: inline-flex; opacity: .85; }
.side-cat-title .cat-ico svg { width: 100%; height: 100%; }
.side-cat-title .cat-name { flex: 1 1 auto; min-width: 0; }
.side-cat-title .cat-count {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; flex: none;
}
.side-cat-title .cat-chev {
  width: 14px; height: 14px; color: var(--muted); flex: none; display: inline-flex;
  transform: rotate(90deg); transition: transform .22s ease;
}
.side-cat-title .cat-chev svg { width: 100%; height: 100%; }
.side-cat.collapsed .cat-chev { transform: rotate(0deg); }

.side-cat-items { overflow: hidden; max-height: 2000px; opacity: 1; transition: max-height .28s ease, opacity .2s ease; }
.side-cat.collapsed .side-cat-items { max-height: 0; opacity: 0; }
.side-cat-inner { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px 6px; }

.side-link {
  display: block; padding: 7px 10px 7px 14px;
  font-size: 13.5px; line-height: 1.4; color: var(--muted);
  border-radius: 7px; border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s ease, color .15s ease;
}
.side-link:hover { background: var(--card); color: var(--text); text-decoration: none; }
.side-link.active {
  color: var(--brand); background: var(--brand-soft);
  font-weight: 600; border-left-color: var(--brand);
}

/* 移动端：侧边栏变为右上角汉堡按钮触发的抽屉 */
@media (max-width: 960px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0;
    width: 280px; max-height: none; height: 100%;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 4px 0 26px rgba(15,23,42,.16);
    border-right: 1px solid var(--line); z-index: 1000;
    overflow-y: auto; overscroll-behavior: contain; padding-top: 14px;
  }
  /* 抽屉打开时锁定页面滚动，背景不再跟着滑动 */
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after {
    content: ""; position: fixed; inset: 56px 0 0 0;
    background: rgba(15,23,42,.35); z-index: 999;
  }
  .nav-toggle { display: inline-flex; }
}

