/* V23.8 — last-mile mobile layout and legible assessment; preserve approved theme. */
:root{--t38-dock-clearance:calc(106px + env(safe-area-inset-bottom, 0px));}
.premium-shell,.premium-shell .workspace,.premium-shell .scrollregion,.premium-shell .v19-module,.premium-shell .v19-module-body{min-width:0;}
.premium-shell :is(.card,.panel,.doc-layout,.stack,.v19-module-body,.suite-panel,.ctx-layout,.ctx-main){min-width:0;}
.premium-shell :is(h1,h2,h3,p,label,small,.hint-panel,.statusline){overflow-wrap:break-word;}
.premium-shell :is(.doc-table-wrapper,.matrix-wrapper,.suite-table,.roster-matrix-wrap){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
.premium-shell img,.premium-shell svg{max-width:100%;}
.qb38-editor{min-width:0;}
.qb38-editor textarea,.qb38-editor input,.qb38-editor select{max-width:100%;font-size:16px;}
.qb38-preview{padding:15px;border:1px solid #b5d7cc;border-radius:15px;background:#f3faf6;color:#1c4238;min-width:0;overflow-wrap:anywhere;}
.qb38-preview>strong{display:block;margin-bottom:10px;font-size:14px;}
.qb38-preview p{font-size:15px;line-height:1.6;margin:0 0 10px;white-space:pre-wrap;}
.qb38-preview small{font-size:12px;line-height:1.4;display:block;color:#637d75;}
.qb38-options{display:grid;gap:5px;padding-left:31px;margin:8px 0 14px;list-style-type:upper-alpha;}
.qb38-options li{padding:7px 10px;line-height:1.4;white-space:pre-wrap;min-width:0;}
.qb38-options li.qb38-selected{outline:1px solid #8bbcae;background:#e5f4ed;border-radius:8px;}
.bank-item{min-width:0;}.bank-item span{min-width:0;overflow-wrap:anywhere;}
@media(max-width:800px){
 html,body{width:100%;max-width:100%;overflow-x:hidden!important;}
 .premium-shell{max-width:100%;overflow-x:clip;}
 .premium-shell .appbar{position:relative!important;top:auto!important;z-index:10!important;}
 .premium-shell .scrollregion{padding-bottom:var(--t38-dock-clearance)!important;max-width:100%;overflow-x:clip!important;scroll-behavior:auto!important;}
 .premium-shell .t20-hub-main{padding-bottom:var(--t38-dock-clearance)!important;max-width:100%;}
 .premium-shell .v19-module-body,.premium-shell .suite-scroll,.premium-shell .form-local-scroll{height:auto!important;max-height:none!important;overflow-y:visible!important;scroll-behavior:auto!important;}
 .premium-shell .doc-layout .listpane,.premium-shell .doc-layout .property{height:auto!important;max-height:none!important;overflow-y:visible!important;}
 .premium-shell .doc-layout .doc-canvas-wrap{height:auto!important;max-height:none!important;overflow-x:auto!important;overflow-y:auto!important;scroll-behavior:auto!important;}
 .premium-shell .doc-layout .paper{max-width:100%!important;}
 .premium-shell .t-bottomnav,.premium-shell .premium-bottom{bottom:0!important;max-width:100vw;z-index:80!important;}
 .premium-shell .t-bottomnav button,.premium-shell .premium-bottom button{min-width:0!important;overflow-wrap:anywhere;}
 .premium-shell .t20-hub-grid,.premium-shell .t20-hub-section-title,.premium-shell .t20-spotlight{min-width:0;}
 .premium-shell .t20-spotlight > div{min-width:0;}
 .premium-shell .t20-spotlight button{max-width:43%;white-space:normal;}
 .premium-shell .v19-module-tab,.premium-shell .v19-tool{scroll-margin-inline:8px;}
 .premium-shell :is(input,textarea,select){min-width:0!important;max-width:100%;scroll-margin-bottom:30vh;font-size:16px!important;}
 .premium-shell .modal-shade,.modal-shade{padding:calc(8px + env(safe-area-inset-top,0px)) 8px calc(8px + env(safe-area-inset-bottom,0px))!important;}
 .premium-shell .modal,.modal{width:min(100%,640px);max-width:100%;max-height:calc(100dvh - 28px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;overflow:auto!important;}
 .premium-shell .modal :is(.topline,.frow){min-width:0;flex-wrap:wrap;}
 .premium-shell .modal :is(.columns,.comparison){grid-template-columns:minmax(0,1fr);}
 .premium-shell .modal .bank-item{align-items:flex-start;gap:8px;}
 .premium-shell .modal .bank-item button{flex-shrink:0;}
 .premium-shell .modal .qb38-editor{padding-bottom:15px;}
 body.thinkora-keyboard-open .t-bottomnav,body.thinkora-keyboard-open .premium-bottom{display:none!important;pointer-events:none!important;}
 body.thinkora-keyboard-open .scrollregion{padding-bottom:25px!important;}
 .premium-shell .card,.premium-shell .t20-hub-tile,.premium-shell .v19-tool{will-change:auto!important;}
}
@media(max-width:390px){
 .premium-shell .t-bottomnav button,.premium-shell .premium-bottom button{font-size:9px!important;padding-inline:1px!important;}
 .premium-shell .v19-doc-block .v19-block-actions{max-width:calc(100% - 8px)!important;}
 .premium-shell .bank-item{flex-wrap:wrap;}
}
@media(hover:none) and (pointer:coarse){
 .premium-shell :is(.t20-hub-tile,.v19-tool,.card){transition-property:background-color,border-color,box-shadow!important;}
 .premium-shell .t20-hub-tile:hover,.premium-shell .v19-tool:hover{transform:none!important;}
}
@media(prefers-reduced-motion:reduce){html *,html *::before,html *::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important;}}
@media print{.qb38-editor,.qb38-preview{display:none!important}.premium-shell .v19-module-body{max-height:none!important;overflow:visible!important}}

.qb38-quickbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;background:#f2faf6;border:1px solid #c8e3d5;border-radius:15px;padding:12px 14px;margin:10px 0;color:#244f43;}
.qb38-quickbar strong,.qb38-quickbar small{display:block}.qb38-quickbar strong{font-size:14px}.qb38-quickbar small{color:#5a8173;font-size:12px;margin-top:3px}.qb38-quickbar button{min-height:44px;}
@media(max-width:420px){.qb38-quickbar{align-items:stretch}.qb38-quickbar button{width:100%}}
/* Editor soal: keep per-field AI tools but place compactly beside each label. */
.qb38-editor{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px!important;align-content:start;}
.qb38-editor > label{position:relative;display:block;min-width:0;margin:3px 0 0!important;padding-top:6px;font-size:12px;font-weight:750;line-height:1.35;}
.qb38-editor > label:has(#qb-stem),.qb38-editor > label:has(#qb-exp),.qb38-editor > label:has(#qb-key),.qb38-editor > .qb38-preview,.qb38-editor > [data-act^="bank-save"]{grid-column:1/-1;}
.qb38-editor > label :is(input,textarea,select){display:block;margin-top:8px!important;min-width:0!important;width:100%;}
.qb38-editor > label .thinkora-field-ai{position:absolute!important;inset-inline-end:0;top:-3px;margin:0!important;padding:4px 9px!important;width:auto!important;min-width:0!important;height:30px!important;min-height:30px!important;font-size:11px!important;border-radius:12px!important;line-height:1!important;white-space:nowrap!important;}
.qb38-editor #qb-stem,.qb38-editor #qb-exp{min-height:80px!important;resize:vertical;}
@media(max-width:360px){.qb38-editor{gap:9px!important}.qb38-editor > label .thinkora-field-ai{padding:4px 6px!important;font-size:10px!important}}
/* Strict print isolation: only the paper subtree and its structural ancestors remain.
   Stats, question-management controls, jump links and floating action buttons must not leak into PDF. */
@media print{
 body:has(#paper) #app :not(#paper):not(#paper *):not(:has(#paper)){display:none!important;}
 body:has(#paper) #paper{break-before:auto!important;break-after:auto!important;}
 body:has(#paper) #paper .v19-block-actions,body:has(#paper) #paper [data-act^="bank-manager"]{display:none!important;}
}

@media print{body:has(#paper) .t38-edit-glyph{display:none!important;}}

/* Page-accurate printing for assessment: every question and its options remain together. */
@media print{
 @page{size:A4 portrait;margin:14mm;}
 #paper[data-doc="asesmen"] .t38-question-group{break-inside:avoid!important;page-break-inside:avoid!important;display:block!important;margin:0 0 3.5mm!important;padding:0!important;}
 #paper[data-doc="asesmen"] .t38-question-group .doc-block{margin:0!important;padding:0!important;border:0!important;min-height:0!important;break-inside:avoid!important;}
 #paper[data-doc="asesmen"] .t38-question-group .doc-block h3{font-size:10pt!important;line-height:1.2!important;padding:3pt 6pt!important;margin:3pt 0 3pt!important;}
 #paper[data-doc="asesmen"] .t38-question-group .doc-block p{font-size:10pt!important;line-height:1.25!important;margin:0 0 2.5pt!important;min-height:0!important;}
 #paper[data-doc="asesmen"] .doc-header{margin-bottom:7pt!important;padding-bottom:6pt!important;}
 #paper[data-doc="asesmen"] .doc-id{margin-bottom:6pt!important;padding:7pt!important;}
 #paper[data-doc="asesmen"] .preview-flag{margin:4pt 0!important;}
}
