/* ════════════════════════════════════════════════════════════
   HETO Radius Fix — Corrige les coins carrés / borders cassées
   - Force display:flex sur les boutons multi-lignes pour que
     border-radius soit respecté quand le texte wrap
   - Ajoute overflow:hidden sur les éléments arrondis pour clipper
     les pseudo-éléments qui bavent
   - Renforce border-box sur tout
   Charger EN DERNIER pour gagner la guerre de spécificité.
   ════════════════════════════════════════════════════════════ */

/* === FIX 1: BOUTONS DOSSIER PANEL (Reprendre/Fermer/Envoyer email/Note) === */
/* Le bug vient de display:inline-block par défaut sur <button> :
   quand le texte wrap, le border-radius n'enveloppe pas les line-boxes */
.hd-side-action,
#hd-root .hd-side-action,
#hd-page-conversations .hd-side-action,
button.hd-side-action {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 38px !important;
  box-sizing: border-box !important;
  white-space: normal !important;
  word-break: normal !important;
  hyphens: auto !important;
  text-align: center !important;
  border-radius: 10px !important;
  border: 1px solid #d6dbe5 !important;
  padding: 9px 12px !important;
  line-height: 1.3 !important;
  /* Empêche tout pseudo-element de baver en dehors */
  position: relative !important;
  overflow: hidden !important;
}

/* Override .danger → couleur rouge mais conserve les fixes ci-dessus */
.hd-side-action.danger,
#hd-root .hd-side-action.danger {
  border-color: #fecaca !important;
  color: #ef4444 !important;
  background: #fff !important;
}

/* Override .agent-active → bleu mais conserve les fixes */
.hd-side-action.agent-active,
#hd-root .hd-side-action.agent-active {
  background: #eef6ff !important;
  border-color: #bfd4ff !important;
  color: var(--hd-accent, #0C55F4) !important;
}

/* Override .hd-side-action-star → ambre mais conserve les fixes */
.hd-side-action-star,
#hd-root .hd-side-action-star {
  border-color: #fde68a !important;
  background: linear-gradient(135deg, #fffbeb, #fff) !important;
  color: #92400e !important;
}

/* === FIX 2: AVATAR PROFIL (coin haut-gauche carré sur image "I") === */
.hd-conv-profile-avatar,
#hd-root .hd-conv-profile-avatar,
.hd-conv-avatar,
#hd-root .hd-conv-avatar,
.hd-conv-avatar-wrap,
#hd-root .hd-conv-avatar-wrap {
  border-radius: 16px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
.hd-conv-avatar,
#hd-root .hd-conv-avatar {
  border-radius: 10px !important;
}
/* Et leur contenu (img/svg) doit suivre la forme */
.hd-conv-profile-avatar > *,
.hd-conv-avatar > *,
.hd-conv-avatar-wrap > * {
  border-radius: inherit !important;
}

/* === FIX 3: BOUTONS BARRE LATÉRALE (Formulaires & autres pages) === */
/* Force overflow:hidden sur les nav items pour clipper les pseudo-elements */
.hd-nav-item,
#hd-root .hd-nav-item {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 12px !important;
}
/* Les pseudo-elements de la nav active (la barre latérale gauche) doivent
   rester DANS le bouton, pas baver au-delà */
.hd-nav-item.active::before,
#hd-root .hd-nav-item.active::before {
  /* Conserve la barre latérale active mais sans bavure */
  left: 0 !important;
  width: 3px !important;
  border-radius: 0 !important;
}

/* === FIX 4: TOUS LES BOUTONS GÉNÉRIQUES — anti-wrap-bug === */
/* Pour tout button avec border-radius, force flex pour éviter le bug
   de wrap multi-ligne qui casse les coins arrondis */
#hd-root button[class*="-btn"],
#hd-root .hd-btn,
#hd-root .ms-tb-btn,
#hd-root .ms-bn-btn,
#hd-root .ms-cn-btn,
#hd-root .cp-folder-create,
#hd-root .cp-folder-save,
#hd-root .cp-folder-delete {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

/* Boutons full-width (à l'intérieur de panneaux étroits) doivent wrap proprement */
.hd-conv-info-actions button,
.hd-conv-info-actions .hd-side-action {
  white-space: normal !important;
  text-align: center !important;
  line-height: 1.3 !important;
}

/* === FIX 5: CARTES & PANELS — overflow:hidden pour clipper les enfants === */
/* Quand une carte a border-radius mais qu'un enfant (ex: header coloré)
   sort du cadre, les coins du haut paraissent carrés */
