/* ==========================================================================
   Plexus Santé — Tableau de bord (reproduction de l'existant)
   Organisation : base → layout → header → sous-navigation → widgets →
   composants (boutons, badges, tuiles, rubans, tâches) → footer → flottants.
   ========================================================================== */

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-page-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
p { margin: 0 0 var(--space-4); }
h1, h2, h3 { margin: 0; }

/* Icônes : Feather font (.feather.icon-*) + sprite SVG pour les pictos pleins */
.feather { display: inline-block; line-height: 1; }
.svg-icon { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Triangle de menu déroulant (équivalent .dropdown-toggle Bootstrap) */
.caret {
  display: inline-block;
  width: 0; height: 0;
  margin-left: var(--space-3);
  border-top: 5px solid currentColor;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  vertical-align: middle;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container-width) + 2 * var(--space-4));
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Grille 12 colonnes à la Bootstrap : col-7 / col-5 */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 calc(var(--gutter) / -2);
}
.col-7, .col-5 { padding: 0 calc(var(--gutter) / 2); }
.col-7 { flex: 0 0 58.3333%; max-width: 58.3333%; }
.col-5 { flex: 0 0 41.6667%; max-width: 41.6667%; }

.page { flex: 1; padding-bottom: 21px; }
.col-7 > .widget:last-child,
.col-5 > .widget:last-child { margin-bottom: 0; }

/* ---------- Header ---------- */
.app-header {
  height: var(--header-height);
  background: var(--color-primary);
  color: var(--color-white);
}
.app-header .container {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.app-header__logo {
  display: flex;
  align-items: center;
  width: 245px;            /* bloc logo : jusqu'au bouton « Créer » */
  padding-left: 24px;
}
.app-header__logo img { height: 58px; width: auto; display: block; }

.app-header__create {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 21px 0 17px;
  border: 0;
  background: var(--color-primary-overlay);
  color: var(--color-white);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
}
.app-header__create .feather { font-size: 17px; }
.app-header__create .caret { margin-left: 4px; }

.app-header__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding-right: 17px;
}

.structure-switch,
.user-menu {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  padding: 0;
  font-size: var(--font-size-base);
}
.structure-switch { color: var(--color-white); font-weight: var(--font-weight-medium); margin-right: 26px; }
.user-menu { color: var(--color-primary-soft); margin-right: 33px; }
.user-menu .caret { margin-left: 4px; border-top-width: 4px; border-left-width: 4px; border-right-width: 4px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px; height: 35px;
  border-radius: 50%;
  font-size: 19px;
  color: var(--color-white);
  flex-shrink: 0;
}
.avatar--user { background: var(--color-avatar-user); margin-right: 3px; }
/* Logo de structure : contenu image (placeholder) */
.avatar--structure {
  background: var(--color-avatar-structure);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.2px;
  margin-right: -4px;
  position: relative;
  z-index: 0;
}

.header-icons { display: flex; align-items: center; gap: 34px; }
.header-icon {
  display: inline-flex;
  border: 0; background: none; padding: 0;
  color: var(--color-primary-soft);
  font-size: 22px;
}

/* ---------- Sous-navigation ---------- */
.subnav {
  position: relative;
  z-index: 1;
  height: var(--subnav-height);
  background: var(--color-white);
  box-shadow: var(--shadow-nav);
}
.subnav__list {
  display: flex;
  align-items: center;
  gap: 45.5px;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.subnav__item { position: relative; height: 100%; }
.subnav__link {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 14px;
  color: var(--color-text-nav);
  font-size: 16.5px;
}
.subnav__link:hover { text-decoration: none; color: var(--color-primary-text); }
.subnav__link .svg-icon,
.subnav__link .feather { font-size: 17px; }
.subnav__link .caret { margin-left: -4px; margin-right: 12px; }

.subnav__item--active .subnav__link { color: var(--color-primary-text); }
.subnav__item--active .subnav__link .svg-icon { color: var(--color-primary); }
/* Encoche sous l'item actif (triangle de la couleur du fond de page) */
.subnav__item--active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(15px);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--color-page-bg);
}

