/* SLPT-R28-B16UX3-MOBILE-UI-RESTORATION-HOTFIX-20260827 */

/* ----------------------------------------------------------------------
   Scope
   - Phone-only sidebar restoration: one column, visible menu names.
   - Phone dashboard grids: bounded/direct-parent only.
   - Preserve the mobile Program Editor correction without owning app-wide layout.
   - No desktop/tablet structural ownership.
   ---------------------------------------------------------------------- */

@media (max-width: 767px){

  /* === Expanded mobile sidebar === */
  [data-r28ux3-sidebar]{
    width:min(88vw, 348px)!important;
    max-width:348px!important;
    min-width:0!important;
  }

  [data-r28ux3-nav-list]{
    display:flex!important;
    flex-direction:column!important;
    flex-wrap:nowrap!important;
    grid-template-columns:1fr!important;
    grid-auto-flow:row!important;
    gap:2px!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }

  [data-r28ux3-nav-item]{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:12px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:48px!important;
    padding:9px 12px!important;
    margin:0!important;
    text-align:left!important;
    grid-column:auto!important;
    grid-row:auto!important;
  }

  [data-r28ux3-nav-item] > svg,
  [data-r28ux3-nav-item] > [class*="icon"],
  [data-r28ux3-nav-item] > [class*="Icon"]{
    flex:0 0 auto!important;
  }

  [data-r28ux3-nav-label]{
    display:inline-block!important;
    visibility:visible!important;
    opacity:1!important;
    position:static!important;
    width:auto!important;
    max-width:calc(100% - 48px)!important;
    min-width:0!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    clip:auto!important;
    clip-path:none!important;
    transform:none!important;
    translate:none!important;
    scale:1!important;
    text-indent:0!important;
    font-size:14px!important;
    font-weight:700!important;
    line-height:1.25!important;
    letter-spacing:normal!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    color:inherit!important;
    flex:1 1 auto!important;
    pointer-events:auto!important;
  }

  [data-r28ux3-generated-label]{
    display:inline-block!important;
  }

  /* === Coach dashboard: only containers explicitly marked by B16UX3 === */
  [data-r28ux3-grid="quick"]{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
    align-items:stretch!important;
  }

  [data-r28ux3-grid="top"],
  [data-r28ux3-grid="bottom"]{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
    align-items:stretch!important;
  }

  [data-r28ux3-grid="focus"]{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
    align-items:stretch!important;
  }

  [data-r28ux3-grid-card]{
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
  }

  [data-r28ux3-grid="top"] [data-r28ux3-grid-card],
  [data-r28ux3-grid="bottom"] [data-r28ux3-grid-card]{
    padding:10px 6px!important;
  }

  [data-r28ux3-grid="top"] [data-r28ux3-grid-card] *,
  [data-r28ux3-grid="bottom"] [data-r28ux3-grid-card] *{
    min-width:0!important;
    overflow-wrap:anywhere;
  }

  /* === Program Editor mobile containment === */
  .advanced-builder.r27-option1-builder{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
  }

  .r27-option1-builder #builderCanvas.r27-option1-canvas,
  .r27-option1-block-body,
  .r27-option1-session-stage,
  .r27-option1-session-list,
  .r27-option1-session-card.selected,
  .r27-option1-inline-editor,
  .r27-option1-exercise-stack,
  .r27-option1-exercise-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:none!important;
  }

  .r27-option1-builder #builderCanvas.r27-option1-canvas,
  .r27-option1-block-body,
  .r27-option1-session-stage,
  .r27-option1-session-card.selected,
  .r27-option1-inline-editor,
  .r27-option1-exercise-stack,
  .r27-option1-exercise-card{
    overflow:visible!important;
  }

  .r27-option1-block-body{
    display:block!important;
  }

  .r27-option1-week-rail{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch;
    margin-bottom:10px!important;
  }

  .r27-option1-week-list{
    display:flex!important;
    width:max-content!important;
    min-width:100%!important;
    max-width:none!important;
    overflow:visible!important;
  }

  .r27-option1-session-stage{
    display:block!important;
    position:static!important;
  }

  .r27-option1-session-list{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:9px!important;
  }

  .r27-option1-session-card.selected,
  .r27-option1-inline-editor{
    display:block!important;
    position:static!important;
  }

  .r27-option1-inline-editor{
    padding:10px!important;
    margin:0!important;
  }

  .r27-option1-section-head{
    align-items:flex-start!important;
    flex-wrap:wrap!important;
  }

  .r27-option1-section-actions{
    width:100%!important;
    justify-content:flex-start!important;
  }

  .r27-option1-exercise-stack{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:10px!important;
  }

  .r27-option1-exercise-card{
    display:block!important;
  }

  .r27-option1-prescription{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .r27-option1-notes{
    grid-column:1/-1!important;
  }

  .r27-option1-builder .r27-option1-session-details{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
    position:static!important;
  }
}

@media (max-width: 520px){
  .r27-option1-prescription,
  .r27-option1-more-grid,
  .r27-option1-alternate,
  .r27-option1-follower-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }

  .r27-option1-prescription label,
  .r27-option1-notes,
  .r27-option1-alternate label,
  .r27-option1-follower-grid label{
    grid-column:1!important;
  }

  .r27-option1-single-toggle{
    max-width:100%!important;
    white-space:normal!important;
  }
}

@media (prefers-reduced-motion: reduce){
  [data-r28ux3-sidebar] *,
  [data-r28ux3-grid] *,
  .r27-option1-builder *{
    transition:none!important;
    animation:none!important;
    scroll-behavior:auto!important;
  }
}