.hd-card,
.hd-stat,
.hd-quick-action,
.hd-recent-item,
.hd-plan-card,
.hd-cal-card,
.hd-conv-progress-card,
.hd-conv-info-section,
.hd-conv-profile-card,
#hd-root .hd-card,
#hd-root .hd-stat,
#hd-root .hd-conv-progress-card {
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* === FIX 6: WIDGET CHATBOT — bulles de message === */
/* Le thème "corporate" utilise des bulles avec un coin droit ouvert
   (border-radius: 0 4px 4px 4px). Ce n'est PAS un bug, c'est le design.
   On le préserve mais on s'assure que les autres thèmes restent ronds. */
#aichat-widget-root:not([data-theme="corporate"]) .aichat-msg-bubble {
  border-radius: 14px !important;
  overflow: hidden !important;
}

/* === FIX 7: HEADER DE CARTE qui dépasse === */
/* Si un header coloré (gradient) dépasse les coins arrondis de sa carte,
   le clipping fait le travail */
.hd-card > *:first-child,
.hd-stat > *:first-child {
  border-top-left-radius: inherit !important;
  border-top-right-radius: inherit !important;
}

/* === FIX 8: SAFETY NET — force box-sizing partout === */
#hd-root *,
#hd-root *::before,
#hd-root *::after {
  box-sizing: border-box;
}
/* ════════════════════════════════════════════════════════════
   HETO 2.1.169 — nettoyage final radius / doubles bordures
   - Les conteneurs de layout restent carrés (pages, colonnes, panneaux)
   - Les cartes/boutons gardent leurs arrondis cohérents
   - Une seule ligne de séparation entre deux panneaux collés
   ════════════════════════════════════════════════════════════ */

/* 1) Surfaces de page: pas de faux arrondis aux jonctions avec topbar/sidebar */
#hd-root .hd-page,
#hd-root .hd-page-inner,
#hd-root .pcontent,
#hd-root .hd-topbar,
#hd-root .hd-widget-editor-shell,
#hd-root .hd-editor-shell,
#hd-root .hd-config-editor,
#hd-root .editor,
#hd-root .hd-widget-tabs,
#hd-root .hd-editor-tabs,
#hd-root .hd-config-tabs,
#hd-root .mtabs {
  border-radius: 0 !important;
}

/* 2) Conversations: colonnes collées = carrées + pas de border complète en double */
#hd-root #hd-page-conversations .hd-conv-wrap {
  overflow: hidden !important;
}

#hd-root #hd-page-conversations .hd-conv-left,
#hd-root #hd-page-conversations #hd-conv-mid,
#hd-root #hd-page-conversations .hd-conv-panel,
#hd-root #hd-page-conversations .hd-conv-side,
#hd-root #hd-page-conversations .hd-conv-detail-shell,
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro,
#hd-root #hd-page-conversations .hd-conv-thread,
#hd-root #hd-page-conversations .hd-conv-thread--pro,
#hd-root #hd-page-conversations .hd-conv-info-panel,
#hd-root #hd-page-conversations .hd-conv-info-panel--pro {
  border-radius: 0 !important;
  box-shadow: none !important;
}

#hd-root #hd-page-conversations .hd-conv-left,
#hd-root #hd-page-conversations #hd-conv-mid {
  border: 0 !important;
  border-right: 1px solid #e2eaf6 !important;
}

#hd-root #hd-page-conversations .hd-conv-panel,
#hd-root #hd-page-conversations .hd-conv-detail-shell,
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro,
#hd-root #hd-page-conversations .hd-conv-thread,
#hd-root #hd-page-conversations .hd-conv-thread--pro {
  border: 0 !important;
}

#hd-root #hd-page-conversations .hd-conv-info-panel,
#hd-root #hd-page-conversations .hd-conv-info-panel--pro {
  border: 0 !important;
}

#hd-root #hd-page-conversations .hd-conv-detail-shell--pro.is-panel-open .hd-conv-info-panel--pro,
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro.is-panel-open .hd-conv-info-panel {
  border-left: 1px solid #e2eaf6 !important;
}

/* 3) Header/tabs du panneau droit: bord droit/gauche carré et une seule ligne */
#hd-root #hd-page-conversations .cp-tabs-wrap {
  border: 0 !important;
  border-bottom: 1px solid #eef3fb !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
  overflow: visible !important;
}