/* ---------- En-tête de page ---------- */
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 69px;
}
.page-title h1 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-heading);
}
.breadcrumb {
  display: flex;
  gap: 10px;
  margin: 0; padding: 0;
  list-style: none;
  font-size: var(--font-size-base);
  color: var(--color-text-breadcrumb);
}
.breadcrumb li + li::before { content: ">"; color: #d0d1d2; margin-right: 10px; }
.breadcrumb [aria-current] { color: var(--color-text-disabled); }

/* ---------- Widgets ---------- */
.widget {
  position: relative;
  margin-bottom: 29px;
  padding: 10px var(--space-6) var(--space-6);
  background: var(--color-white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
.widget--muted { background: var(--color-widget-bg); }

/* Outils de widget : rafraîchir / réduire */
.widget__tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  height: 18px;
  margin-bottom: 11px;
  margin-right: -1px;
}
.widget__tool {
  display: inline-flex;
  border: 0; background: none; padding: 0;
  color: #525a5c;
  font-size: 16px;
}

.widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 33px;
  margin-bottom: 8px;
}
.widget__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  color: var(--color-text-widget-title);
}
.widget__title .svg-icon { font-size: 22px; }
.widget__empty-text { margin: 0 0 var(--space-4); }
.widget.is-collapsed .widget__body { display: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }
.btn--secondary {
  height: 33px;
  padding: 0 16px;
  background: var(--color-secondary);
  color: var(--color-white);
  font-size: var(--font-size-btn);
}
.btn--primary {
  height: 42px;
  padding: 0 12px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 17px;
}
.btn--warning {
  height: 37px;
  padding: 0 13.5px;
  border-radius: var(--radius-md);
  background: var(--color-warning);
  color: var(--color-white);
  font-size: var(--font-size-base);
}

/* ---------- État vide « projets favoris » ---------- */
.empty-state {
  padding: 38px var(--space-5) 46.5px;
  background: var(--color-empty-bg);
  border: 1px dashed var(--color-empty-border);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--color-text-strong);
}
.empty-state__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8.5px 0 7px;
  font-size: 22.4px;
  font-weight: var(--font-weight-regular);
}
.empty-state__title .svg-icon { font-size: 19px; }
.empty-state p { margin-bottom: 9px; font-size: 15.6px; }
.empty-state__link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  border: 0; background: none; padding: 0;
  color: var(--color-primary-text);
}
.empty-state__link .feather { font-size: 15px; }

/* ---------- Tuiles projets ---------- */
.project-grid {
  margin-top: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 29px;
}
.project-tile {
  display: flex;
  gap: 9px;
  min-width: 0;
  margin-bottom: 12px;
  padding: 13px;
  background: var(--color-white);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--color-border);
}
.project-tile--alert { border-left: 5px solid var(--color-danger); padding-left: 9px; }

.project-tile__media {
  flex: 0 0 102px;
  height: 102px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
/* Contenu image (placeholder demandé) */
.project-tile__media--image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: repeating-linear-gradient(135deg, #dce7ee 0 8px, #d3e0e8 8px 16px);
  color: #6f8a9b;
  font-size: 11px;
}
.project-tile__media--image .feather { font-size: 24px; }
/* Projet sans image : cadre blanc + dossier bleu */
.project-tile__media--none {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dfe2e1;
  color: var(--color-primary);
  font-size: 36px;
}

.project-tile__content { flex: 1; min-width: 0; }
.project-tile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}
.project-tile__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  margin-top: 2px;
  color: var(--color-primary-text);
}
.project-tile__fav {
  border: 0; background: none; padding: 0;
  margin: -1px 6px 0 0;
  transform: translateY(0.5px);
  color: var(--color-primary);
  font-size: 20px;
  line-height: 1;
}
.project-tile__fav[aria-pressed="false"] .svg-icon { fill: none; stroke: currentColor; stroke-width: 2; }
.project-tile__desc {
  margin: 7px 0 9.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--font-size-base);
  line-height: 1.3;
  color: var(--color-primary-text);
  padding-right: 30px;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--radius-md);
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 16px;
}

