html, body {
  min-height: 100vh;
  background-color: #fafafa;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* L'attribut [hidden] doit toujours masquer, même contre les `display: flex` de Bulma. */
[hidden] { display: none !important; }

/* ---- Top navbar ---- */

.navbar.is-link .navbar-brand-logo img {
  max-height: 36px;
}

/* ---- Layout : sidebar + main ---- */

.app-body {
  display: flex;
  flex: 1 0 auto;
  min-height: 0;
}

.app-sidebar {
  flex: 0 0 240px;
  width: 240px;
  background: #f7f9fb;
  border-right: 1px solid #e4e7ec;
  overflow-y: auto;
  align-self: stretch;
  position: sticky;
  top: 0;
  height: calc(100vh - 3.25rem);
  transition: flex-basis .18s ease, width .18s ease;
  display: flex;
  flex-direction: column;
}

/* Quand repliée, la sidebar reste visible sous forme d'un rail étroit
   pour conserver le bouton de dépliage accessible. */
body.sidebar-collapsed .app-sidebar {
  flex: 0 0 36px;
  width: 36px;
}

body.sidebar-collapsed .sidebar-nav {
  display: none;
}

/* ---- En-tête de la sidebar : bouton chevron en haut à droite ---- */

.sidebar-header {
  display: flex;
  justify-content: flex-end;
  padding: .3rem;
  border-bottom: 1px solid #e4e7ec;
  flex: 0 0 auto;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: .3rem .15rem;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: #4a4a4a;
  cursor: pointer;
  padding: .1rem .5rem;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: background .1s, border-color .1s;
}
.sidebar-toggle:hover {
  background: rgba(72, 95, 199, 0.1);
  border-color: rgba(72, 95, 199, 0.3);
}

.sidebar-toggle-icon {
  font-weight: 700;
  font-size: 1.1rem;
}

.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.app-main main {
  flex: 1 0 auto;
}

/* ---- Sidebar menu ---- */

.sidebar-nav {
  padding: 1rem .75rem;
}

.sidebar-nav .menu-list a {
  color: #37352f;
  border-radius: 4px;
  padding: .45rem .75rem;
  font-size: .85rem;
  display: block;
  text-decoration: none;
  transition: background .1s, color .1s;
}

.sidebar-nav .menu-list a:hover {
  background: rgba(72, 95, 199, 0.1);
  color: #1f3a93;
}

.sidebar-nav .menu-list a.is-active {
  background: #485fc7;
  color: #fff;
  font-weight: 600;
}

.sidebar-nav .menu-list a.is-disabled {
  opacity: .5;
  pointer-events: none;
}

.menu-group {
  margin: .75rem 0 .25rem;
}

.menu-group-toggle {
  background: transparent;
  border: 0;
  color: #4a4a4a;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: .7rem;
  padding: .35rem .5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  text-align: left;
  border-radius: 3px;
}
.menu-group-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.menu-group-caret {
  display: inline-block;
  transition: transform .15s ease;
  font-size: .65rem;
}

.menu-group.is-collapsed .menu-group-caret {
  transform: rotate(-90deg);
}

.menu-group.is-collapsed .menu-group-items {
  display: none;
}

/* ---- Vue Kanban : layout plein écran ---------------------------------------
 * La page Kanban occupe la hauteur disponible sous la navbar.
 * - .kanban-page : conteneur flex-column plein viewport (moins navbar + paddings)
 * - .kanban-board : prend l'espace restant, scroll horizontal, colonnes étirées
 * - .kanban-column : chaque colonne remplit la hauteur, son body scrolle, son
 *   footer (« + Nouvelle tâche ») reste toujours visible au bas.
 * Hauteurs : navbar = 3.25rem ; section Bulma = padding 3rem top/bottom.
 */

.kanban-page {
  display: flex;
  flex-direction: column;
  /* viewport - navbar - section top/bottom padding */
  height: calc(100vh - 3.25rem - 6rem);
  min-height: 420px;
  min-width: 0;
}

.kanban-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: .5rem .25rem 0;
  /* Les colonnes démarrent en haut et prennent leur hauteur naturelle — sans
     se dilater pour remplir tout le board. */
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 300px;
  width: 300px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  /* Grandit avec son contenu jusqu'à la hauteur du board, puis se fige et
     active le scroll interne sur son body. */
  max-height: 100%;
}

