body.template-editing{overflow:hidden}.template-editor{position:fixed;inset:0;z-index:1000;background:#f7f5ef;color:#302f29;display:flex;flex-direction:column;font-size:14px}.template-editor *{box-sizing:border-box}.template-editor button{cursor:pointer;font:inherit}.template-editor button:disabled{cursor:default;opacity:.4}.te-toolbar{display:flex;align-items:center;gap:22px;padding:16px 28px;border-bottom:1px solid #ded8cb;background:#fffdf7;flex-shrink:0}.te-toolbar>div{flex:1}.te-toolbar strong,.te-toolbar small{display:block}.te-toolbar small{color:#817e73;margin-top:4px}.template-editor .primary-button,.template-editor .outline-button{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:10px 22px;font-size:14px;line-height:1.4;gap:8px;margin:0}.te-layout{display:grid;grid-template-columns:minmax(0,1fr) 350px;min-height:0;flex:1}.te-canvas{overflow:auto;padding:36px}.te-paper{max-width:820px;min-height:100%;margin:auto;background:#fffdf7;border:1px solid #ded8cb;box-shadow:0 8px 30px #49392a07;padding:48px 50px}.template-editor label{display:grid;gap:8px;margin:0;font-size:12px;color:#79766c}.template-editor input,.template-editor textarea{font:inherit;min-width:0;width:100%;border:1px solid #ded8cb;background:transparent;border-radius:10px;padding:12px;color:#302f29}.te-name-label input{font-family:'Libre Caslon Text',serif;font-size:30px;color:#49392a;border:0;border-bottom:1px solid #ded8cb;border-radius:0;padding:12px 0 18px}.te-meta{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:24px 0 36px}.te-meta .meeting-control-trigger{min-height:45px;font-size:13px;padding:10px 12px}.te-paper-heading{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ded8cb;padding-bottom:16px}.te-paper-heading h2,.te-library h2{font-family:'Libre Caslon Text',serif;font-size:22px;font-weight:400;color:#49392a;margin:0}.te-paper-heading span{font-size:12px;color:#817e73}.te-question{display:grid;grid-template-columns:26px minmax(0,1fr) 28px;gap:12px;padding:22px 0;border-bottom:1px solid #e8e3d9}.te-number{color:#7a8d74;font-size:14px;padding-top:3px}.te-question small{color:#817e73;font-size:11px}.te-question p{font-size:15px;line-height:1.6;margin:6px 0 18px}.te-answer-line{border-bottom:1px solid #eeeae1;height:12px}.te-row-actions{display:flex;flex-direction:column;gap:3px}.te-row-actions button{border:0;background:transparent;color:#284d33;width:28px;height:28px;border-radius:50%}.te-row-actions button:hover{background:#e8ede4}.te-empty{text-align:center;padding:54px 20px;border:1px dashed #d6d3c7;margin:22px 0;color:#817e73}.te-empty h3{font-size:20px;color:#49392a}.te-empty p{font-size:14px;line-height:1.7}.te-drop-over{border-top:3px solid #284d33}.te-own-toggle{margin-top:24px!important}.te-custom{display:grid;gap:16px;border-top:1px solid #ded8cb;padding-top:22px;margin-top:22px}.te-custom[hidden]{display:none}.te-library{overflow:auto;border-left:1px solid #ded8cb;padding:26px 24px;background:#faf8f2}.te-library>p,.te-source p{font-size:12px;line-height:1.6;color:#817e73}.te-source{margin:22px 0;border:1px solid #ded8cb;border-radius:12px;padding:14px}.te-library summary{display:flex;align-items:center;gap:10px;list-style:none;cursor:pointer;font-size:13px;font-weight:500;padding:15px 0;color:#284d33}.te-library summary::-webkit-details-marker{display:none}.te-library summary svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5;flex-shrink:0;margin-left:auto}.te-library details[open]>summary svg{transform:rotate(90deg)}.te-library summary span{font-size:11px;color:#817e73}.te-source summary{padding:0}.te-source button{display:flex;justify-content:space-between;text-align:left;gap:12px;width:100%;padding:12px 0;border:0;border-top:1px solid #ded8cb;background:transparent;color:#284d33;font-size:12px}.te-library-heading{display:flex;align-items:center;justify-content:space-between}.te-library-heading h3{margin:0;font-size:15px}.te-library-heading span{font-size:11px;color:#817e73}.te-library input{margin:10px 0 14px}.te-library [data-te-bank]>details{border-bottom:1px solid #ded8cb}.te-bank-question{display:flex;gap:12px;align-items:flex-start;padding:12px 0;border-top:1px solid #e8e3d9}.te-bank-question p{font-size:12px;line-height:1.7;margin:0;flex:1}.te-bank-question button{border:1px solid #ded8cb;border-radius:50%;width:28px;height:28px;flex-shrink:0;background:transparent;color:#284d33}.te-announcement{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.template-editor :focus-visible{outline:2px solid #728b6d;outline-offset:3px}@media(max-width:1000px){.te-layout{grid-template-columns:minmax(0,1fr) 290px}.te-canvas{padding:20px}.te-paper{padding:28px 24px}}@media(max-width:700px){.te-layout{display:block;overflow:auto}.te-canvas,.te-library{overflow:visible}.te-library{border-left:0;border-top:1px solid #ded8cb}.te-toolbar{padding:12px;gap:10px}.te-toolbar small{display:none}.te-toolbar .primary-button,.te-toolbar .outline-button{padding:10px 14px}.te-meta{grid-template-columns:1fr}.te-name-label input{font-size:25px}.te-paper{min-height:0}.te-canvas{padding:16px}}
.template-editor .te-toolbar>button{width:auto;flex:0 0 auto;white-space:nowrap}.template-editor .te-toolbar>div{min-width:0}.template-editor .te-own-toggle,.template-editor .te-custom>.primary-button{width:auto;justify-self:start}.template-editor .te-row-actions button{padding:0;min-height:28px;line-height:1;display:grid;place-items:center}.template-editor .te-bank-question button{padding:0;min-height:28px;display:grid;place-items:center;line-height:1}.template-editor .te-library-heading h3{font-family:inherit}
.te-question{grid-template-columns:26px minmax(0,1fr) 46px}.template-editor .te-position-label{font-size:9px;gap:3px;text-align:center}.template-editor .te-position-label input{font-size:12px;padding:4px 2px;border-radius:6px;text-align:center;height:29px}.te-row-actions{align-items:center}.te-toolbar [data-te="delete"]{color:#874b3b;border-color:#cdbcb4}@media(max-width:700px){.te-toolbar{flex-wrap:wrap}.te-toolbar>div{min-width:100px}.te-toolbar [data-te="delete"]{font-size:12px}}
/* A4 uses fixed document geometry; the canvas scales the sheets, not their text flow. */
.te-canvas{padding:24px;background:#eeece5}
.te-pages{width:794px;margin:0 auto;transform-origin:top center}
.template-editor .te-paper{position:relative;width:794px;max-width:none;height:1123px;min-height:1123px;margin:0 0 24px;padding:56px;background:#fffdf8;overflow:hidden}
.te-document-header{padding-bottom:20px}
.te-paper-heading{margin-top:18px}
.te-page-footer{position:absolute;bottom:22px;left:56px;right:56px;text-align:right;color:#817e73;font-size:11px}
.te-continuation-name{font-family:'Libre Caslon Text',serif;font-size:18px;color:#493628;padding-bottom:24px;overflow-wrap:anywhere}
.te-pages-count{display:block;font-size:12px;color:#6f8369;margin-top:3px}
.te-question{position:relative;grid-template-columns:26px minmax(0,1fr);padding:40px 0 20px;break-inside:avoid}
.te-question p{overflow-wrap:anywhere;white-space:pre-wrap}
.te-row-actions{position:absolute;right:0;top:7px;display:flex;flex-direction:row;gap:3px;align-items:center}
.template-editor .te-position-label{display:flex;align-items:center;gap:5px}
.template-editor .te-position-label input{width:42px;height:25px}
.te-settings{border-bottom:1px solid #ded8cb;margin:0 0 24px;padding-bottom:12px}
.te-settings .te-meta{grid-template-columns:1fr;margin:12px 0;gap:14px}
.te-settings input{margin:0}
.te-start-dialog{width:min(600px,calc(100vw - 32px));max-height:85dvh;border:1px solid #ded8cb;border-radius:24px;padding:32px;background:#fffdf8;color:#302f29}
.te-start-dialog::backdrop{background:#16341f66;backdrop-filter:blur(4px)}
.te-start-dialog h2{font-family:'Libre Caslon Text',serif;color:#493628;font-size:28px;font-weight:400;margin:0 45px 16px 0}
.te-start-dialog>p{color:#777269;line-height:1.6}
.te-start-close{position:absolute;right:20px;top:20px}
.te-start-dialog>h3{font-size:14px;margin:28px 0 12px}
.te-start-list{display:grid}
.te-start-list>button{display:flex;align-items:center;justify-content:space-between;gap:20px;border:0;border-top:1px solid #ded8cb;padding:16px 0;background:transparent;text-align:left;color:#284f32;cursor:pointer}
.te-start-list>button:hover{background:#e8ede4}
.te-start-list span{display:flex;align-items:center;gap:10px;white-space:nowrap;font-size:12px;color:#777269}
.te-start-list svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6}
@media print{
 @page{size:A4;margin:0}
 body.template-editing>*:not(.template-editor){display:none!important}
 body.template-editing,.template-editor{position:static!important;overflow:visible!important;height:auto!important;background:white}
 .te-toolbar,.te-library,.te-row-actions{display:none!important}
 .te-layout,.te-canvas{display:block;overflow:visible;padding:0}
 .te-pages{zoom:1!important;width:210mm}
 .template-editor .te-paper{width:210mm;height:297mm;min-height:297mm;margin:0;border:0;box-shadow:none;break-after:page}
 .template-editor .te-paper:last-child{break-after:auto}
}
/* Library tools stay in reach while the question list scrolls independently. */
.te-library{display:flex;flex-direction:column;overflow:hidden;padding:20px;gap:14px}
.te-settings{flex-shrink:0;margin:0;padding:0}.te-settings[open]{max-height:240px;overflow:auto}
.te-library-tools{flex-shrink:0}.te-insert-actions{display:flex;gap:8px;margin-bottom:20px}
.template-editor .te-insert-actions button{padding:9px 12px;min-height:38px;font-size:12px;flex:1}
.te-library-tools>p{font-size:12px;line-height:1.6;color:#817e73;margin:10px 0}
.te-library-tools>input{margin-bottom:0}.te-library [data-te-bank]{overflow-y:auto;overscroll-behavior:contain;min-height:0;flex:1;padding-right:5px}
.te-custom{margin:0 0 18px;padding:12px 0;max-height:42vh;overflow:auto;gap:10px}.te-custom input{margin:0}
.te-bank-question{padding:12px 8px;border-radius:8px;align-items:flex-start;cursor:grab}.te-bank-question:hover{background:#edf0e8}
.te-grip{color:#819078;font-size:21px;line-height:1.4}.te-bank-question p{line-height:1.6}
.template-editor .te-bank-question button{background:#284d33;color:white;border:0;font-size:21px}
.te-toolbar svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.te-drop-over{box-shadow:0 -3px #284d33;border-top:0}.te-drop-after{box-shadow:0 3px #284d33}
.te-dragging .te-empty{border:2px dashed #284d33;background:#edf0e8}.te-dragging .te-canvas{background:#e6eade}
.te-response-label{display:flex!important;align-items:center;gap:12px!important;margin:8px 0!important}.te-response-label .meeting-control{width:155px}.te-response-label .meeting-control-trigger{font-size:11px;min-height:30px;padding:5px 10px}
.te-scale-preview{display:flex;gap:10px;margin:15px 0}.te-scale-preview span{display:grid;place-items:center;border:1px solid #ded8cb;border-radius:50%;width:28px;height:28px;font-size:12px}
.te-question textarea{line-height:1.7;resize:vertical;max-height:430px;font-size:15px;background:#fffdf8}
@media(max-width:700px){.te-library{max-height:75vh;min-height:420px}.te-library [data-te-bank]{max-height:45vh}.te-custom{max-height:30vh}}
@media print{.te-response-label{display:none!important}.te-question textarea{border:0;padding:0;resize:none}}
.te-question textarea[data-te-prose-edit]{resize:none;overflow:hidden;max-height:none}
/* One scrolling surface per sidebar, including when composing a question. */
.te-library{display:block;overflow-y:auto;overscroll-behavior:contain;padding:20px 24px;scrollbar-width:thin;scrollbar-color:#b3bcae transparent}
.te-library-tools{position:sticky;top:-20px;background:#faf8f2;z-index:2;padding-top:16px;padding-bottom:16px}
.te-library [data-te-bank]{overflow:visible;max-height:none;padding:0}
.te-library .te-custom,.te-library .te-settings[open]{max-height:none;overflow:visible}
.te-library.te-composing .te-settings,.te-library.te-composing [data-te-bank],.te-composing .te-library-heading,.te-composing .te-library-tools>p,.te-composing [data-te-search],.te-composing .te-insert-actions{display:none}
.te-composing .te-library-tools{position:static;padding:0}.te-custom{border:0;padding:0;margin:0;gap:18px}.te-custom h3{font-family:inherit;font-size:20px;margin:0;color:#49392a}
.te-composer-back{justify-self:start;font-size:12px!important;margin:0 0 8px!important;padding:0!important}.te-library summary{display:grid;grid-template-columns:minmax(0,1fr) 26px 16px;gap:12px}.te-library summary span{text-align:right}.te-settings summary{display:flex}
.te-order-hint{font-size:11px;color:#817e73;margin:12px 0 0}.te-question{padding:26px 38px 24px 0}.te-row-actions{right:-5px;top:20px;flex-direction:column;gap:8px}
.template-editor .te-row-actions button{width:30px;height:30px;color:#6f8369}.te-row-actions svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.te-row-actions .te-drag-handle{cursor:grab}.te-drag-handle:active{cursor:grabbing}.te-drag-handle svg circle{fill:currentColor;stroke:none}.te-row-actions button:hover{color:#284d33;background:#e8ede4}
@media(max-width:700px){.te-library{max-height:75vh;min-height:420px}.te-library [data-te-bank]{max-height:none}}
@media print{.te-order-hint{display:none}.te-question{padding-right:0}}

.te-answer-caption{font-size:11px;color:#817e73;margin:12px 0 8px}.te-answer-preview{min-height:72px;border:0;border-radius:0;padding:8px 0;margin-top:14px;background:transparent;color:#8a877d;font-size:13px;line-height:1.6;white-space:pre-wrap}.te-scale-preview{margin:8px 0 14px;gap:12px}.te-scale-preview span{width:32px;height:32px;border-color:#bac5b5;color:#284d33}
@media print{.te-answer-preview{background:transparent}.te-answer-preview span{color:#999}}

.template-archive>summary{display:flex;align-items:center;gap:10px;list-style:none;cursor:pointer}.template-archive>summary::-webkit-details-marker{display:none}.template-archive>summary::marker{content:""}.template-archive-chevron{width:18px;height:18px;flex:none;fill:none;stroke:#284d33;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;transition:transform .18s ease}.template-archive[open]>summary .template-archive-chevron{transform:rotate(90deg)}

.te-bank-question:has(button[aria-pressed="true"]){cursor:default}.te-bank-question:has(button[aria-pressed="true"]) p,.te-bank-question:has(button[aria-pressed="true"]) .te-grip{opacity:.45}.te-bank-question button[aria-pressed="true"]{background:#e8e5dc;color:#6c7067;border:1px solid #d8d5cc;opacity:1}

.template-editor .te-question-edit{display:block;width:100%;font:inherit;font-size:14px;line-height:1.65;color:inherit;padding:8px;margin:10px 0;border:1px solid #728b6d;border-radius:8px;background:#fffdf8;resize:none;overflow:hidden}
/* Keep the start actions visible; only the inset template list scrolls. */
.te-start-dialog[open]{display:flex;flex-direction:column;box-sizing:border-box;width:min(640px,calc(100vw - 32px));max-height:min(640px,calc(100dvh - 48px));overflow:hidden;padding:28px}
.te-start-dialog>form,.te-start-dialog>h2,.te-start-dialog>p,.te-start-dialog>h3,.te-start-dialog>[data-start-blank]{flex-shrink:0}
.te-start-dialog>form{margin:0;height:0}
.te-start-dialog>p{margin:0 0 20px;font-size:14px}
.te-start-dialog>[data-start-blank]{align-self:flex-start;width:auto;font-size:14px;padding:12px 22px;min-height:44px}
.te-start-dialog>h3{margin:24px 0 12px}
.te-start-dialog .te-start-list{display:block;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#a3ad9d transparent;padding-right:12px;scrollbar-gutter:stable}
.te-start-dialog .te-start-list>button{width:100%;min-height:58px;padding:14px 8px;gap:16px;font-size:14px;line-height:1.45}
.te-start-list strong{min-width:0;overflow-wrap:anywhere}
.te-start-list::-webkit-scrollbar{width:6px}
.te-start-list::-webkit-scrollbar-thumb{background:#a3ad9d;border-radius:10px}
@media(max-width:600px){.te-start-dialog[open]{padding:20px;max-height:calc(100dvh - 32px)}.te-start-dialog h2{font-size:24px;margin-right:48px}.te-start-close{right:14px;top:14px}.te-start-dialog .te-start-list>button{gap:10px}.te-start-list span{font-size:11px}}

/* Keep every action inside its question, including short scale questions. */
.template-editor .te-question{grid-template-columns:26px minmax(0,1fr) 30px;padding:26px 0 24px;align-items:start}
.template-editor .te-row-actions{position:static;align-self:start;display:flex;flex-direction:column;gap:2px;margin:0;padding:0}
.template-editor .te-row-actions button{flex:0 0 30px;width:30px;height:30px;min-height:30px;margin:0;padding:0;display:grid;place-items:center}
.template-editor .te-row-actions svg{display:block;margin:0}
.te-question-added{animation:te-question-added 800ms ease-in-out 3}
@keyframes te-question-added{0%,100%{background-color:transparent}50%{background-color:#e3eddf}}
@media(prefers-reduced-motion:reduce){.te-question-added{animation:te-question-added-still 2400ms linear 1}@keyframes te-question-added-still{from,to{background-color:#e3eddf}}}

/* A readable editing surface on phones; A4 pagination remains on desktop. */
@media screen and (max-width:700px){
 .te-pages{width:100%;zoom:1!important}
 .template-editor .te-paper{width:100%;height:auto;min-height:0;padding:20px 16px;overflow:visible;margin:0}
 .te-canvas{padding:12px}
 .template-editor .te-question{grid-template-columns:22px minmax(0,1fr);gap:10px;padding:22px 0}
 .template-editor .te-row-actions{grid-column:2;flex-direction:row;flex-wrap:wrap;gap:4px}
 .template-editor .te-row-actions button{width:40px;height:40px;min-height:40px;flex-basis:40px}
 .te-scale-preview{flex-wrap:wrap;gap:8px}
 .te-question p{font-size:15px;overflow-wrap:anywhere}
 .te-question small{font-size:12px}
 .te-name-label input{font-size:22px}
 .te-page-footer{display:none}
 .te-toolbar{gap:8px}
 .te-toolbar>div{flex:1;min-width:0}
 .te-toolbar strong{font-size:13px}
 .te-toolbar .primary-button,.te-toolbar .outline-button{padding:9px 12px}
}
