/* Ajustes de pantalla; los formularios impresos mantienen sus medidas de papel. */
@media screen{
  body{overflow-wrap:break-word}
  .district-page main,.district-page .card,.district-page .grid>*,.portal-grid>*,.portal-about>*,.login-shell{min-width:0}
  .district-page .grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .district-page .table-wrap{max-width:100%;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
  .district-sidebar{overflow-y:auto;overscroll-behavior:contain;max-height:calc(100dvh - 50px)}
  .district-page textarea{max-width:100%}
  .district-page fieldset{min-width:0;max-width:100%;border:1px solid #d3dee6;padding:14px;margin:12px 0}
  .district-page legend{max-width:100%;white-space:normal}
  .district-page .actions{flex-wrap:wrap}
  .portal-header{width:100%}
  .portal-brand>span{min-width:0}
  .portal-article-image{height:auto}
  .portal-card-meta{flex-wrap:wrap}
  .portal-article-text,.portal-article h1,.portal-card h3{overflow-wrap:anywhere}
  .carousel-controls>button,.carousel-dots button{min-width:36px;min-height:44px}
  .carousel-dots{gap:0}
  .portal-menu-toggle{display:none}
  .preview-scroll,.md-paper-scroll{max-width:100%;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .saved-record strong{overflow-wrap:anywhere}
  .login-page{min-height:100svh}
  @media(max-width:1150px) and (min-width:851px){
    .district-page .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .district-page .new-form-page .student-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  }
  @media(max-width:850px){
    .district-page .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .district-page .button{min-height:44px;white-space:normal}
    .district-page input:not([type=checkbox]):not([type=hidden]),.district-page select,.district-page textarea{font-size:16px;min-height:44px}
    .district-page .history-editor input{min-height:40px}
    .district-page .account-row summary{overflow-wrap:anywhere}
    .district-page h1{overflow-wrap:anywhere}
    .saved-toolbar .button{min-height:44px}
    .portal-button,.portal-filters a,.portal-read,.portal-back,.portal-pagination a{min-height:44px;display:inline-flex;align-items:center}
    .portal-filters{gap:5px 15px}
    .portal-header{position:relative;display:flex;flex-flow:row wrap;align-items:center;justify-content:space-between;padding:14px 20px;gap:12px}
    .portal-brand{font-size:17px;justify-content:flex-start;flex-shrink:1}
    .portal-brand img{width:52px;height:52px;flex-shrink:0}
    .portal-brand small{font-size:9px}
    .portal-nav-ready .portal-menu-toggle{display:inline-flex;gap:7px;align-items:center;justify-content:center;min-width:44px;min-height:44px;border:1px solid #cddbd0;border-radius:5px;color:#07552e;background:#fff;font:13px Arial;cursor:pointer}
    .portal-menu-toggle svg{width:20px;height:20px}
    .portal-header nav{flex:0 0 100%;align-items:stretch;justify-content:flex-start;gap:0;font-size:14px}
    .portal-nav-ready .portal-header nav{display:none}
    .portal-nav-ready .portal-header nav.is-open{display:flex;flex-direction:column;border-top:1px solid #e4ebe2;padding-top:8px}
    .portal-header nav>a{padding:12px;min-height:44px;border-radius:4px}
    .portal-header nav .portal-login{margin-top:6px;text-align:center;padding:12px 18px}
    .carousel-content{padding:22px 22px 85px}
    .carousel-image{height:clamp(220px,48vw,380px)}
    .carousel-bottom{bottom:15px;right:20px;left:20px;display:flex;justify-content:center}
    .carousel-controls{gap:5px;max-width:100%;flex-wrap:wrap;justify-content:center}
    .carousel-controls>span{display:none}
    .portal-about{grid-template-columns:1fr}
  }
  @media(max-width:600px){
    .district-page .grid{grid-template-columns:1fr}
    .district-page .wide{grid-column:auto}
    .district-page .actions{align-items:stretch;flex-direction:column}
    .district-page .account-nav{align-items:stretch}
    .district-page .card .grid{gap:16px}
    .md-hero .button{width:100%}
    .md-form-actions{display:flex;flex-direction:column}
    .portal-grid{grid-template-columns:1fr}
    .portal-footer>div{width:100%}
    .portal-section-heading h2{font-size:25px}
    .portal-header{padding:12px 14px}
    .portal-article h1{font-size:26px}
    .carousel-content h1,.carousel-content h2{font-size:24px}
    .login-shell{max-width:440px}
    .saved-toolbar{margin:12px 10px;grid-template-columns:repeat(2,minmax(0,1fr))}
    .saved-toolbar .button{min-width:0;overflow-wrap:anywhere}
    .saved-toolbar #md-print{grid-column:1/-1}
  }
  @media(max-width:360px){
    .portal-brand{font-size:14px;gap:8px}.portal-brand img{width:44px;height:44px}.portal-brand small{font-size:8px}.portal-menu-toggle span{display:none}
    .carousel-controls{gap:2px}.carousel-controls>button,.carousel-dots button{min-width:30px}
    .district-session{display:none}.district-page .form-actions .action-buttons{grid-template-columns:1fr}
  }
}
