/* Additive compact template dialog. Canvas design and page sizing are untouched. */
#xh-template-library{position:fixed;inset:0;z-index:110000;font:13px/1.55 "Microsoft YaHei",sans-serif;color:#eee}
#xh-template-library *{box-sizing:border-box}
#xh-template-library .xh-tpl-backdrop{position:absolute;inset:0;background:#000a;backdrop-filter:none!important}
#xh-template-library >section{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(1100px,calc(100vw - 48px));height:min(700px,calc(100dvh - 48px));display:flex;flex-direction:column;background:#19191b!important;border:1px solid #39393d;border-radius:14px;box-shadow:0 20px 70px #0006;overflow:hidden;color:#ececef}
#xh-template-library header{padding:14px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #333338;background:#202023!important;flex:none}
#xh-template-library h2{font-size:18px;margin:0}#xh-template-library h3{font-size:18px;margin:16px 0 8px}
#xh-template-library p{margin:5px 0;color:#b8b8c2}#xh-template-library header p{font-size:11px;margin:2px 0 0}
#xh-template-library button{border:1px solid #414149;border-radius:7px;background:#28282d;color:#eee;padding:8px 11px;cursor:pointer;font:inherit;text-align:left}
#xh-template-library button:hover{border-color:#83838e;background:#33333b}
#xh-template-library button:focus-visible,#xh-template-library input:focus-visible,#xh-template-library textarea:focus-visible{outline:2px solid #bcb7f2;outline-offset:2px}
#xh-template-library button:disabled{opacity:.55;cursor:wait}
#xh-template-library .xh-tpl-header-actions{display:flex;gap:6px}#xh-template-library header button{font-size:22px;padding:0;width:32px;height:32px;text-align:center;border-color:transparent;background:transparent}
#xh-template-library .xh-tpl-body{display:grid;grid-template-columns:184px minmax(0,1fr);flex:1;min-height:0}
#xh-template-library nav{padding:12px 10px;background:#242427!important;border-right:1px solid #36363a;overflow:auto;scrollbar-width:thin}
#xh-template-library nav hr{border:0;border-top:1px solid #424249;margin:10px 4px}
#xh-template-library nav button{display:block;width:100%;margin:3px 0;border-color:transparent;background:transparent;padding:8px 12px}
#xh-template-library nav button[aria-pressed=true]{background:#3b3b43;border-color:transparent;color:#fff}
#xh-template-library nav .xh-tpl-save{font-size:11px;margin-top:15px;color:#c6c3d1}
#xh-template-library main{padding:16px 18px;overflow:auto;min-width:0;background:#151516!important;scrollbar-width:thin;scrollbar-gutter:stable;scroll-behavior:auto}
#xh-template-library form{display:flex;gap:8px;margin-bottom:12px}
#xh-template-library input,#xh-template-library textarea{font:inherit;color:#f1f1f5;background:#28282d;border:1px solid #46464e;border-radius:7px;padding:8px 10px;min-width:0;width:100%}
#xh-template-library form button{white-space:nowrap}
#xh-template-library .xh-tpl-count{font-size:11px;margin:4px 0 12px;color:#aaaab4}
#xh-template-library .xh-tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(126px,1fr));gap:14px 12px;align-items:start}
#xh-template-library .xh-tpl-card{display:flex;flex-direction:column;padding:0;border:0;background:transparent;min-width:0;border-radius:8px;overflow:hidden;contain:layout style}
#xh-template-library .xh-tpl-card:hover{background:transparent;color:#fff}
#xh-template-library .xh-tpl-card strong{font-size:12px;font-weight:600;margin:8px 0 4px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:34px}
#xh-template-library .xh-tpl-cover,#xh-template-library .xh-tpl-symbol{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:cover;border-radius:8px;background:#28282d;flex:none}
#xh-template-library .xh-tpl-symbol{display:grid;place-items:center;font-size:30px;color:#c2c0d2;background:linear-gradient(145deg,#333139,#202026)}
#xh-template-library small{font-size:10px;color:#aaaab8}#xh-template-library .xh-tpl-card-action{margin-top:3px;color:#b5b0d0;font-size:10px}
#xh-template-library .xh-tpl-error{color:#ffc2c2;border:1px solid #754949;border-radius:7px;padding:8px}
#xh-template-library .xh-tpl-status{padding:8px;border:1px solid #565269;border-radius:7px;color:#ded9f7}
#xh-template-library .xh-tpl-flow{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;list-style-position:inside;padding:0}
#xh-template-library .xh-tpl-flow li{background:#252529;border:1px solid #42424a;border-radius:9px;padding:12px}
#xh-template-library .xh-tpl-flow span{display:block;color:#b7b1d4;font-size:11px}#xh-template-library .xh-tpl-flow strong{font-size:13px}
#xh-template-library .xh-tpl-flow p{white-space:pre-wrap;max-height:130px;overflow:auto;font-size:11px}
#xh-template-library .xh-tpl-detail-footer{position:sticky;bottom:-16px;background:#19191bef;padding:10px;display:flex;justify-content:space-between;gap:12px;align-items:center;border-top:1px solid #343439}
#xh-template-library .xh-tpl-primary{background:#e7e4f3;color:#18171c;border-color:#e7e4f3;font-weight:600}
#xh-template-library footer{border-top:1px solid #333338;padding:9px 18px;color:#b7b5c1;font-size:10px;background:#202023!important;flex:none}
#xh-template-library [data-save-form]{display:grid;max-width:520px}#xh-template-library [data-save-form] label{display:block}
@media(max-width:720px){#xh-template-library >section{width:calc(100vw - 24px);height:calc(100dvh - 32px)}#xh-template-library .xh-tpl-body{grid-template-columns:120px minmax(0,1fr)}#xh-template-library main{padding:12px}#xh-template-library header{padding:12px}#xh-template-library .xh-tpl-grid{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))}#xh-template-library nav button{padding:8px 7px}}
