/* Shared frontend corrections remain behind the reference-design flag. */
:root:has(body.medvise-reference-typography),body.medvise-reference-typography{min-width:0!important}
:root body.medvise-reference-typography :is(input,textarea)::placeholder{color:#68717e!important;opacity:1}
:root body.medvise-reference-workspace #med-openvladas-app :is(input,textarea)::placeholder{color:var(--mc-muted)!important}
body.medvise-reference-design .reference-legal :is(h1,h2,h3){overflow-wrap:anywhere}
body.medvise-reference-typography .hdr>.wrap{grid-template-columns:auto minmax(0,1fr) auto;height:auto;min-height:76px;padding-top:12px;padding-bottom:12px}
body.medvise-reference-typography .hdr .nav{min-width:0;justify-content:center;flex-wrap:wrap;gap:8px 24px}
body.medvise-reference-typography .hdr .nav a{white-space:normal;overflow-wrap:anywhere;line-height:1.4}
body.medvise-reference-typography .hdr-right{min-width:0;flex-wrap:wrap;justify-content:flex-end}
body.medvise-reference-workspace #header.hdr{height:auto}
body.medvise-reference-workspace #header.hdr .wrap{height:auto;min-height:76px;padding-top:12px;padding-bottom:12px}
body.medvise-reference-design :is(.btn,.mnav-acts a){height:auto;min-height:46px;padding-top:10px;padding-bottom:10px;white-space:normal;overflow-wrap:anywhere;text-align:center;line-height:1.4}
body.medvise-reference-design .btn-sm{min-height:38px}
body.medvise-reference-design .medvise-ohlp-viewer.medvise-ohlp-viewer-text-mode.medvise-ohlp-mobile-ready .medvise-ohlp-mobile-toolbar{top:var(--reference-reader-toolbar-top,132px)}
body.medvise-reference-design .medvise-ohlp-viewer-text-mode .medvise-ohlp-text-reader :is([data-text-target],[data-reference-toc-target]){scroll-margin-top:var(--reference-reader-anchor-top,240px)}

/* WordPress reserves its toolbar with an HTML margin, outside the app height. */
:root:has(body.medvise-reference-workspace.admin-bar){height:calc(100% - 32px)!important}
@media(max-width:782px){:root:has(body.medvise-reference-workspace.admin-bar){height:calc(100% - 46px)!important}}

@media(max-width:1100px){
 body.medvise-reference-typography .hdr>.wrap{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px}
 body.medvise-reference-typography .hdr :is(.nav,.hdr-right){display:none}
 body.medvise-reference-typography .hdr .menu-btn{display:inline-flex}
 :root body.medvise-reference-typography :is(button,summary,select,input[type=submit],input[type=button],[role=button],[role=tab],.btn,.button,.woocommerce-button,.elementor-button,a.med-chat-icon):not(:where(#wpadminbar,#wpadminbar *)){min-width:44px!important;min-height:44px!important}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-welcome:not([hidden]){display:none!important}
}
@media(max-width:1250px){
 body.medvise-reference-workspace .med-chat-tools .mvfb-trigger{width:44px;min-width:44px;padding:10px}
 body.medvise-reference-workspace .med-chat-tools .mvfb-trigger-label{display:none}
}
@media(min-width:761px) and (max-width:960px){
 body.medvise-reference-workspace #med-openvladas-app .med-chat-mode-nav{grid-template-columns:repeat(4,minmax(0,1fr))}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-mode-nav button:nth-child(n){grid-column:span 2!important}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-mode-nav button:last-child{grid-column:span 4!important}
}
body.medvise-reference-workspace #med-openvladas-app .med-chat-mode-nav :is(.design-mode-copy,.med-chat-mode-label,.med-chat-mode-label span){min-width:0;overflow-wrap:anywhere;word-break:normal}
@media(max-width:360px){
 body.medvise-reference-workspace #med-openvladas-app .med-chat-topbar{display:grid;grid-template-columns:44px minmax(0,1fr)}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-menu{grid-column:1;grid-row:1}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-heading{grid-column:2;grid-row:1}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-tools{grid-column:1/-1;justify-content:flex-end}
 :root body.medvise-reference-typography.medvise-article #main [role=heading]{font-size:20px!important;line-height:1.35;word-break:normal;overflow-wrap:anywhere}
}

/* A short viewport or keyboard needs one scroll flow, with no composer overlay. */
body.medvise-reference-workspace #med-openvladas-app[data-reference-compact-height=true] .med-chat-topbar{position:static}
body.medvise-reference-workspace #med-openvladas-app[data-reference-compact-height=true] .med-chat-compose-area{position:static}
body.medvise-reference-workspace #med-openvladas-app[data-reference-compact-height=true] :is(.med-chat-flow,.med-chat-workspace,.med-chat-conversation,.med-chat-scroll){flex:0 0 auto;min-height:auto}
body.medvise-reference-workspace #med-openvladas-app[data-reference-compact-height=true] .med-chat-welcome:not([hidden]){display:none!important}
@media(max-height:600px),(max-width:360px){
 body.medvise-reference-workspace #med-openvladas-app .med-chat-topbar{position:static}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-compose-area{position:static}
 body.medvise-reference-workspace #med-openvladas-app :is(.med-chat-flow,.med-chat-workspace,.med-chat-conversation,.med-chat-scroll){flex:0 0 auto;min-height:auto}
 body.medvise-reference-workspace #med-openvladas-app .med-chat-welcome:not([hidden]){display:none!important}
}
