/* Screen-only adaptations. Original PDF templates and print styles stay intact. */
@media screen {
 .pet-main,.pet-popup-main,.portal-main,.card,.card-body,.row>[class*="col"],fieldset{min-width:0}
 .pet-main img,.portal-main img{max-width:100%}
 .pet-main :is(h1,h2,h3,p,legend,.alert,.card-header),.portal-main :is(h1,h2,h3,p,.alert,.card-header){overflow-wrap:anywhere}
 .pet-mobile-sort,.report-mobile-note{display:none}
}
@media screen and (max-width:1100px){
 body.ap-admin{--pet-nav-height:64px}
 body.ap-admin .navbar.fixed-top{height:var(--pet-nav-height);padding:6px 0}
 body.ap-admin .navbar>.container-fluid{flex-wrap:nowrap;gap:8px;padding:0 12px;min-width:0}
 body.ap-admin .navbar .ap-mega-nav,body.ap-admin .navbar .pet-nav-quick,body.ap-admin .navbar .pet-nav-password,body.ap-admin .navbar .app-user-chip{display:none!important}
 body.ap-admin .navbar .navbar-brand{display:flex;align-items:center;gap:6px;min-width:0;margin-right:auto;font-size:16px}
 body.ap-admin .navbar .navbar-brand img{width:28px;height:28px;object-fit:contain}
 body.ap-admin .navbar .btn{min-height:44px!important;min-width:44px;padding:8px 12px;font-size:14px}
 body.ap-admin .navbar .ms-auto{margin-left:0!important;flex-shrink:0}
 body.ap-admin .pet-workbar{margin-top:var(--pet-nav-height)}
 .pet-sidebar-account{overflow-wrap:anywhere}
 #sidebarMenu{--bs-offcanvas-width:min(360px,92vw)}
 #sidebarMenu .offcanvas-body{padding-bottom:max(24px,env(safe-area-inset-bottom))}
 #sidebarMenu :is(.nav-link,.btn){min-height:44px;display:flex;align-items:center}
}
@media screen and (max-width:767px){
 .pet-main{padding-top:16px}
 body.ap-admin .pet-main>.container-fluid,.pet-main .container-fluid{padding-left:12px!important;padding-right:12px!important}
 .page-heading{gap:8px;flex-wrap:wrap;margin-bottom:16px}
 .page-heading h1{font-size:22px;line-height:1.25}
 .page-heading>span{font-size:12px}
 .ap-layout .ap-work-tabs{padding:6px 12px 0;max-width:100%;overscroll-behavior-x:contain;scrollbar-width:thin}
 .ap-work-tabs :is(a,span){flex-shrink:0}
 .pet-cards,.portal-pets{grid-template-columns:minmax(0,1fr)}
 .pet-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .pet-stats .card-body{min-height:96px}
 .pet-stats .pet-stat{font-size:26px}
 .pet-detail-grid{grid-template-columns:minmax(0,1fr);gap:16px}
 .ap-layout .card-body{padding:14px}
 .ap-layout .card-header{padding:12px 14px;gap:10px;flex-wrap:wrap}
 .pet-fieldset{padding:12px;margin-bottom:14px}
 .pet-fieldset legend{font-size:15px;max-width:100%}
 :is(.ap-layout,.pet-login) :is(.form-control,.form-select){font-size:16px;min-height:44px;max-width:100%}
 :is(.ap-layout,.pet-login) textarea.form-control{min-height:110px}
 .ap-layout :is(.btn,.btn-sm),.pet-login .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;white-space:normal;line-height:1.3;font-size:14px;padding:10px 12px}
 .ap-layout .form-check-input{width:22px;height:22px;flex-shrink:0}
 .ap-layout .form-check-label{padding:3px 0 3px 5px}
 .ap-layout .form-switch .form-check-input{width:42px;height:24px}
 .pet-actions,.portal-actions{gap:8px;align-items:stretch}
 .pet-actions>:is(a,button),.portal-actions>:is(a,button){flex:1 1 140px}
 .pet-actions form{display:flex;flex:1 1 140px}.pet-actions form .btn{width:100%}
 .pet-form-actions{flex-wrap:wrap;gap:8px;padding-bottom:max(12px,env(safe-area-inset-bottom));scroll-margin-bottom:16px}
 .pet-form-actions>:is(a,button){flex:1 1 130px}
 .pet-patient-strip{align-items:flex-start;flex-wrap:wrap;gap:12px}
 .pet-patient-strip>div{min-width:0;flex:1 1 180px;overflow-wrap:anywhere}
 .pet-patient-strip h2{font-size:21px}
 .pet-page{gap:12px;flex-wrap:wrap}
 .pet-record-tabs a{min-height:44px;display:flex;align-items:center}
 .pet-login{min-height:100dvh;grid-template-columns:minmax(0,1fr)}
 .pet-login-panel{padding:20px 12px;min-width:0}
 .pet-login-card{padding:22px 18px;max-width:100%}
 .pet-login h1{font-size:25px}
 .portal-header .container{gap:12px!important}
 .portal-header .container>div{justify-content:flex-start;min-width:0}
 .portal-header .container>div>span{flex-basis:100%;overflow-wrap:anywhere}
 .portal-header .btn{min-height:44px}
 .portal-main{padding:18px 12px 28px;max-width:100%}
 .portal-main h1{font-size:22px;margin-bottom:18px;line-height:1.25}
 .portal-patient-option{gap:12px;min-width:0}
 .portal-patient-option>span{min-width:0;overflow-wrap:anywhere}
 .pet-mobile-sort{display:flex;align-items:center;gap:8px;margin:10px 12px;flex-wrap:wrap;font-size:13px}
 .pet-mobile-sort select{flex:1 1 150px;width:auto}
 .pet-mobile-cards{display:block;width:100%!important;max-width:100%;border:0;table-layout:auto}
 .pet-mobile-cards>thead{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important}
 .pet-mobile-cards>tbody{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:10px}
 .pet-mobile-cards>tbody>tr{display:block;min-width:0;border:1px solid #cdd3d4;border-radius:6px;overflow:hidden;background:#f8fafa}
 .pet-mobile-cards>tbody>tr>:is(td,th){display:block;width:auto!important;max-width:none!important;padding:10px 12px!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere;border-bottom:1px solid #dce3e4!important;box-shadow:none!important;background:transparent!important}
 .pet-mobile-cards>tbody>tr>:last-child{border-bottom:0!important}
 .pet-mobile-cards td[data-label]::before{content:attr(data-label);display:block;font-size:12px;font-weight:700;color:#51605f;margin-bottom:5px;line-height:1.3}
 .pet-mobile-cards .pet-mobile-full::before{display:none}
 .pet-mobile-cards td.actions .btn,.pet-mobile-cards td .btn{margin:3px 4px 3px 0;max-width:100%}
 .pet-mobile-cards td:has(.form-check-input){min-height:48px}
 .pet-mobile-exam-table{display:block;width:100%;margin:0}
 .pet-mobile-exam-table>thead{display:none}
 .pet-mobile-exam-table>tbody{display:block;width:100%}
 .pet-mobile-exam-table>tbody>tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;padding:12px 0;border-bottom:1px solid #cdd3d4}
 .pet-mobile-exam-table>tbody>tr>th{grid-column:1/-1}
 .pet-mobile-exam-table>tbody>tr>:is(td,th){min-width:0;padding:0!important;border:0!important;max-width:none!important;overflow-wrap:anywhere}
 .pet-mobile-exam-table td[data-label]::before{content:attr(data-label);display:block;font-size:12px;color:#51605f;margin-bottom:5px;font-weight:600}
 .pet-mobile-exam-table :is(input,small){max-width:100%}
 .pet-form-modal .modal-content{height:var(--pet-viewport-height,100dvh);max-height:var(--pet-viewport-height,100dvh)}
 .pet-form-modal .modal-header{padding:10px 12px!important;gap:8px;flex-shrink:0}
 .pet-form-modal .modal-title{min-width:0;overflow-wrap:anywhere;font-size:16px!important;line-height:1.3}
 .pet-form-modal .btn-close{flex-shrink:0;min-width:24px;min-height:24px;padding:10px;box-sizing:content-box;margin:0}
 .pet-form-modal .pet-popup-content{height:calc(var(--pet-viewport-height,100dvh) - var(--pet-popup-header-height,64px))!important}
 .pet-popup-frame .pet-popup-main{padding-top:12px}
 .pet-popup-frame .pet-fieldset .row{--bs-gutter-x:16px}
 .rx-item .d-flex{gap:12px;flex-wrap:wrap}
 .rx-item legend{width:auto;flex:1 1 130px}
 .pet-tv header{padding:14px 16px;gap:8px 14px}
 .pet-tv header span{font-size:16px}.pet-tv header time{font-size:23px}
 .pet-tv main{padding:12px;gap:16px}
 .pet-tv .tv-current{padding:12px}.pet-tv h1{font-size:clamp(32px,10vw,58px)}
 .pet-tv #tvTutor{font-size:24px}.pet-tv #tvRoom{font-size:28px;padding:16px}
 .pet-tv footer{padding:12px}.pet-tv footer>div{flex-wrap:wrap}
 .pet-report-viewer{height:100dvh;min-width:0;overflow-x:hidden}
 .pet-report-viewer .toolbar{gap:8px;padding:10px;flex-shrink:0;min-width:0}
 .pet-report-viewer .toolbar a{flex:1 1 135px;min-height:44px;box-sizing:border-box;text-align:center;display:flex;align-items:center;justify-content:center;white-space:normal}
 .pet-report-viewer .report-title{order:-1;flex-basis:100%;font-weight:bold;overflow-wrap:anywhere}
 .pet-report-viewer .report-help{display:none}
 .pet-report-viewer iframe{min-height:0;flex:1 1 auto;max-width:100%}
 .pet-report-viewer #exam-auto-print{font-size:13px;overflow-wrap:anywhere}
}

@media screen and (max-width:767px),screen and (max-width:1100px) and (pointer:coarse){
 .pet-report-viewer iframe{display:none}
 .pet-report-viewer .report-mobile-note{display:flex;flex:1;align-items:center;justify-content:center;padding:24px 16px;background:#e9eded;min-height:230px}
 .report-mobile-note>div{max-width:420px;background:#fff;border:1px solid #cdd3d4;border-radius:7px;padding:24px;color:#303638;text-align:center}
 .report-mobile-note h1{font-size:21px;margin:0 0 16px;line-height:1.3}
 .report-mobile-note p{font-size:15px;line-height:1.5}
 .report-mobile-note a{display:flex;min-height:48px;align-items:center;justify-content:center;background:#008f91;color:#fff;text-decoration:none;border-radius:5px;margin:18px 0}
 .report-mobile-note .report-mobile-detail{font-size:12px;color:#667275;margin-bottom:0}
}
