/* ==========================================================================
   Structure du portail : shell, header, navigation, contenu, footer
   ========================================================================== */

.fpt-portal-body { background: var(--fpt-bg); }

.fpt-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* --------------------------------------------------------------- Header */

.fpt-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--fpt-header);
  border-bottom: 1px solid var(--fpt-border);
  box-shadow: var(--fpt-head-shadow);
}
.fpt-header-in {
  display: flex;
  align-items: center;
  gap: var(--fpt-3);
  height: var(--fpt-header-h);
  padding: 0 var(--fpt-4);
}
.fpt-header-spacer { flex: 1; }

.fpt-brand { display: inline-flex; align-items: center; color: inherit; }
.fpt-brand:hover { text-decoration: none; }
.fpt-brand-mobile { display: none; }
.fpt-logo { max-height: 34px; width: auto; display: block; }
.fpt-logo-text { font-weight: var(--fpt-fw-b); letter-spacing: -.01em; font-size: var(--fpt-fs-lg); }

.fpt-header-company {
  padding-left: var(--fpt-3);
  border-left: 1px solid var(--fpt-border);
  color: var(--fpt-muted);
  font-size: var(--fpt-fs-sm);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(.fpt-portal-body,.fpt-auth) .fpm-company-switch { display: flex; }
:is(.fpt-portal-body,.fpt-auth) .fpm-company-switch select { max-width: 220px; font-size: var(--fpt-fs-sm); padding: 6px 10px; }

.fpt-burger { display: none; }

.fpt-user-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--fpt-2);
  padding: 5px 9px 5px 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.fpt-user-btn:hover { background: var(--fpt-surface-2); border-color: var(--fpt-border); }
.fpt-user-btn:focus-visible { box-shadow: var(--fpt-ring); }
.fpt-user-name { font-size: .9375rem; font-weight: var(--fpt-fw-md); }

.fpt-theme-toggle .fpt-i-dark { display: none; }
[data-theme="dark"] .fpt-theme-toggle .fpt-i-light { display: none; }
[data-theme="dark"] .fpt-theme-toggle .fpt-i-dark { display: block; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .fpt-theme-toggle .fpt-i-light { display: none; }
  [data-theme="auto"] .fpt-theme-toggle .fpt-i-dark { display: block; }
}

/* ----------------------------------------------------------------- Corps */

.fpt-body { display: flex; flex: 1; align-items: stretch; min-height: 0; }

/* -------------------------------------------------------------- Sidebar */

.fpt-nav--sidebar {
  flex: 0 0 var(--fpt-sidebar-w);
  width: var(--fpt-sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--fpt-sidebar);
  color: var(--fpt-sidebar-tx);
  box-shadow: var(--fpt-sidebar-edge);
  transition: width var(--fpt-speed) var(--fpt-ease), flex-basis var(--fpt-speed) var(--fpt-ease);
}
.fpt-nav--sidebar.is-collapsed {
  flex-basis: var(--fpt-sidebar-collapsed);
  width: var(--fpt-sidebar-collapsed);
}
.fpt-nav-scroll { flex: 1; overflow-y: auto; padding: var(--fpt-5) 0; }
.fpt-nav-mobile-head { display: none; }

.fpt-nav-list, .fpt-nav-pages { list-style: none; margin: 0; padding: 0; }
.fpt-nav-section { margin-bottom: var(--fpt-5); }
.fpt-nav-section-title {
  display: flex;
  align-items: center;
  gap: var(--fpt-2);
  padding: 0 var(--fpt-4) 6px;
  font-size: var(--fpt-fs-xs);
  font-weight: var(--fpt-fw-b);
  text-transform: uppercase;
  letter-spacing: .09em;
  opacity: .6;
}
/* Le lien se decolle du bord : la gouttiere permet au fond actif de
   devenir une pilule posee sur la colonne, au lieu d'un bandeau colle
   contre le bord de l'ecran. Gouttiere a 0, l'ancien rendu revient. */
