/* V172 FINAL STABILITY — defensive only; planner internals intentionally untouched. */
*,*::before,*::after{box-sizing:border-box}
html,body{max-width:100%;}
body{overflow-x:hidden}
.main-shell,.content,.page{min-width:0}

/* Reference dashboard: prevent clipping and keep internal scroll areas independent. */
#refDashboard{min-width:0;max-width:100%}
#refDashboard .ref-card{min-width:0}
#refDashboard .ref-plan{overflow:hidden!important}
#refDashboard .ref-plan #refToday{min-height:0!important;contain:layout paint;}
#refDashboard .ref-task-row{width:100%!important;max-width:100%!important;box-sizing:border-box!important}
#refDashboard .ref-task-row>b{min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
#refDashboard .ref-date,#refDashboard .ref-yks-countdown{min-width:0}

/* AI coach: composer/send button must remain visible at every supported width. */
#coachPage .v123-coach,#coachPage .v123-chat{min-width:0!important}
#coachPage .v123-compose{width:auto!important;min-width:0!important;grid-template-columns:minmax(0,1fr) 48px!important}
#coachPage .v123-compose textarea{min-width:0!important;width:100%!important}
#coachPage .v123-compose button{width:48px!important;min-width:48px!important;overflow:visible!important}
#coachPage .v123-msgs{min-width:0!important}

/* Desktop flyouts stay inside viewport on shorter displays. */
@media (min-width:901px){
  html.nirvana-desktop .nav-flyout{max-height:min(72vh,620px)!important;overscroll-behavior:contain!important}
}

/* Tablet/mobile: eliminate horizontal bleed while preserving inner scrolling. */
@media (max-width:900px){
  .main-shell,.content,.page{width:100%!important;max-width:100%!important}
  #refDashboard .ref-main,#refDashboard .ref-bottom,#refDashboard .ref-kpis{min-width:0!important}
  #coachPage .v123-compose{margin-left:8px!important;margin-right:8px!important}
}

/* Touch devices: reliable momentum scroll in today's plan. */
@media (hover:none) and (pointer:coarse){
  #refDashboard .ref-plan #refToday{-webkit-overflow-scrolling:touch!important;touch-action:pan-y!important}
}
