/* The template gallery is application UI, never part of exported documents. */
.template-gallery-button{min-height:39px;gap:8px;padding:9px 13px;border-color:#d7dee7;background:#fff;color:#334964;font-weight:600;}
.template-gallery-button:hover{background:#f4f7fa;border-color:#aebed0;}
.template-gallery-icon{position:relative;display:inline-block;width:14px;height:16px;border:1.4px solid currentColor;border-radius:2px;}
.template-gallery-icon::before,.template-gallery-icon::after{content:"";position:absolute;left:3px;right:3px;height:1px;background:currentColor;}
.template-gallery-icon::before{top:5px;}
.template-gallery-icon::after{top:9px;}
.document-template-dialog{width:min(1040px,calc(100% - 32px));max-height:88vh;max-height:88dvh;padding:0;overflow:auto;border:1px solid #e2e7ee;border-radius:16px;background:#f6f8fa;color:#25364b;box-shadow:0 30px 100px rgba(20,36,58,.22);}
.document-template-dialog::backdrop{background:rgba(22,34,50,.4);backdrop-filter:blur(4px);}
.document-template-header{position:sticky;top:0;z-index:1;display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:24px 28px 22px;border-bottom:1px solid #e5eaf0;background:rgba(255,255,255,.98);}
.template-eyebrow{margin-bottom:6px;font-size:10px;font-weight:700;letter-spacing:.17em;color:#8794a5;}
.document-template-header h2{margin:0 0 8px;font-size:23px;letter-spacing:-.03em;font-weight:700;}
.document-template-header p{margin:0;color:#778394;font-size:12px;line-height:1.7;}
.template-close-button{flex-shrink:0;min-height:33px;color:#617085;border-color:#dfe5ed;}
.document-template-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;padding:24px 28px;}
.document-template-card{min-width:0;overflow:hidden;border:1px solid #dfe6ed;border-radius:10px;background:#fff;}
.document-template-card[data-selected="true"]{border-color:#6f8eae;box-shadow:0 0 0 2px #dbe6f1;}
.template-mini{height:174px;padding:16px 32px 0;overflow:hidden;background:linear-gradient(135deg,#edf1f5,#f7f9fb);}
.template-mini-sheet{min-height:190px;padding:17px 19px;background:var(--mini-paper);border:1px solid rgba(37,54,75,.08);box-shadow:0 5px 14px rgba(28,45,66,.07);}
.template-mini-kicker{display:block;margin-bottom:8px;color:#a0a8b1;font-size:6px;letter-spacing:.1em;}
.template-mini-title{display:block;color:var(--mini-accent);font-size:15px;line-height:1.4;}
.template-mini-rule{display:block;height:2px;margin:9px 0 11px;background:var(--mini-accent);opacity:.8;}
.template-mini-line{display:block;width:88%;height:3px;margin:5px 0;border-radius:2px;background:#dce1e6;}
.template-mini-line.long{width:100%;}
.template-mini-line.short{width:64%;}
.template-mini-section{display:block;width:42%;height:5px;margin:12px 0 7px;border-radius:1px;background:var(--mini-accent);opacity:.8;}
.template-mini-table{display:block;height:24px;margin-top:10px;border:1px solid #e0e5eb;background:repeating-linear-gradient(to right,transparent 0,transparent 32%,#e0e5eb 32%,#e0e5eb 33%),linear-gradient(to bottom,#eaf0f5 0,#eaf0f5 8px,#fff 8px);}
.template-mini[data-mini-theme="academic"] .template-mini-title{text-align:center;font-family:"Songti SC",SimSun,Georgia,serif;}
.template-mini[data-mini-theme="academic"] .template-mini-rule{height:1px;}
.template-mini[data-mini-theme="editorial"] .template-mini-title{font-family:"Songti SC",SimSun,Georgia,serif;font-size:17px;}
.template-mini[data-mini-theme="editorial"] .template-mini-rule{width:32%;height:1px;}
.template-mini[data-mini-theme="proposal"] .template-mini-sheet{border-top:3px solid var(--mini-accent);}
.template-mini[data-mini-theme="brief"] .template-mini-section{width:100%;height:10px;opacity:.2;}
.template-mini[data-mini-theme="resume"] .template-mini-title{font-size:19px;}
.template-mini[data-mini-theme="resume"] .template-mini-rule{height:1px;}
.template-card-content{padding:16px;}
.template-card-content h3{margin:0 0 6px;font-size:14px;font-weight:700;}
.template-card-content p{min-height:40px;margin:0 0 14px;font-size:11px;line-height:1.8;color:#7e8997;}
.template-card-actions{display:flex;gap:7px;flex-wrap:wrap;}
.template-card-actions .btn{flex:1;justify-content:center;min-height:33px;padding:7px 8px;white-space:nowrap;font-size:11px;}
.template-style-button{color:#52657d;border-color:#dce4ed;background:#fff;}
.template-insert-button{background:#263e58;border-color:#263e58;color:#fff;}
.document-template-footer{padding:0 28px 22px;color:#8892a0;font-size:11px;line-height:1.8;}
@media (max-width:800px){.document-template-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:20px;}.document-template-header{padding:20px;}}
@media (max-width:520px){.document-template-dialog{width:calc(100% - 20px);border-radius:12px;}.document-template-header h2{font-size:20px;}.document-template-grid{grid-template-columns:1fr;padding:14px;}.document-template-card{display:grid;grid-template-columns:105px minmax(0,1fr);}.template-mini{height:100%;padding:15px 9px 0;}.template-mini-sheet{padding:12px 8px;}.template-mini-title{font-size:10px;}.template-mini[data-mini-theme="resume"] .template-mini-title{font-size:13px;}.template-mini[data-mini-theme="editorial"] .template-mini-title{font-size:12px;}.template-mini-kicker{font-size:5px;}.template-card-content{padding:14px 12px;}.template-card-actions .btn{font-size:10px;}.document-template-footer{padding:0 18px 18px;}}
@media print{.document-template-dialog{display:none !important;}}
