/* SMMPIX mobile-responsive v82 — global + page patterns */

/* ---------- Base safe areas ---------- */
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body{ overflow-x:hidden; }
main.main-pad, .main-pad{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  padding-left:max(12px, env(safe-area-inset-left));
  padding-right:max(12px, env(safe-area-inset-right));
  padding-bottom:max(24px, env(safe-area-inset-bottom));
}

/* ---------- Topbar mobile ---------- */
@media (max-width:767px){
  .topbar{ height:52px; padding:0 10px; gap:6px; }
  .topbar-left,.topbar-right{ gap:6px; }
  .topbar-logo{ height:26px; max-width:88px; }
  .topbar-icon-btn, .theme-toggle, .cur-btn, .topbar-balance{ min-height:34px; }
  .topbar-icon-btn, .theme-toggle{ width:34px; height:34px; }
  .cur-btn{ min-width:48px; padding:5px 8px; font-size:11px; }
  .topbar-balance{ padding:5px 8px; font-size:11px; }
  .topbar-balance-ico{ display:none; }
  .topbar-title{ display:none!important; }
}

/* ---------- Drawer full height ---------- */
#drawer .drawer-panel{
  max-width:min(300px, 88vw);
  padding-bottom:max(16px, env(safe-area-inset-bottom));
}
#drawer .nav-item{ min-height:44px; }

/* ---------- Shared page shells ---------- */
@media (max-width:767px){
  body.is-client .page-head,
  body.is-client .mo-page-head,
  body.is-client .uo-title{
    flex-direction:column;
    align-items:flex-start!important;
    gap:6px;
  }
  body.is-client .page-head h1,
  body.is-client .mo-page-head h1,
  body.is-client .uo-title h1,
  body.is-client h1{
    font-size:1.25rem!important;
    line-height:1.25;
    word-break:break-word;
  }
  body.is-client .card,
  body.is-client .xo-card,
  body.is-client .u6-card,
  body.is-client .afx-card,
  body.is-client .client-section{
    border-radius:14px;
    padding:14px;
  }
  body.is-client .btn,
  body.is-client .btn-primary,
  body.is-client .xo-submit,
  body.is-client .afx-submit,
  body.is-client .mo-search-btn,
  body.is-client .svc-btn{
    min-height:42px;
  }
  body.is-client input:not([type=checkbox]):not([type=radio]):not([type=color]),
  body.is-client select,
  body.is-client textarea{
    font-size:16px!important; /* prevent iOS zoom */
    min-height:42px;
  }
  body.is-client textarea{ min-height:96px; }
}

/* ---------- Grid patterns ---------- */
@media (max-width:639px){
  body.is-client .grid,
  body.is-client .client-stat-grid,
  body.is-client .mo-stat-grid,
  body.is-client .uo-stats,
  body.is-client .dash-stats,
  body.is-client .svc-stats,
  body.is-client .cp-stats{
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
  }
  body.is-client .grid-cols-3,
  body.is-client .grid-cols-4,
  body.is-client .sm\:grid-cols-3,
  body.is-client .sm\:grid-cols-4,
  body.is-client .md\:grid-cols-3,
  body.is-client .md\:grid-cols-4,
  body.is-client .lg\:grid-cols-3,
  body.is-client .lg\:grid-cols-4{
    grid-template-columns:1fr 1fr!important;
  }
}
@media (max-width:379px){
  body.is-client .client-stat-grid,
  body.is-client .mo-stat-grid,
  body.is-client .uo-stats,
  body.is-client .dash-stats,
  body.is-client .svc-stats{
    grid-template-columns:1fr!important;
  }
}

/* ---------- Tables: horizontal scroll ---------- */
@media (max-width:767px){
  body.is-client .table-wrap,
  body.is-client .overflow-x-auto,
  body.is-client .mo-table-wrap,
  body.is-client .uo-table-wrap,
  body.is-client .svc-table-wrap{
    display:block;
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    margin-left:-4px;
    margin-right:-4px;
    padding-left:4px;
    padding-right:4px;
  }
  body.is-client table{
    min-width:560px;
  }
}

/* ---------- New Order ---------- */
@media (max-width:767px){
  .xo-layout, .xo-grid, .new-order-grid{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:12px!important;
  }
  .xo-side, .xo-summary, .order-summary{
    order:2;
  }
  .xo-main, .xo-form-col{
    order:1;
  }
  .xo-select, .xo-menu, .xo-dropdown{
    max-width:100%;
  }
  .xo-menu{
    max-height:min(50vh, 320px);
  }
}

/* ---------- Services ---------- */
@media (max-width:680px){
  .svc-layout{ grid-template-columns:1fr!important; }
  .svc-side{ display:none!important; }
  .svc-controls{
    grid-template-columns:1fr!important;
    gap:8px;
  }
  .svc-table-wrap{ display:none!important; }
  .svc-cards{ display:block!important; }
  .svc-card{ margin-bottom:10px; }
  .svc-card-actions{
    display:flex; flex-wrap:wrap; gap:6px;
  }
  .svc-card-actions .svc-btn{ flex:1 1 auto; min-height:40px; }
  .svc-modal{ align-items:flex-end!important; padding:0!important; }
  .svc-dialog{
    width:100%!important;
    max-height:88vh;
    border-radius:18px 18px 0 0!important;
  }
}

