
/* V12.5.38 — CLIENT MOBILE COMPOSITION SYSTEM
   Mobile is treated as its own composition of the SAME design system.
   Scope: customer portal <= 900px. Desktop/internal desktop unchanged. */

.amica-mobile-topbar{display:none}

@media (max-width:900px){
  /* ---------- Real mobile app bar ---------- */
  .amica-shell{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:56px minmax(0,1fr)!important;
    width:100%!important;
    min-width:0!important;
    min-height:100dvh!important;
  }

  .amica-mobile-topbar{
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    gap:12px!important;
    width:100%!important;
    height:56px!important;
    min-height:56px!important;
    padding:8px 12px!important;
    background:#f4f6f8!important;
    border-bottom:1px solid #dde3ea!important;
    position:sticky!important;
    top:0!important;
    z-index:35!important;
    box-sizing:border-box!important;
  }

  .amica-mobile-nav-toggle{
    position:static!important;
    inset:auto!important;
    display:inline-flex!important;
    flex:0 0 42px!important;
    width:42px!important;
    min-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    margin:0!important;
    border-radius:10px!important;
    background:#fff!important;
    border:1px solid #cfd7e2!important;
    box-shadow:0 1px 2px rgba(16,24,40,.04)!important;
  }

  .amica-mobile-page-title{
    display:block!important;
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:19px!important;
    line-height:1.2!important;
    font-weight:700!important;
    color:#172033!important;
    letter-spacing:-.015em!important;
  }

  .amica-main{
    grid-column:1!important;
    grid-row:2!important;
    width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
  }

  body.customer-portal .amica-content{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    padding:12px 12px 28px!important;
    margin:0!important;
    overflow-x:hidden!important;
  }

  /* ---------- No duplicate desktop title on mobile ---------- */
  body.customer-portal .client-page-head h2,
  body.customer-portal .wallet-page-head h2,
  body.customer-portal #content>h2:first-child{
    display:none!important;
  }

  body.customer-portal #content>h2:first-child + p.sub{
    display:none!important;
  }

  /* ---------- Compact operational page header ---------- */
  body.customer-portal .client-page-head,
  body.customer-portal .wallet-page-head{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    gap:9px!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    padding:0!important;
    margin:0 0 12px!important;
  }

  body.customer-portal .client-page-head>div,
  body.customer-portal .wallet-page-head>div{
    display:grid!important;
    gap:0!important;
    width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    padding:0!important;
    margin:0!important;
  }

  body.customer-portal .client-page-head p,
  body.customer-portal .wallet-page-head p{
    width:100%!important;
    max-width:none!important;
    min-height:0!important;
    padding:0!important;
    margin:0!important;
    font-size:13px!important;
    line-height:1.4!important;
    color:#667085!important;
  }

  body.customer-portal .client-page-head p:empty,
  body.customer-portal .wallet-page-head p:empty{
    display:none!important;
  }

  body.customer-portal .client-page-actions,
  body.customer-portal .page-head-actions{
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    gap:8px!important;
    width:100%!important;
    margin:0!important;
  }

  body.customer-portal .client-page-actions .btn,
  body.customer-portal .client-page-head>.btn{
    flex:1 1 150px!important;
    width:auto!important;
    min-height:40px!important;
    height:auto!important;
    padding:9px 12px!important;
    white-space:normal!important;
  }

  /* ---------- KPI composition ---------- */
  body.customer-portal .client-kpis{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:9px!important;
    width:100%!important;
    margin:0 0 12px!important;
  }

  body.customer-portal .client-kpi{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:
      "label action"
      "value action"
      "meta action"!important;
    column-gap:12px!important;
    row-gap:3px!important;
    align-items:center!important;
    width:100%!important;
    min-height:0!important;
    padding:13px 14px!important;
  }

  body.customer-portal .client-kpi>span:first-child{
    grid-area:label!important;
  }

  body.customer-portal .client-kpi>strong{
    grid-area:value!important;
    font-size:24px!important;
    line-height:1.05!important;
    overflow-wrap:anywhere!important;
  }

  body.customer-portal .client-kpi>small{
    grid-area:meta!important;
    margin:0!important;
  }

  body.customer-portal .client-kpi>.btn{
    grid-area:action!important;
    align-self:center!important;
    width:auto!important;
    min-width:88px!important;
  }

  /* If a KPI contains long descriptive content, keep it readable. */
  body.customer-portal .client-kpi span,
  body.customer-portal .client-kpi small{
    max-width:100%!important;
    overflow-wrap:anywhere!important;
  }

  /* ---------- Panels ---------- */
  body.customer-portal .client-panel,
  body.customer-portal .wallet-section,
  body.customer-portal .client-machine-card,
  body.customer-portal .support-ticket-card{
    margin-bottom:10px!important;
    border-radius:12px!important;
    overflow:hidden!important;
  }

  body.customer-portal .client-panel-head,
  body.customer-portal .wallet-section-head{
    display:flex!important;
    flex-direction:row!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:10px!important;
    padding:14px!important;
  }

  body.customer-portal .client-panel-head>div{
    min-width:0!important;
  }

  body.customer-portal .client-panel-head h3,
  body.customer-portal .wallet-section-head h3{
    margin:0 0 3px!important;
    font-size:18px!important;
    line-height:1.25!important;
  }

  body.customer-portal .client-panel-head p,
  body.customer-portal .wallet-section-head p{
    margin:0!important;
    font-size:12.5px!important;
    line-height:1.35!important;
  }

  /* ---------- Assistance / access: remove landing-page spacing ---------- */
  body.customer-portal .support-ticket-list{
    margin-top:0!important;
  }

  body.customer-portal .client-admin-panel{
    margin-top:0!important;
  }

  body.customer-portal .client-admin-summary{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:0!important;
    padding:0 14px 12px!important;
  }

  body.customer-portal .client-admin-summary>div{
    display:grid!important;
    grid-template-columns:105px minmax(0,1fr)!important;
    gap:10px!important;
    align-items:start!important;
    padding:10px 0!important;
    border-bottom:1px solid #edf0f4!important;
  }

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

  body.customer-portal .client-admin-summary small{
    margin:0!important;
    color:#667085!important;
  }

  body.customer-portal .client-admin-summary b,
  body.customer-portal .client-admin-summary span{
    overflow-wrap:anywhere!important;
  }

  /* ---------- Profile: preserve the good compact pattern ---------- */
  body.customer-portal .client-profile-layout{
    gap:10px!important;
  }

  body.customer-portal .client-data-list{
    padding:0 14px 12px!important;
  }

  body.customer-portal .client-data-list>div{
    grid-template-columns:120px minmax(0,1fr)!important;
    gap:10px!important;
    padding:10px 0!important;
  }

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

  /* ---------- Equipment ---------- */
  body.customer-portal .client-machine-card{
    padding:0!important;
  }

  body.customer-portal .client-machine-card-head{
    padding:14px!important;
  }

  body.customer-portal .client-machine-meta{
    padding:0 14px 10px!important;
  }

  /* ---------- Maintenance stays dense/readable ---------- */
  body.customer-portal .client-table tr{
    margin:0!important;
    padding:11px 13px!important;
    border-width:0 0 1px!important;
    border-radius:0!important;
  }

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

  /* ---------- Orders / wallet: vertical first on phone ---------- */
  body.customer-portal .wallet-owner-grid,
  body.customer-portal .wallet-order-items{
    grid-template-columns:1fr!important;
  }

  body.customer-portal .wallet-balance-card{
    margin-bottom:10px!important;
  }

  body.customer-portal .wallet-section{
    margin-bottom:10px!important;
  }

  /* ---------- Support cards ---------- */
  body.customer-portal .support-ticket-main{
    padding:14px!important;
  }

  body.customer-portal .support-ticket-main h3{
    font-size:18px!important;
    margin:2px 0 5px!important;
  }

  body.customer-portal .support-ticket-main p{
    font-size:12.5px!important;
    line-height:1.4!important;
  }

  body.customer-portal .support-ticket-meta{
    padding:0 14px!important;
  }

  body.customer-portal .support-ticket-actions{
    padding:12px 14px 14px!important;
  }

  /* ---------- Chat: compact app-like mobile shell ---------- */
  body.customer-portal #modalRoot .modal:has(.support-chat-shell){
    inset:4px!important;
    width:auto!important;
    height:calc(100dvh - 8px)!important;
    max-height:calc(100dvh - 8px)!important;
    border-radius:12px!important;
  }

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

  body.customer-portal .support-chat-header h3{
    font-size:17px!important;
  }

  body.customer-portal .support-chat-header p{
    font-size:11.5px!important;
  }

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

  body.customer-portal .support-message{
    max-width:90%!important;
    padding:9px 10px!important;
  }

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

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

  /* ---------- 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-invite-basic{
    grid-template-columns:1fr!important;
  }

  /* ---------- Never allow document-level sideways movement ---------- */
  body.customer-portal,
  body.customer-portal .amica-shell,
  body.customer-portal .amica-main,
  body.customer-portal .amica-content,
  body.customer-portal #content{
    max-width:100%!important;
    overflow-x:hidden!important;
  }

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

@media (min-width:761px) and (max-width:900px){
  body.customer-portal .client-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media (max-width:760px){
  /* One KPI per row on actual phone widths. */
  body.customer-portal .client-kpis{
    grid-template-columns:1fr!important;
  }

  body.customer-portal .client-kpi{
    grid-template-columns:minmax(0,1fr) auto!important;
  }

  /* Primary page action stays prominent but not detached from its context. */
  body.customer-portal .client-page-actions .btn.primary,
  body.customer-portal .client-page-head>.btn.primary{
    flex-basis:100%!important;
  }
}

@media (max-width:430px){
  .amica-mobile-page-title{
    font-size:18px!important;
  }

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

  body.customer-portal .client-panel-head,
  body.customer-portal .wallet-section-head{
    padding:13px!important;
  }

  body.customer-portal .client-admin-summary,
  body.customer-portal .client-data-list{
    padding-left:13px!important;
    padding-right:13px!important;
  }

  body.customer-portal .client-admin-summary>div,
  body.customer-portal .client-data-list>div{
    grid-template-columns:96px minmax(0,1fr)!important;
  }
}