.fpt-nav-link {
  display: flex;
  align-items: center;
  gap: var(--fpt-3);
  margin: 0 var(--fpt-nav-gutter);
  padding: var(--fpt-nav-pad);
  color: inherit;
  font-size: .9375rem;
  border-left: var(--fpt-nav-indicator) solid transparent;
  border-radius: var(--fpt-nav-radius);
  transition: background var(--fpt-speed) var(--fpt-ease), color var(--fpt-speed) var(--fpt-ease);
}
.fpt-nav-link:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.fpt-nav-link.is-active {
  background: var(--fpt-nav-active-bg);
  border-left-color: var(--fpt-primary);
  box-shadow: var(--fpt-nav-active-edge);
  font-weight: var(--fpt-fw-b);
  color: var(--fpt-nav-active-tx);
}
/* L'icone de l'element actif reprend la couleur principale : c'est
   elle qu'on voit avant de lire le libelle. */
.fpt-nav-link.is-active svg { color: var(--fpt-primary); }

.fpt-nav-section-title { padding-inline: calc(var(--fpt-4) + var(--fpt-nav-gutter)); }
.fpt-nav-link:focus-visible { outline-offset: -2px; }
.fpt-nav-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; margin: 0 6px; }
.fpt-nav-empty { padding: var(--fpt-4); font-size: var(--fpt-fs-sm); opacity: .7; }

.fpt-nav-collapse {
  display: flex;
  align-items: center;
  gap: var(--fpt-2);
  width: 100%;
  padding: var(--fpt-3) var(--fpt-4);
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.09);
  color: inherit;
  font: inherit;
  font-size: var(--fpt-fs-sm);
  opacity: .7;
  cursor: pointer;
}
.fpt-nav-collapse:hover { opacity: 1; background: rgba(255,255,255,.06); }

.fpt-nav--sidebar.is-collapsed .fpt-nav-label,
.fpt-nav--sidebar.is-collapsed .fpt-nav-section-title { display: none; }
.fpt-nav--sidebar.is-collapsed .fpt-nav-section { margin-bottom: var(--fpt-2); }
.fpt-nav--sidebar.is-collapsed .fpt-nav-link { justify-content: center; padding: 11px 0; margin-inline: 6px; border-left-width: 0; }
.fpt-nav--sidebar.is-collapsed .fpt-nav-count { display: none; }
.fpt-nav--sidebar.is-collapsed .fpt-nav-collapse { justify-content: center; }
.fpt-nav--sidebar.is-collapsed .fpt-nav-collapse svg { transform: rotate(180deg); }

/* --------------------------------------------------- Navigation horizontale */

.fpt-nav--horizontal {
  background: var(--fpt-surface);
  border-bottom: 1px solid var(--fpt-border);
  position: sticky;
  top: var(--fpt-header-h);
  z-index: 40;
}
.fpt-nav--horizontal .fpt-topnav-in {
  max-width: var(--fpt-content-w);
  margin: 0 auto;
  padding: 0 var(--fpt-4);
}
.fpt-nav--horizontal { --fpt-nav-gutter: 0px; --fpt-nav-radius: 0px; }
.fpt-nav--horizontal .fpt-nav-list { display: flex; flex-wrap: wrap; }
.fpt-nav--horizontal .fpt-nav-section { margin: 0; }
.fpt-nav--horizontal .fpt-nav-section-title {
  padding: var(--fpt-3) var(--fpt-3);
  padding-inline: var(--fpt-3);
  text-transform: none;
  letter-spacing: 0;
  font-size: .9375rem;
  font-weight: var(--fpt-fw-md);
  opacity: 1;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
}
.fpt-nav--horizontal .fpt-nav-section-title:hover { color: var(--fpt-primary); }
.fpt-nav--horizontal .fpt-dropdown-panel { left: 0; right: auto; }

/* --------------------------------------------------------------- Contenu */

.fpt-main { flex: 1; min-width: 0; }
.fpt-main-in {
  max-width: var(--fpt-content-w);
  margin: 0 auto;
  padding: var(--fpt-6) var(--fpt-5) var(--fpt-8);
}
.fpt-main:focus { outline: none; }

