/* Physical-touch mobile layout repair.
   Covers Android Chrome desktop-site mode, where CSS viewport can exceed the
   handset width and ordinary max-width:760px rules do not run. */
@media (hover:none) and (pointer:coarse) and (min-width:601px) and (max-width:1100px) {
  html body.app-page.page-app #appMain { min-width:0!important; width:100%!important; max-width:100%!important; }
  html body.app-page.page-app #appMain > .topbar {
    display:flex!important; flex-direction:column!important; align-items:stretch!important;
    width:100%!important; max-width:100%!important; min-width:0!important;
    height:auto!important; min-height:0!important; padding:14px!important; gap:12px!important;
    overflow:visible!important; box-sizing:border-box!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-title,
  html body.app-page.page-app #appMain > .topbar > .topbar-actions {
    display:flex!important; flex:1 1 auto!important; flex-direction:row!important;
    flex-wrap:wrap!important; align-items:center!important; justify-content:flex-start!important;
    width:100%!important; max-width:100%!important; min-width:0!important; gap:8px!important;
    overflow:visible!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-title { align-items:flex-start!important; }
  html body.app-page.page-app #appMain > .topbar > .topbar-title .academic-kicker,
  html body.app-page.page-app #appMain > .topbar > .topbar-title #page-title,
  html body.app-page.page-app #appMain > .topbar > .topbar-title .school-identity {
    flex:1 1 100%!important; width:100%!important; max-width:100%!important;
    min-width:0!important; white-space:normal!important; overflow-wrap:anywhere!important;
  }
  html body.app-page.page-app #appMain > .topbar > .topbar-actions > *,
  html body.app-page.page-app #appMain > .topbar > .topbar-title > * {
    max-width:100%!important; min-width:0!important; box-sizing:border-box!important;
  }

  /* The hero image/identity panel was retaining desktop absolute positioning,
     covering the welcome copy on narrow physical screens. */
  html body.app-page.page-app #appMain > #dashboard > .campus-hero {
    display:grid!important; position:relative!important; grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto auto!important; align-items:stretch!important;
    width:100%!important; min-width:0!important; min-height:0!important; height:auto!important;
    padding:16px!important; gap:14px!important; overflow:hidden!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .campus-hero > div:first-child {
    display:block!important; position:relative!important; inset:auto!important; order:0!important;
    width:100%!important; max-width:100%!important; min-width:0!important; height:auto!important;
    min-height:0!important; margin:0!important; padding:0!important; z-index:1!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .campus-hero .campus-visual {
    display:flex!important; position:relative!important; inset:auto!important; order:1!important;
    grid-column:1!important; grid-row:2!important; flex-direction:column!important;
    align-items:center!important; justify-content:center!important; text-align:center!important;
    width:100%!important; max-width:100%!important; min-width:0!important;
    min-height:150px!important; height:auto!important; max-height:220px!important;
    margin:0!important; padding:16px!important; transform:none!important;
    overflow:hidden!important; box-sizing:border-box!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .campus-hero .campus-visual :is(img,.campus-icon) {
    position:relative!important; inset:auto!important; width:auto!important; max-width:88px!important;
    height:auto!important; max-height:88px!important; margin:0 auto 8px!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .campus-hero .campus-visual :is(strong,span) {
    display:block!important; position:relative!important; width:100%!important; max-width:100%!important;
    white-space:normal!important; overflow-wrap:anywhere!important; text-align:center!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .cards {
    display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:100%!important; min-width:0!important; gap:10px!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .cards > .card.stat {
    display:flex!important; flex-direction:column!important; align-items:flex-start!important;
    min-width:0!important; min-height:108px!important; height:auto!important; padding:12px!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .cards > .card.stat > span {
    display:block!important; width:100%!important; font-size:13px!important;
    line-height:1.35!important; white-space:normal!important; overflow-wrap:anywhere!important;
  }
  html body.app-page.page-app #appMain > #dashboard > .grid-2 { grid-template-columns:minmax(0,1fr)!important; }

  /* Login/role selection stays legible in Android desktop-site mode. */
  html body.auth-page.page-login #authCard,
  html body.auth-page.page-login .main > .card {
    width:100%!important; max-width:520px!important; min-width:0!important;
    margin-left:auto!important; margin-right:auto!important; box-sizing:border-box!important;
  }
  html body.auth-page.page-login :is(h1,h2,.eyebrow,.subtitle,label,.help,.role-guidance) {
    font-size:clamp(13px,3.5vw,17px)!important; line-height:1.4!important;
  }
  html body.auth-page.page-login .roles { display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:10px!important; }
  html body.auth-page.page-login .role { min-width:0!important; min-height:104px!important; padding:12px!important; }
  html body.auth-page.page-login .role :is(strong,small) { font-size:13px!important; line-height:1.35!important; white-space:normal!important; }
  html body.auth-page.page-login :is(input,select,textarea) { min-height:46px!important; font-size:16px!important; }

  /* Keep the public navigation and feature tiles usable without desktop scaling. */
  html body.page-home :is(.home-nav,.site-header,header) { flex-wrap:wrap!important; gap:7px!important; }
  html body.page-home :is(.home-nav,.site-header,header) :is(a,button) { min-height:38px!important; font-size:12px!important; }
  html body.page-home :is(.home-feature-grid,.home-tools-grid) { grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:9px!important; }
}
@media (hover:none) and (pointer:coarse) and (max-width:390px) {
  html body.auth-page.page-login .roles,
  html body.page-home :is(.home-feature-grid,.home-tools-grid) { grid-template-columns:minmax(0,1fr)!important; }
  html body.app-page.page-app #appMain > #dashboard > .cards { gap:7px!important; }
}
