:root {
  --client-header-offset: 88px;
  --client-sidebar-width: 236px;
  --client-sidebar-gap: 12px;
  --client-content-top-gap: 10px;
}

.client-shell,
.client-layout {
  transition: grid-template-columns 0.22s ease;
  padding-top: var(--client-content-top-gap);
  min-height: calc(100dvh - var(--client-header-offset) + clamp(180px, 24vh, 280px));
}

.client-shell.sidebar-fixed-desktop,
.client-layout.sidebar-fixed-desktop {
  grid-template-columns: minmax(0, 1fr) !important;
}

.client-shell.sidebar-fixed-desktop > .client-nav-card,
.client-layout.sidebar-fixed-desktop > .client-sidebar {
  position: fixed !important;
  top: calc(var(--client-header-offset) + 8px) !important;
  left: 0 !important;
  width: var(--client-sidebar-width) !important;
  height: calc(100dvh - var(--client-header-offset) - 14px) !important;
  min-height: calc(100dvh - var(--client-header-offset) - 14px) !important;
  max-height: calc(100dvh - var(--client-header-offset) - 14px) !important;
  align-self: start !important;
  overflow: hidden !important;
  border-left: none !important;
  border-radius: 0 16px 16px 0 !important;
  border-color: rgba(120, 160, 235, 0.20) !important;
  background: linear-gradient(180deg, rgba(16, 31, 63, 0.96), rgba(9, 17, 37, 0.96)) !important;
  box-shadow: 0 10px 30px rgba(3, 8, 20, 0.32) !important;
  padding: 0.85rem 0.7rem !important;
  z-index: 160 !important;
}

.client-shell.sidebar-fixed-desktop > .client-content,
.client-shell.sidebar-fixed-desktop > .services-content,
.client-shell.sidebar-fixed-desktop > .mailspace-content,
.client-shell.sidebar-fixed-desktop > .domains-content,
.client-shell.sidebar-fixed-desktop > .billing-content,
.client-shell.sidebar-fixed-desktop > .admin-dashboard,
.client-layout.sidebar-fixed-desktop > .client-content {
  margin-left: calc(var(--client-sidebar-width) + var(--client-sidebar-gap)) !important;
  padding-top: 4px !important;
  padding-bottom: clamp(90px, 12vh, 150px) !important;
}