#hd-root #hd-page-conversations .cp-tabs {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

#hd-root #hd-page-conversations .cp-tab {
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

#hd-root #hd-page-conversations .cp-tab.active {
  border-bottom-color: #0C55F4 !important;
}

#hd-root #hd-page-conversations .cp-body,
#hd-root #hd-page-conversations .cp-section {
  border-radius: 0 !important;
}

/* 4) Actions du dossier: largeur stable, plus de boutons compressés/mots empilés */
#hd-root #hd-page-conversations .hd-conv-info-actions {
  width: 100% !important;
  max-width: 100% !important;
  align-self: stretch !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

#hd-root #hd-page-conversations .hd-conv-info-actions .hd-side-action,
#hd-root #hd-page-conversations .hd-side-action,
#hd-root #hd-page-conversations button.hd-side-action {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 9px 12px !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

/* 5) Champs libellé/couleur: pas de chevauchement ni de micro-décalage */
#hd-root #hd-page-conversations .cp-folder-edit {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 38px !important;
  gap: 8px !important;
  align-items: center !important;
  width: 100% !important;
}

#hd-root #hd-page-conversations .cp-folder-name {
  width: 100% !important;
  min-width: 0 !important;
}

#hd-root #hd-page-conversations .cp-folder-color {
  width: 38px !important;
  min-width: 38px !important;
  height: 34px !important;
}

#hd-root #hd-page-conversations .cp-folder-save,
#hd-root #hd-page-conversations .cp-folder-delete {
  grid-column: 1 / -1 !important;
  width: max-content !important;
  max-width: 100% !important;
}

/* 6) Panneaux de formulaires/configuration: angles carrés seulement sur le shell */
#hd-root #hd-page-forms .hd-page-inner,
#hd-root #hd-page-forms .pcontent,
#hd-root #hd-page-forms .hd-editor-shell,
#hd-root #hd-page-forms .hd-config-editor,
#hd-root #hd-page-forms .editor,
#hd-root #hd-page-widget-editor .hd-page-inner,
#hd-root #hd-page-widget-editor .hd-widget-editor-shell,
#hd-root #hd-page-settings .hd-page-inner,
#hd-root #hd-page-account .hd-page-inner,
#hd-root #hd-page-integrations .hd-page-inner,
#hd-root #hd-page-knowledge .hd-page-inner,
#hd-root #hd-page-workflows .hd-page-inner,
#hd-root #hd-page-email-templates .hd-page-inner,
#hd-root #hd-page-rdv-config .hd-page-inner {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* 7) Évite les doubles lignes quand un header touche un corps */
#hd-root .hd-topbar + .hd-page-inner,
#hd-root .hd-topbar + .pcontent,
#hd-root .hd-widget-tabs + .hd-widget-editor-content,
#hd-root .hd-editor-tabs + .hd-editor-content,
#hd-root .hd-config-tabs + .hd-config-content,
#hd-root .mtabs + .pcontent {
  border-top: 0 !important;
}



/* ════════════════════════════════════════════════════════════
   HETO 2.1.169 — restauration des arrondis EXTERIEURS
   On garde le nettoyage des doubles bordures à l'intérieur,
   mais on rend aux gros blocs externes leur curve d'origine.
   ════════════════════════════════════════════════════════════ */

/* Le cadre extérieur doit rester arrondi comme avant. */
#hd-root #hd-page-conversations .hd-conv-wrap {
  border-radius: 28px !important;
  overflow: hidden !important;
}

/* Les deux gros blocs visibles gardent leurs arrondis externes.
   Les enfants internes restent carrés grâce aux règles 2.1.168. */
#hd-root #hd-page-conversations .hd-conv-left,
#hd-root #hd-page-conversations #hd-conv-mid,
#hd-root #hd-page-conversations .hd-conv-panel {
  border-radius: 24px !important;
  overflow: hidden !important;
  background: #fff !important;
  border: 1px solid var(--idx-border, #e2eaf6) !important;
  box-shadow: var(--idx-shadow, 0 12px 30px rgba(13,21,38,.08)) !important;
}

