/* 自定义模板：模板库、编辑器、使用页、草图确认（templates.js） */
.tl-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.tl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tl-tools .tl-q { width: 180px; }
.tl-tools select { width: auto; }
.tl-cats { margin-bottom: 14px; }
.tl-card .tpl-top { flex-wrap: wrap; gap: 6px; }
.tl-mode { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tl-mode.job, .tl-mode.news_brief, .tl-mode.software_demo { background: var(--bg-3); color: var(--muted); }
.tl-scope { font-size: 11px; color: var(--warn-ink); }
.tl-cover-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.tl-featchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tl-featchips .chip { font-size: 11px; }
.tl-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.tl-modecard { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); color: var(--ink); cursor: pointer; font: inherit; }
.tl-modecard:hover { border-color: var(--accent); }
.tl-modecard.on { border-color: var(--accent); background: var(--accent-soft); }
.tl-modecard b { font-size: 15px; }
.tl-modecard span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.tl-modecard small { color: var(--dim); font-size: 12px; }
.tl-modecard .ic-wrap { color: var(--accent); }
.tl-modecard .needs { color: var(--muted); }
.tl-morelist { display: flex; flex-direction: column; gap: 6px; }
.tl-morelist .btn { justify-content: flex-start; }
.tl-vers { width: 100%; }
.tl-diff { margin: 6px 0 0 18px; font-size: 13px; line-height: 1.7; }