.kanban-column-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.kanban-column-footer {
  flex: 0 0 auto;
  padding: .4rem .5rem;
  border-top: 1px solid #f0f3f7;
  background: #fff;
}

/* Drop indicators : bandeau bleu au-dessus ou en-dessous d'une carte pour
   signaler la position d'insertion lors d'un drag & drop. */
.kanban-card {
  position: relative;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transition: border-color .08s linear;
}
.kanban-card.is-drop-above { border-top-color: #485fc7; }
.kanban-card.is-drop-below { border-bottom-color: #485fc7; }

.kanban-column-body.is-drop-target { background: #f0f7fb; }

/* En-tête de colonne triable : curseur pointer et ombre discrète au hover. */
th.sortable-th {
  position: relative;
  transition: background .08s;
}
th.sortable-th:hover {
  background: rgba(72, 95, 199, 0.06);
}

/* Cellule cliquable d'une liste (trigramme, code, nom) qui ouvre la fiche. */
.row-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: 3px;
  padding: .1rem .2rem;
  margin: -.1rem -.2rem;
  transition: background .08s, color .08s;
}
.row-link:hover {
  background: rgba(72, 95, 199, 0.08);
  color: #1f3a93;
}

/* Espace entre deux boutons d'action dans une cellule. */
td .button.is-rounded + .button.is-rounded,
td .button.is-rounded + a.button.is-rounded,
td a.button.is-rounded + .button.is-rounded {
  margin-left: .35rem;
}

/* ---- Matrice des compétences ------------------------------------------------
 * - Colonne utilisateur sticky à gauche (scroll vertical uniquement pour elle).
 * - Partie droite : scroll horizontal et vertical dans le même conteneur.
 * - Toutes les colonnes de compétence ont la même largeur ; les noms trop longs
 *   sont tronqués par ellipsis (tooltip via attribut title).
 */

.matrix-scroll {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid #e4e7ec;
  border-radius: 4px;
  background: #fff;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: .78rem;
  table-layout: fixed;
}

.matrix-table thead th {
  background: #f7f9fb;
  position: sticky;
  z-index: 3;
}

.matrix-table thead tr:nth-child(1) th { top: 0; }
.matrix-table thead tr:nth-child(2) th { top: 30px; }

.matrix-cat-head {
  text-align: center;
  padding: .35rem .4rem;
  background: #eef0fb;
  color: #374a9a;
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #c6ccea;
}

/* Alternance des couleurs des en-têtes de catégorie (Bulma-like). */
.matrix-cat-head.is-link.is-light  { background-color: #eff1fa; color: #3850b7; }
.matrix-cat-head.is-info.is-light  { background-color: #eff5fb; color: #1d72aa; }
/* Alternance des en-têtes de compétence : gris / gris clair. */
.matrix-skill-head.is-grey-a       { background-color: #e3e3e3; }
.matrix-skill-head.is-grey-b       { background-color: #f0f0f0; }

.matrix-skill-head {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  padding: .35rem .25rem;
  text-align: center;
  font-weight: 600;
  color: #4a4a4a;
  border-bottom: 1px solid #c7c7c7;
  vertical-align: middle;
}

.matrix-skill-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
}

.matrix-user-head {
  left: 0;
  z-index: 4;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  padding: .45rem .6rem;
  background: #f7f9fb;
  border-right: 2px solid #c7c7c7;
  border-bottom: 1px solid #c7c7c7;
  text-align: left;
}

.matrix-corner {
  left: 0;
  z-index: 5;
  background: #f7f9fb;
  border-right: 2px solid #c7c7c7;
  border-bottom: 1px solid #c6ccea;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}

.matrix-user-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  border-right: 2px solid #c7c7c7;
  padding: .3rem .6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}

.matrix-user-name {
  margin-left: .4rem;
}

.matrix-cell {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  padding: 0;
  text-align: center;
  border-bottom: 1px solid #edf0f3;
}

.matrix-level-select {
  width: 100%;
  border: 0;
  padding: .35rem .1rem;
  font-size: .72rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
}
.matrix-level-select:focus {
  outline: 2px solid #485fc7;
  outline-offset: -2px;
}

/* ---- User switcher dropdown (haut droite) ---- */

#user-switcher .navbar-dropdown {
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
}

#save-indicator.is-saving   { background-color: #ffe08a; color: #3b3108; }
#save-indicator.is-saved    { background-color: #c8eecd; color: #0f5132; }
#save-indicator.is-error    { background-color: #ffcccc; color: #7a0b0b; }
#save-indicator.is-readonly { background-color: #d6e4ff; color: #102a71; }
#save-indicator.is-idle     { background-color: #eaeaea; color: #444; }

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
}
.toast-container .notification {
  margin: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  padding: 1rem 2.75rem 1rem 1rem;
}
.toast-container .notification > .delete {
  position: absolute;
  top: .5rem;
  right: .5rem;
}

.onboarding-card {
  max-width: 640px;
  margin: 3rem auto;
}

.project-card .tag { margin-right: .25rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}
.empty-state .icon-wrap {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: .3;
}

/* --- GANTT : couleurs de barre selon le statut de la tâche ---
 * Les hex par défaut servent de fallback ; les variables --neo-status-*
 * sont posées dynamiquement par services/statusColors.js.
 */
.gantt-container {
  --g-weekend-highlight-color: #dadee3;
  --neo-holiday-color: #c4cdd5; /* jours fériés — gris un poil plus soutenu que les WE */
}

.gantt .bar-wrapper.g-status-todo    .bar { fill: var(--neo-status-pending, #9aa4af); }
.gantt .bar-wrapper.g-status-doing   .bar { fill: var(--neo-status-active, #3e8ed0); }
.gantt .bar-wrapper.g-status-done    .bar { fill: var(--neo-status-done, #48c78e); }
.gantt .bar-wrapper.g-status-blocked .bar { fill: var(--neo-status-blocked, #f14668); }

.gantt .bar-wrapper.g-status-todo    .bar-progress,
.gantt .bar-wrapper.g-status-doing   .bar-progress,
.gantt .bar-wrapper.g-status-done    .bar-progress,
.gantt .bar-wrapper.g-status-blocked .bar-progress {
  fill: rgba(255, 255, 255, 0.28);
}

.gantt .bar-wrapper.g-status-todo    .bar-label,
.gantt .bar-wrapper.g-status-doing   .bar-label,
.gantt .bar-wrapper.g-status-done    .bar-label,
.gantt .bar-wrapper.g-status-blocked .bar-label {
  fill: #ffffff;
  font-weight: 500;
}

/* Barre "lot" (summary) : foncée, lecture seule */
.gantt .bar-wrapper.g-lot-summary .bar {
  fill: #37352f;
  stroke: #37352f;
}
.gantt .bar-wrapper.g-lot-summary .bar-progress {
  fill: rgba(255, 255, 255, 0.2);
}
.gantt .bar-wrapper.g-lot-summary .bar-label {
  fill: #ffffff;
  font-weight: 700;
}
.gantt .bar-wrapper.g-lot-summary .handle {
  display: none;  /* pas de poignée de resize */
}

/* Masque la scrollbar interne du panneau gauche (scroll synchronisé) */
.gantt-left-rows::-webkit-scrollbar { display: none; }
.gantt-left-rows { scrollbar-width: none; }

/* Tâches / lots non planifiés : row présent mais barre invisible */
.gantt .bar-wrapper.g-unscheduled .bar,
.gantt .bar-wrapper.g-unscheduled .bar-progress,
.gantt .bar-wrapper.g-unscheduled .bar-label,
.gantt .bar-wrapper.g-unscheduled .handle,
.gantt .bar-wrapper.g-unscheduled .date-range-highlight {
  display: none !important;
}
.gantt .bar-wrapper.g-unscheduled { pointer-events: none; }