/* On évite que le panneau détail recrée un 2e arrondi à l'intérieur. */
#hd-root #hd-page-conversations .hd-conv-detail-shell,
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro,
#hd-root #hd-page-conversations .hd-conv-thread,
#hd-root #hd-page-conversations .hd-conv-thread--pro,
#hd-root #hd-page-conversations .hd-conv-info-panel,
#hd-root #hd-page-conversations .hd-conv-info-panel--pro,
#hd-root #hd-page-conversations .cp-tabs-wrap,
#hd-root #hd-page-conversations .cp-tabs,
#hd-root #hd-page-conversations .cp-body,
#hd-root #hd-page-conversations .cp-section {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Le panneau droit est clippé par le bloc extérieur : pas de faux coin interne,
   mais le coin extérieur du bloc reste bien arrondi. */
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro.is-panel-open .hd-conv-info-panel--pro,
#hd-root #hd-page-conversations .hd-conv-detail-shell--pro.is-panel-open .hd-conv-info-panel {
  border-left: 1px solid #e2eaf6 !important;
}

/* HETO 2.1.170 — conversations : suppression dans le champ + plus de scroll horizontal */
#hd-root #hd-page-conversations,
#hd-root #hd-page-conversations .hd-page-inner,
#hd-root #hd-page-conversations .hd-conv-wrap,
#hd-root #hd-page-conversations .hd-conv-left,
#hd-root #hd-page-conversations #hd-conv-mid,
#hd-root #hd-page-conversations .hd-conv-list,
#hd-root #hd-page-conversations .hd-conv-item,
#hd-root #hd-page-conversations .hd-conv-main,
#hd-root #hd-page-conversations .hd-conv-body,
#hd-root #hd-page-conversations .hd-conv-content{
  min-width:0 !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}

#hd-root #hd-page-conversations .hd-conv-wrap,
#hd-root #hd-page-conversations .hd-conv-left,
#hd-root #hd-page-conversations #hd-conv-mid,
#hd-root #hd-page-conversations .hd-conv-list,
#hd-root #hd-page-conversations .hd-conv-item{
  overflow-x:hidden !important;
}

#hd-root #hd-page-conversations .hd-conv-list{
  overflow-y:auto !important;
}

#hd-root #hd-page-conversations .hd-conv-main{
  width:100% !important;
  grid-template-columns:44px minmax(0,1fr) !important;
}

#hd-root #hd-page-conversations .hd-conv-avatar-wrap{
  position:relative !important;
  width:44px !important;
  min-width:44px !important;
  max-width:44px !important;
  height:44px !important;
  overflow:hidden !important;
  flex:0 0 44px !important;
}

#hd-root #hd-page-conversations .hd-conv-trash-trigger{
  position:absolute !important;
  inset:auto !important;
  left:4px !important;
  top:4px !important;
  width:36px !important;
  min-width:36px !important;
  max-width:36px !important;
  height:36px !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  border-radius:12px !important;
  background:#EF4444 !important;
  color:#fff !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  opacity:0 !important;
  pointer-events:none !important;
  transform:none !important;
  box-sizing:border-box !important;
  z-index:5 !important;
}

#hd-root #hd-page-conversations .hd-conv-item:hover .hd-conv-trash-trigger,
#hd-root #hd-page-conversations .hd-conv-item:focus-within .hd-conv-trash-trigger{
  opacity:1 !important;
  pointer-events:auto !important;
}

#hd-root #hd-page-conversations .hd-conv-trash-trigger:hover{
  background:#DC2626 !important;
}

#hd-root #hd-page-conversations .hd-conv-trash-trigger svg,
#hd-root #hd-page-conversations .hd-conv-trash-trigger svg *{
  stroke:#fff !important;
  color:#fff !important;
}

#hd-root #hd-page-conversations .hd-conv-bulk-bar{
  min-width:0 !important;
  max-width:100% !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}

#hd-root #hd-page-conversations .hd-conv-bulk-bar > *{
  min-width:0 !important;
}

#hd-root #hd-page-conversations .hd-conv-bulk-del{
  flex:0 0 auto !important;
  max-width:118px !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

@media (max-width:720px){
  #hd-root #hd-page-conversations .hd-conv-left,
  #hd-root #hd-page-conversations #hd-conv-mid{
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    flex:1 1 auto !important;
  }
}

@media (max-width:430px){
  #hd-root #hd-page-conversations .hd-conv-bulk-del{
    width:36px !important;
    max-width:36px !important;
    min-width:36px !important;
    height:30px !important;
    padding:0 !important;
    font-size:0 !important;
    gap:0 !important;
  }
  #hd-root #hd-page-conversations .hd-conv-bulk-del svg{
    width:14px !important;
    height:14px !important;
  }
}
