/* ESEM Campus · ajuste estructural responsive UI4.
   Esta capa sólo corrige composición, desbordes y ergonomía táctil. */

:where(.campus-stage,.campus-stage main,.shell,.future-shell,.page-shell,.agenda-workspace){min-width:0;max-width:100%}
:where(.future-student-grid,.future-lower-grid,.future-course-layout,.future-course-main,.future-course-rail,.future-course-grid,.teacher-grid,.future-secondary-grid,.academic-admin-layout,.academic-course-directory,.academic-create-card,.coursework-layout,.coursework-main-column,.material-actions-grid,.materials-library,.global-lower-grid,.invite-admin-layout,.communications-admin-layout,.academic-settings-grid,.academic-people-grid)>*{min-width:0;max-width:100%}
:where(h1,h2,h3,h4,p,b,strong,small,span,label,legend,dd,dt){overflow-wrap:break-word}
:where(img,video,canvas,svg,iframe,embed,object){max-width:100%}
:where(button,.primary,.secondary,.ghost,.ghost-link,.manage-link,.meet-cta,summary){min-width:0;max-width:100%;white-space:normal}
:where(input,select,textarea){max-width:100%}
.future-campus-page main{overflow-x:clip}
.responsive-data-scroll,.invite-table-wrap,.audit-table-wrap,.coursework-table-wrap{max-width:100%;overscroll-behavior-inline:contain}