/* ---------- Orders ---------- */
@media (max-width:767px){
  .mo-filters, .uo-filters, .orders-filters{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px;
  }
  .mo-filters .mo-field,
  .uo-filters input,
  .uo-filters select{
    width:100%!important;
  }
  .mo-actions, .uo-actions{
    display:flex; flex-wrap:wrap; gap:8px;
  }
  .mo-actions > *, .uo-actions > *{ flex:1 1 auto; }
}

/* ---------- Add funds / account / tickets ---------- */
@media (max-width:767px){
  .afx-grid, .afx-layout, .u6-grid, .account-grid{
    grid-template-columns:1fr!important;
  }
  .pay-methods, .afx-methods{
    grid-template-columns:1fr!important;
  }
  .tk-list .tk-row{
    flex-direction:column;
    align-items:flex-start!important;
  }
}

/* ---------- Child panel / API / mass order ---------- */
@media (max-width:900px){
  .cp-grid{ grid-template-columns:1fr!important; }
  .cp-preview{ position:static!important; }
  .cp-form-grid{ grid-template-columns:1fr!important; }
  .cp-setup{ grid-template-columns:1fr 1fr!important; }
}
@media (max-width:600px){
  .cp-setup{ grid-template-columns:1fr!important; }
  .cp-stats{ grid-template-columns:1fr 1fr!important; }
  .mass-grid, .mo2-grid{ grid-template-columns:1fr!important; }
}

/* ---------- Landing page ---------- */
@media (max-width:767px){
  .pp-l .wrap{ padding-left:14px; padding-right:14px; }
  .pp-l .section{ padding:2.25rem 0; }
  .pp-l .section h2{ font-size:1.3rem; }
  .pp-l .grid3, .pp-l .grid4{
    grid-template-columns:1fr!important;
    gap:12px!important;
  }
  .pp-l .stats{ grid-template-columns:1fr 1fr 1fr; gap:8px; }
  .pp-l .stats strong{ font-size:1.1rem; }
  .pp-l .stats span{ font-size:10px; }
  .pp-l .split{ grid-template-columns:1fr!important; gap:1rem; }
  .pp-l .split-copy h2, .pp-l .split-copy .lead{ text-align:left; }
  .pp-l .gallery{ grid-template-columns:1fr!important; }
  .pp-l .banner-band{ aspect-ratio:16/7; min-height:110px; border-radius:14px; }
  .pp-l .banner-strip{
    max-height:72px !important;
    aspect-ratio:21/4 !important;
    object-fit:cover !important;
    object-position:center !important;
    height:auto !important;
  }
  .pp-l .shot{ border-radius:14px; }
  .pp-l .hero{ padding:1.5rem 0 1.75rem; }
  .pp-l .cta-inner{ flex-direction:column; align-items:flex-start; }
  .pp-l .cta-actions{ width:100%; }
  .pp-l .cta-actions a{ flex:1; text-align:center; }
  .pp-l .pricing-grid{ grid-template-columns:1fr!important; }
  .pp-l .plats{ justify-content:flex-start; }
  .pp-l .plat{ min-width:78px; padding:10px 8px; }
  .pp-nav-inner{ height:56px; }
  .pp-nav-cta{ padding:8px 12px; font-size:12px; min-height:36px; }
}
@media (max-width:479px){
  .pp-l .stats{ grid-template-columns:1fr; }
  .pp-l .gallery{ grid-template-columns:1fr; }
  .pp-l .banner-strip{
    max-height:56px !important;
    aspect-ratio:18/4 !important;
  }
}

/* ---------- Forms full width ---------- */
@media (max-width:767px){
  body.is-client form .flex.gap-2,
  body.is-client form .flex.gap-3,
  body.is-client .client-action-row{
    flex-wrap:wrap;
  }
  body.is-client form .flex.gap-2 > *,
  body.is-client form .flex.gap-3 > *,
  body.is-client .client-action-row > *{
    flex:1 1 100%;
  }
}

/* ---------- Touch targets ---------- */
@media (pointer:coarse){
  body.is-client a, body.is-client button, body.is-client .nav-item{
    min-height:40px;
  }
  body.is-client .nav-item{
    padding-top:10px; padding-bottom:10px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion:reduce){
  .pp-l .card, .pp-l .gallery-item img,
  body.is-client .card, body.is-client .btn{
    transition:none!important;
    transform:none!important;
  }
}

/* ---------- UX v137 extras ---------- */
@media (max-width:767px){
  body.is-client .filter-bar,
  body.is-client .xo-filters,
  body.is-client .orders-filter,
  body.is-client .svc-toolbar{
    display:flex;flex-wrap:wrap;gap:8px;
  }
  body.is-client .filter-bar > *,
  body.is-client .xo-filters > *,
  body.is-client .orders-filter > *{
    flex:1 1 140px;min-width:0;
  }
  body.is-client .pagination,
  body.is-client .pager{
    display:flex;flex-wrap:wrap;gap:6px;justify-content:center;
  }
  body.is-client .pagination a,
  body.is-client .pagination span,
  body.is-client .pager a,
  body.is-client .pager span{
    min-width:40px;min-height:40px;display:inline-flex;align-items:center;justify-content:center;
    border-radius:10px;
  }
  /* Sticky bottom safe area for mobile nav if present */
  body.is-client .bottom-nav{
    padding-bottom:max(8px, env(safe-area-inset-bottom));
  }
}
@media (max-width:479px){
  body.is-client .stat-row,
  body.is-client .metrics-row{
    grid-template-columns:1fr 1fr!important;
  }
}
