/* NAKIMA V24.1.21 — sortie fiche cliente mobile garantie */

body.v241-ready .customer-modal{
  width:min(1120px,calc(100vw - 48px))!important;
  max-width:1120px!important;
  overflow-x:hidden!important;
}
body.v241-ready .customer-modal .customer-profile,
body.v241-ready .customer-modal .customer-history-summary,
body.v241-ready .customer-modal .customer-detail-section,
body.v241-ready .customer-modal .v241-client-tabs{
  min-width:0!important;
  max-width:100%!important;
}

/* Desktop : le tableau reste entièrement dans la fenêtre. */
body.v241-ready .customer-modal .table-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  -webkit-overflow-scrolling:touch!important;
}
body.v241-ready .customer-modal .nk-customer-history-table{
  width:100%!important;
  min-width:920px!important;
}
body.v241-ready .customer-modal .nk-customer-history-table th,
body.v241-ready .customer-modal .nk-customer-history-table td{
  vertical-align:top!important;
}
body.v241-ready .customer-modal .nk-history-services{min-width:0!important}
body.v241-ready .customer-modal .nk-history-service-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:12px!important;
  min-width:0!important;
}

.nk-customer-mobile-back,
.nk-mobile-history-cards{display:none}

body.v241-ready .customer-modal .modal-head>button:not(.nk-customer-mobile-back){
  flex:0 0 44px!important;
  width:44px!important;
  height:44px!important;
  border-radius:50%!important;
  color:#5f3044!important;
  background:#fff2f6!important;
  cursor:pointer!important;
  touch-action:manipulation!important;
  z-index:52!important;
}
body.v241-ready .customer-modal .modal-head>button:not(.nk-customer-mobile-back) svg{
  width:22px!important;
  height:22px!important;
  pointer-events:none!important;
}

