/* SmartTeam shared layout fixes — 2026.09.06-r6 */
html,body{max-width:100%;overflow-x:hidden}
.shell,main,nav.rail{min-width:0}
#topActions{min-width:0;max-width:100%}
.sheetcard{
  align-self:center;
  width:100%;
  max-height:calc(100dvh - 2rem);
  overflow:auto;
  background:var(--surface);
  border:1px solid var(--rule);
  border-radius:6px;
  box-shadow:var(--shadow);
}
.sheetcard>header{
  position:sticky;top:0;z-index:2;
  display:flex;align-items:center;gap:.8rem;
  padding:1rem 1.3rem;
  background:var(--surface);
  border-bottom:1px solid var(--rule);
}
.sheetcard>header h2{flex:1;margin:0;font-family:var(--display);font-size:1.1rem}
.sheetcard>.body{padding:1.3rem}
.sheetcard>footer{
  position:sticky;bottom:0;z-index:2;
  display:flex;gap:.6rem;justify-content:flex-end;
  padding:.85rem 1.3rem;
  background:var(--surface);
  border-top:1px solid var(--rule);
}
label.fld textarea{
  width:100%;min-width:0;
  border:1px solid var(--rule);
  border-radius:3px;
  padding:.55rem;
  color:var(--ink);
  background:var(--surface);
  resize:vertical;
}
@media(max-width:1200px){
  .topbar #topActions{flex:1 0 100%;width:100%}
}
@media(max-width:860px){
  .scrim{padding:.5rem}
  .sheetcard{max-height:calc(100dvh - 1rem);border-radius:6px}
  .sheetcard>.body{padding:1rem}
  .sheetcard>footer{padding:.75rem 1rem;flex-wrap:wrap}
  .sheetcard>footer .btn{flex:1;justify-content:center}
}
@media(max-width:520px){
  .sheetcard .g2,.sheetcard .g3{grid-template-columns:1fr}
  .topbar #topActions>.btn{flex:1 1 calc(50% - .5rem);justify-content:center}
}

/* Mobile navigation: keep system names and selectors readable. */
@media(max-width:860px){
  nav.rail{display:flex;flex-direction:column;align-items:stretch;gap:.65rem;overflow:visible}
  nav.rail .switcher{order:1;flex:0 0 auto;flex-wrap:nowrap;overflow-x:auto;padding:0 0 .15rem;scrollbar-width:thin}
  nav.rail .swhome,nav.rail .swtab{flex:0 0 auto;white-space:nowrap}
  nav.rail .bookpick{order:2;display:grid;grid-template-columns:minmax(0,1fr) minmax(7rem,.65fr);gap:.3rem .6rem;padding:0}
  nav.rail .bookpick>label:first-of-type{grid-column:1;grid-row:1}
  nav.rail .bookpick>#bookSel{grid-column:1;grid-row:2}
  nav.rail .bookpick>.row:first-of-type{grid-column:1;grid-row:3}
  nav.rail .bookpick>label:nth-of-type(2){grid-column:2;grid-row:1;margin-top:0!important}
  nav.rail .bookpick>#yearSel{grid-column:2;grid-row:2}
  nav.rail .bookpick>.row:nth-of-type(2){grid-column:2;grid-row:3}
  nav.rail .navlist{order:3;width:100%;overflow-x:auto;justify-content:space-around;padding:.1rem 0 0;scrollbar-width:thin}
  nav.rail .navlist button{width:auto;flex:0 0 auto}
}


/* Long-form modal scrolling: headers and actions stay visible. */
.scrim{padding:1rem;overflow:hidden}
.sheetcard,.drawer{display:flex;flex-direction:column;max-height:calc(100dvh - 2rem);overflow:hidden}
.sheetcard>header,.drawer>header,.sheetcard>footer,.drawer>footer{flex:0 0 auto}
.sheetcard>.body,.drawer>.body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
.sheetcard>footer,.drawer>footer{z-index:3;flex-wrap:wrap;background:var(--surface)}
@media(max-width:860px){
  .scrim{padding:.5rem}
  .sheetcard,.drawer{max-height:calc(100dvh - 1rem)}
}