/* El ancho real disponible lo determina el shell, no el viewport completo. */
.academic-admin-shell{container-name:academic-page;container-type:inline-size}
.academic-admin-layout{grid-template-columns:minmax(0,1fr) minmax(320px,360px)}
.academic-course-directory,.academic-create-card{min-width:0;max-width:100%}
.academic-course-list{min-width:0;overflow:hidden}
.academic-course-row{grid-template-columns:minmax(88px,.55fr) minmax(180px,1.55fr) minmax(170px,.8fr) minmax(132px,.65fr);gap:clamp(10px,1.25vw,20px);min-width:0}
.academic-course-row>*{min-width:0;max-width:100%}
.academic-course-copy :where(small,h3,p){max-width:100%;overflow:hidden;text-overflow:ellipsis}
.academic-course-actions{min-width:0;max-width:100%}
.academic-course-actions a{width:100%;overflow-wrap:normal}
.academic-admin-hero aside{color:#173f4d;border-color:#d5e4e5;background:rgba(255,255,255,.72);backdrop-filter:none}
.academic-admin-hero aside span{color:#167778}
.academic-admin-hero aside small{color:#5f747b}
.future-course-hero.themed-course-hero .future-hero-pills span{color:#eefbfc;border-color:rgba(255,255,255,.2);background:rgba(255,255,255,.12)}
.future-course-hero.themed-course-hero .course-identity-grid>span{border-color:rgba(255,255,255,.18);background:rgba(255,255,255,.1)}
.future-course-hero.themed-course-hero .course-identity-grid :where(small,b){color:#f3fcfc}
.future-course-hero.themed-course-hero .course-real-progress{border-color:rgba(255,255,255,.2);background:rgba(255,255,255,.11)}
.future-course-hero.themed-course-hero .course-real-progress :where(span,b,small){color:#f3fcfc}
.future-course-hero.themed-course-hero .course-real-progress>div{background:rgba(255,255,255,.35)}

@container academic-page (max-width:1200px){
  .academic-admin-layout{grid-template-columns:minmax(0,1fr)}
  .academic-create-card{position:static;top:auto}
  .academic-course-row{grid-template-columns:minmax(90px,.5fr) minmax(0,1.5fr) minmax(170px,.75fr) minmax(132px,.6fr)}
}

@container academic-page (max-width:880px){
  .academic-course-row{grid-template-columns:minmax(86px,.4fr) minmax(0,1fr) minmax(132px,.5fr)}
  .academic-course-stats{display:none}
}

@container academic-page (max-width:620px){
  .academic-course-row{grid-template-columns:minmax(0,1fr);gap:10px;padding:17px}
  .academic-course-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  .academic-course-actions{grid-template-columns:minmax(0,1fr);justify-items:stretch;text-align:left}
  .academic-course-actions .account-state{justify-self:start}
  .academic-course-copy :where(small,h3,p){overflow:visible;text-overflow:clip}
}

@media(max-width:1280px){
  .future-campus-page :where(.future-section-head,.global-section-head,.invite-section-head,.user-directory-head,.coursework-panel>header,.drive-folder-preview>header){align-items:flex-start;flex-wrap:wrap}
  .material-actions-grid,.coursework-layout{grid-template-columns:minmax(0,1fr)}
  .coursework-create-card{position:static}
}

@media(max-width:860px){
  body{max-width:100%;overflow-x:hidden}
  .campus-stage{width:100%;overflow-x:hidden}
  .campus-mobile-header{min-height:64px;height:auto;padding-top:max(5px,var(--safe-area-top));padding-bottom:5px}
  .mobile-nav-drawer{width:min(88vw,352px)}
  .mobile-nav-links a{min-height:52px}
  .mobile-nav-account>a,.mobile-nav-account .ghost{min-height:48px}

  .future-campus-page :where(.shell,.future-shell,.page-shell,.academic-admin-shell,.academic-course-shell,.users-admin-shell,.global-command-shell,.communications-shell,.coursework-shell,.activity-shell,.materials-page){width:100%;padding-right:max(14px,var(--safe-area-right));padding-left:max(14px,var(--safe-area-left))}
  .future-campus-page :where(.ds-page-header,.future-welcome-strip,.future-hero,.future-course-hero,.academic-admin-hero,.academic-course-hero,.materials-hero){padding:20px 18px;border-radius:20px}
  .future-campus-page :where(.ds-page-header h1,.future-welcome-strip h1,.future-hero h1,.future-course-hero h1,.academic-admin-hero h1,.academic-course-hero h1,.materials-hero h1){font-size:clamp(27px,8vw,34px);line-height:1.08}
  .future-campus-page :where(.ds-page-actions,.future-action-row,.teacher-card-actions,.academic-hero-actions,.upload-actions,.row-actions,.agenda-dialog-actions){display:grid;grid-template-columns:minmax(0,1fr);width:100%;gap:9px}
  .future-campus-page :where(.ds-page-actions,.future-action-row,.teacher-card-actions,.academic-hero-actions,.upload-actions,.row-actions,.agenda-dialog-actions)>*{width:100%;min-height:46px}

  .future-student-grid{gap:12px}
  .future-focus-card{padding:20px}
  .future-focus-card h2{font-size:clamp(25px,7vw,32px)}
  .future-student-side{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .future-stat-card{min-height:0;padding:13px 9px}
  .future-stat-card b{font-size:22px}
  .future-course-card,.teacher-card,.future-info-card,.future-rail-card,.future-module-card{padding:17px}
  .future-course-meta{grid-template-columns:minmax(0,1fr);gap:5px}
  .future-right-rail{grid-template-columns:minmax(0,1fr)}
  .future-course-layout{grid-template-columns:minmax(0,1fr)}
  .future-course-sidehero,.course-real-progress{width:100%;min-width:0}
  .future-course-rail{position:static}
  .future-lesson-row{grid-template-columns:44px minmax(0,1fr) 20px}
  .future-material-row,.lesson-material-link{grid-template-columns:40px minmax(0,1fr) 20px}

  .academic-kpis,.academic-course-kpis,.coursework-kpis,.materials-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .academic-admin-hero{gap:18px}
  .academic-admin-hero aside{padding:15px}
  .academic-kpis article,.academic-course-kpis article,.coursework-kpis article,.materials-metrics>div{min-height:0;padding:15px}
  .academic-form-pair,.material-form-grid,.course-defaults form,.template-options{grid-template-columns:minmax(0,1fr)}
  .academic-form-pair>*{min-width:0}
  .academic-create-card,.academic-settings-card,.academic-workflow-card,.material-action-card,.coursework-create-card{padding:18px}

  .materials-hero{align-items:stretch}
  .new-material-menu{width:100%}
  .new-material-menu>summary{width:100%;min-height:48px;text-align:center}
  .new-material-menu nav{left:0;right:0;width:100%;min-width:0}
  .materials-toolbar{grid-template-columns:minmax(0,1fr)}
  .material-edit-form{grid-template-columns:minmax(0,1fr)}
  .material-edit-form>*{grid-column:auto}
  .material-name{grid-template-columns:40px minmax(0,1fr)}
  .upload-progress-row{grid-template-columns:minmax(0,1fr) 44px}

  .agenda-commandbar{align-items:stretch;flex-direction:column}
  .agenda-command-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .agenda-command-actions>*{width:100%;min-width:0}
  .agenda-new-menu>summary{width:100%;min-height:46px}
  .agenda-toolbar{align-items:stretch}
  .agenda-period-nav{display:grid;grid-template-columns:auto 44px 44px minmax(0,1fr)}
  .agenda-period-nav>*{min-width:0}
  .agenda-view-switch{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;overflow:visible}
  .agenda-view-switch button{min-height:42px}
  .agenda-filterbar{align-items:stretch}
  .agenda-kind-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .agenda-kind-filters button{justify-content:flex-start;min-height:42px}
  .agenda-course-filter select{min-width:0;max-width:70%}
  .agenda-calendar-card{overflow:hidden}
  .agenda-list-view{padding:7px 12px 18px}
  .agenda-list-event{grid-template-columns:58px minmax(0,1fr) 18px;min-height:58px;padding:11px 4px}
  .agenda-list-copy{min-width:0}
  .agenda-list-copy :where(b,small){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  dialog,.agenda-event-dialog{max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);overflow:auto}
  :where(form,.confirm-dialog-card,.communication-edit-panel form)>*{min-width:0}
}

@media(max-width:560px){
  .future-campus-page :where(.shell,.future-shell,.page-shell,.academic-admin-shell,.academic-course-shell,.users-admin-shell,.global-command-shell,.communications-shell,.coursework-shell,.activity-shell,.materials-page){padding-right:max(10px,var(--safe-area-right));padding-left:max(10px,var(--safe-area-left))}
  .dashboard-tools{margin-block:10px}
  .widget-library>summary{min-height:44px}
  .future-student-side{grid-template-columns:repeat(3,minmax(0,1fr))}
  .future-stat-card span{font-size:9px}
  .future-chip-row{gap:5px}
  .future-chip-row span{padding:6px 8px}
  .future-course-top{align-items:flex-start;gap:7px;flex-direction:column}
  .future-percent,.course-badge{max-width:100%}
  .academic-kpis,.academic-course-kpis,.coursework-kpis,.materials-metrics{grid-template-columns:minmax(0,1fr)}
  .academic-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;overflow:visible}
  .academic-nav a{min-width:0;padding:12px;overflow:hidden}
  .academic-nav a :where(b,small){overflow-wrap:normal}
  .academic-nav a:last-child:nth-child(odd){grid-column:1/-1}
  .academic-course-directory>header,.academic-people-card>header,.coursework-panel>header{padding:17px}
  .agenda-command-actions{grid-template-columns:minmax(0,1fr)}
  .agenda-period-nav{grid-template-columns:minmax(0,1fr) 44px 44px}
  .agenda-period-nav h2{grid-column:1/-1;margin:3px 0 0}
  .agenda-view-switch{grid-template-columns:repeat(3,minmax(0,1fr))}
  .agenda-view-switch button[data-agenda-view="week"],.agenda-view-switch button[data-agenda-view="year"]{display:none}
  .agenda-context-panel{grid-template-columns:minmax(0,1fr)}
  .agenda-mini-card,.agenda-legend{display:none}
  .agenda-list-event{grid-template-columns:52px minmax(0,1fr) 16px}
  .agenda-dialog-actions{grid-template-columns:minmax(0,1fr)}
  .pdf-reader-navigation{grid-template-columns:minmax(0,1fr)}
  .pdf-reader-navigation span:last-child{text-align:left}
}

@media(max-width:390px){
  .campus-mobile-brand b{font-size:11px}
  .future-student-side{grid-template-columns:minmax(0,1fr)}
  .future-stat-card{display:flex;align-items:center;justify-content:space-between}
  .future-stat-card b{font-size:20px}
}

@media(prefers-reduced-motion:reduce){
  .mobile-nav-backdrop,.mobile-nav-drawer{transition:none}
}

/* Fase 2: búsqueda discreta y compartida para listados. */
.record-search-bar{display:flex;align-items:end;gap:9px;flex-wrap:wrap;margin:0 0 16px;padding:12px;border:1px solid var(--esem-slate-200,#dce5e7);border-radius:14px;background:#f8fafb}
.record-search-bar.compact{padding:9px;margin-block:10px;background:#fff}
.record-search-bar label{display:grid;gap:4px;min-width:145px;color:var(--esem-slate-700,#40565e);font-size:10px;font-weight:720}
.record-search-bar :is(input,select){min-height:40px;margin:0;padding:8px 10px;border:1px solid var(--esem-slate-300,#cbd8dc);border-radius:9px;background:#fff;font:inherit;color:var(--esem-slate-950,#102f38)}
.record-search-main{flex:1 1 250px}.record-search-main input{width:100%}
.record-filter-details{display:contents}.record-filter-details>summary{display:none}.record-filter-details>div{display:flex;align-items:end;gap:9px;flex-wrap:wrap}
.candidate-search{display:flex;align-items:end;gap:8px;margin:10px 0}.candidate-search label{display:grid;flex:1;gap:4px;font-size:10px;font-weight:720}.candidate-search input{min-height:40px}
.record-history-panel{margin-top:16px;border-top:1px solid var(--esem-slate-200,#dce5e7);padding-top:14px}.record-history-panel>summary{cursor:pointer;font-weight:760}
.record-history-list{display:grid;gap:8px}.record-history-list article{display:grid;grid-template-columns:minmax(180px,1fr) auto auto minmax(180px,1fr);align-items:center;gap:10px;padding:10px;border:1px solid var(--esem-slate-200,#dce5e7);border-radius:10px;background:#fff}.record-history-list article div{display:grid}.record-history-list article small{overflow-wrap:anywhere}
.filter-no-results{padding:14px;border-radius:10px;background:var(--esem-slate-100,#eef3f4);color:var(--esem-slate-700,#40565e)}

@media(max-width:760px){
  .record-search-bar{align-items:stretch}.record-search-bar>*{width:100%}.record-search-bar :is(button,a.secondary){justify-content:center}
  .record-filter-details{display:block;width:100%}.record-filter-details>summary{display:block;padding:9px 0;cursor:pointer;font-weight:760}.record-filter-details>div{display:grid;grid-template-columns:minmax(0,1fr)}
  .record-history-list article{grid-template-columns:minmax(0,1fr) auto}.record-history-list article>small{grid-column:1/-1}
  .candidate-search{align-items:stretch;flex-direction:column}
}