.fpt-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fpt-4);
  flex-wrap: wrap;
  margin-bottom: var(--fpt-5);
  padding-bottom: var(--fpt-4);
  border-bottom: 1px solid var(--fpt-border);
}
.fpt-page-title { margin: 0; }
.fpt-page-desc { margin: 6px 0 0; color: var(--fpt-muted); font-size: .9375rem; max-width: 68ch; }
.fpt-page-head-actions { display: flex; gap: var(--fpt-2); flex-wrap: wrap; }
.fpt-page-head-actions:empty { display: none; }

/* Le bandeau d'accueil porte deja son propre h1 : le fil d'Ariane
   reste, l'entete de page s'efface pour ne pas afficher deux titres
   l'un au-dessus de l'autre. */
.fpt-main-in:has(.fpt-hero) .fpt-page-head { display: none; }

/* le theme affiche deja le titre : on masque celui emis par le plugin,
   uniquement dans le shell du portail (les shortcodes le conservent) */
.fpt-portal-body .fpt-page-head ~ * .fpm-title,
.fpt-portal-body .fpt-main-in > .fpm-title { display: none; }

/* ------------------------------------------------------- Bandeau d'accueil

   Premiere chose lue sur le tableau de bord : qui, quand, et les deux
   actions qu'on fait le plus souvent. Sans lui, la page s'ouvre sur une
   grille de cartes de meme poids, que l'oeil parcourt sans savoir par
   ou commencer.
   -------------------------------------------------------------------- */

.fpt-hero {
  display: flex;
  align-items: center;
  gap: var(--fpt-5);
  flex-wrap: wrap;
  padding: var(--fpt-5) var(--fpt-card-pad);
  margin-bottom: var(--fpt-gap);
  background: var(--fpt-surface);
  background-image: linear-gradient(135deg, transparent 40%, var(--fpt-tint) 100%);
  border: var(--fpt-card-bd) solid var(--fpt-border);
  border-radius: var(--fpt-card-radius);
  box-shadow: var(--fpt-shadow);
}
.fpt-hero-text { flex: 1 1 320px; min-width: 0; }
.fpt-hero-title { margin: 0 0 4px; font-size: 1.375rem; font-weight: var(--fpt-fw-b); letter-spacing: -.02em; }
.fpt-hero-sub { margin: 0; color: var(--fpt-muted); font-size: .9375rem; }
.fpt-hero-actions { display: flex; gap: var(--fpt-2); flex-wrap: wrap; }

/* Rangee de chiffres : quatre tuiles egales, pas quatre cartes de
   tailles differentes. */
.fpt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--fpt-gap);
  margin-bottom: var(--fpt-gap);
}
.fpt-stat {
  padding: var(--fpt-4);
  background: var(--fpt-tile);
  border: var(--fpt-card-bd) solid var(--fpt-tile-bd);
  border-radius: var(--fpt-card-radius);
  box-shadow: var(--fpt-shadow);
  transition: box-shadow var(--fpt-speed) var(--fpt-ease), transform var(--fpt-speed) var(--fpt-ease);
}
.fpt-stat:hover { box-shadow: var(--fpt-card-hover-shadow); transform: translateY(var(--fpt-card-lift)); }
.fpt-stat-head { display: flex; align-items: center; gap: var(--fpt-2); margin-bottom: var(--fpt-3); }
.fpt-stat-head .fpt-stat-label { font-size: var(--fpt-fs-sm); font-weight: var(--fpt-fw-md); color: var(--fpt-muted); }
.fpt-stat-n {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.fpt-stat-n small { font-size: 1rem; font-weight: var(--fpt-fw-b); color: var(--fpt-muted); }
.fpt-stat .fpt-gauge { margin-top: var(--fpt-3); }

/* -------------------------------------------------------------- Widgets */

.fpt-widgets, :is(.fpt-portal-body,.fpt-auth) .fpm-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--fpt-gap);
  align-items: start;
}
.fpt-widgets .fpt-card, :is(.fpt-portal-body,.fpt-auth) .fpm-widgets .fpm-card { margin: 0; }
.fpt-w-2 { grid-column: span 2; }
@media (max-width: 1099px) { .fpt-w-2 { grid-column: span 1; } }

/* ------------------------------------------------- Module identite entreprise */

