/* =====================================================================
   Sync Technology : en-tête v2 (assets/css/header.css)
   Disposition : logo sur deux lignes | ligne 1 : recherche + comptes | ligne 2 : domaines
   Polices : IBM Plex Sans / Space Grotesk si la page les charge, sinon police système.
   ===================================================================== */
:root {
  --ink: #0E1420;
  --muted: #5B6472;
  --line: #E4E8ED;
  --surface: #FFFFFF;
  --surface-tint: #F5F9FA;
  --accent: #17B8D6;
  --accent-deep: #0B7C93;
  --navy: #0E1420;
  --danger: #C62828;
  --ok: #1E9E4A;
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-title: 'Space Grotesk', var(--font-ui);
  --header-max: 1320px;
  --mega-height: 320px;
}

*, *::before, *::after { box-sizing: border-box; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 2000; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; font: 500 14px var(--font-ui); text-decoration: none; }
.skip-link:focus { top: 12px; }

.sync-header {
  position: sticky; top: 0; z-index: 1000; background: var(--surface);
  border-bottom: 1px solid var(--line); font-family: var(--font-ui); color: var(--ink);
  transition: box-shadow .2s ease;
}
.sync-header.is-scrolled { box-shadow: 0 6px 20px rgba(14, 20, 32, .08); }
.sync-header a { color: inherit; text-decoration: none; }
.sync-header ul { list-style: none; margin: 0; padding: 0; }
.sync-header button { font: inherit; color: inherit; }
.sync-header :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sync-header svg { display: block; }

/* ---------- Grille : le logo occupe les deux lignes ---------- */
.sync-header__inner {
  max-width: var(--header-max); margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 20px; align-items: center;
  grid-template-areas:
    "logo search quick"
    "logo nav    nav";
}
.sync-burger { display: none; grid-area: burger; }
.sync-logo { grid-area: logo; align-self: stretch; display: flex; align-items: center; padding: 8px 16px 8px 0; }
.sync-logo img { display: block; height: 76px; width: auto; max-width: 160px; object-fit: contain; }
.sync-search { grid-area: search; position: relative; margin: 10px 0; }
.sync-quick { grid-area: quick; display: flex; align-items: center; gap: 2px; }
.sync-services { grid-area: nav; align-self: stretch; border-top: 1px solid var(--line); }

/* ---------- Recherche ---------- */
.sync-search input {
  width: 100%; height: 44px; padding: 0 78px 0 46px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-tint); font: 400 15px var(--font-ui); color: var(--ink);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.sync-search input::placeholder { color: var(--muted); }
.sync-search input:hover { border-color: #CBD3DB; }
.sync-search input:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 184, 214, .25); }
.sync-search__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.sync-search__icon svg { width: 18px; height: 18px; }
.sync-search__hint {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 500 12px var(--font-ui); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; background: #fff;
}
.sync-search input:focus ~ .sync-search__hint { display: none; }
.sync-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 1100; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(14, 20, 32, .14); padding: 8px;
}
.sync-suggest[hidden] { display: none; }
.sync-suggest li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; }
.sync-suggest li a small { color: var(--muted); font-size: 12px; }
.sync-suggest li a:hover, .sync-suggest li a[aria-selected="true"] { background: var(--surface-tint); }
.sync-suggest__empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }

/* ---------- Liens rapides, icônes, utilisateur ---------- */
.sync-quick__link { height: 44px; padding: 0 12px; display: inline-flex; align-items: center; font-weight: 500; font-size: 14.5px; border-radius: 999px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.sync-quick__link:hover { background: var(--surface-tint); color: var(--accent-deep); }
.sync-quick__link--pro { color: var(--accent-deep); font-weight: 600; }

.icon-btn {
  position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--ink); transition: background .15s ease;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-tint); }
.icon-btn svg { width: 22px; height: 22px; }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--danger); color: #fff; font: 600 11px var(--font-ui);
  border-radius: 999px; border: 2px solid #fff; line-height: 1;
}

