/* PM24 V393 HF4 — mobile-only fixes from the full-app Android audit.
   No desktop workflow, business logic, permissions, data or report calculations are changed. */

/* Profile & Property Photos: replace the cramped native file field with a
   clear tap target and a separately wrapped filename. */
.app-profile-settings .pm24-file-picker{
  position:relative!important;
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  align-items:center!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
  min-height:46px!important;
  padding:0!important;
  overflow:visible!important;
  border:0!important;
  background:transparent!important;
  text-align:left!important;
}
.app-profile-settings .pm24-file-picker-button{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:44px!important;
  padding:10px 13px!important;
  border:1px solid #b9cdec!important;
  border-radius:12px!important;
  background:#eef5ff!important;
  color:#1559a8!important;
  font-size:11px!important;
  font-weight:900!important;
  white-space:nowrap!important;
}
.app-profile-settings .pm24-file-picker-name{
  min-width:0!important;
  color:#60738f!important;
  font-size:11px!important;
  font-weight:750!important;
  line-height:1.35!important;
  overflow-wrap:anywhere!important;
}
.app-profile-settings .pm24-file-picker input[type="file"]{
  position:absolute!important;
  inset:0!important;
  z-index:2!important;
  width:100%!important;
  height:100%!important;
  padding:0!important;
  opacity:0!important;
  cursor:pointer!important;
}
.app-profile-settings .pm24-file-picker:focus-within .pm24-file-picker-button{
  outline:3px solid rgba(8,119,255,.16)!important;
  border-color:#6ca5f0!important;
}