/* 编辑器 */
.te-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.te-steps { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 8px; }
.te-steps button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 10px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.te-steps button .n { width: 20px; height: 20px; border-radius: 50%; background: var(--bg-3); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; }
.te-steps button.on { background: var(--accent-soft); color: var(--ink); border-color: var(--accent-soft); }
.te-steps button.on .n { background: var(--accent); color: #fff; }
.te-steps button.bad .n { background: var(--cut); color: #fff; }
.te-body { padding: 18px 20px; min-width: 0; }
.te-body h2 { margin: 0 0 12px; font-size: 18px; }
.te-body h3 { font-size: 15px; }
.te-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 12px; }
.te-side .row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.te-side .row span:first-child { color: var(--muted); }
.te-nav { display: flex; justify-content: space-between; margin-top: 10px; }
.te-est { margin-top: 8px; font-size: 12.5px; }
.te-est table { width: 100%; }
.te-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; }
.te-issues li { padding: 6px 8px; border-radius: 6px; background: var(--bg-3); }
.te-issues li.bad { background: var(--cut-soft); color: var(--err-ink); }
.te-issues li.warn { background: var(--warn-soft); color: var(--warn-ink); }
.te-issues li.fix { background: var(--keep-soft); color: var(--ok-ink); }
:root[data-theme="light"] .te-issues li.bad { color: #b4232f; }
:root[data-theme="light"] .te-issues li.warn { color: #8a5a00; }
:root[data-theme="light"] .te-issues li.fix { color: #12714b; }
.ok-line { color: var(--keep); font-size: 13px; margin: 0; }
.te-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.te-presets .lb { margin: 0; }
.te-grp { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--bg-2); }
.te-grp > summary { display: flex; gap: 8px; align-items: center; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.te-feat { padding: 10px 14px; border-top: 1px solid var(--line); }
.te-feat.soon { opacity: .6; }
.te-feat-h { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.te-feat-h .chip { font-size: 11px; }
.te-feat-d { color: var(--muted); font-size: 12.5px; margin: 4px 0 0 24px; line-height: 1.5; }
.te-feat-p { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 14px; margin: 10px 0 2px 24px; }
.te-feat-p .fp { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.te-feat-p .fp.full { grid-column: 1 / -1; }
.te-feat-p .fp:has(> input[type=checkbox]) { flex-direction: row; align-items: center; }
.te-refs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.te-ref { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-3);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.te-ref img { width: 100%; height: 100%; object-fit: cover; }
.te-ref button { position: absolute; top: 3px; right: 3px; border: 0; border-radius: 50%; width: 20px; height: 20px; background: rgba(0,0,0,.6); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.te-ref button .ic { width: 12px; height: 12px; }
.te-ref.add { cursor: pointer; border-style: dashed; }
.te-char, .te-part { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.te-char input:first-child { width: 140px; }
.te-char input:nth-child(2), .te-part .grow { flex: 1; }
.te-part select { width: 90px; }
.te-part input[data-pl] { width: 110px; }
.te-vars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.te-var { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; }
.te-var-r { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.te-var-r input, .te-var-r select { flex: 1; min-width: 120px; }
.te-var-r .chk { display: flex; gap: 4px; align-items: center; font-size: 12.5px; white-space: nowrap; }
.te-var-r .icon-btn { flex: none; }
.te-preview { padding: 14px; }
.tl-form .req { color: var(--cut); }
.tu-ov { padding: 8px 0 0; }

/* 草图 / 分镜确认 + 出图结果 */
.sd-review { border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px; background: var(--accent-soft); margin-bottom: 12px; }
.sd-review-h { margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.sd-rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.sd-rv-grid.story { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sd-rv { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.sd-rv-img { position: relative; display: block; border-radius: 6px; overflow: hidden; background: var(--bg-3); }
.sd-rv-img img { width: 100%; max-height: 260px; object-fit: contain; display: block; }
.sd-rv-img input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; }
.sd-rv-img .n { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; }
.sd-rv-img .chip { position: absolute; bottom: 6px; left: 6px; font-size: 11px; }
.sd-rv textarea, .sd-rv input:not([type]) { font-size: 12.5px; }
.sd-rv .chk { font-size: 12px; display: flex; gap: 4px; align-items: center; color: var(--muted); }
.sd-gallery { margin-bottom: 12px; }
.sd-gallery .sd-files-h { display: flex; gap: 10px; align-items: center; }
.sd-gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.sd-gal-grid a { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11.5px; }
.sd-gal-grid img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--bg-3); border-radius: 8px; border: 1px solid var(--line); }

@media (max-width: 1180px) { .te-layout { grid-template-columns: 150px minmax(0, 1fr); } .te-side { grid-column: 1 / -1; position: static; } }
@media (max-width: 760px) {
  .te-layout { grid-template-columns: 1fr; }
  .te-steps { flex-direction: row; overflow-x: auto; position: static; }
  .te-steps button { white-space: nowrap; }
  .te-feat-p { margin-left: 0; }
  .tl-tools .tl-q { width: 100%; }
}
.te-var-r .chk input, .te-feat-h input, .sd-rv .chk input, .checks input { flex: none; min-width: 0; width: auto; }
.te-var-r .icon-btn { width: 28px; min-width: 28px; }

/* 新建模板弹窗（TC-010） */
.modal .box.tl-np-box, .modal .box.ti-box { width: min(920px, 94vw); }
.tl-np-sec { margin: 4px 0 14px; }
.tl-np-sec > .lb { font-weight: 700; color: var(--ink); margin-bottom: 8px; display: block; }
.tl-np-sec .chips { margin-bottom: 0; }
.tl-need { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 99px; margin-right: 4px; background: var(--bg-3); }
.tl-need.ok { color: var(--ok-ink); background: var(--keep-soft); }
.tl-need.miss { color: var(--warn-ink); background: var(--warn-soft); }
.tl-miss { color: var(--muted); }
.tl-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.tl-np-list, .ti-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; }
.tl-np-item, .ti-item { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink); cursor: pointer; font: inherit; }
.tl-np-item:hover, .ti-item:hover { border-color: var(--accent); }
.tl-np-item span, .ti-item span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.g3f { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.g3f label { display: flex; flex-direction: column; gap: 4px; }
.g3f select { width: 100%; }

/* 编辑器三层（TC-011） */
.te-level { margin-right: 4px; }
.te-level span { cursor: pointer; user-select: none; font-size: 12.5px; }
.te-more { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; margin: 14px 0 0; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; }
.te-sub { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; }
.te-sub > .lb { display: block; margin-bottom: 8px; }
.te-slot { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; background: var(--bg-2); }
.te-page-row, .te-shot { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.te-page-row .n { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; flex: none; }
.te-page-row .grow, .te-shot .grow { flex: 1; min-width: 160px; }
.te-shot { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg-2); }
.te-shot .n { display: flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.te-shot .n input { width: 52px; }
.te-shot select { width: auto; max-width: 150px; }
.te-shot .chk, .te-slot .chk { display: flex; gap: 4px; align-items: center; font-size: 12.5px; white-space: nowrap; }
.te-part { flex-wrap: wrap; }
.te-feat-h .te-reset { margin-left: auto; }
.te-var-adv { border-top: 1px dashed var(--line); padding-top: 6px; }
.te-json { width: 100%; font-size: 12px; line-height: 1.45; min-height: 360px; }
.tl-grp { font-weight: 700; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 4px; }
.tl-color { display: flex; gap: 8px; align-items: center; }
.tl-color input[type=color] { width: 44px; height: 32px; padding: 2px; flex: none; }
.tl-usage { margin-bottom: 12px; }

/* 导入（TI 系列） */
.ti-tabs { margin-bottom: 12px; }
.ti-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 34px 16px;
  border: 2px dashed var(--line-2); border-radius: var(--radius); cursor: pointer; color: var(--muted); }
.ti-drop b { color: var(--ink); }
.ti-drop span { font-size: 12.5px; max-width: 520px; line-height: 1.5; }
.ti-drop.on, .tl-dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
.ti-deep { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ti-deep input { flex: none; margin-top: 3px; }
.ti-busy { padding: 30px 0; text-align: center; color: var(--muted); }
.ti-pv { display: flex; flex-direction: column; gap: 12px; }
.ti-pv-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ti-an { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg-2); }
.ti-an p { margin: 6px 0 0; }
.ti-conf, .ti-deps { border: 1px solid var(--warn-soft); background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ti-conf label { display: flex; gap: 6px; align-items: center; }
.ti-conf input { flex: none; width: auto; }
.ti-dep { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ti-dep select { width: auto; max-width: 320px; }
.ti-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ti-sum .lb { display: block; }
.ti-code { display: flex; gap: 8px; }
.ti-code input { max-width: 200px; letter-spacing: 1px; text-transform: uppercase; }
.ti-codeout { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px 12px; background: var(--accent-soft); border-radius: 8px; }
.ti-codeout .mono { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.ti-bundle { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.ti-bundle label { display: flex; gap: 6px; align-items: center; }
.ti-bundle input { flex: none; width: auto; }
.ti-env summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) { .g3f, .ti-sum { grid-template-columns: 1fr; } .te-level { order: -1; } }
.te-part > *, .te-page-row > *, .te-shot > *, .te-slot .te-var-r > * { flex: 0 0 auto; }
.te-part select { width: 92px; }
.te-part input[data-pl] { width: 110px; }
.te-part .grow { flex: 1 1 260px; min-width: 200px; }
.te-part input[data-pn], .te-part input[data-psec] { width: 70px !important; }
.te-part select[data-psc], .te-part select[data-ptr] { width: 128px; }
.te-page-row input[data-pgl] { width: 110px; }
.te-page-row .grow { flex: 1 1 220px; }
.te-page-row input[data-pgt] { flex: 0 1 200px; }
.te-page-row select, .te-slot select { width: auto; max-width: 220px; }
.te-slot .te-var-r input[data-sll] { flex: 1 1 140px; }
.te-shot .grow { flex: 1 1 220px; }
.te-shot input[data-sht] { flex: 0 1 140px; }

/* 导出 */
.modal .box.ex-box { width: min(760px, 94vw); }
.ex-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.ex-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; margin-bottom: 12px; }
.ex-item { display: flex; gap: 10px; align-items: center; padding: 6px 12px; cursor: pointer; }
.ex-item:hover { background: var(--bg-3); }
.ex-item input { flex: none; width: auto; }
.ex-item span { display: flex; flex-direction: column; }
.ex-item small { color: var(--muted); font-size: 12px; }
.ex-fmts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.ex-fmt { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ex-fmt.on { border-color: var(--accent); background: var(--accent-soft); }
.ex-fmt input { display: none; }
.ex-fmt span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ex-assets { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.ex-assets input { flex: none; width: auto; }
@media (max-width: 760px) { .ex-fmts { grid-template-columns: 1fr; } }

/* 模板使用指南（#/tpl/guide） */
.tl-guide-link { font-size: 12.5px; font-weight: 400; margin-left: 8px; display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.tl-guide-link .ic { width: 14px; height: 14px; }
.gd-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.gd-toc { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 2px; }
.gd-toc .lb { margin: 0 0 6px 10px; }
.gd-toc button { display: flex; gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.gd-toc button:hover { color: var(--ink); background: var(--bg-3); }
.gd-toc button.on { background: var(--accent-soft); color: var(--ink); }
.gd-toc .ic { width: 16px; height: 16px; flex: none; }
.gd-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 980px; }
.gd-sec { padding: 20px 24px; scroll-margin-top: 12px; transition: box-shadow .3s; }
.gd-sec.hl { box-shadow: 0 0 0 2px var(--accent-soft); }
.gd-sec h2 { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-size: 19px; }
.gd-sec h2 .ic { color: var(--accent); }
.gd-sec > p { line-height: 1.75; color: var(--ink); margin: 0 0 12px; }
.gd-table { overflow-x: auto; margin: 10px 0 14px; }
.gd-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gd-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.gd-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); line-height: 1.6; vertical-align: top; }
.gd-table td.gd-k { font-weight: 600; white-space: nowrap; }
.gd-steps { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-direction: column; gap: 10px; }
.gd-steps li { display: flex; gap: 12px; align-items: flex-start; }
.gd-steps .n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex: none; margin-top: 1px; }
.gd-steps b { display: block; margin-bottom: 2px; }
.gd-steps p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 13.5px; }
.gd-tips { list-style: none; padding: 12px 14px; margin: 10px 0; background: var(--bg-3); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.gd-tips li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.6; }
.gd-tips .ic { color: var(--accent); flex: none; width: 15px; height: 15px; margin-top: 3px; }
.gd-faq details { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.gd-faq summary { cursor: pointer; font-weight: 600; }
.gd-faq p { margin: 8px 0 2px; color: var(--muted); line-height: 1.7; font-size: 13.5px; }
.gd-actions { margin-top: 12px; }
.gd-top { text-align: center; }
@media (max-width: 860px) {
  .gd-layout { grid-template-columns: 1fr; }
  .gd-toc { position: static; flex-direction: row; overflow-x: auto; }
  .gd-toc .lb { display: none; }
  .gd-toc button { white-space: nowrap; }
  .gd-sec { padding: 16px; }
  .gd-table td.gd-k { white-space: normal; }
}
@media print {
  #nav, .topbar, .gd-toc, .page-head .right, .gd-actions, .gd-top { display: none !important; }
  .gd-layout { display: block; }
  .gd-sec { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
