/* RTS Nexus 2.1.99 - Mobile app force UX.
   Desktop invariato: regole attive solo sotto 768px. */
.mobile-app-bottom-nav{display:none}

@media (max-width:767.98px){
  html,body{max-width:100%;overflow-x:hidden}
  body.nexus-body,
  body.nexus-mobile-app{background:#f4f6fb!important;color:#0f172a;-webkit-tap-highlight-color:transparent;overscroll-behavior-y:contain}
  .nexus-shell{display:block!important;min-height:100dvh!important;background:#f4f6fb!important}
  .nexus-sidebar,
  .sidebar-backdrop,
  [data-sidebar-open]{display:none!important}
  .nexus-main{margin-left:0!important;width:100%!important;min-width:0!important;background:#f4f6fb!important}
  .nexus-topbar{position:sticky!important;top:0!important;z-index:1030!important;min-height:58px!important;padding:calc(env(safe-area-inset-top,0px) + 8px) 12px 8px!important;background:rgba(255,255,255,.96)!important;backdrop-filter:blur(18px)!important;border-bottom:1px solid rgba(226,232,240,.95)!important;box-shadow:0 8px 24px rgba(15,23,42,.06)!important}
  .page-title{font-size:1.05rem!important;max-width:calc(100vw - 112px)!important;letter-spacing:-.02em!important}
  .page-subtitle{display:none!important}
  .topbar-actions{gap:8px!important}
  .topbar-new-request,.topbar-user{display:none!important}
  .topbar-notification{width:42px!important;height:42px!important;border-radius:16px!important;box-shadow:none!important;background:#f8fafc!important}
  .topbar-notification .notification-dot{top:-4px!important;right:-4px!important}
  .nexus-content{padding:12px 12px calc(90px + env(safe-area-inset-bottom,0px))!important;max-width:100vw!important;overflow-x:hidden!important}

  .mobile-app-bottom-nav{display:flex!important;position:fixed!important;left:10px!important;right:10px!important;bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;z-index:1040!important;min-height:64px!important;align-items:center!important;justify-content:space-around!important;gap:8px!important;padding:8px!important;border:1px solid rgba(226,232,240,.98)!important;border-radius:26px!important;background:rgba(255,255,255,.97)!important;backdrop-filter:blur(20px)!important;box-shadow:0 18px 46px rgba(15,23,42,.18)!important}
  .mobile-app-nav-item{flex:1!important;min-width:0!important;min-height:48px!important;border-radius:20px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;color:#64748b!important;text-decoration:none!important;font-size:.72rem!important;font-weight:800!important;line-height:1!important}
  .mobile-app-nav-item i{font-size:1.25rem!important;line-height:1!important}
  .mobile-app-nav-item.active{background:#eff6ff!important;color:#0d6efd!important}
  .mobile-app-nav-primary{flex:0 0 76px!important;background:#0d6efd!important;color:#fff!important;box-shadow:0 10px 24px rgba(13,110,253,.28)!important}
  .mobile-app-nav-primary i{font-size:1.45rem!important}

  .card,.nx-card,.requests-card,.request-card,.request-hero{border-radius:22px!important;border-color:#e8eef6!important;box-shadow:0 12px 32px rgba(15,23,42,.07)!important}
  .card-body,.nx-card-body{padding:14px!important}
  .btn{min-height:42px!important;border-radius:14px!important;font-weight:800!important}
  .form-control,.form-select{min-height:46px!important;border-radius:14px!important;font-size:16px!important}
  textarea.form-control{min-height:118px!important}

  /* Dashboard mobile reale */
  .nx-dashboard .nx-page-head{margin-bottom:12px!important;gap:10px!important}
  .nx-dashboard .nx-page-head h1{font-size:1.45rem!important;margin-bottom:0!important;letter-spacing:-.035em!important}
  .nx-dashboard .nx-page-head .text-muted{display:none!important}
  .nx-dashboard .nx-page-head .d-flex{width:100%!important;display:grid!important;grid-template-columns:1fr!important}
  .nx-dashboard .nx-page-head a[href*="/pipeline"],
  .nx-dashboard .nx-page-head a[href*="/reports"]{display:none!important}
  .nx-dashboard .row.g-3.mb-3{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;margin-bottom:12px!important}
  .nx-dashboard .row.g-3.mb-3>[class*="col-"]{width:100%!important;max-width:100%!important;padding:0!important;flex:none!important}
  .kpi-card{height:100%!important;min-height:104px!important;padding:14px!important;border-radius:22px!important;background:#fff!important}
  .kpi-label{font-size:.67rem!important;line-height:1.05!important;letter-spacing:.045em!important}
  .kpi-value{font-size:1.45rem!important;margin-top:7px!important;letter-spacing:-.04em!important}
  .kpi-icon{width:34px!important;height:34px!important;border-radius:13px!important;font-size:1rem!important;opacity:.9!important}
  .nx-card-head{padding:14px!important;border-bottom:1px solid #eef2f7!important}
  .nx-card-head .btn,.nx-card-head a[href*="/reports"]{display:none!important}
  .month-bars{height:150px!important;gap:7px!important;padding-top:12px!important;margin-bottom:22px!important;overflow:hidden!important}
  .month-bar{min-width:20px!important;border-radius:9px 9px 0 0!important}
  .bar-row{grid-template-columns:96px 1fr 32px!important;gap:8px!important;margin-bottom:10px!important}
  .mini-request{padding:12px 0!important}
  .mini-title{font-size:.94rem!important;line-height:1.18!important}
  .mini-meta{font-size:.77rem!important}

  /* Richieste mobile reale */
  .requests-page .requests-head{margin-bottom:10px!important;gap:10px!important}
  .requests-page .requests-head h1{font-size:1.45rem!important;margin-bottom:0!important;letter-spacing:-.035em!important}
  .requests-page .requests-head .text-muted{display:none!important}
  .requests-page .requests-head .btn{display:none!important}
  .requests-filter{position:sticky!important;top:60px!important;z-index:1010!important;margin:0 0 12px!important;padding:10px!important;border-radius:22px!important;background:rgba(255,255,255,.96)!important;backdrop-filter:blur(16px)!important;box-shadow:0 10px 28px rgba(15,23,42,.08)!important}
  .requests-filter .form-label{font-size:.72rem!important;text-transform:uppercase!important;letter-spacing:.04em!important;color:#64748b!important;font-weight:900!important;margin-bottom:4px!important}
  .requests-filter .row{--bs-gutter-x:.5rem!important;--bs-gutter-y:.5rem!important}
  .requests-filter .col-12.col-xl-4{flex:0 0 100%!important;max-width:100%!important;width:100%!important}
  .requests-filter .col-6{flex:0 0 50%!important;max-width:50%!important;width:50%!important}
  .requests-filter .col-12.col-xl-2{flex:0 0 100%!important;max-width:100%!important;width:100%!important}
  .requests-filter .switch-apple{padding:8px 2px!important;margin:0!important}
  .requests-table-wrap,.table-responsive:has(.requests-table){display:none!important}
  .request-mobile-list{display:grid!important;gap:10px!important}
  .request-mobile-card{display:block!important;border:1px solid #e8eef6!important;border-radius:22px!important;background:#fff!important;padding:14px!important;text-decoration:none!important;color:#0f172a!important;box-shadow:0 10px 26px rgba(15,23,42,.07)!important}
  .request-mobile-card:active{transform:scale(.992)!important}
  .request-mobile-card .fw-bold{font-size:.78rem!important;color:#0d6efd!important;letter-spacing:.02em!important}
  .request-mobile-card .fw-semibold{font-size:1.02rem!important;line-height:1.18!important;letter-spacing:-.02em!important}
  .request-mobile-card .badge{border-radius:999px!important;white-space:normal!important;text-align:right!important;line-height:1.1!important}
  .mobile-meta{display:flex!important;gap:6px!important;overflow-x:auto!important;margin-top:10px!important;padding-bottom:2px!important;scrollbar-width:none!important}
  .mobile-meta::-webkit-scrollbar{display:none!important}
  .meta-chip{flex:0 0 auto!important;display:inline-flex!important;align-items:center!important;gap:5px!important;min-height:30px!important;border-radius:999px!important;background:#f1f5f9!important;color:#334155!important;padding:5px 9px!important;font-size:.76rem!important;font-weight:800!important}
  .meta-chip i{color:#64748b!important}

  /* Dettaglio richiesta e form */
  .request-page .row.g-3{--bs-gutter-x:.75rem!important;--bs-gutter-y:.75rem!important}
  .request-page h1,.request-page .h3{font-size:1.35rem!important;letter-spacing:-.035em!important}
  .request-kpi{padding:12px!important;border-radius:18px!important;box-shadow:none!important}
  .request-kpi .label{font-size:.67rem!important}
  .request-kpi .value{font-size:.92rem!important}
  .sticky-actions{position:static!important}
  .action-stack{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}
  .action-stack .btn{justify-content:center!important;font-size:.86rem!important;padding-left:8px!important;padding-right:8px!important}
  .nav-request-tabs{display:flex!important;gap:6px!important;overflow-x:auto!important;flex-wrap:nowrap!important;padding-bottom:4px!important;scrollbar-width:none!important}
  .nav-request-tabs::-webkit-scrollbar{display:none!important}
  .nav-request-tabs .nav-item{flex:0 0 auto!important}
  .nav-request-tabs .nav-link{border-radius:999px!important;white-space:nowrap!important;padding:8px 12px!important;font-size:.82rem!important}
  .comm-layout{display:block!important;min-height:0!important}
  .comm-list{display:flex!important;gap:8px!important;overflow-x:auto!important;max-height:none!important;border-right:0!important;border-bottom:1px solid #e8eef6!important;padding:8px!important;background:#f8fafc!important;scrollbar-width:none!important}
  .comm-list::-webkit-scrollbar{display:none!important}
  .comm-item{flex:0 0 260px!important;border:1px solid #e8eef6!important;border-radius:16px!important;background:#fff!important;padding:10px!important}
  .comm-item.active{box-shadow:inset 0 0 0 2px #0d6efd!important}
  .mail-meta{padding:12px!important}
  .mail-frame-wrap{padding:8px!important}
  .mail-frame{min-height:380px!important;border-radius:16px!important}
  .info-row{display:block!important;padding:9px 0!important}
  .info-row .val{text-align:left!important;margin-top:2px!important}
  form.card{border-radius:22px!important;overflow:hidden!important}
  form.card .card-footer{position:sticky!important;bottom:calc(74px + env(safe-area-inset-bottom,0px))!important;z-index:1020!important;display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;padding:10px!important;background:rgba(255,255,255,.96)!important;backdrop-filter:blur(14px)!important}
  #clientSearchPanel{padding:10px!important;border-radius:18px!important}
  #clientSearchPanel .input-group{display:grid!important;grid-template-columns:42px 1fr!important;gap:6px!important}
  #clientSearchPanel .input-group .btn{grid-column:1 / -1!important;width:100%!important}
  #clientSelect{height:auto!important;min-height:150px!important}
  .accordion-button{border-radius:16px!important;font-weight:800!important}
}


/* RTS Nexus 2.2.00 - Mobile user menu */
.mobile-app-more{display:none}
@media (max-width:767.98px){
  .mobile-app-bottom-nav{gap:6px!important;padding:8px!important}
  .mobile-app-bottom-nav .mobile-app-more{display:block!important;flex:1!important;min-width:0!important;position:relative!important}
  .mobile-app-more-button{width:100%!important;border:0!important;background:transparent!important;appearance:none!important;-webkit-appearance:none!important;padding:0!important;margin:0!important}
  .mobile-app-more-button.active{background:#eff6ff!important;color:#0d6efd!important}
  .mobile-app-more .dropdown-toggle::after{display:none!important}
  .mobile-app-more-menu{position:absolute!important;right:0!important;bottom:64px!important;left:auto!important;min-width:min(286px,calc(100vw - 28px))!important;border:1px solid rgba(226,232,240,.98)!important;border-radius:22px!important;padding:8px!important;background:#fff!important;box-shadow:0 18px 46px rgba(15,23,42,.18)!important;overflow:hidden!important}
  .mobile-app-more-user{max-width:100%!important}
  .mobile-app-more-menu .dropdown-item{min-height:46px!important;border-radius:14px!important;display:flex!important;align-items:center!important;font-size:.95rem!important;font-weight:800!important;color:#0f172a!important}
  .mobile-app-more-menu .dropdown-item:active,.mobile-app-more-menu .dropdown-item:hover{background:#f1f5f9!important;color:#0d6efd!important}
  .mobile-app-more-menu .dropdown-item.text-danger{color:#dc3545!important}
  .mobile-app-more-menu .dropdown-item.text-danger:hover{background:#fff1f2!important;color:#b91c1c!important}
  .mobile-app-more-menu .dropdown-divider{margin:6px 0!important;border-color:#eef2f7!important}
  .mobile-app-nav-primary{flex-basis:auto!important}
}


/* RTS Nexus 2.2.02 - Mobile bottom nav balance */
@media (max-width:767.98px){
  .mobile-app-bottom-nav{
    justify-content:space-between!important;
    gap:4px!important;
    padding:8px 10px!important;
  }
  .mobile-app-bottom-nav > .mobile-app-nav-item,
  .mobile-app-bottom-nav > .mobile-app-more{
    min-width:0!important;
  }
  .mobile-app-bottom-nav > .mobile-app-nav-item{
    flex:1 1 0!important;
  }
  .mobile-app-bottom-nav .mobile-app-more{
    flex:0 0 54px!important;
    width:54px!important;
    max-width:54px!important;
  }
  .mobile-app-nav-item{
    min-height:46px!important;
    border-radius:16px!important;
    gap:2px!important;
    font-size:.69rem!important;
    padding:4px 2px!important;
  }
  .mobile-app-nav-item i{
    font-size:1.18rem!important;
  }
  .mobile-app-nav-primary{
    flex:0 0 62px!important;
    width:62px!important;
    min-width:62px!important;
    min-height:54px!important;
    border-radius:18px!important;
  }
  .mobile-app-nav-primary i{
    font-size:1.34rem!important;
  }
  .mobile-app-more-button{
    min-height:46px!important;
    border-radius:16px!important;
    justify-content:center!important;
  }
  .mobile-app-more-button span{
    display:none!important;
  }
  .mobile-app-more-button i{
    font-size:1.28rem!important;
  }
  .mobile-app-more-menu{
    bottom:60px!important;
  }
}


/* RTS Nexus 2.2.05 - Ripristino mobile stabile + barra inferiore sempre fissa */
@media (max-width:767.98px){
  html,
  body{
    min-height:100%!important;
    overflow-x:hidden!important;
  }

  body.nexus-body{
    padding-bottom:calc(86px + env(safe-area-inset-bottom,0px))!important;
  }

  .nexus-shell{
    min-height:100svh!important;
    overflow:visible!important;
  }

  .nexus-main,
  .nexus-content{
    overflow:visible!important;
  }

  .nexus-content{
    padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))!important;
  }

  .mobile-app-bottom-nav{
    display:flex!important;
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
    top:auto!important;
    z-index:2147483000!important;
    transform:translate3d(0,0,0)!important;
    -webkit-transform:translate3d(0,0,0)!important;
    backface-visibility:hidden!important;
    -webkit-backface-visibility:hidden!important;
    will-change:transform!important;
    pointer-events:auto!important;
  }

  .mobile-app-bottom-nav *{
    pointer-events:auto!important;
  }

  .mobile-app-bottom-nav.is-scrolling,
  .mobile-app-bottom-nav.scrolled,
  body .mobile-app-bottom-nav{
    position:fixed!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
  }

  /* Ripristino vista comunicazioni cliente precedente: annulla i tentativi 2.2.03/2.2.04 */
  .comm-layout{
    display:block!important;
    min-height:0!important;
  }

  .comm-list{
    display:flex!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    max-height:none!important;
    border-right:0!important;
    border-bottom:1px solid #e8eef6!important;
    padding:8px!important;
    background:#f8fafc!important;
    scrollbar-width:none!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .comm-list::-webkit-scrollbar{
    display:none!important;
  }

  .comm-item{
    flex:0 0 260px!important;
    width:auto!important;
    max-width:260px!important;
    min-width:260px!important;
    border:1px solid #e8eef6!important;
    border-radius:16px!important;
    background:#fff!important;
    padding:10px!important;
  }

  .comm-item.active{
    box-shadow:inset 0 0 0 2px #0d6efd!important;
  }

  .mail-meta{
    padding:12px!important;
  }

  .mail-frame-wrap{
    padding:8px!important;
  }

  .mail-frame{
    min-height:380px!important;
    border-radius:16px!important;
  }
}


/* RTS Nexus 2.2.07 - Ripristino prima versione Richieste mobile ottimizzata.
   Annulla la 2.2.06 che riportava Richieste in desktop/responsive. */
@media (max-width:767.98px){
  body.nexus-body.nexus-requests-desktop-mobile{
    padding-bottom:calc(86px + env(safe-area-inset-bottom,0px))!important;
  }

  .requests-page .requests-head{
    margin-bottom:10px!important;
    gap:10px!important;
  }

  .requests-page .requests-head h1{
    font-size:1.45rem!important;
    margin-bottom:0!important;
    letter-spacing:-.035em!important;
  }

  .requests-page .requests-head .text-muted{
    display:none!important;
  }

  .requests-page .requests-head .btn{
    display:none!important;
  }

  .requests-filter{
    position:sticky!important;
    top:60px!important;
    z-index:1010!important;
    margin:0 0 12px!important;
    padding:10px!important;
    border-radius:22px!important;
    background:rgba(255,255,255,.96)!important;
    backdrop-filter:blur(16px)!important;
    box-shadow:0 10px 28px rgba(15,23,42,.08)!important;
  }

  .requests-filter .form-label{
    font-size:.72rem!important;
    text-transform:uppercase!important;
    letter-spacing:.04em!important;
    color:#64748b!important;
    font-weight:900!important;
    margin-bottom:4px!important;
  }

  .requests-filter .row{
    --bs-gutter-x:.5rem!important;
    --bs-gutter-y:.5rem!important;
  }

  .requests-filter .col-12.col-xl-4{
    flex:0 0 100%!important;
    max-width:100%!important;
    width:100%!important;
  }

  .requests-filter .col-6{
    flex:0 0 50%!important;
    max-width:50%!important;
    width:50%!important;
  }

  .requests-filter .col-12.col-xl-2{
    flex:0 0 100%!important;
    max-width:100%!important;
    width:100%!important;
  }

  .requests-filter .switch-apple{
    padding:8px 2px!important;
    margin:0!important;
  }

  .requests-table-wrap,
  .table-responsive:has(.requests-table){
    display:none!important;
  }

  .request-mobile-list{
    display:grid!important;
    gap:10px!important;
  }

  .request-mobile-card{
    display:block!important;
    border:1px solid #e8eef6!important;
    border-radius:22px!important;
    background:#fff!important;
    padding:14px!important;
    text-decoration:none!important;
    color:#0f172a!important;
    box-shadow:0 10px 26px rgba(15,23,42,.07)!important;
  }

  .request-mobile-card:active{
    transform:scale(.992)!important;
  }

  .request-mobile-card .fw-bold{
    font-size:.78rem!important;
    color:#0d6efd!important;
    letter-spacing:.02em!important;
  }

  .request-mobile-card .fw-semibold{
    font-size:1.02rem!important;
    line-height:1.18!important;
    letter-spacing:-.02em!important;
  }

  .request-mobile-card .badge{
    border-radius:999px!important;
    white-space:normal!important;
    text-align:right!important;
    line-height:1.1!important;
  }

  .mobile-meta{
    display:flex!important;
    gap:6px!important;
    overflow-x:auto!important;
    margin-top:10px!important;
    padding-bottom:2px!important;
    scrollbar-width:none!important;
  }

  .mobile-meta::-webkit-scrollbar{
    display:none!important;
  }

  .meta-chip{
    flex:0 0 auto!important;
    display:inline-flex!important;
    align-items:center!important;
    gap:5px!important;
    min-height:30px!important;
    border-radius:999px!important;
    background:#f1f5f9!important;
    color:#334155!important;
    padding:5px 9px!important;
    font-size:.76rem!important;
    font-weight:800!important;
  }

  .meta-chip i{
    color:#64748b!important;
  }

  .request-page .row.g-3{
    --bs-gutter-x:.75rem!important;
    --bs-gutter-y:.75rem!important;
  }

  .request-page h1,
  .request-page .h3{
    font-size:1.35rem!important;
    letter-spacing:-.035em!important;
  }

  .request-kpi{
    padding:12px!important;
    border-radius:18px!important;
    box-shadow:none!important;
  }

  .request-kpi .label{
    font-size:.67rem!important;
  }

  .request-kpi .value{
    font-size:.92rem!important;
  }

  .sticky-actions{
    position:static!important;
  }

  .action-stack{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
  }

  .action-stack .btn{
    justify-content:center!important;
    font-size:.86rem!important;
    padding-left:8px!important;
    padding-right:8px!important;
  }

  .nav-request-tabs{
    display:flex!important;
    gap:6px!important;
    overflow-x:auto!important;
    flex-wrap:nowrap!important;
    padding-bottom:4px!important;
    scrollbar-width:none!important;
  }

  .nav-request-tabs::-webkit-scrollbar{
    display:none!important;
  }

  .nav-request-tabs .nav-item{
    flex:0 0 auto!important;
  }

  .nav-request-tabs .nav-link{
    border-radius:999px!important;
    white-space:nowrap!important;
    padding:8px 12px!important;
    font-size:.82rem!important;
  }

  .comm-layout{
    display:block!important;
    min-height:0!important;
  }

  .comm-list{
    display:flex!important;
    gap:8px!important;
    overflow-x:auto!important;
    max-height:none!important;
    border-right:0!important;
    border-bottom:1px solid #e8eef6!important;
    padding:8px!important;
    background:#f8fafc!important;
    scrollbar-width:none!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .comm-list::-webkit-scrollbar{
    display:none!important;
  }

  .comm-item{
    flex:0 0 260px!important;
    border:1px solid #e8eef6!important;
    border-radius:16px!important;
    background:#fff!important;
    padding:10px!important;
  }

  .comm-item.active{
    box-shadow:inset 0 0 0 2px #0d6efd!important;
  }

  .mail-meta{
    padding:12px!important;
  }

  .mail-frame-wrap{
    padding:8px!important;
  }

  .mail-frame{
    min-height:380px!important;
    border-radius:16px!important;
  }

  /* Barra inferiore sempre fissa */
  .mobile-app-bottom-nav{
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
    top:auto!important;
    z-index:2147483000!important;
    transform:translate3d(0,0,0)!important;
    -webkit-transform:translate3d(0,0,0)!important;
    backface-visibility:hidden!important;
    -webkit-backface-visibility:hidden!important;
    will-change:transform!important;
  }
}


/* RTS Nexus 2.2.10 - Mobile scroll container
   Fix definitivo: il body non scorre più su mobile. Scorre solo .nexus-content.
   La barra inferiore resta fuori dallo scroll e quindi resta ferma in basso. */
@media (max-width:767.98px){
  html,
  body{
    height:100%!important;
    min-height:100%!important;
    max-height:100%!important;
    overflow:hidden!important;
    position:fixed!important;
    inset:0!important;
    width:100%!important;
    overscroll-behavior:none!important;
  }

  body.nexus-body{
    padding-bottom:0!important;
    background:#f4f6fb!important;
  }

  .nexus-shell{
    height:100dvh!important;
    min-height:100dvh!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
    background:#f4f6fb!important;
  }

  .nexus-main{
    height:100dvh!important;
    min-height:100dvh!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
  }

  .nexus-topbar{
    position:relative!important;
    flex:0 0 auto!important;
    top:auto!important;
    z-index:1030!important;
  }

  .nexus-content{
    flex:1 1 auto!important;
    min-height:0!important;
    height:auto!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:calc(116px + env(safe-area-inset-bottom,0px))!important;
    overscroll-behavior:contain!important;
  }

  .mobile-app-bottom-nav{
    display:flex!important;
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    top:auto!important;
    bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;
    z-index:2147483000!important;
    transform:none!important;
    -webkit-transform:none!important;
    translate:none!important;
    margin:0!important;
    will-change:auto!important;
    pointer-events:auto!important;
  }

  .mobile-app-bottom-nav,
  .mobile-app-bottom-nav *{
    transform:none!important;
    -webkit-transform:none!important;
  }

  .mobile-app-more-menu{
    bottom:60px!important;
  }
}

/* RTS Nexus 3.2.66 - Mobile modal hardening
   Tutti i popup Bootstrap devono restare utilizzabili su smartphone, anche con
   contenuti lunghi, tastiera virtuale e safe-area iOS/Android. */
@media (max-width: 767.98px) {
    body.modal-open {
        overflow: hidden !important;
    }

    .modal {
        padding: 0 !important;
        overflow: hidden !important;
    }

    .modal .modal-dialog,
    .modal .modal-dialog.modal-lg,
    .modal .modal-dialog.modal-xl,
    .modal .modal-dialog.modal-sm,
    .modal .modal-dialog-scrollable {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        display: flex !important;
        align-items: stretch !important;
    }

    .modal .modal-content {
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border: 0 !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .modal .modal-header,
    .modal .modal-footer {
        flex: 0 0 auto !important;
        background: #fff;
        position: relative;
        z-index: 3;
    }

    .modal .modal-header {
        padding-top: max(.85rem, env(safe-area-inset-top));
    }

    .modal .modal-footer {
        padding-bottom: max(.85rem, env(safe-area-inset-bottom));
        flex-wrap: wrap;
        gap: .5rem;
    }

    .modal .modal-body,
    .modal .modal-dialog-scrollable .modal-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .modal .modal-footer > .btn,
    .modal .modal-footer > form,
    .modal .modal-footer > form > .btn {
        min-height: 44px;
    }

    .modal .table-responsive,
    .modal .list-group,
    .modal .dropdown-menu,
    .modal textarea,
    .modal .html-editor {
        max-width: 100%;
    }

    /* Un popup aperto sopra un altro non deve finire dietro al primo. */
    .modal.show + .modal.show,
    .modal.reply-recipients-modal,
    .modal.rentman-quote-modal {
        z-index: 1095;
    }
}

/* RTS Nexus 3.2.68 - iOS modal inner-scroll fix
   Il composer email avvolge header/body/footer in un <form>. Il form deve quindi
   partecipare al layout flex del modal, altrimenti .modal-body non riceve una
   altezza limitata e Safari iOS non ha un vero contenitore interno da scorrere. */
@media (max-width: 767.98px) {
    /* Supporto generale ai modal in cui il form avvolge header/body/footer. */
    .modal .modal-content > form {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* Il composer Rispondi deve avere un solo punto di scroll: il modal-body. */
    #replyModal .reply-modal-content > form {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    #replyModal .reply-modal-body {
        flex: 1 1 0% !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
        touch-action: pan-y !important;
        position: relative !important;
    }

    /* Header e comandi invio non devono partecipare allo scroll. */
    #replyModal .modal-header,
    #replyModal .reply-modal-footer {
        flex: 0 0 auto !important;
    }

    /* Evita che editor, dropzone e pannelli laterali blocchino il gesto verticale. */
    #replyModal .reply-editor-panel,
    #replyModal .reply-composer-layout,
    #replyModal .reply-side-panel,
    #replyModal .reply-main-toolbar,
    #replyModal .reply-subject-row {
        min-height: 0 !important;
        touch-action: pan-y !important;
    }

    #replyModal .html-editor {
        max-height: none !important;
        overflow: visible !important;
        touch-action: pan-y !important;
    }
}

/* RTS Nexus 3.2.69 - Reply mobile action bar
   Il footer del composer deve rimanere sempre dentro la viewport visiva iOS.
   Il contenuto centrale continua a scorrere; Annulla/Invia restano ancorati in basso. */
@media (max-width: 767.98px) {
    body > #replyModal .reply-modal-content > form,
    #replyModal .reply-modal-content > form {
        position: relative !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    body > #replyModal .reply-modal-body,
    #replyModal .reply-modal-body {
        /* Spazio reale per la barra azioni sovrapposta + safe area iPhone. */
        padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body > #replyModal .reply-modal-footer,
    #replyModal .reply-modal-footer {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        min-height: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
        padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px)) !important;
        flex: 0 0 auto !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 10px !important;
        background: rgba(255,255,255,.98) !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -8px 24px rgba(15,23,42,.12) !important;
        z-index: 2147483100 !important;
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
    }

    body > #replyModal .reply-modal-footer > .btn,
    #replyModal .reply-modal-footer > .btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 0 !important;
        min-height: 48px !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    body > #replyModal .reply-modal-footer > .btn-outline-secondary,
    #replyModal .reply-modal-footer > .btn-outline-secondary {
        flex: 0 0 auto !important;
        min-width: 104px !important;
    }

    body > #replyModal .reply-modal-footer > .js-confirm-send,
    #replyModal .reply-modal-footer > .js-confirm-send {
        flex: 1 1 auto !important;
        width: auto !important;
        font-weight: 700 !important;
    }
}


/* RTS Nexus 3.2.70 - Mobile reply header actions + compact composer
   Safari iOS proved unreliable for a bottom action bar inside the fullscreen modal.
   The primary send action therefore lives in the non-scrolling modal header. */
@media (max-width: 767.98px) {
    #replyModal .reply-modal-header {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: max(12px, env(safe-area-inset-top, 0px)) 12px 10px !important;
    }

    #replyModal .reply-modal-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex: 0 0 auto !important;
    }

    #replyModal .reply-mobile-send {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 42px !important;
        min-width: 82px !important;
        padding: 8px 14px !important;
        border-radius: 12px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    #replyModal .reply-modal-header .btn-close {
        flex: 0 0 auto !important;
        margin: 5px 0 0 0 !important;
    }

    #replyModal .reply-modal-header-help {
        display: none !important;
    }

    /* Il footer desktop non viene più usato su smartphone. */
    body > #replyModal .reply-modal-footer,
    #replyModal .reply-modal-footer {
        display: none !important;
    }

    #replyModal .reply-modal-body {
        padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
        scroll-padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
    }

    #replyModal .js-email-template {
        min-height: 44px !important;
        font-size: 16px !important; /* evita lo zoom automatico di Safari */
    }
}