.client-shell > .client-nav-card,
.client-layout > .client-sidebar {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.client-nav,
.client-nav-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.client-nav-group,
.client-nav-top {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  padding-right: 2px;
  /* Les CSS de page anciens (mes-boites-mail, domaines, factures) passent ce
     bloc en `display: grid`. Une grille repartit par defaut toute sa hauteur
     entre ses lignes : avec `flex: 1` ci-dessus, chaque lien s'etirait sur un
     sixieme de la colonne. On empile les liens en haut, quel que soit le mode. */
  align-content: flex-start;
}

.client-nav-group-bottom,
.client-nav-bottom {
  margin-top: auto !important;
  flex: 0 0 auto;
  padding-top: 0.55rem;
}

.sidebar-collapse-btn {
  flex-shrink: 0;
  align-self: flex-end;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(120, 160, 235, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  display: grid;
  place-items: center;
  margin-bottom: 0.6rem;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.sidebar-collapse-btn:hover {
  border-color: var(--accent-3);
  color: var(--text);
  background: rgba(47, 123, 245, 0.12);
}

/* Separation nette entre la navigation et le pied (Profil / Deconnecter) :
   ce sont deux natures d'action differentes, les melanger dans une meme
   colonne uniforme force a lire chaque libelle pour s'y retrouver. */
/* Le pied reste colle en bas : `margin-top: auto` est declare plus haut et ne
   doit PAS etre ecrase — c'est lui qui pousse Profil et Deconnecter au bas de
   la colonne au lieu de les laisser suivre le dernier lien. */
.client-nav-bottom,
.client-nav-group-bottom {
  border-top: 1px solid rgba(120, 160, 235, 0.14);
  padding-top: 0.7rem;
}

.sidebar-collapse-btn:hover { transform: translateY(-1px); }

.client-shell.is-collapsed,
.client-layout.is-collapsed {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Palette alignee sur les tokens du site.
   Les valeurs precedentes (cyans : #dce9fb, rgba(132,188,235)) dataient d'avant
   la migration vers le bleu du logo : la barre laterale ressortait comme une
   piece rapportee sur toutes les pages de l'espace client.

   Les liens ne sont plus des boites encadrees mais des lignes discretes : c'est
   la ligne ACTIVE qui doit se voir, pas les six autres. */
.client-nav-link {
  display: flex !important;
  align-items: center;
  width: 100%;
  gap: 0.6rem;
  position: relative;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text-secondary) !important;
  font-size: 0.88rem;
  font-weight: 600 !important;
  min-height: 42px;
  padding: 0.58rem 0.75rem !important;
  border-radius: 10px !important;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease !important;
  transform: none !important;
  box-shadow: none !important;
}

.client-nav-link.is-hidden {
  display: none !important;
}

.client-nav-link:hover {
  border-color: transparent !important;
  background: rgba(120, 160, 235, 0.09) !important;
  color: var(--text) !important;
  transform: none !important;
}

.client-nav-link:focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: 2px;
}

/* Etat actif : fond bleu translucide ET barre d'accent a gauche. La couleur
   seule se lit mal sur un fond deja sombre ; la barre situe la page d'un
   coup d'oeil, meme en vision peripherique. */
.client-nav-link.is-active {
  color: #fff !important;
  font-weight: 700 !important;
  border-color: transparent !important;
  background: rgba(47, 123, 245, 0.16) !important;
  box-shadow: inset 3px 0 0 0 var(--accent-3) !important;
}

.client-nav-link.is-active:hover {
  background: rgba(47, 123, 245, 0.22) !important;
}

/* Icone visible en permanence, plus seulement en mode replie : une colonne de
   libelles nus oblige a lire chaque ligne pour se reperer. Pas de pastille
   encadree — le trait suffit et reste lisible sur un fond sombre. */
.client-nav-icon {
  display: inline-grid;
  width: 1.15rem;
  min-width: 1.15rem;
  height: 1.15rem;
  place-items: center;
  opacity: .75;
  transition: opacity 0.16s ease;
}

/* Les icones sont injectees par client-sidebar.js sous forme de <i> Font
   Awesome — cibler un <svg> ici n'aurait servi a rien, le script remplace le
   contenu du lien au chargement. */
.client-nav-icon i {
  font-size: 0.92rem !important;
  line-height: 1;
}

.client-nav-icon svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

.client-nav-link:hover .client-nav-icon,
.client-nav-link.is-active .client-nav-icon { opacity: 1; }

/* ── Encadre « Prelevement auto » ─────────────────────────────────────────
   Genere par le script pour toutes les pages, il n'existait auparavant que
   sur quatre d'entre elles, avec un identifiant different a chaque fois. */
.client-renewal {
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(47, 123, 245, 0.18);
  background: rgba(47, 123, 245, 0.06);
}

.client-renewal-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin-bottom: 0.3rem;
}

.client-renewal-state {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

/* Pastilles pleines, vert et rouge : un cercle vide se lit comme un defaut
   d'affichage, pas comme un etat. */
.client-renewal-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.client-renewal-dot.is-on  { background: var(--success); box-shadow: 0 0 0 3px rgba(53, 201, 107, 0.16); }
.client-renewal-dot.is-off { background: var(--danger);  box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.16); }

.client-renewal a {
  font-size: 0.76rem;
  color: var(--accent-3);
  text-decoration: none;
}
.client-renewal a:hover { text-decoration: underline; }

/* Menu replie : l'encadre n'a plus la place de s'afficher. */
.client-shell.is-collapsed .client-renewal,
.client-layout.is-collapsed .client-renewal { display: none; }

.client-nav-icon i {
  font-size: 0.76rem;
  line-height: 1;
}

.client-nav-label {
  white-space: nowrap;
}

.client-shell.is-collapsed .client-nav-icon,
.client-layout.is-collapsed .client-nav-icon {
  display: inline-grid;
}

.client-shell.is-collapsed .client-nav-label,
.client-layout.is-collapsed .client-nav-label {
  display: none;
}

.client-shell.is-collapsed .client-nav-link,
.client-layout.is-collapsed .client-nav-link {
  justify-content: center;
  padding: 0.44rem !important;
  min-height: 40px;
}

.client-shell.is-collapsed .client-nav-icon,
.client-layout.is-collapsed .client-nav-icon {
  width: 1.52rem;
  min-width: 1.52rem;
  height: 1.52rem;
}

.mobile-sidebar-toggle,
.mobile-sidebar-backdrop {
  display: none;
}

body.sidebar-mobile-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .sidebar-collapse-btn {
    display: none;
  }

  .client-shell,
  .client-layout,
  .client-shell.is-collapsed,
  .client-layout.is-collapsed,
  .client-shell.sidebar-fixed-desktop,
  .client-layout.sidebar-fixed-desktop {
    grid-template-columns: 1fr !important;
    padding-top: 0;
    min-height: auto;
  }

  .client-shell.sidebar-fixed-desktop > .client-content,
  .client-shell.sidebar-fixed-desktop > .services-content,
  .client-shell.sidebar-fixed-desktop > .mailspace-content,
  .client-shell.sidebar-fixed-desktop > .domains-content,
  .client-shell.sidebar-fixed-desktop > .billing-content,
  .client-shell.sidebar-fixed-desktop > .admin-dashboard,
  .client-layout.sidebar-fixed-desktop > .client-content {
    margin-left: 0 !important;
    padding-top: 0 !important;
  }

  .client-shell .client-nav-card,
  .client-layout .client-sidebar,
  .client-shell.sidebar-fixed-desktop > .client-nav-card,
  .client-layout.sidebar-fixed-desktop > .client-sidebar {
    position: fixed !important;
    top: var(--client-header-offset) !important;
    left: 0 !important;
    bottom: 0;
    width: min(86vw, 310px) !important;
    height: auto !important;
    min-height: calc(100dvh - var(--client-header-offset)) !important;
    max-height: calc(100dvh - var(--client-header-offset)) !important;
    z-index: 220 !important;
    background: #0d1932;
    border-right: 1px solid rgba(120, 160, 235, .22);
    padding: .85rem .7rem;
    overflow: hidden;
    visibility: hidden;
    transform: translateX(-105%);
    transition: transform 0.22s ease, visibility 0.22s ease;
  }

  .client-shell .client-nav-card.is-open,
  .client-layout .client-sidebar.is-open {
    visibility: visible;
    transform: translateX(0);
  }

  .mobile-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--client-header-offset) 0 0;
    border: none;
    background: rgba(2, 8, 20, 0.55);
    backdrop-filter: blur(2px);
    z-index: 210;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .mobile-sidebar-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(47, 123, 245, 0.4);
    background: linear-gradient(135deg, rgba(17, 96, 224, 0.28), rgba(47, 123, 245, 0.24));
    color: #e8f3ff;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.88rem;
    padding: 0.48rem 0.7rem;
    cursor: pointer;
    margin: 0 0 0.72rem;
    position: static;
    top: auto;
    z-index: 120;
    white-space: nowrap;
    min-height: 40px;
    line-height: 1;
    width: auto;
    max-width: max-content;
    justify-content: flex-start;
    align-self: flex-start;
  }

  .mobile-sidebar-toggle > span:last-child {
    white-space: nowrap;
  }

  .client-shell.is-collapsed .client-nav-label,
  .client-layout.is-collapsed .client-nav-label {
    display: inline;
  }

  .client-shell.is-collapsed .client-nav-icon,
  .client-layout.is-collapsed .client-nav-icon {
    display: none;
  }
}