.fpt-identity-head {
  display: flex;
  align-items: baseline;
  gap: var(--fpt-3);
  flex-wrap: wrap;
  margin-bottom: var(--fpt-5);
}
.fpt-identity-name { font-size: 1.375rem; font-weight: var(--fpt-fw-b); margin: 0; }
.fpt-identity-form { color: var(--fpt-muted); font-size: .9375rem; }
.fpt-identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--fpt-gap);
  align-items: start;
}
.fpt-identity-grid .fpm-card { margin: 0; }

/* ------------------------------------------------------------- Overlay */

.fpt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 44;
}

/* --------------------------------------------------------------- Footer */

.fpt-footer { border-top: 1px solid var(--fpt-border); background: var(--fpt-surface); }
.fpt-footer-in {
  display: flex;
  align-items: center;
  gap: var(--fpt-4);
  flex-wrap: wrap;
  max-width: var(--fpt-content-w);
  margin: 0 auto;
  padding: var(--fpt-4) var(--fpt-5);
  font-size: var(--fpt-fs-sm);
  color: var(--fpt-muted);
}
.fpt-footer-links { display: flex; gap: var(--fpt-4); list-style: none; margin: 0; padding: 0; }
.fpt-footer-links a { color: var(--fpt-muted); }
.fpt-footer-meta { margin-left: auto; display: flex; gap: var(--fpt-2); align-items: center; }
.fpt-footer-version { opacity: .65; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ Ecrans d'authentification */

.fpt-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--fpt-4);
  padding: var(--fpt-5);
  background: var(--fpt-bg);
}
.fpt-auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--fpt-6);
  background: var(--fpt-surface);
  border: 1px solid var(--fpt-border);
  border-radius: var(--fpt-radius-lg);
  box-shadow: var(--fpt-shadow-lg);
}
.fpt-auth-head { text-align: center; margin-bottom: var(--fpt-5); }
.fpt-auth-head .fpt-logo { margin: 0 auto; }
.fpt-auth-sub { margin: var(--fpt-3) 0 0; font-weight: var(--fpt-fw-b); font-size: var(--fpt-fs-lg); }
.fpt-auth-foot { display: flex; align-items: center; gap: var(--fpt-3); font-size: var(--fpt-fs-sm); color: var(--fpt-muted); }
:is(.fpt-portal-body,.fpt-auth) .fpm-auth-wrap { min-height: 0; padding: 0; background: transparent; }
:is(.fpt-portal-body,.fpt-auth) .fpm-auth-card { max-width: none; padding: 0; background: transparent; border: 0; box-shadow: none; }
:is(.fpt-portal-body,.fpt-auth) .fpm-auth-head { display: none; }
:is(.fpt-portal-body,.fpt-auth) .fpm-auth-links { margin-top: var(--fpt-4); text-align: center; font-size: var(--fpt-fs-sm); color: var(--fpt-muted); }
:is(.fpt-portal-body,.fpt-auth) .fpm-strength { height: 4px; border-radius: 2px; background: var(--fpt-border); overflow: hidden; margin-top: 5px; }
:is(.fpt-portal-body,.fpt-auth) .fpm-strength i { display: block; height: 100%; width: 0; transition: width var(--fpt-speed) var(--fpt-ease); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1023px) {
  .fpt-burger { display: inline-flex; }
  .fpt-header-company { display: none; }

  .fpt-nav--sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(320px, 86vw);
    flex-basis: auto;
    transform: translateX(-100%);
    transition: transform var(--fpt-speed) var(--fpt-ease);
    box-shadow: var(--fpt-shadow-lg);
  }
  .fpt-nav--sidebar.is-open { transform: none; }
  .fpt-nav--sidebar.is-collapsed { width: min(320px, 86vw); }
  .fpt-nav--sidebar.is-collapsed .fpt-nav-label,
  .fpt-nav--sidebar.is-collapsed .fpt-nav-section-title { display: flex; }
  .fpt-nav--sidebar.is-collapsed .fpt-nav-link { justify-content: flex-start; padding: var(--fpt-nav-pad); margin: 0 var(--fpt-nav-gutter); }
  .fpt-nav--sidebar.is-collapsed .fpt-nav-count { display: inline-flex; }
  .fpt-nav-collapse { display: none; }

  .fpt-nav-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--fpt-3);
    padding: var(--fpt-3) var(--fpt-4);
    border-bottom: 1px solid rgba(255,255,255,.09);
  }
  .fpt-nav-mobile-head .fpt-icon-btn { color: inherit; }

  .fpt-nav--horizontal { position: static; }
  .fpt-nav--horizontal .fpt-nav-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .fpt-nav--horizontal .fpt-nav-list::-webkit-scrollbar { display: none; }

  .fpt-main-in { padding: var(--fpt-5) var(--fpt-4) var(--fpt-7); }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table { display: block; overflow-x: auto; }
}

