.wx-template-bar,.wx-template-dialog{--tpl-ink:var(--text-primary,var(--ink,#20251f));--tpl-muted:var(--text-secondary,var(--muted,#646b62));--tpl-line:var(--border-card,var(--line,#e1e4dc));--tpl-surface:var(--bg-card,var(--panel,#fff));--tpl-soft:var(--bg-secondary,#f5f6f2);--tpl-field:var(--input-bg,#fafbf8);--tpl-focus:var(--brand-start,#59684c);--tpl-danger:#a43b32;color:var(--tpl-ink);font-family:var(--font-stack,-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif)}
.wx-template-bar{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;max-width:440px;margin:0 0 0 auto;font-size:13px;line-height:1.5}.wx-template-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;width:19px;height:19px;color:inherit}.wx-template-icon svg{width:100%;height:100%;display:block}
.wx-template-bar button,.wx-template-dialog button,.wx-template-card-menu>summary{display:inline-flex;align-items:center;justify-content:center;gap:7px;box-sizing:border-box;min-height:44px;padding:10px 14px;border:1px solid var(--tpl-line);border-radius:8px;background:var(--tpl-surface);color:var(--tpl-ink);font:inherit;font-weight:500;line-height:1.4;cursor:pointer;text-decoration:none;white-space:nowrap;box-shadow:none;transition:background-color .16s ease,border-color .16s ease,color .16s ease}
.wx-template-bar button:hover,.wx-template-dialog button:hover,.wx-template-card-menu>summary:hover{background:var(--tpl-soft);border-color:var(--tpl-muted)}.wx-template-bar .wx-template-save,.wx-template-bar .wx-template-undo{border-color:transparent;background:transparent;color:var(--tpl-muted);padding-inline:10px}.wx-template-bar .wx-template-save:hover,.wx-template-bar .wx-template-undo:hover{background:var(--tpl-soft);color:var(--tpl-ink);border-color:transparent}.wx-template-bar-notice{flex:1 0 100%;max-width:46ch;text-align:right;font-size:12px;line-height:1.6;color:var(--tpl-muted);overflow-wrap:anywhere}.wx-template-bar-notice:empty{display:none}.wx-template-bar [hidden],.wx-template-dialog [hidden]{display:none!important}
.wx-template-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;flex-wrap:wrap}.wx-template-heading-copy,.wx-template-heading>.tool-panel-header-text{flex:1 1 280px;min-width:0}.wx-template-heading>.wx-template-bar{flex:0 1 auto;padding-top:2px}.wx-template-heading>.tool-back-btn{order:2;align-self:center}.wx-template-heading-tools{display:flex;flex-direction:column;align-items:flex-end;gap:12px}.wx-template-heading-tools .overlay-account{margin:0}.header-side>.wx-template-bar{margin-top:16px}.wx-template-step-tools{margin:0 0 20px auto}.wx-template-raw-header{position:relative;padding-right:300px}.wx-template-raw-header>.wx-template-bar{position:absolute;right:0;top:12px}
.wx-template-dialog{padding:0;width:min(760px,calc(100vw - 40px));max-width:none;max-height:min(860px,calc(100dvh - 64px));border:1px solid var(--tpl-line);border-radius:16px;background:var(--tpl-surface);font-size:14px;line-height:1.65;overflow:hidden;box-sizing:border-box;box-shadow:0 28px 90px #12200f26,0 2px 10px #12200f0d;z-index:110000}.wx-template-dialog[open]{display:flex;flex-direction:column;animation:wx-template-appear .18s ease-out}.wx-template-dialog::backdrop{background:#111b1459}
.wx-template-dialog>header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;flex:none;gap:16px;width:auto;max-width:none;margin:0;padding:23px 28px 20px;border-bottom:1px solid var(--tpl-line);background:var(--tpl-surface)}.wx-template-dialog h2{margin:2px 0 0;color:var(--tpl-ink);font-size:23px;line-height:1.4;font-weight:650;letter-spacing:-.5px}.wx-template-dialog .wx-template-caption{margin:0;color:var(--tpl-muted);font-size:12px;line-height:1.5;letter-spacing:.04em}.wx-template-dialog .wx-template-close{min-width:44px;padding:10px;border-color:transparent;background:transparent;color:var(--tpl-muted);border-radius:50%}
.wx-template-body{padding:22px 28px 26px;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;flex:1 1 auto}.wx-template-body>p:first-child{margin:0 0 20px}.wx-template-dialog p{color:var(--tpl-muted);font-size:13px;line-height:1.75;margin:8px 0}.wx-template-section{margin:22px 0 0;min-width:0}.wx-template-section h3{font-size:14px;font-weight:600;margin:0 0 12px;line-height:1.5}
.wx-template-recent{display:flex;align-items:center;gap:14px;padding:16px 18px;border:1px solid var(--tpl-line);border-radius:10px;background:var(--tpl-soft)}.wx-template-recent>.wx-template-icon{width:38px;height:38px;border:1px solid var(--tpl-line);padding:8px;border-radius:9px;background:var(--tpl-surface);box-sizing:border-box}.wx-template-recent>div{min-width:0;flex:1}.wx-template-recent strong{font-size:14px;font-weight:600}.wx-template-recent p{font-size:12px;margin:2px 0 0}.wx-template-recent>button{flex:none;background:var(--tpl-surface);font-size:13px}
.wx-template-library-tools{display:flex;align-items:center;gap:12px;margin-bottom:16px}.wx-template-library-tools>.wx-template-field{flex:1;margin:0;min-width:0}.wx-template-library-tools>button{flex:none;font-size:13px}.wx-template-search{position:relative}.wx-template-search>.wx-template-field-label{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wx-template-search>.wx-template-icon{position:absolute;left:13px;top:13px;z-index:1;color:var(--tpl-muted);pointer-events:none;width:18px;height:18px}.wx-template-dialog .wx-template-search input{padding-left:40px;background:var(--tpl-field)}
.wx-template-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}.wx-template-card{min-width:0;border:1px solid var(--tpl-line);border-radius:10px;padding:18px;background:var(--tpl-surface)}.wx-template-card-head{display:flex;align-items:flex-start;gap:12px;min-height:60px;margin-bottom:16px}.wx-template-card-head>.wx-template-icon{width:34px;height:38px;box-sizing:border-box;padding:7px;background:var(--tpl-soft);border:1px solid var(--tpl-line);border-radius:6px}.wx-template-card-head>div{min-width:0;flex:1}.wx-template-card h3{font-size:14px;line-height:1.65;margin:0 0 3px;font-weight:600;overflow-wrap:anywhere}.wx-template-card small{display:block;font-size:12px;line-height:1.5;color:var(--tpl-muted)}.wx-template-card-actions{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.wx-template-card-actions>button{min-width:96px;font-size:13px}
.wx-template-card-menu{position:relative;margin:0}.wx-template-card-menu>summary{list-style:none;width:44px;padding:10px;border-color:transparent;color:var(--tpl-muted)}.wx-template-card-menu>summary::-webkit-details-marker{display:none}.wx-template-menu-items{position:absolute;right:0;top:48px;min-width:174px;padding:5px;z-index:4;background:var(--tpl-surface);border:1px solid var(--tpl-line);border-radius:9px;box-shadow:0 10px 28px #12200f1f}.wx-template-menu-items button{display:flex;width:100%;justify-content:flex-start;border:0;border-radius:5px;background:transparent;font-size:13px}
.wx-template-dialog .wx-template-primary{border-color:var(--tpl-ink);background:var(--tpl-ink);color:var(--tpl-surface)}.wx-template-dialog .wx-template-primary:hover{background:var(--tpl-ink);border-color:var(--tpl-ink);filter:brightness(.88)}.wx-template-dialog .wx-template-danger{color:var(--tpl-danger)}.wx-template-empty{grid-column:1/-1;text-align:center;padding:34px 20px 30px;border:1px dashed var(--tpl-line);border-radius:10px;background:var(--tpl-field)}.wx-template-empty>.wx-template-icon{width:42px;height:42px;color:var(--tpl-muted);padding:9px;box-sizing:border-box;margin-bottom:12px;background:var(--tpl-surface);border:1px solid var(--tpl-line);border-radius:10px}.wx-template-empty h3{margin:0;font-size:15px}.wx-template-empty p{margin:6px 0 18px}.wx-template-empty button{font-size:13px}
.wx-template-field{display:block;margin:0;min-width:0}.wx-template-field-label{display:block;margin-bottom:8px;color:var(--tpl-ink);font-size:13px;font-weight:500;line-height:1.5}.wx-template-dialog input:not([type=checkbox]),.wx-template-dialog textarea{display:block;box-sizing:border-box;width:100%;max-width:100%;min-height:44px;border:1px solid var(--tpl-line);border-radius:8px;background:var(--tpl-field);color:var(--tpl-ink);padding:11px 12px;font:inherit;font-size:14px;line-height:1.7;box-shadow:none;transition:border-color .16s ease,box-shadow .16s ease}.wx-template-dialog textarea{min-height:104px;resize:vertical}.wx-template-dialog input::placeholder,.wx-template-dialog textarea::placeholder{color:var(--tpl-muted);opacity:.8}.wx-template-dialog input[readonly]{background:var(--tpl-soft);color:var(--tpl-muted)}.wx-template-dialog input[aria-invalid=true]{border-color:var(--tpl-danger)}.wx-template-field-error{display:block;margin-top:6px;color:var(--tpl-danger);font-size:12px;line-height:1.5}
.wx-template-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.wx-template-field-wide{grid-column:1/-1}.wx-template-dialog .wx-template-field-help{margin:12px 0 0;font-size:12px}.wx-template-field-help code{font-family:inherit;background:var(--tpl-soft);border:1px solid var(--tpl-line);padding:1px 5px;border-radius:4px;color:var(--tpl-ink);white-space:nowrap}.wx-template-dialog .wx-template-variables{padding:18px;border:1px solid var(--tpl-line);border-radius:10px;background:var(--tpl-soft)}.wx-template-variables>p{margin:-5px 0 14px}
.wx-template-disclosure{margin-top:20px;border-top:1px solid var(--tpl-line)}.wx-template-disclosure>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;padding:8px 0;box-sizing:border-box;font-size:13px;font-weight:500;color:var(--tpl-muted);cursor:pointer;list-style:none}.wx-template-disclosure>summary::-webkit-details-marker{display:none}.wx-template-disclosure>summary::after{content:'+';font-size:20px;font-weight:400;line-height:1}.wx-template-disclosure[open]>summary::after{content:'−'}.wx-template-disclosure>.wx-template-field-grid{padding:8px 0 3px}.wx-template-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 24px;margin:4px 0 8px;padding:16px;border-radius:8px;background:var(--tpl-soft)}.wx-template-settings>div{min-width:0}.wx-template-settings dt{font-size:12px;line-height:1.5;color:var(--tpl-muted);margin-bottom:4px}.wx-template-settings dd{margin:0;font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.wx-template-reference{padding:16px;border:1px solid var(--tpl-line);border-radius:10px;background:var(--tpl-soft)}.wx-template-reference img{display:block;max-height:140px;max-width:100%;object-fit:contain;border-radius:6px;margin:10px 0}.wx-template-reference>label{display:flex;align-items:center;gap:8px;font-size:13px;min-height:44px;cursor:pointer}.wx-template-reference input[type=checkbox]{width:17px;height:17px;accent-color:var(--tpl-ink);flex:none}.wx-template-dialog .wx-template-footnote{margin:22px 0 0;font-size:12px;line-height:1.7;color:var(--tpl-muted)}
.wx-template-dialog>.wx-template-notice{flex:none;margin:0;padding:12px 28px;font-size:13px;background:var(--tpl-soft);border-top:1px solid var(--tpl-line);white-space:pre-wrap;overflow-wrap:anywhere;max-height:100px;overflow:auto}.wx-template-dialog>.wx-template-notice:empty{display:none}.wx-template-dialog>.wx-template-error{color:var(--tpl-danger)}.wx-template-dialog>footer{flex:none;display:flex;justify-content:space-between;gap:12px;margin:0;padding:16px 28px;border-top:1px solid var(--tpl-line);background:var(--tpl-surface)}.wx-template-dialog>footer:empty{display:none}.wx-template-dialog>footer button{min-width:118px;font-size:13px}.wx-template-dialog button:disabled{opacity:.5;cursor:not-allowed}.wx-template-dialog button[aria-busy=true]{cursor:progress}.wx-template-dialog button[aria-busy=true]::after{content:'';width:13px;height:13px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:wx-template-spin .65s linear infinite}
.wx-template-bar button:focus-visible,.wx-template-dialog button:focus-visible,.wx-template-dialog summary:focus-visible{outline:2px solid var(--tpl-focus);outline-offset:3px}.wx-template-dialog input:focus-visible,.wx-template-dialog textarea:focus-visible{outline:2px solid var(--tpl-focus);outline-offset:2px;border-color:var(--tpl-focus)}
@keyframes wx-template-appear{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes wx-template-spin{to{transform:rotate(360deg)}}
@media(max-width:900px){.wx-template-raw-header{padding-right:0}.wx-template-raw-header>.wx-template-bar{position:static;margin:20px 0 0;justify-content:flex-start}.wx-template-heading{gap:16px}.wx-template-heading>.wx-template-bar{margin-left:0}}
@media(max-width:600px){.wx-template-dialog{width:calc(100vw - 20px);max-height:calc(100dvh - 24px);border-radius:13px}.wx-template-dialog>header{padding:18px 18px 16px}.wx-template-dialog h2{font-size:21px}.wx-template-body{padding:18px}.wx-template-dialog>footer{padding:14px 18px;gap:10px}.wx-template-dialog>.wx-template-notice{padding:12px 18px}.wx-template-dialog>footer button{flex:1;min-width:0;padding-inline:10px}.wx-template-list,.wx-template-field-grid,.wx-template-settings{grid-template-columns:minmax(0,1fr)}.wx-template-card{padding:16px}.wx-template-card-head{min-height:auto;margin-bottom:14px}.wx-template-recent{flex-wrap:wrap;gap:10px;padding:14px}.wx-template-recent>div{flex:1 1 calc(100% - 54px)}.wx-template-recent>button{margin-left:48px;min-width:100px}.wx-template-library-tools{flex-wrap:wrap;gap:10px}.wx-template-library-tools>.wx-template-field{flex-basis:100%}.wx-template-library-tools>button{margin-left:auto}.wx-template-dialog input:not([type=checkbox]),.wx-template-dialog textarea{font-size:16px}.wx-template-heading-tools{align-items:flex-start;gap:10px}.wx-template-bar{margin-left:0;justify-content:flex-start;max-width:100%}.wx-template-bar-notice{text-align:left}.header-side>.wx-template-bar{margin-top:12px}.wx-template-heading>.wx-template-bar{flex-basis:100%}.wx-template-step-tools{margin-bottom:14px}}
@media(prefers-reduced-motion:reduce){.wx-template-dialog[open]{animation:none}.wx-template-bar button,.wx-template-dialog button,.wx-template-dialog input,.wx-template-dialog textarea{transition:none}.wx-template-dialog button[aria-busy=true]::after{animation:none}}

/* Keep expanded management actions inside the scrolling card, including the final row. */
.wx-template-card-actions{flex-wrap:wrap}.wx-template-card-menu[open]{flex-basis:100%;width:100%}.wx-template-card-menu[open]>summary{margin-left:auto}.wx-template-menu-items{position:static;min-width:0;margin-top:6px;box-shadow:none;background:var(--tpl-soft)}
.header-side:has(>.wx-template-bar){flex-direction:column;gap:0}@media(max-width:680px){.header-side:has(>.wx-template-bar){align-items:flex-start}}

/* Explicit geometry and scoped type resist the host page's universal reset and hero headings. */
.wx-template-dialog{position:fixed;inset:0;margin:auto;height:fit-content;width:min(720px,calc(100vw - 48px));max-height:calc(100dvh - 80px);border-radius:18px;background:var(--bg-primary,var(--panel,#fff))}
.wx-template-dialog[data-view=editor]{width:min(560px,calc(100vw - 48px))}
.wx-template-dialog #wx-template-title{font-family:inherit;font-size:21px;font-weight:600;line-height:1.45;letter-spacing:-.02em;text-wrap:initial;margin:3px 0 0}
.wx-template-dialog .wx-template-section h3,.wx-template-dialog .wx-template-card h3{font-family:inherit;font-size:14px;font-weight:600;line-height:1.6;letter-spacing:0;text-wrap:initial}
.wx-template-dialog>header{padding:22px 24px 18px;background:transparent;border-bottom:0}
.wx-template-dialog .wx-template-caption{font-size:12px;line-height:1.5;color:var(--tpl-muted)}
.wx-template-body{padding:0 24px 24px;scrollbar-gutter:auto}
.wx-template-body>p:first-child{margin:0 0 22px;font-size:13px;line-height:1.7}
.wx-template-body>.wx-template-section:first-of-type{margin-top:0}
.wx-template-dialog .wx-template-field-label{font-size:13px;margin-bottom:8px}
.wx-template-dialog input:not([type=checkbox]){min-height:44px;padding:10px 12px;border-radius:8px;font-size:14px;line-height:1.6;background:var(--tpl-surface)}
.wx-template-dialog textarea{min-height:88px;font-size:14px;line-height:1.65;background:var(--tpl-surface)}
.wx-template-dialog input:focus-visible,.wx-template-dialog textarea:focus-visible{outline:2px solid var(--tpl-focus);outline-offset:2px;border-color:transparent}
.wx-template-overview{display:flex;align-items:flex-start;gap:12px;margin-top:18px;padding:15px 16px;border:1px solid var(--tpl-line);border-radius:10px;background:var(--tpl-soft)}
.wx-template-overview>.wx-template-icon{width:20px;height:20px;margin-top:2px;color:var(--tpl-muted)}
.wx-template-overview>div{min-width:0}.wx-template-overview strong{font-size:13px;font-weight:500;line-height:1.6}
.wx-template-dialog .wx-template-overview p{font-size:12px;margin:3px 0 0;overflow-wrap:anywhere}
.wx-template-copy-editor{margin-top:0}.wx-template-copy-editor>summary{color:var(--tpl-ink)}
.wx-template-dialog .wx-template-footnote{margin-top:16px;font-size:12px;line-height:1.7}
.wx-template-dialog>footer{justify-content:flex-end;gap:10px;padding:16px 24px;background:var(--tpl-soft)}
.wx-template-dialog>footer button{min-width:104px}
@media(max-width:600px){.wx-template-dialog,.wx-template-dialog[data-view=editor]{width:calc(100vw - 24px);max-height:calc(100dvh - 32px)}.wx-template-dialog>header{padding:20px 20px 16px}.wx-template-body{padding:0 20px 20px}.wx-template-dialog>footer{padding:14px 20px}.wx-template-dialog input:not([type=checkbox]),.wx-template-dialog textarea{font-size:16px}}