/* Monthly report: keep the SVG and its labels clipped inside the card. */
.app-reports .pmr-card.wide{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
}
.app-reports .pmr-chart-frame{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin-top:8px!important;
  overflow:hidden!important;
  border-radius:12px!important;
}
.app-reports .pmr-chart-frame .pmr-chart{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  overflow:hidden!important;
}
.app-reports .pmr-chart-frame polyline{
  vector-effect:non-scaling-stroke;
}
.app-reports .pmr-chart-labels{
  display:grid!important;
  grid-template-columns:repeat(6,minmax(0,1fr))!important;
  gap:3px!important;
  width:100%!important;
  max-width:100%!important;
  margin-top:5px!important;
  color:#7a89a0!important;
  font-size:10px!important;
  text-align:center!important;
  overflow:hidden!important;
}
.app-reports .pmr-chart-labels span{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

@media (max-width:850px){
  /* Overall bottom bar: keep labels above Android's gesture area. */
  .bottom-nav.pm24-overall-bottom-nav{
    height:auto!important;
    min-height:calc(76px + env(safe-area-inset-bottom,0px))!important;
    padding:5px 8px calc(9px + env(safe-area-inset-bottom,0px))!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    align-items:stretch!important;
  }
  .bottom-nav.pm24-overall-bottom-nav a{
    position:relative!important;
    display:grid!important;
    grid-template-rows:25px 18px!important;
    align-content:center!important;
    justify-items:center!important;
    gap:2px!important;
    min-width:0!important;
    min-height:56px!important;
    padding:5px 2px 3px!important;
    line-height:1!important;
  }
  .bottom-nav.pm24-overall-bottom-nav a>span{
    position:static!important;
    display:block!important;
    max-width:100%!important;
    margin:0!important;
    font-size:10px!important;
    line-height:1.2!important;
    text-align:center!important;
    white-space:nowrap!important;
  }
  .bottom-nav.pm24-overall-bottom-nav a.active::before{
    top:-5px!important;
  }
  @supports selector(body:has(*)){
    body:has(.bottom-nav.pm24-overall-bottom-nav){
      padding-bottom:calc(96px + env(safe-area-inset-bottom,0px))!important;
    }
  }
}

@media (max-width:760px){
  /* Members & Payments: replace the wide desktop table with one card per person. */
  body.app-members .section-title{
    align-items:stretch!important;
    flex-direction:column!important;
  }
  body.app-members .section-title>.btn{
    width:100%!important;
  }
  body.app-members .pgco-member-view-tabs{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    overflow:visible!important;
  }
  body.app-members .pgco-member-view-tabs a{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
    padding:10px 13px!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  body.app-members .pgco-members-mobile-list{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
  }
  body.app-members .pgco-members-table,
  body.app-members .pgco-members-table tbody{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  body.app-members .pgco-members-table thead{
    display:none!important;
  }
  body.app-members .pgco-members-table tbody{
    display:grid!important;
    gap:12px!important;
  }
  body.app-members .pgco-members-table tr{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    padding:14px!important;
    overflow:hidden!important;
    border:1px solid #dce6f3!important;
    border-radius:17px!important;
    background:#fff!important;
    box-shadow:0 9px 24px rgba(7,31,75,.055)!important;
  }
  body.app-members .pgco-members-table td{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    justify-content:flex-start!important;
    gap:4px!important;
    width:100%!important;
    min-width:0!important;
    padding:10px!important;
    overflow-wrap:anywhere!important;
    text-align:left!important;
    border:0!important;
    border-radius:11px!important;
    background:#f7faff!important;
  }
  body.app-members .pgco-members-table td::before{
    content:attr(data-label);
    display:block!important;
    color:#71819b!important;
    font-size:9px!important;
    font-weight:900!important;
    letter-spacing:.055em!important;
    line-height:1.2!important;
    text-transform:uppercase!important;
  }
  body.app-members .pgco-members-table .pgco-member-property,
  body.app-members .pgco-members-table .pgco-member-primary,
  body.app-members .pgco-members-table .pgco-member-actions{
    grid-column:1/-1!important;
  }
  body.app-members .pgco-members-table .pgco-member-primary{
    padding:12px!important;
    background:#fff!important;
    border:1px solid #e4ebf5!important;
  }
  body.app-members .pgco-member-cell{
    width:100%!important;
    min-width:0!important;
    align-items:center!important;
  }
  body.app-members .pgco-member-cell>div{
    min-width:0!important;
  }
  body.app-members .pgco-member-cell b,
  body.app-members .pgco-member-cell small{
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  body.app-members .pgco-member-actions{
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:wrap!important;
    align-items:stretch!important;
    gap:8px!important;
    background:#fff!important;
    border-top:1px solid #e9eef6!important;
  }
  body.app-members .pgco-member-actions::before{
    flex:0 0 100%!important;
  }
  body.app-members .pgco-member-actions>.btn,
  body.app-members .pgco-member-actions>.inline-form{
    flex:1 1 calc(50% - 4px)!important;
    min-width:0!important;
    margin:0!important;
  }
  body.app-members .pgco-member-actions>.inline-form .btn{
    width:100%!important;
  }

  /* Payments member picker: never widen the page on narrow devices. */
  body.app-payments .payment-member-picker,
  body.app-payments .payment-member-list,
  body.app-payments .payment-member-row{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  body.app-payments .payment-member-row{
    grid-template-columns:42px minmax(0,1fr)!important;
    gap:10px!important;
  }
  body.app-payments .payment-member-row>span:nth-of-type(3),
  body.app-payments .payment-member-row>span:nth-of-type(4){
    display:grid!important;
    grid-column:2!important;
    padding-top:5px!important;
    border-top:1px solid #edf2f8!important;
  }
  body.app-payments .payment-member-row>em{
    grid-column:2!important;
    justify-self:start!important;
  }

  /* Profile upload controls stack cleanly on phones. */
  .app-profile-settings .pm24-file-picker{
    grid-template-columns:1fr!important;
  }
  .app-profile-settings .pm24-file-picker-button{
    width:100%!important;
  }

  /* Report title/legend and labels stay within the card. */
  .app-reports .pmr-card.wide .pmr-card-head{
    align-items:flex-start!important;
    flex-direction:column!important;
  }
  .app-reports .pmr-legend{
    width:100%!important;
    gap:10px!important;
    flex-wrap:wrap!important;
  }
  .app-reports .pmr-chart-frame{
    border-radius:10px!important;
  }
  .app-reports .pmr-chart-labels{
    font-size:9px!important;
  }
}

@media (max-width:370px){
  body.app-members .pgco-members-table tr{
    grid-template-columns:1fr!important;
  }
  body.app-members .pgco-members-table td,
  body.app-members .pgco-members-table .pgco-member-property,
  body.app-members .pgco-members-table .pgco-member-primary,
  body.app-members .pgco-members-table .pgco-member-actions{
    grid-column:1!important;
  }
}
