/* C013/A: narrow-screen overrides, scoped to the existing product. */
:root{--visual-height:100dvh}
.mobile-photo-preview{display:block;max-width:100%;max-height:45dvh;object-fit:contain;margin:12px auto}
.mobile-pair-qr{display:block;width:min(100%,294px);height:auto;aspect-ratio:1;margin:12px auto}
.mobile-pair-qr[hidden]{display:none}
#mobile-offline{position:fixed;inset:0;z-index:100000;padding:24px;background:var(--bg,#f4f5ef);overflow:auto}
#mobile-offline[hidden]{display:none}
.supreme-offline #app,.supreme-offline #modal-root,.supreme-offline #access-gate,.supreme-offline #toast,.supreme-offline [data-audio-session-banner]{visibility:hidden!important;pointer-events:none!important}
@media screen and (max-width:850px){
 *,*::before,*::after{box-sizing:border-box}
 .workspace,.page,.page>*,.bench,.panel,.panel-body,.card,.grid>*,.field,.actions,.page-header>*,.encounter-head>*,.between>*{min-width:0}
 .page,.panel,.card,.field,.bench{max-width:100%}
 .page,.modal{overflow-wrap:anywhere}
 .actions,.between,.page-header,.document-toolbar,.doc-footer,.section-top,.toolbar,.encounter-meta,.panel-header{flex-wrap:wrap}
 .page-header{gap:12px}
 .page-header>.actions,.document-toolbar>.actions{max-width:100%}
 button,.btn,a[href],input:not([type=hidden]),select,textarea,summary,[role=button],[tabindex="0"]{min-width:44px!important;min-height:44px!important}
 a[href]{display:inline-flex;align-items:center}
 button.icon,.btn.icon,.icon.small,.icon.quiet,.small.icon{width:44px;height:44px;flex-shrink:0}
 button,.btn,select{max-width:100%;white-space:normal;overflow-wrap:anywhere}
 input:not([type=checkbox]):not([type=radio]),textarea,select{max-width:100%;font-size:16px}
 input[type=checkbox],input[type=radio]{width:44px;height:44px;vertical-align:middle;flex:0 0 44px}
 .field>span{max-width:100%}
 .panel-header{height:auto;min-height:54px;gap:8px}
 .document-toolbar{height:auto;gap:6px;padding:8px}
 .document-toolbar .doc-select{flex:1 1 150px;width:100%;max-width:100%}
 .document-editor{max-width:100%;overflow-wrap:anywhere;white-space:pre-wrap}
 .modal-backdrop{align-items:flex-start;padding:8px;max-height:var(--visual-height);overflow:auto}
 .modal,.modal.wide{width:100%;max-width:100%;max-height:calc(var(--visual-height) - 16px);display:flex;flex-direction:column}
 #modal-form{min-height:0;display:flex;flex-direction:column;overflow:auto}
 .modal-body{min-height:0;overflow:auto;padding:16px}
 .modal-header,.modal-footer{flex-shrink:0;padding:12px;gap:8px}
 .modal-header h2{min-width:0}
 .modal-footer button{flex-shrink:0}
 .sidebar{max-height:var(--visual-height);overflow:auto}
 .sidebar:not(.open){visibility:hidden}
 .sidebar.open{visibility:visible}
 table{table-layout:fixed;width:100%}
 td,th{overflow-wrap:anywhere}
 .table-wrap,.calendar-wrap,.measurement-table-scroll{max-width:100%;overflow:auto}
 .mobile-active-composer{position:fixed!important;left:8px!important;right:8px!important;top:var(--composer-top,8px)!important;bottom:auto!important;z-index:500;background:var(--bg,#f4f5ef);max-height:calc(var(--visual-height) - 16px);overflow:auto;border:1px solid var(--line,#ccc);border-radius:8px}
 .mobile-active-composer textarea{min-height:60px!important;max-height:90px}
 body.mobile-keyboard .document-editor:focus{min-height:80px!important;max-height:calc(var(--visual-height) - 88px)!important;overflow:auto;scroll-margin:8px}
 .chat-compose .actions{gap:8px;flex-wrap:wrap}
 .messages{overflow-wrap:anywhere}
 .messages pre{white-space:pre-wrap;overflow-wrap:anywhere}
 .source-card,.prose,.message,.modal-body code{overflow-wrap:anywhere}
 [data-audio-session-banner]{max-width:calc(100vw - 16px);white-space:normal}
}
@media screen and (max-width:520px){
 .notice{flex-wrap:wrap}.notice>strong,.notice>p{flex:1 1 100%;min-width:0}
 .table-wrap>table{min-width:600px;table-layout:auto}
 .page{padding:16px 12px}
 .page-header{align-items:flex-start;flex-direction:column}
 .bench-mobile-tabs{flex-wrap:wrap}
 .bench-mobile-tabs button{flex:1 1 80px;min-height:44px}
 .top-actions{justify-content:flex-start}
 .stats,.grid.four{grid-template-columns:repeat(2,minmax(0,1fr))}
 .encounter-head .actions{width:100%}
 .source-panel .panel-body,.document-panel .panel-body,.assistant-panel .panel-body{padding:12px}
}
@media screen and (max-width:850px){
 .mobile-active-composer .actions>button:not([data-action="send-message"]),.mobile-active-composer .actions>.caption{display:none}
}
#mobile-update{position:fixed;z-index:1000;bottom:1rem;left:50%;transform:translateX(-50%);max-width:calc(100vw - 2rem);padding:.5rem;border-radius:.75rem;background:#173c56;box-shadow:0 4px 18px #0005}
#mobile-update button{color:white;background:transparent;border:0;padding:.5rem 1rem;cursor:pointer;font:inherit}

.camera-context-preview{display:block;width:100%;max-height:180px;object-fit:contain;margin:8px 0}