.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; transition: background .15s ease; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-tint); }
.user-btn__ico { position: relative; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-deep); color: #fff; }
.user-btn__ico svg { width: 17px; height: 17px; }
.user-btn__dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; background: var(--ok); border: 2px solid #fff; border-radius: 50%; }
.user-btn__name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 14.5px; }
.user-btn > svg { width: 16px; height: 16px; color: var(--muted); }
.user-btn[aria-expanded="true"] > svg { transform: rotate(180deg); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; font: 600 14px var(--font-ui); border: 1px solid transparent; cursor: pointer; transition: background .15s ease; }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--accent-deep); color: #fff !important; }
.btn--primary:hover { background: #096579; }

/* ---------- Menus déroulants de la ligne 1 (applications, utilisateur) ---------- */
.sync-dd { position: relative; }
.sync-dd__panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 1100; min-width: 220px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(14, 20, 32, .14); padding: 12px;
}
.sync-dd__panel[hidden] { display: none; }
.sync-dd__title { margin: 2px 6px 10px; font-size: 13px; color: var(--muted); }
.sync-menu-list li a { display: block; padding: 11px 14px; border-radius: 10px; font-size: 14.5px; }
.sync-menu-list li a:hover { background: var(--surface-tint); }
.sync-dd__panel--apps { width: 360px; max-width: calc(100vw - 24px); }
.sync-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sync-apps a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px; border-radius: 12px; text-align: center; font-size: 13px; line-height: 1.25; }
.sync-apps a:hover { background: var(--surface-tint); }
.sync-apps__icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-tint); color: var(--accent-deep); transition: all .15s ease; }
.sync-apps__icon svg { width: 21px; height: 21px; }
.sync-apps a:hover .sync-apps__icon { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Ligne 2 : domaines et menus de taille identique ---------- */
.sync-drawer__head, .sync-drawer__links { display: none; }
.sync-services__list { display: flex; gap: 2px; }
.sync-services__item { position: static; }  /* le menu se place par rapport à l'en-tête entier */
.sync-services__trigger {
  height: 48px; padding: 0 12px; display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent;
  cursor: pointer; font-weight: 500; font-size: 14.5px; white-space: nowrap; box-shadow: inset 0 -3px 0 transparent;
  transition: box-shadow .15s ease, color .15s ease;
}
.sync-services__trigger svg { width: 16px; height: 16px; transition: transform .15s ease; }
.sync-services__trigger:hover { color: var(--accent-deep); }
.sync-services__trigger[aria-expanded="true"] { color: var(--accent-deep); box-shadow: inset 0 -3px 0 var(--accent); }
.sync-services__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

.sync-mega {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 1100; background: #fff;
  border-top: 1px solid var(--line); box-shadow: 0 28px 40px rgba(14, 20, 32, .14);
}
.sync-mega[hidden] { display: none; }
.sync-mega__inner {
  max-width: var(--header-max); margin: 0 auto; padding: 32px 24px; height: var(--mega-height); overflow-y: auto;
  display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 56px; align-content: start;
}
.sync-mega__intro h3 { margin: 0 0 10px; font: 600 26px var(--font-title); letter-spacing: -.01em; }
.sync-mega__intro p { margin: 0 0 22px; color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 34ch; }
.sync-mega__links { columns: 3; column-gap: 28px; align-self: start; }
.sync-mega__links li { break-inside: avoid; margin-bottom: 4px; }
.sync-mega__links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 10px; font-size: 15px; font-weight: 500; }
.sync-mega__links a svg { width: 16px; height: 16px; color: var(--accent-deep); opacity: 0; transform: translateX(-4px); transition: all .15s ease; flex: 0 0 auto; }
.sync-mega__links a:hover { background: var(--surface-tint); color: var(--accent-deep); }
.sync-mega__links a:hover svg { opacity: 1; transform: none; }

.sync-burger, .sync-overlay, .sync-drawer__links { display: none; }
body.sync-no-scroll { overflow: hidden; }

/* ---------- Écran large : domaines affichés selon la place disponible ---------- */
@media (min-width: 1024px) {
  .sync-services__item.p2, .sync-services__item.p3 { display: none; }
  .sync-more .more-p2, .sync-more .more-p3 { display: block; }
}
@media (min-width: 1180px) {
  .sync-services__item.p2 { display: block; }
  .sync-more .more-p2 { display: none; }
}