/* ---------- Annonces (ruban « Info ») ---------- */
.announcement { padding: 25px 110px 28.5px var(--space-6); }
.announcement__title {
  margin-bottom: 8px;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
  color: var(--color-info-text);
}
.announcement__body { padding-top: 18px; }
.announcement__body p:last-child { margin-bottom: var(--space-4); }

.ribbon {
  position: absolute;
  top: 27px;
  right: -6px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 14px 0 14px;
  background: var(--color-info);
  color: var(--color-white);
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  border-radius: 2px 2px 0 2px;
  box-shadow: var(--shadow-ribbon);
}
.ribbon .feather { font-size: 11px; }
/* Pli du ruban */
.ribbon::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -6px;
  border-top: 6px solid var(--color-info-dark);
  border-right: 6px solid transparent;
}

/* ---------- Tâches ---------- */
.task-list { margin: 0 0 7px; padding: 0; list-style: none; }
.task {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 5px 10px 6.2px 5px;
}
.task:nth-child(even) { background: var(--color-stripe); }
.task__main { flex: 1; min-width: 0; }
.task__dates {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 5px;
  font-size: 13.8px;
  font-style: italic;
  color: var(--color-text-muted);
}
.task__dates .feather { font-size: 11px; color: #5c6263; }
.task--late .task__dates .feather { color: var(--color-danger-muted); }
.task__title { margin-top: -1.2px; font-size: var(--font-size-md); color: var(--color-text); line-height: 1.6; }
.task__actions { display: flex; gap: 11px; }
.task__action {
  display: inline-flex;
  border: 0; background: none; padding: 0;
  color: #565b5f;
  font-size: 18px;
}

/* ---------- Footer ---------- */
.app-footer {
  height: var(--footer-height);
  background: var(--color-white);
  color: var(--color-text-muted);
}
.app-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding-left: calc(var(--space-4) + 14px);
  padding-right: calc(var(--space-4) + 14px);
}
.app-footer__version { display: flex; align-items: center; gap: 5px; }
.app-footer__version .svg-icon { color: #c6cbcd; font-size: 15px; }
.app-footer__links { display: flex; align-items: center; gap: 29px; }
.app-footer__links .btn--warning { margin-right: -10.5px; }
.app-footer__links a:not(.btn) {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--color-text-muted);
}
.app-footer__links .feather { font-size: 14px; }
.app-footer__links a.is-spaced { gap: 6px; } /* « Aide » et « Statut » : icône plus détachée */

/* ---------- Éléments flottants ---------- */
.news-tab {
  position: fixed;
  left: 0;
  top: calc(50% + 37px);
  transform: translateY(-50%);
  width: 41px;
  height: 192px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0 5px 5px 0;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 19.5px;
  font-weight: var(--font-weight-medium);
  z-index: 10;
}
.news-tab span { transform: rotate(-90deg); white-space: nowrap; }

.fab {
  position: fixed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: var(--color-white);
  z-index: 10;
}
.fab--top {
  right: 28px; bottom: 100px;
  width: 56px; height: 56px;
  background: var(--color-primary-alpha-45);
  font-size: 30px;
}
.fab--chat {
  right: 26px; bottom: 22px;
  width: 61px; height: 61px;
  background: var(--color-primary);
  box-shadow: var(--shadow-float);
  font-size: 32px;
}

/* ---------- Outil de maquette (hors design Plexus) ---------- */
.proto-toolbar {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(20, 24, 28, 0.86);
  color: #fff;
  font: 500 12px/1 system-ui, sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
.proto-toolbar__label { padding: 0 8px 0 10px; opacity: 0.7; }
.proto-toolbar button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  background: transparent;
  color: #fff;
  font: inherit;
}
.proto-toolbar button[aria-pressed="true"] { background: #fff; color: #111; }
.proto-toolbar[hidden] { display: none; }

/* Affichage conditionnel selon l'état simulé */
[data-state="vide"] .when-favoris,
[data-state="favoris"] .when-vide { display: none; }