@media(max-width:700px){
  body.v241-ready .customer-modal{
    width:100%!important;
    max-width:100%!important;
    min-height:100dvh!important;
    height:100dvh!important;
    max-height:100dvh!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior-y:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }

  body.v241-ready .customer-modal .modal-head{
    position:sticky!important;
    top:0!important;
    z-index:60!important;
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    min-height:66px!important;
    padding:max(10px,env(safe-area-inset-top)) 10px 9px!important;
    background:rgba(255,255,255,.985)!important;
    border-bottom:1px solid #f0e1e7!important;
  }
  body.v241-ready .customer-modal .modal-head>div{min-width:0!important}
  body.v241-ready .customer-modal .modal-head .eyebrow{display:none!important}
  body.v241-ready .customer-modal .modal-head h2{
    margin:0!important;
    font-size:19px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  body.v241-ready .customer-modal .nk-customer-mobile-back{
    display:inline-flex!important;
    align-items:center!important;
    gap:5px!important;
    min-width:74px!important;
    height:42px!important;
    padding:0 9px!important;
    border:1px solid #ead8df!important;
    border-radius:13px!important;
    color:#6f3a50!important;
    background:#fff!important;
    font-size:13px!important;
    touch-action:manipulation!important;
    z-index:62!important;
  }
  body.v241-ready .customer-modal .nk-customer-mobile-back span{font-size:20px!important;line-height:1!important}
  body.v241-ready .customer-modal .nk-customer-mobile-back b{font-weight:800!important}

  body.v241-ready .customer-modal .modal-head>button:not(.nk-customer-mobile-back){
    width:42px!important;
    height:42px!important;
    margin:0!important;
    justify-self:end!important;
  }

  body.v241-ready .customer-modal .customer-profile,
  body.v241-ready .customer-modal .customer-history-summary,
  body.v241-ready .customer-modal .customer-detail-section{
    padding-left:14px!important;
    padding-right:14px!important;
  }

  /* Les onglets restent accessibles après un scroll. */
  body.v241-ready .customer-modal .v241-client-tabs{
    position:sticky!important;
    top:66px!important;
    z-index:55!important;
    display:flex!important;
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    padding:7px 10px!important;
    gap:6px!important;
    overflow-x:auto!important;
    border:0!important;
    border-bottom:1px solid #f0e1e7!important;
    border-radius:0!important;
    background:rgba(255,250,252,.985)!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.v241-ready .customer-modal .v241-client-tabs button{
    flex:0 0 auto!important;
    min-height:40px!important;
    padding:9px 14px!important;
    touch-action:manipulation!important;
  }

  /* On ne transforme plus les éléments TABLE en block : c'était la source
     du bug mobile. Le tableau React reste intact et une vue cartes dédiée
     est générée séparément. */
  body.v241-ready .customer-modal .nk-customer-history-table{
    display:none!important;
  }
  body.v241-ready .customer-modal .table-wrap{
    overflow:visible!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-cards{
    display:grid!important;
    gap:12px!important;
    width:100%!important;
    padding:2px 0 max(22px,env(safe-area-inset-bottom))!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-card{
    width:100%!important;
    min-width:0!important;
    padding:14px!important;
    border:1px solid #f0e1e7!important;
    border-radius:18px!important;
    background:#fff!important;
    box-shadow:0 6px 20px rgba(45,28,39,.045)!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-field{
    display:grid!important;
    grid-template-columns:104px minmax(0,1fr)!important;
    gap:10px!important;
    align-items:start!important;
    padding:6px 0!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-label{
    color:#9b7284!important;
    font-size:10px!important;
    font-weight:850!important;
    letter-spacing:.055em!important;
    text-transform:uppercase!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-value{
    min-width:0!important;
    color:#2d1f25!important;
    overflow-wrap:anywhere!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-services-field{
    display:block!important;
    margin:7px 0!important;
    padding:11px 0!important;
    border-top:1px solid #f3edf0!important;
    border-bottom:1px solid #f3edf0!important;
  }
  body.v241-ready .customer-modal .nk-mobile-history-services-field .nk-mobile-history-label{
    display:block!important;
    margin-bottom:8px!important;
  }
  body.v241-ready .customer-modal .nk-history-service-row{
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:8px!important;
    padding:10px!important;
    border:1px solid #f0e1e7!important;
    border-radius:14px!important;
  }
  body.v241-ready .customer-modal .nk-history-service-row+ .nk-history-service-row{margin-top:8px!important}
  body.v241-ready .customer-modal .nk-history-service-row b{font-size:13px!important;line-height:1.3!important}
  body.v241-ready .customer-modal .nk-history-service-row small{font-size:11px!important}
  body.v241-ready .customer-modal .nk-history-service-row strong{font-size:12px!important;white-space:nowrap!important}
  body.v241-ready .customer-modal .nk-mobile-history-empty{
    padding:22px 14px!important;
    border:1px dashed #ead8df!important;
    border-radius:16px!important;
    color:#806b74!important;
    text-align:center!important;
    background:#fffafc!important;
  }
}


/* ============================================================
   V24.1.21 — barre de sortie mobile indépendante de la modale
   Elle est rendue directement dans <body>, donc aucun overflow,
   header sticky ou composant React ne peut masquer Retour / Fermer.
   ============================================================ */
.nk-customer-escape-bar{display:none}

@media(max-width:700px){
  body.nk-customer-sheet-open{
    overflow:hidden!important;
  }

  body.nk-customer-sheet-open .nk-customer-escape-bar{
    position:fixed!important;
    inset:0 0 auto 0!important;
    z-index:2147483000!important;
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    min-height:calc(60px + env(safe-area-inset-top))!important;
    padding:calc(env(safe-area-inset-top) + 8px) 10px 8px!important;
    border-bottom:1px solid #ecdde3!important;
    background:rgba(255,255,255,.99)!important;
    box-shadow:0 6px 18px rgba(54,25,38,.10)!important;
    -webkit-backdrop-filter:blur(18px)!important;
    backdrop-filter:blur(18px)!important;
    pointer-events:auto!important;
  }

  body.nk-customer-sheet-open .nk-customer-escape-title{
    min-width:0!important;
    overflow:hidden!important;
    text-align:center!important;
    color:#38242d!important;
  }
  body.nk-customer-sheet-open .nk-customer-escape-title small{
    display:block!important;
    margin-bottom:1px!important;
    color:#9b7284!important;
    font-size:9px!important;
    font-weight:850!important;
    letter-spacing:.08em!important;
    text-transform:uppercase!important;
  }
  body.nk-customer-sheet-open .nk-customer-escape-title b{
    display:block!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:14px!important;
  }

  body.nk-customer-sheet-open .nk-customer-escape-back,
  body.nk-customer-sheet-open .nk-customer-escape-close{
    position:relative!important;
    z-index:2147483001!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:46px!important;
    height:44px!important;
    margin:0!important;
    padding:0 12px!important;
    border:1px solid #ead8df!important;
    border-radius:14px!important;
    background:#fff!important;
    color:#6f3a50!important;
    box-shadow:none!important;
    font:800 13px/1 DM Sans,system-ui,sans-serif!important;
    cursor:pointer!important;
    touch-action:manipulation!important;
    -webkit-tap-highlight-color:transparent!important;
  }
  body.nk-customer-sheet-open .nk-customer-escape-back{
    gap:5px!important;
  }
  body.nk-customer-sheet-open .nk-customer-escape-back .arrow{
    font-size:20px!important;
    line-height:1!important;
  }
  body.nk-customer-sheet-open .nk-customer-escape-close{
    width:44px!important;
    min-width:44px!important;
    padding:0!important;
    border-radius:50%!important;
    background:#fff2f6!important;
    font-size:24px!important;
    line-height:1!important;
  }

  /* La barre fixe remplace entièrement l'ancien header mobile. */
  body.nk-customer-sheet-open .customer-modal{
    padding-top:calc(60px + env(safe-area-inset-top))!important;
  }
  body.nk-customer-sheet-open .customer-modal .modal-head{
    display:none!important;
  }
  body.nk-customer-sheet-open .customer-modal .v241-client-tabs{
    top:0!important;
  }
}
