/* SERVICES-r39 — tablet/wide overlap cleanup for services-app.
   Scope: .services-app-page and .services-app-sheet only.
   Goal: prevent text-on-text overlays on tablets without changing JS/API flow. */

.services-app-page,
.services-app-sheet{
  text-size-adjust:100%;
  -webkit-text-size-adjust:100%;
}
.services-app-page *,
.services-app-sheet *{
  min-width:0;
}
.services-app-page strong,
.services-app-page b,
.services-app-page em,
.services-app-page small,
.services-app-page span,
.services-app-page h1,
.services-app-sheet b,
.services-app-sheet span,
.services-app-sheet em{
  overflow-wrap:anywhere;
  word-break:normal;
}
.services-app-tile,
.services-app-list-card,
.services-app-shop-card,
.services-app-selected-card,
.services-app-field,
.services-app-confirm-row,
.services-app-sheet__options button{
  min-width:0;
}
.services-app-tile__label,
.services-app-list-body,
.services-app-shop-body,
.services-app-selected-card b,
.services-app-field span,
.services-app-confirm-row strong,
.services-app-sheet__options button span{
  min-width:0;
  max-width:100%;
}

/* Mobile guard: не ломаем телефон, но не даём длинным словам залезать друг на друга. */
@media (max-width:767px){
  .services-app-home-head h1,
  .services-app-nav-head h1{
    overflow-wrap:anywhere;
  }
  .services-app-tile__label{
    display:block;
    white-space:normal;
    overflow:hidden;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .services-app-list-body strong,
  .services-app-list-body em,
  .services-app-list-body b,
  .services-app-shop-body strong,
  .services-app-shop-body em,
  .services-app-shop-body small{
    white-space:normal;
  }
}

/* Tablet portrait: fixed-height cards caused text overlay; cards now grow by content. */
@media (min-width:768px) and (max-width:1023px){
  .services-app-phone{
    overflow:visible;
  }
  .services-app-home-head h1{
    max-width:none;
    font-size:clamp(28px,3.8vw,36px);
    line-height:1.12;
    overflow-wrap:anywhere;
  }
  .services-app-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:stretch;
  }
  .services-app-tile{
    height:auto;
    min-height:118px;
    display:grid;
    grid-template-rows:auto minmax(34px,auto);
    align-content:center;
    justify-items:center;
    gap:12px;
  }
  .services-app-tile__label{
    width:100%;
    min-height:34px;
    text-align:center;
    white-space:normal;
    overflow:hidden;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .services-app-emergency-row{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    align-items:stretch;
  }
  .services-app-emergency-row button,
  .services-app-emergency-row .services-app-emergency,
  .services-app-emergency-row > *{
    min-width:0;
    white-space:normal;
    height:auto;
    min-height:48px;
    line-height:1.2;
  }
  .services-app-list{
    grid-template-columns:1fr;
    padding-bottom:84px;
  }
  .services-app-list-card{
    min-height:104px;
    height:auto;
    align-items:start;
    grid-template-columns:58px minmax(0,1fr) 22px;
  }
  .services-app-list-body{
    gap:5px;
    align-self:center;
  }
  .services-app-list-body strong,
  .services-app-list-body em,
  .services-app-list-body b{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }
  .services-app-shop-card{
    height:auto;
    min-height:104px;
    align-items:start;
  }
  .services-app-shop-body{
    align-self:center;
    gap:5px;
  }
  .services-app-shop-body strong,
  .services-app-shop-body em,
  .services-app-shop-body small{
    white-space:normal;
  }
  .services-app-nav-head{
    height:auto;
    min-height:52px;
    align-items:flex-start;
  }
  .services-app-nav-head h1{
    white-space:normal;
    line-height:1.18;
    padding-top:8px;
  }
  .services-app-chips{
    flex-wrap:wrap;
    overflow:visible;
    padding-bottom:18px;
  }
  .services-app-chips button{
    white-space:normal;
    line-height:1.2;
  }
  .services-app-selected-card{
    height:auto;
    min-height:82px;
    align-items:flex-start;
  }
  .services-app-selected-card b,
  .services-app-selected-card em{
    white-space:normal;
  }
  .services-app-field{
    min-height:54px;
    height:auto;
    gap:12px;
    padding-top:10px;
    padding-bottom:10px;
    align-items:flex-start;
  }
  .services-app-field span{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    line-height:1.3;
  }
  .services-app-confirm-row{
    grid-template-columns:minmax(118px,.36fr) minmax(0,1fr);
    align-items:start;
  }
  .services-app-confirm-row strong{
    text-align:left;
  }
}

/* Wide / desktop preview: не растягиваем тексты поверх соседних колонок. */
@media (min-width:1024px){
  .services-app-page--home .services-app-phone{
    grid-template-columns:minmax(320px,.72fr) minmax(520px,1fr);
    overflow:visible;
  }
  .services-app-page--home .services-app-home-head,
  .services-app-page--home .services-app-search,
  .services-app-page--home .services-app-emergency-row,
  .services-app-page--home .services-app-grid,
  .services-app-page--home .services-app-nearby{
    min-width:0;
  }
  .services-app-home-head h1{
    max-width:100%;
    line-height:1.12;
    overflow-wrap:anywhere;
  }
  .services-app-grid{
    align-items:stretch;
  }
  .services-app-page--home .services-app-grid{
    grid-template-columns:repeat(3,minmax(150px,1fr));
  }
  .services-app-tile{
    height:auto;
    min-height:126px;
    display:grid;
    grid-template-rows:auto minmax(40px,auto);
    align-content:center;
  }
  .services-app-tile__label{
    width:100%;
    white-space:normal;
    line-height:1.22;
    text-align:center;
  }
  .services-app-page--category .services-app-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .services-app-list-card{
    height:auto;
    min-height:112px;
    align-items:start;
  }
  .services-app-list-body{
    align-self:center;
    gap:5px;
  }
  .services-app-list-body strong,
  .services-app-list-body em,
  .services-app-list-body b{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }
  .services-app-page--request .services-app-form{
    align-items:stretch;
  }
  .services-app-page--request .services-app-form-label,
  .services-app-page--request .services-app-selected-card,
  .services-app-page--request .services-app-textarea,
  .services-app-page--request .services-app-submit,
  .services-app-page--request .services-app-form-note{
    min-width:0;
  }
  .services-app-selected-card{
    height:auto;
    min-height:88px;
  }
  .services-app-selected-card b,
  .services-app-selected-card em{
    white-space:normal;
  }
  .services-app-field{
    height:auto;
    min-height:56px;
    align-items:flex-start;
    padding-top:12px;
    padding-bottom:12px;
  }
  .services-app-field span{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }
  .services-app-confirm-row{
    grid-template-columns:150px minmax(0,1fr);
  }
  .services-app-confirm-row strong{
    text-align:left;
  }
}

/* Bottom sheet tablet: options stop overlapping, panel becomes wider and scroll-safe. */
@media (min-width:768px){
  .services-app-sheet{
    align-items:center;
    padding:24px;
  }
  .services-app-sheet__panel{
    width:min(720px, calc(100vw - 48px));
    max-height:min(82dvh,760px);
    border-radius:28px;
    padding:12px 20px 20px;
  }
  .services-app-sheet__head{
    align-items:flex-start;
  }
  .services-app-sheet__head b{
    font-size:20px;
    line-height:1.18;
  }
  .services-app-sheet__head span{
    font-size:13px;
    line-height:1.35;
  }
  .services-app-sheet__options{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
  }
  .services-app-sheet__options button{
    min-height:56px;
    height:auto;
    align-items:flex-start;
    padding:12px 14px;
  }
  .services-app-sheet__options button span{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    font-size:14px;
    line-height:1.3;
  }
  .services-app-sheet__options button em{
    flex:0 0 auto;
  }
  .services-app-sheet__custom{
    grid-template-columns:minmax(0,1fr) 128px;
  }
  .services-app-sheet__custom input,
  .services-app-sheet__custom button{
    height:auto;
    min-height:48px;
    font-size:14px;
  }
}

@media (min-width:1024px){
  .services-app-sheet__panel{
    width:min(820px, calc(100vw - 72px));
  }
}

/* Low-height tablet landscape: reduce only vertical spaces, not text sizes to unsafe values. */
@media (min-width:768px) and (max-height:820px){
  .services-app-phone{
    overflow:visible;
  }
  .services-app-tile{
    min-height:96px;
  }
  .services-app-tile__label{
    -webkit-line-clamp:2;
  }
  .services-app-list-card{
    min-height:92px;
  }
  .services-app-sheet__panel{
    max-height:88dvh;
  }
}