@media (min-width: 1024px) {
  .fpt-overlay { display: none !important; }
}

@media (max-width: 700px) {
  .fpt-brand-desktop { display: none; }
  .fpt-brand-mobile { display: inline-flex; }
  .fpt-user-name { display: none; }
  :is(.fpt-portal-body,.fpt-auth) .fpm-company-switch select { max-width: 130px; }

  .fpt-dl, :is(.fpt-portal-body,.fpt-auth) .fpm-dl { grid-template-columns: 1fr; gap: 2px; }
  .fpt-dl dd, :is(.fpt-portal-body,.fpt-auth) .fpm-dl dd { margin-bottom: var(--fpt-3); }

  /* tableaux en cartes : le plugin fournit deja data-label */
  .fpm-table, :is(.fpt-portal-body,.fpt-auth) .fpm-table tbody, :is(.fpt-portal-body,.fpt-auth) .fpm-table tr, :is(.fpt-portal-body,.fpt-auth) .fpm-table td { display: block; width: 100%; }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table { overflow: visible; border: 0; background: transparent; }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table thead { display: none; }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table tr {
    background: var(--fpt-surface);
    border: 1px solid var(--fpt-border);
    border-radius: var(--fpt-radius);
    margin-bottom: var(--fpt-3);
    padding: var(--fpt-2) 0;
  }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table td {
    display: flex;
    justify-content: space-between;
    gap: var(--fpt-4);
    border: 0;
    padding: 6px var(--fpt-4);
  }
  :is(.fpt-portal-body,.fpt-auth) .fpm-table td::before {
    content: attr(data-label);
    color: var(--fpt-muted);
    font-size: var(--fpt-fs-sm);
    flex-shrink: 0;
  }
  :is(.fpt-portal-body,.fpt-auth) .fpm-row-actions { justify-content: flex-start; }

  .fpt-btn, :is(.fpt-portal-body,.fpt-auth) .fpm-btn { min-height: 44px; }
  .fpt-icon-btn { width: 42px; height: 42px; }

  .fpt-actions, :is(.fpt-portal-body,.fpt-auth) .fpm-actions {
    position: sticky;
    bottom: 0;
    background: var(--fpt-surface);
    padding: var(--fpt-3) 0;
    margin-inline: calc(var(--fpt-4) * -1);
    padding-inline: var(--fpt-4);
  }

  .fpt-auth { padding: 0; }
  .fpt-auth-card { max-width: none; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
}

/* Premier maillon du fil d'Ariane : une maison plutot qu'un mot.

   La racine du portail et la page d'accueil d'une section portent
   souvent le meme nom, et le fil affichait alors « Accueil › Section ›
   Accueil ». L'icone supprime la repetition sans amputer le chemin.

   font-size: 0 cache le mot a l'oeil mais le laisse dans le document :
   les lecteurs d'ecran l'annoncent toujours, ce qu'un aria-label sur un
   lien vide ne ferait pas mieux. */
.fpt-breadcrumbs li:first-child a {
  display: inline-flex;
  align-items: center;
  font-size: 0;
  line-height: 0;
}
.fpt-breadcrumbs li:first-child a::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10.5 12 4l9 6.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10.5 12 4l9 6.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/></svg>") center / contain no-repeat;
}
/* Repli pour les navigateurs sans mask : le mot revient. */
@supports not ((mask: url("#x")) or (-webkit-mask: url("#x"))) {
  .fpt-breadcrumbs li:first-child a { font-size: inherit; line-height: inherit; }
  .fpt-breadcrumbs li:first-child a::before { content: none; }
}
