@media (max-width: 560px){
  /* Portfolio mobile: money and holdings first */
  body{padding-bottom:24px}
  .wrap{padding-left:10px!important;padding-right:10px!important;display:flex!important;flex-direction:column!important;gap:10px!important}

  /* Keep secondary trading-room market blocks out of the way */
  #proDesk{display:none!important}
  #proPortfolioPanel{display:none!important}

  /* Summary: only balance + unrealized P&L */
  #summary{order:1!important;display:grid!important;grid-template-columns:1fr!important;gap:8px!important;padding:12px!important;margin:0!important}
  #summary>div{padding:11px!important;border:1px solid #dfe7f1;border-radius:14px;background:#fff}
  #summary>div:first-child{background:#f7fbff!important}
  #summary>div:first-child .muted{font-size:13px!important}
  #summary>div:first-child>div:nth-child(2){font-size:31px!important;line-height:1.05!important}
  #summary>div:nth-child(3),#summary>div:nth-child(4),#summary>div:nth-child(5),#summary>div:nth-child(6){display:none!important}

  /* Flatten desktop wrappers so the mobile order is deliberate */
  .grid3,.grid2,.grid2>aside{display:contents!important}
  .tableCard{order:2!important}                  /* positions */
  .grid3>section:nth-child(2){order:3!important} /* allocation */
  .grid3>section:nth-child(1){order:4!important} /* performance */
  .grid3>section:nth-child(3){order:5!important} /* goals */
  .grid2>aside>section:nth-child(1){order:6!important} /* activity */
  .grid2>aside>section:nth-child(2){order:7!important;margin-top:0!important} /* journal */
  .footerNote{order:8!important;margin-top:0!important}

  .section{padding:14px!important;margin:0!important}
  .section h2,.section h3{margin-bottom:12px!important;font-size:22px!important}

  /* Positions: compact stacked cards */
  .tableCard{overflow:visible!important;padding:12px!important;margin:0!important}
  .tabs{overflow-x:auto!important;white-space:nowrap!important;margin-bottom:8px!important}
  .tableCard table,.tableCard thead,.tableCard tbody,.tableCard tr,.tableCard td{display:block!important;width:100%!important;min-width:0!important}
  .tableCard thead{display:none!important}
  .tableCard tr{border:1px solid #dfe7f1!important;border-radius:16px!important;padding:10px 12px!important;margin:8px 0!important;background:#fff!important}
  .tableCard td{display:flex!important;justify-content:space-between!important;gap:12px!important;padding:4px 0!important;border:0!important;font-size:13px!important;text-align:right!important}
  .tableCard td:before{font-weight:800!important;color:#687990!important;text-align:left!important}
  .tableCard td:nth-child(1):before{content:'Instrument'}
  .tableCard td:nth-child(2):before{content:'Type'}
  .tableCard td:nth-child(3):before{content:'Quantité'}
  .tableCard td:nth-child(4):before{content:"Prix d'entrée"}
  .tableCard td:nth-child(5):before{content:'Prix actuel'}
  .tableCard td:nth-child(6):before{content:'P&L'}
  .tableCard td:nth-child(7):before{content:'Action'}
  .tableCard td[colspan]{display:block!important;text-align:left!important}
  .tableCard td[colspan]:before{content:none!important}
  .tableCard .pillBtn{width:100%!important;min-height:38px!important;margin-top:3px!important}

  /* Allocation and analytics come after holdings */
  .donut{width:170px!important;height:170px!important;margin:8px auto 10px!important}
  .grid3>section:nth-child(2)>div:last-child{font-size:13px!important;line-height:1.65!important}
  .toolbar{display:block!important}
  .toolbar h2{margin-bottom:10px!important}
  .times{display:flex!important;gap:7px!important;overflow-x:auto!important;padding-bottom:2px}
  .times .pillBtn{min-width:52px!important;min-height:42px!important}
  .chart{height:190px!important}
  .statusBox{font-size:12px!important;padding:9px!important}
  .rank{padding:9px 0!important;min-height:auto!important}
  .grid3>section:nth-child(3) .cta{margin-top:8px!important;min-height:46px!important}

  /* Activity and journal stay secondary */
  .grid2>aside .section{padding:13px!important}
  #journal{min-height:110px!important}
  #saveNote{min-height:46px!important}
}
