/* Styles globaux du gabarit commun (sortis de base.html, lot vitesse F). Contenu identique : barre de défilement, bandeaux, etc. */
    /* ── Custom Global Scrollbar : Contacto Pink (#E71D72) & Transparent Track ── */
    html,
    body,
    * {
      scrollbar-color: #E71D72 transparent;
      scrollbar-width: thin;
    }

    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }

    ::-webkit-scrollbar-track {
      background: transparent !important;
    }

    ::-webkit-scrollbar-thumb {
      background-color: #E71D72;
      border-radius: 9999px;
      border: 2px solid transparent;
      background-clip: padding-box;
      transition: background-color 0.2s ease;
    }

    ::-webkit-scrollbar-thumb:hover {
      background-color: #c5165d;
    }

    ::-webkit-scrollbar-corner {
      background: transparent;
    }

    .nav-back-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      padding: 0;
      border: 1.5px solid #006289;
      border-radius: 999px;
      background: #fff;
      color: #006289;
      cursor: pointer;
      flex-shrink: 0;
      position: relative;
      z-index: 30;
      transition: background .15s, color .15s, border-color .15s;
    }

    .nav-back-btn svg {
      width: 20px;
      height: 20px;
    }

    .nav-back-btn:hover {
      background: #006289;
      color: #fff;
    }

    .nav-back-btn:focus-visible {
      outline: 2px solid #006289;
      outline-offset: 2px;
    }

    @media (max-width: 640px) {
      .nav-back-btn {
        width: 38px;
        height: 38px;
      }

      .nav-back-btn svg {
        width: 18px;
        height: 18px;
      }
    }

    /* Mobile App Bottom Navigation Bar */
    .app-mobile-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      z-index: 9999 !important;
      background: #073A50; /* Cabinet : pétrole Contacto */
      /* Pas de backdrop-filter : bug iOS Safari connu — décroche position:fixed vers le milieu de l'écran */
      border-top: 1px solid rgba(255,255,255,0.10);
      box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.25);
      padding-bottom: var(--sab, 0px);
      /* Ancrage GPU stable sur iOS */
      transform: translate3d(0, 0, 0);
      -webkit-transform: translate3d(0, 0, 0);
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
    }

    .app-mobile-nav__grid {
      display: grid;
      grid-template-columns: 1fr 1fr auto 1fr 1fr;
      align-items: center;
      height: 68px;
      width: 100%;
      max-width: 100%;
      margin: 0 auto;
      padding: 0 8px;
    }

    .app-mobile-nav__grid--guest {
      grid-template-columns: repeat(4, 1fr) !important;
      width: 100%;
      max-width: 100% !important;
      padding: 0 8px;
    }

    .app-mobile-nav__item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      min-width: 0;
      text-decoration: none;
      color: #CBD5E1;
      font-size: 11.5px;
      font-weight: 700;
      letter-spacing: -0.01em;
      transition: color 0.15s ease, transform 0.1s ease;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 0 2px;
    }

    .app-mobile-nav__item span {
      display: block;
      margin-top: 1.5px;
      line-height: 1.1;
      font-size: 11.5px;
      white-space: nowrap !important;
      text-align: center;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Libellé long (« Fil d'actualités ») : 2 lignes plutôt que tronqué */
    .app-mobile-nav__item span.app-mobile-nav__label--wrap {
      white-space: normal !important;
      font-size: 10.5px;
      line-height: 1.05;
    }

    .app-mobile-nav__item:active {
      transform: scale(0.92);
      color: #FFFFFF;
    }

    .app-mobile-nav__item.is-active {
      color: #FFFFFF;
      font-weight: 800;
    }

    .app-mobile-nav__icon {
      position: relative;
      width: 25px;
      height: 25px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 1px;
      transition: transform 0.15s ease, color 0.15s ease;
      color: inherit;
    }

    .app-mobile-nav__badge {
      position: absolute;
      top: -5px;
      right: -8px;
      min-width: 17px;
      height: 17px;
      padding: 0 4px;
      border-radius: 9999px;
      background: #ef4444;
      color: #ffffff !important;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1.5px solid #142234;
      box-shadow: none !important;
      pointer-events: none;
      white-space: nowrap;
      transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    @keyframes badgePopPulse {
      0% {
        transform: scale(0.6);
      }

      50% {
        transform: scale(1.35);
      }

      100% {
        transform: scale(1);
      }
    }

    .contacto-badge-pop {
      animation: badgePopPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    }

    .contacto-badge-pill {
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 9999px;
      background: #ef4444;
      color: #ffffff !important;
      font-size: 10px;
      font-weight: 800;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-shadow: none;
      white-space: nowrap;
      margin-left: 2px;
      transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .app-mobile-nav__item.is-active .app-mobile-nav__icon {
      color: #FFFFFF;
    }

    .app-mobile-nav__center-wrap {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      padding: 0 4px;
    }

    .app-mobile-nav__center-btn {
      width: 100px;
      height: 44px;
      padding: 0 8px;
      border-radius: 9999px;
      background: #FFFFFF; /* Cabinet : pilule blanche sur barre pétrole */
      color: #073A50;
      border: 1px solid #FFFFFF;
      box-shadow: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: transform 0.15s ease, background 0.15s ease;
      -webkit-tap-highlight-color: transparent;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .app-mobile-nav__center-btn:active {
      transform: scale(0.94);
      background: #c5165d;
      box-shadow: none;
    }

    .app-mobile-nav__center-btn-text {
      font-size: 12.5px;
      font-weight: 800;
      letter-spacing: 0.04em;
      line-height: 1;
      text-transform: uppercase;
      color: #073A50;
    }

    @media (max-width: 767px) {
      body {
        padding-top: 0 !important;
        padding-bottom: calc(102px + var(--sab, 0px)) !important;
        background-position: top 0 center !important;
      }

      main,
      main[class],
      [class*="main-wrap"],
      [class*="-main"],
      .container {
        padding-top: 0 !important;
        margin-top: 0 !important;
      }

      .af-mobile-bar {
        bottom: calc(76px + var(--sab, 0px)) !important;
      }
      .faf-mobile-bar {
        bottom: calc(69px + var(--sab, 0px)) !important;
        z-index: 9998 !important;
      }

      .profil-edit-save-bar,
      .meet-settings-save-bar,
      .ep-actionbar {
        bottom: calc(69px + var(--sab, 0px)) !important;
      }

      .ppf-trigger {
        bottom: calc(76px + var(--sab, 0px)) !important;
      }

      .contacto-drawer-panel {
        bottom: calc(69px + var(--sab, 0px)) !important;
        height: auto !important;
      }

      .contacto-drawer-footer {
        padding-bottom: 0.625rem !important;
      }

      /* Marge basse de sécurité pour les pages avec barres d'action flottantes */
      .ep-page,
      .ep-shell,
      .abo-page {
        padding-bottom: calc(104px + var(--sab, 0px)) !important;
      }
    }

    @media (min-width: 768px) {
      .app-mobile-nav {
        display: none !important;
      }

      .contacto-drawer-panel {
        bottom: 0 !important;
        height: 100% !important;
      }
    }

    .contacto-drawer-panel {
      width: 100% !important;
      max-width: 100% !important;
    }

    @media (min-width: 640px) {
      .contacto-drawer-panel {
        width: 440px !important;
        max-width: 440px !important;
        box-shadow: -10px 0 35px rgba(0, 0, 0, 0.4) !important;
      }
    }

    @media (min-width: 1024px) {
      .contacto-drawer-panel {
        width: 490px !important;
        max-width: min(490px, 90vw) !important;
      }
    }

    /* Boutons tableau de bord dans le tiroir menu — layout compact 1 ligne */
    .menu-lp-actions {
      display: flex;
      flex-direction: column;
      gap: 0.55rem;
      min-width: 0;
    }
    .menu-lp-actions .lp-action {
      display: flex !important;
      flex-direction: row !important;
      align-items: center !important;
      justify-content: space-between !important;
      gap: 0.65rem;
      padding: 0.75rem 0.85rem !important;
      border-radius: 0.625rem;
      background: #fff;
      border: 1px solid #DCE6EA;
      box-shadow: 0 4px 12px rgba(4, 19, 26, 0.04);
      text-decoration: none;
      color: inherit;
      min-width: 0;
      width: 100%;
      box-sizing: border-box;
      overflow: hidden;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .menu-lp-actions a.lp-action:hover,
    .menu-lp-actions a.lp-action:active {
      transform: none;
      box-shadow: 0 6px 16px rgba(4, 19, 26, 0.08);
      border-color: #50A8CB;
    }
    .menu-lp-actions .lp-action__media {
      display: flex !important;
      flex-direction: row !important;
      align-items: center !important;
      gap: 0.7rem;
      min-width: 0;
      flex: 1 1 auto;
    }
    .menu-lp-actions .lp-action__media > div:last-child {
      min-width: 0;
      flex: 1 1 auto;
    }
    .menu-lp-actions .lp-action__icon {
      flex-shrink: 0 !important;
      width: 2.25rem !important;
      height: 2.25rem !important;
      border-radius: 0.5rem;
      display: grid !important;
      place-items: center;
      background: #f0f7fa !important;
      color: #006289 !important;
    }
    .menu-lp-actions .lp-action__icon svg {
      width: 1.2rem !important;
      height: 1.2rem !important;
    }
    .menu-lp-actions .lp-action h3 {
      margin: 0 !important;
      font-size: 0.875rem !important;
      font-weight: 700;
      color: #04131a;
      line-height: 1.3;
      overflow-wrap: anywhere;
    }
    .menu-lp-actions .lp-action__count {
      font-weight: 700;
      color: #006289 !important;
      white-space: nowrap;
    }
    /* Descriptions masquées dans le menu (trop verbeuses sur mobile) */
    .menu-lp-actions .lp-action p {
      display: none !important;
    }
    /* CTA → chevron compact à droite, plus de pastille qui déborde */
    .menu-lp-actions .lp-action__cta {
      display: inline-flex !important;
      align-items: center;
      justify-content: center;
      flex-shrink: 0 !important;
      align-self: center !important;
      width: 1.75rem !important;
      min-width: 1.75rem !important;
      height: 1.75rem !important;
      min-height: 1.75rem !important;
      padding: 0 !important;
      border-radius: 999px !important;
      background: #EDF3F5 !important;
      color: transparent !important;
      font-size: 0 !important;
      line-height: 0 !important;
      white-space: nowrap;
      overflow: hidden;
      position: relative;
    }
    .menu-lp-actions .lp-action__cta::after {
      content: "";
      position: absolute;
      inset: 0;
      margin: auto;
      width: 0.45rem;
      height: 0.45rem;
      border-right: 2px solid #073A50;
      border-bottom: 2px solid #073A50;
      transform: rotate(-45deg) translate(-1px, -1px);
    }

    /* Élévation universelle de tous les modals, tiroirs et overlays au-dessus de la navbar mobile */
    [role="dialog"],
    [aria-modal="true"],
    .crop-modal-overlay,
    .crop-modal,
    .modal-overlay,
    .ep-modal-overlay,
    .ppf-card,
    .ppf-overlay,
    .abo-modal,
    .meet-guard-overlay,
    .sdash-sheet,
    .fixed.inset-0.z-50,
    .fixed.inset-0.z-\[60\],
    [id*="-modal"],
    [class*="-modal-overlay"],
    [class*="__modal-overlay"] {
      z-index: 999999 !important;
    }

    .contacto-drawer-search::placeholder,
    .contacto-drawer-search::-webkit-input-placeholder,
    .contacto-drawer-search::-moz-placeholder,
    .contacto-drawer-search:-ms-input-placeholder {
      color: rgba(255, 255, 255, 0.72) !important;
      opacity: 1 !important;
    }

    #ia-user-input:focus {
      border-color: #006289 !important;
      box-shadow: 0 0 0 2px #006289 !important;
      outline: none !important;
    }

    textarea {
      overflow-y: hidden;
      /* masque la barre verticale */
      resize: none;
      /* interdit le resize manuel */
    }

    .no-anchoring {
      overflow-anchor: none;
    }

    [x-cloak] {
      display: none !important;
    }

    .pwa-install-safe-area {
      padding-bottom: max(1rem, var(--sab, 0px));
    }
    /* Une fenêtre (modale) est ouverte : le bandeau d'installation ne la recouvre pas */
    html[data-modal-open="1"] .pwa-install-safe-area {
      display: none !important;
    }
    /* Mobile : le bandeau d'installation se pose au-dessus de la barre du bas au lieu de la recouvrir */
    @media (max-width: 767px) {
      .pwa-install-safe-area {
        bottom: calc(69px + var(--sab, 0px)) !important;
        padding-bottom: 0.75rem;
      }
    }

    .triangle-left {
      width: 0;
      height: 0;
      border-top: 8px solid transparent;
      border-bottom: 8px solid transparent;
      border-right: 8px solid #006289;
      /* plein */
      margin-left: 4px;
    }

    #ia-user-input:focus {
      --tw-ring-shadow: none !important;
      --tw-ring-color: transparent !important;
      box-shadow: none !important;
      border-color: #50a8cb !important;
      /* brand-400 */
    }

      {
      % if user.is_superuser %
    }

    /* Indicateur de réseau */
    .net-bar {
      transition: fill 0.3s ease, stroke 0.3s ease;
    }

    .net-bar--good {
      stroke: #10b981;
      fill: #10b981;
    }

    .net-bar--weak {
      stroke: #f97316;
      fill: #f97316;
    }

    .net-bar--weak-inactive {
      stroke: #e5e7eb;
      fill: transparent;
    }

    .net-bar--offline {
      stroke: #ef4444;
      fill: #ef4444;
    }

    @keyframes net-pulse {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0.3;
      }
    }

    .net-pulse {
      animation: net-pulse 1.5s infinite ease-in-out;
    }

      {
      % endif %
    }
