
/* V12.5.37 — CLIENT MOBILE RESPONSIVE HARDENING
   Scope intentionally limited to customer portal + <=900px.
   Desktop/internal layouts are not changed. */

@media (max-width:900px){

  /* ---------- Hard viewport contract ---------- */
  html,
  body.customer-portal{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
  }

  body.customer-portal *{
    min-width:0;
    box-sizing:border-box;
  }

  body.customer-portal img,
  body.customer-portal video,
  body.customer-portal canvas,
  body.customer-portal svg{
    max-width:100%;
  }

  body.customer-portal .amica-main,
  body.customer-portal .amica-content,
  body.customer-portal #content,
  body.customer-portal #content>div,
  body.customer-portal #content>section{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .amica-content{
    padding:12px 10px 24px!important;
    overflow-x:hidden!important;
  }

  /* ---------- Page headers ---------- */
  body.customer-portal .client-page-head,
  body.customer-portal .wallet-page-head,
  body.customer-portal .standard-page-head,
  body.customer-portal .v4-page-head{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:10px!important;
    width:100%!important;
    margin:0 0 12px!important;
  }

  body.customer-portal .client-page-head>div,
  body.customer-portal .wallet-page-head>div,
  body.customer-portal .standard-page-head>div{
    width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .client-page-head h2,
  body.customer-portal .wallet-page-head h2,
  body.customer-portal .standard-page-head h2,
  body.customer-portal #content>h2{
    font-size:22px!important;
    line-height:1.18!important;
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .client-page-head p,
  body.customer-portal .wallet-page-head p,
  body.customer-portal .standard-page-head p{
    line-height:1.4!important;
    margin-top:3px!important;
  }

  body.customer-portal .client-page-actions,
  body.customer-portal .page-head-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
    margin:0!important;
  }

  body.customer-portal .client-page-actions .btn,
  body.customer-portal .page-head-actions .btn,
  body.customer-portal .client-page-head>.btn{
    width:100%!important;
    min-height:42px!important;
    white-space:normal!important;
  }

  /* ---------- Shared cards / panels ---------- */
  body.customer-portal .client-panel,
  body.customer-portal .card,
  body.customer-portal .wallet-section,
  body.customer-portal .wallet-action-card,
  body.customer-portal .wallet-balance-card,
  body.customer-portal .client-machine-card,
  body.customer-portal .support-ticket-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    border-radius:12px!important;
  }

  body.customer-portal .client-panel{
    overflow:hidden!important;
  }

  body.customer-portal .client-panel-head,
  body.customer-portal .wallet-section-head,
  body.customer-portal .client-machine-card-head,
  body.customer-portal .support-ticket-main{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    gap:8px!important;
  }

  body.customer-portal .client-panel-head>div,
  body.customer-portal .client-machine-card-head>div,
  body.customer-portal .support-ticket-main>div{
    width:100%!important;
    min-width:0!important;
  }

  /* ---------- Dashboard ---------- */
  body.customer-portal .client-kpis{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
    width:100%!important;
  }

  body.customer-portal .client-kpi{
    width:100%!important;
    min-width:0!important;
    padding:13px!important;
  }

  body.customer-portal .client-kpi strong{
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .client-portal-alerts{
    display:grid!important;
    gap:8px!important;
  }

  body.customer-portal .client-alert{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    padding:12px!important;
  }

  body.customer-portal .client-alert-date{
    display:flex!important;
    justify-content:space-between!important;
    gap:8px!important;
    width:100%!important;
  }

  body.customer-portal .client-alert .btn{
    width:100%!important;
  }

  /* ---------- Generic forms ---------- */
  body.customer-portal .formgrid,
  body.customer-portal .grid,
  body.customer-portal .grid2,
  body.customer-portal .g2,
  body.customer-portal .g3,
  body.customer-portal .g4,
  body.customer-portal .wallet-form-grid,
  body.customer-portal .client-profile-grid,
  body.customer-portal .client-invite-basic{
    grid-template-columns:minmax(0,1fr)!important;
  }

  body.customer-portal .span2,
  body.customer-portal .span3,
  body.customer-portal .span4{
    grid-column:auto!important;
  }

  body.customer-portal input:not([type="checkbox"]):not([type="radio"]),
  body.customer-portal select,
  body.customer-portal textarea{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .field{
    min-width:0!important;
    width:100%!important;
  }

  /* ---------- Orders ---------- */
  body.customer-portal .order-summary{
    position:relative!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:6px!important;
    width:100%!important;
    min-width:0!important;
    padding:12px 42px 12px 12px!important;
  }

  body.customer-portal .order-summary>*{
    min-width:0!important;
    max-width:100%!important;
  }

  body.customer-portal .order-detail,
  body.customer-portal .order-loading-grid,
  body.customer-portal .order-loading-panel{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  body.customer-portal .sticky-actions{
    position:static!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
  }

  body.customer-portal .sticky-actions .btn{
    width:100%!important;
  }

  /* ---------- Wallet ---------- */
  body.customer-portal .wallet-owner-grid,
  body.customer-portal .wallet-order-items{
    grid-template-columns:1fr!important;
  }

  body.customer-portal .wallet-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  body.customer-portal .wallet-actions .btn{
    width:100%!important;
  }

  body.customer-portal .wallet-ledger-table{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  body.customer-portal .wallet-ledger-table table{
    width:100%!important;
    min-width:0!important;
  }

  /* ---------- Equipment ---------- */
  body.customer-portal .client-machine-grid{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    width:100%!important;
  }

  body.customer-portal .client-machine-meta{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:0!important;
  }

  body.customer-portal .client-machine-meta>div{
    display:flex!important;
    justify-content:space-between!important;
    gap:12px!important;
    padding:9px 0!important;
    border-bottom:1px solid #edf0f4!important;
  }

  body.customer-portal .client-machine-meta>div:last-child{
    border-bottom:0!important;
  }

  body.customer-portal .client-machine-meta b{
    text-align:right!important;
    overflow-wrap:anywhere!important;
  }

  /* ---------- Maintenance: no body horizontal scroll ---------- */
  body.customer-portal .client-table{
    overflow:visible!important;
    width:100%!important;
  }

  body.customer-portal .client-table table,
  body.customer-portal .client-table tbody{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .client-table thead{
    display:none!important;
  }

  body.customer-portal .client-table tr{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:0!important;
    width:100%!important;
    margin:0 0 10px!important;
    padding:10px 12px!important;
    border:1px solid #e4e7ec!important;
    border-radius:10px!important;
    background:#fff!important;
  }

  body.customer-portal .client-table td{
    display:grid!important;
    grid-template-columns:minmax(92px,36%) minmax(0,1fr)!important;
    align-items:start!important;
    gap:10px!important;
    width:100%!important;
    padding:7px 0!important;
    border:0!important;
    border-bottom:1px solid #f0f2f5!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .client-table td:last-child{
    border-bottom:0!important;
  }

  body.customer-portal .client-table td:nth-child(1)::before{content:"Data";font-weight:700;color:#667085}
  body.customer-portal .client-table td:nth-child(2)::before{content:"Equipamento";font-weight:700;color:#667085}
  body.customer-portal .client-table td:nth-child(3)::before{content:"Evento";font-weight:700;color:#667085}
  body.customer-portal .client-table td:nth-child(4)::before{content:"Fluxo / técnico";font-weight:700;color:#667085}
  body.customer-portal .client-table td:nth-child(5)::before{content:"Status";font-weight:700;color:#667085}

  body.customer-portal .client-table td.empty{
    display:block!important;
    padding:18px 0!important;
    text-align:center!important;
  }

  body.customer-portal .client-table td.empty::before{
    content:none!important;
  }

  /* ---------- Assistance ticket list ---------- */
  body.customer-portal .support-ticket-list{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    width:100%!important;
  }

  body.customer-portal .support-ticket-card{
    overflow:hidden!important;
  }

  body.customer-portal .support-ticket-main,
  body.customer-portal .support-ticket-meta,
  body.customer-portal .support-ticket-actions{
    padding-left:12px!important;
    padding-right:12px!important;
  }

  body.customer-portal .support-ticket-main h3,
  body.customer-portal .support-ticket-main p{
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .support-ticket-meta{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:0!important;
  }

  body.customer-portal .support-ticket-meta>div{
    display:grid!important;
    grid-template-columns:minmax(120px,42%) minmax(0,1fr)!important;
    gap:10px!important;
    padding:9px 0!important;
    border-bottom:1px solid #edf0f4!important;
  }

  body.customer-portal .support-ticket-meta>div:last-child{
    border-bottom:0!important;
  }

  body.customer-portal .support-ticket-meta b{
    text-align:right!important;
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .support-ticket-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
  }

  body.customer-portal .support-ticket-actions .btn{
    width:100%!important;
  }

  /* ---------- Chat / support modals: mobile first ---------- */
  body.customer-portal #modalRoot{
    overflow:hidden!important;
  }

  body.customer-portal #modalRoot .modal{
    max-width:calc(100vw - 12px)!important;
  }

  body.customer-portal #modalRoot .modal:has(.support-chat-shell),
  body.customer-portal #modalRoot .modal:has(.support-form-shell),
  body.customer-portal #modalRoot .modal:has(.support-close-modal),
  body.customer-portal #modalRoot .modal:has(.support-existing-modal){
    position:fixed!important;
    inset:6px!important;
    width:auto!important;
    max-width:none!important;
    height:calc(100dvh - 12px)!important;
    max-height:calc(100dvh - 12px)!important;
    margin:0!important;
    border-radius:12px!important;
  }

  body.customer-portal .support-chat-shell.client-invite-modal{
    height:100%!important;
    max-height:none!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
  }

  body.customer-portal .support-internal-modal.support-chat-shell{
    grid-template-rows:auto auto minmax(0,1fr) auto!important;
  }

  body.customer-portal .support-chat-header{
    padding:12px 13px 10px!important;
  }

  body.customer-portal .support-chat-header h3{
    font-size:18px!important;
    margin:1px 0 3px!important;
  }

  body.customer-portal .support-chat-header p{
    font-size:12px!important;
    line-height:1.3!important;
  }

  body.customer-portal .support-chat-stream-wrap{
    min-height:0!important;
    overflow:hidden!important;
  }

  body.customer-portal .support-thread{
    height:100%!important;
    min-height:0!important;
    padding:12px!important;
    overscroll-behavior:contain;
  }

  body.customer-portal .support-message{
    max-width:88%!important;
  }

  body.customer-portal .support-composer{
    padding:10px 12px 12px!important;
    gap:8px!important;
  }

  body.customer-portal .support-composer textarea{
    min-height:54px!important;
    max-height:112px!important;
  }

  body.customer-portal .support-composer-actions,
  body.customer-portal .support-composer-actions.internal{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr) auto!important;
    gap:7px!important;
  }

  body.customer-portal .support-composer-actions small{
    font-size:10px!important;
    line-height:1.25!important;
  }

  body.customer-portal .support-attach-button,
  body.customer-portal .support-composer-actions .btn{
    width:auto!important;
    min-width:72px!important;
  }

  body.customer-portal .support-form-shell .support-open-basic,
  body.customer-portal .support-close-basic{
    grid-template-columns:1fr!important;
    overflow-y:auto!important;
  }

  body.customer-portal .support-form-shell>.client-invite-actions,
  body.customer-portal .support-close-modal>.client-invite-actions,
  body.customer-portal .support-existing-modal>.client-invite-actions{
    margin-top:10px!important;
    padding:12px 14px!important;
    flex-wrap:wrap!important;
  }

  body.customer-portal .support-form-shell>.client-invite-actions .btn,
  body.customer-portal .support-close-modal>.client-invite-actions .btn{
    flex:1 1 140px!important;
  }

  /* ---------- Profile ---------- */
  body.customer-portal .client-profile-layout{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }

  body.customer-portal .client-data-list,
  body.customer-portal .client-data-list>div{
    width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .client-data-list dd{
    overflow-wrap:anywhere!important;
  }

  /* ---------- Users / access ---------- */
  body.customer-portal .client-admin-summary,
  body.customer-portal .client-member-main,
  body.customer-portal .client-member-card,
  body.customer-portal .client-team-empty{
    grid-template-columns:1fr!important;
    width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .client-member-main{
    display:grid!important;
    gap:9px!important;
  }

  body.customer-portal .client-member-contact{
    min-width:0!important;
  }

  body.customer-portal .client-member-contact span{
    display:block!important;
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .client-member-actions{
    width:100%!important;
  }

  body.customer-portal .client-member-actions .btn{
    width:100%!important;
  }

  body.customer-portal .client-role-shortcuts{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:7px!important;
  }

  body.customer-portal .client-role-shortcuts .btn{
    width:100%!important;
  }

  /* ---------- Modal base (all client modals) ---------- */
  body.customer-portal #modalRoot .modal{
    overflow-x:hidden!important;
  }

  body.customer-portal #modalRoot .modal>*{
    max-width:100%!important;
    min-width:0!important;
  }

  body.customer-portal .client-invite-modal{
    min-width:0!important;
    max-width:100%!important;
  }

  body.customer-portal .client-invite-modal-head,
  body.customer-portal .client-invite-basic,
  body.customer-portal .client-role-summary,
  body.customer-portal .client-invite-confirm,
  body.customer-portal .client-invite-actions{
    max-width:100%!important;
  }

  /* ---------- Long text / badges ---------- */
  body.customer-portal .maintenance-status,
  body.customer-portal .client-count{
    max-width:100%!important;
    white-space:normal!important;
  }

  body.customer-portal .notice,
  body.customer-portal .muted,
  body.customer-portal p,
  body.customer-portal small,
  body.customer-portal b,
  body.customer-portal span,
  body.customer-portal dd{
    overflow-wrap:anywhere;
  }

  /* ---------- Toast ---------- */
  body.customer-portal .portal-toast-wrap{
    left:10px!important;
    right:10px!important;
    bottom:10px!important;
  }

  body.customer-portal .portal-toast{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
}

@media (max-width:520px){
  body.customer-portal .client-kpis{
    grid-template-columns:1fr!important;
  }

  body.customer-portal .amica-content{
    padding-left:8px!important;
    padding-right:8px!important;
  }

  body.customer-portal .client-page-head h2,
  body.customer-portal .wallet-page-head h2,
  body.customer-portal #content>h2{
    font-size:20px!important;
  }

  body.customer-portal .support-composer-actions,
  body.customer-portal .support-composer-actions.internal{
    grid-template-columns:auto minmax(0,1fr) auto!important;
  }

  body.customer-portal .support-composer-actions small{
    display:none!important;
  }

  body.customer-portal .support-attach-button{
    min-width:70px!important;
  }

  body.customer-portal .support-composer-actions .btn.primary{
    min-width:68px!important;
  }

  body.customer-portal .client-table td{
    grid-template-columns:92px minmax(0,1fr)!important;
  }

  body.customer-portal .support-ticket-meta>div{
    grid-template-columns:110px minmax(0,1fr)!important;
  }
}