/* ---------- Mobile et tablette ---------- */
@media (max-width: 1023px) {
  .sync-header__inner {
    grid-template-columns: auto auto 1fr; padding: 0 12px; column-gap: 8px;
    grid-template-areas:
      "burger logo quick"
      "search search search";
  }
  .sync-burger { display: inline-flex; }
  .sync-logo { padding: 6px 8px 6px 0; }
  .sync-logo img { height: 44px; max-width: 120px; }
  .sync-quick { justify-self: end; }
  .sync-quick__link, .sync-quick__home { display: none; }
  .user-btn__name { display: none; }
  .user-btn { padding: 0 8px 0 6px; }
  .sync-search { margin: 0 0 10px; }
  .sync-search__hint { display: none; }
  .sync-dd__panel { right: -8px; }

  .sync-services {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1200; width: min(88vw, 380px); background: #fff; border: 0;
    transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility .25s;
    overflow-y: auto; box-shadow: 0 0 40px rgba(14, 20, 32, .25);
  }
  .sync-header.is-menu-open .sync-services { transform: translateX(0); visibility: visible; }
  .sync-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--line); font: 600 16px var(--font-title); }
  .sync-drawer__links { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .sync-drawer__links a { flex: 1; text-align: center; padding: 11px 8px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; font-size: 14px; }
  .sync-services__list { flex-direction: column; gap: 0; padding: 4px 12px 24px; }
  .sync-services__item, .sync-services__item.p2, .sync-services__item.p3 { display: block; }
  .sync-services__item.sync-more { display: none; }
  .sync-services__trigger { width: 100%; justify-content: space-between; height: 52px; padding: 0 8px; font-size: 16px; box-shadow: none !important; border-bottom: 1px solid var(--line); border-radius: 0; }
  .sync-mega { position: static; border: 0; box-shadow: none; }
  .sync-mega__inner { height: auto; display: block; padding: 8px 4px 14px; overflow: visible; }
  .sync-mega__intro p, .sync-mega__intro .btn { display: none; }
  .sync-mega__intro h3 { display: none; }
  .sync-mega__links { columns: 1; }
  .sync-mega__links a svg { display: none; }
  .sync-overlay { display: block; position: fixed; inset: 0; z-index: 1150; background: rgba(14, 20, 32, .5); }
  .sync-overlay[hidden] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sync-header *, .sync-header *::before, .sync-header *::after { transition: none !important; }
}

/* =====================================================================
   À AJOUTER À LA FIN de assets/css/header.css
   ===================================================================== */

/* 1) Menu « Plus » : inutile sur grand écran s'il ne reste aucun domaine de priorité 3 */
@media (min-width: 1180px) {
  .sync-more.sync-more--lt1180 { display: none; }
}

/* 2) Mobile et tablette : les menus déroulants s'ancrent sur la largeur de l'écran
      (et non sur leur bouton, ce qui faisait déborder le menu des 9 points à gauche) */
@media (max-width: 1023px) {
  .sync-quick .sync-dd { position: static; }

  .sync-header .sync-dd__panel {
    position: absolute; left: 12px; right: 12px; top: 100%;
    width: auto; min-width: 0; max-width: none; margin-top: 8px;
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
  }
  /* le menu utilisateur reste étroit, aligné à droite */
  .sync-header .sync-dd__panel--user { left: auto; width: min(260px, calc(100vw - 24px)); }

  .sync-dd__panel--apps .sync-apps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sync-apps a { padding: 12px 4px 10px; font-size: 12.5px; overflow-wrap: anywhere; }
}

/* =====================================================================
   À AJOUTER À LA FIN de assets/css/header.css
   En-tête fixe qui se condense au défilement (la ligne 1 disparaît).
   ===================================================================== */

html { scroll-padding-top: var(--sync-header-hc, 56px); }

/* L'en-tête est fixe : l'espaceur garde la place d'origine (aucun saut de page) */
.sync-header { position: fixed; top: 0; left: 0; right: 0; }
.sync-header-spacer { height: var(--sync-header-h, 114px); }

/* Pendant les mesures, aucune animation */
.sync-header.is-measuring, .sync-header.is-measuring * { transition: none !important; }

/* Ligne 1 (recherche + liens) et logo : transitions douces */
.sync-search, .sync-quick {
  max-height: 80px;
  transition: opacity .2s ease, max-height .25s ease, margin .25s ease, visibility 0s;
}
.sync-logo, .sync-logo img { transition: height .25s ease, padding .25s ease; }

/* ----- État condensé (ordinateur) : la ligne 1 disparaît, le logo rétrécit ----- */
.sync-header.is-condensed .sync-search,
.sync-header.is-condensed .sync-quick {
  max-height: 0; margin-top: 0; margin-bottom: 0; opacity: 0; overflow: hidden;
  visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, max-height .25s ease, margin .25s ease, visibility 0s linear .25s;
}
.sync-header.is-condensed .sync-logo { padding-top: 6px; padding-bottom: 6px; }
.sync-header.is-condensed .sync-logo img { height: 36px; }

/* ----- Mobile : seule la barre de recherche disparaît (logo, menu et icônes restent) ----- */
@media (max-width: 1023px) {
  .sync-header.is-condensed .sync-quick {
    max-height: 80px; opacity: 1; overflow: visible; visibility: visible; pointer-events: auto;
  }
  .sync-header.is-condensed .sync-logo { padding: 6px 8px 6px 0; }
  .sync-header.is-condensed .sync-logo img { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .sync-search, .sync-quick, .sync-logo, .sync-logo img { transition: none !important; }
}