/* ══════════════════════════════════════════════════════════════════════════
   Ressources — surcouche applicative sur design-kit.
   Ne jamais restyler les primitives du kit : uniquement des classes métier
   (tableau des prestations) + le CSS des composants notification-kit (convention
   de la suite : il vit dans l'app, pas dans le kit).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tableau des prestations ──────────────────────────────────────────────── */
.table-scroll {
  border: 1px solid var(--line);
  border-radius: var(--r1);
  background: var(--surface);
  overflow-x: auto;
}

.table-prestations {
  min-width: 1080px;
}

.table-prestations thead th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-taux {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.cell-prestation { min-width: 240px; }
.nom-prestation { font-weight: 600; color: var(--ink-1); }
.nom-session { color: var(--ink-2); }
.block { display: block; }

/* ── Vue Capacité hebdomadaire ────────────────────────────────────────────── */
.table-capacite { min-width: 1180px; }

/* Niveau d'usage : statut catégoriel (jamais couleur seule — pastille + libellé). */
.niveau {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-11);
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-2);
}
.niveau::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink-3);
  flex: none;
}
.niveau--fort   { color: var(--ok, #1a7f52); }
.niveau--fort::before   { background: var(--ok, #1a7f52); }
.niveau--modere { color: var(--ink-1); }
.niveau--modere::before { background: var(--accent); }
.niveau--faible { color: var(--ink-3); }
.niveau--faible::before { background: var(--ink-3); }

/* Barre de magnitude (participants/sem moyen) — magnitude = teinte unique accent. */
.mag {
  display: flex;
  align-items: center;
  gap: var(--s8);
  justify-content: flex-end;
}
.mag-bar {
  position: relative;
  width: 56px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-inset, var(--bg));
  overflow: hidden;
  flex: none;
}
.mag-bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--accent);
}

.th-triable { cursor: pointer; user-select: none; }
.th-triable:hover { color: var(--accent); }
.th-actif { color: var(--accent); }

/* Couleur des taux (seuils indicatifs) — dérivée des tokens du kit */
.taux--haut  { color: var(--ok, #1a7f52); }
.taux--moyen { color: var(--ink-1); }
.taux--bas   { color: var(--err); }

.date-input {
  font-family: var(--font);
  font-size: var(--t-12);
  color: var(--ink-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 4px 8px;
  outline: none;
}
.date-input:focus { border-color: var(--accent); }

.section-title {
  font-size: var(--t-15);
  font-weight: 600;
  color: var(--ink-1);
}

/* ── Compléments partagés (mêmes classes que References/PMO/Budget) ───────── */
.badge-sm {
  font-size: var(--t-11);
  padding: 2px 6px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--t-11);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r2);
  white-space: nowrap;
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: var(--font);
  font-size: var(--t-11);
  font-weight: 500;
  color: var(--ink-1);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 4px 24px 4px 8px;
  cursor: pointer;
  outline: none;
  min-width: 80px;
  line-height: 1.4;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L4 4L7 1' stroke='%239a9a96' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--dt-fast);
}
.sort-select:focus { border-color: var(--accent); }
.sort-select:hover { border-color: var(--line-strong); }

/* ── KPI Row ─────────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  background: var(--surface);
}
.kpi-card {
  padding: var(--s12) var(--s16);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  border-right: 1px solid var(--line);
  transition: background-color var(--dt-fast) var(--ease);
}
.kpi-card:last-child { border-right: none; }
.kpi-card:hover { background-color: var(--bg); }
.kpi-card--expanded { background-color: var(--accent-dim); }
.kpi-card__label {
  font-size: var(--t-10);
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.kpi-card__value {
  font-size: var(--t-20);
  font-weight: 700;
  color: var(--ink-1);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-card__suffix {
  font-size: var(--t-13);
  color: var(--ink-3);
  font-weight: 400;
  margin-left: var(--s8);
}

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Bannière d'impersonation ────────────────────────────────────────────── */
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s12);
  padding: var(--s8) var(--s16);
  background: var(--warn-dim);
  border: 1px solid var(--warn);
  border-radius: var(--r1);
  margin-bottom: var(--s16);
  font-size: var(--t-13);
}

/* ── Cloche de notifications (notification-kit) ──────────────────────────── */
.notification-bell { position: relative; }
.notification-bell-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r1);
  transition: color 0.15s;
}
.notification-bell-btn:hover { color: var(--ink-1); background: var(--bg-inset); }
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
}
[data-theme="dark"] .notification-dropdown { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s12) var(--s16);
  border-bottom: 1px solid var(--line);
}
.notification-dropdown-title { font-weight: 600; font-size: var(--t-13); color: var(--ink-1); }
.notification-dropdown-list { overflow-y: auto; flex: 1; }
.notification-empty { padding: var(--s32) var(--s16); text-align: center; color: var(--ink-3); font-size: var(--t-13); }
.notification-item {
  padding: var(--s12) var(--s16);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-inset); }
.notification-item--unread { background: var(--accent-dim); }
.notification-item--unread:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.notification-item-title { font-weight: 600; font-size: var(--t-13); color: var(--ink-1); margin-bottom: 2px; }
.notification-item-body { font-size: var(--t-12); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-item-time { font-size: var(--t-11); color: var(--ink-3); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════════════════
   Analyses des ressources — barre de filtres, onglets, cartes, graphes.
   Palette catégorielle validée (mockup) : mappée sur les tokens du kit.
   ══════════════════════════════════════════════════════════════════════════ */
.an-page {
  --seq: var(--accent-mid);
  --track: var(--bg-inset);
  --hair: var(--line);
  --muted: var(--ink-3);
  --s-ai: #2a78d6;  --s-ccc: #008300;  --s-ctt: #e87ba4;  --s-autre: #9aa39f;
  --good: #0ca30c;  --warn: #d9920a;   --crit: #d03b3b;
  --good-wash: #e5f3e5; --warn-wash: #f8ecd4; --crit-wash: #f6e2e2;
}
[data-theme="dark"] .an-page {
  --s-ai: #3987e5;  --s-ccc: #0a9a0a;  --s-ctt: #d55181;  --s-autre: #8a938f;
  --good: #0ca30c;  --warn: #fab219;   --crit: #e05656;
  --good-wash: #12331a; --warn-wash: #3a2f10; --crit-wash: #3a1c1c;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ── Barre de filtres ── */
.an-filters {
  display: flex; flex-wrap: wrap; gap: var(--s16); align-items: flex-end;
  padding: var(--s12) var(--s16); margin-bottom: var(--s16);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r1);
}
.an-fgroup { display: flex; flex-direction: column; gap: 5px; }
.an-fgroup > label {
  font-size: var(--t-10); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 600;
}
.an-per { display: flex; gap: var(--s8); align-items: center; flex-wrap: wrap; }
.an-seg { display: inline-flex; background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--r2); padding: 2px; gap: 2px; }
.an-seg button {
  font: inherit; font-size: var(--t-12); border: 0; background: transparent; color: var(--ink-2);
  padding: 4px 10px; border-radius: var(--r2); cursor: pointer; white-space: nowrap; transition: all var(--dt-fast);
}
.an-seg button:hover { color: var(--ink-1); }
.an-seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.an-sel {
  font: inherit; font-size: var(--t-12); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-1); padding: 4px 7px; border-radius: var(--r1); cursor: pointer;
}
.an-sel:focus { border-color: var(--accent); outline: none; }
.an-dates { font-size: var(--t-12); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }

/* Multi-select */
.an-ms { position: relative; display: inline-block; }
.an-ms-btn {
  font: inherit; font-size: var(--t-12); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); padding: 5px 10px; border-radius: var(--r1); display: inline-flex; align-items: center;
  gap: 7px; cursor: pointer; white-space: nowrap;
}
.an-ms-btn:hover { color: var(--ink-1); border-color: var(--line-strong); }
.an-ms-btn svg { opacity: 0.5; }
.an-cnt { background: var(--accent-dim); color: var(--accent); font-size: var(--t-11); font-weight: 700; border-radius: var(--r2); padding: 1px 6px; }
.an-ms-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 236px; max-height: 330px;
  overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); padding: 6px;
}
[data-theme="dark"] .an-ms-pop { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.an-ms-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r1); cursor: pointer; font-size: var(--t-13); color: var(--ink-2); }
.an-ms-row:hover { background: var(--bg-inset); }
.an-ms-row input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.an-ms-tools { display: flex; gap: 6px; padding: 2px 4px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.an-ms-tools button { flex: 1; font: inherit; font-size: var(--t-12); border: 1px solid var(--line); background: var(--bg-inset); border-radius: var(--r1); padding: 5px; cursor: pointer; color: var(--ink-2); }
.an-ms-tools button:hover { color: var(--ink-1); }

/* Bandeau de synthèse */
.an-slice {
  font-size: var(--t-12); color: var(--ink-2); background: var(--bg-inset);
  border: 1px dashed var(--line); border-radius: var(--r1); padding: 8px 12px; margin-bottom: var(--s16);
}
.an-slice b { color: var(--ink-1); font-weight: 600; }

/* ── Grille de cartes 12 colonnes ── */
.an-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s16); }
.an-col-12 { grid-column: span 12; } .an-col-7 { grid-column: span 7; } .an-col-6 { grid-column: span 6; } .an-col-5 { grid-column: span 5; }
@media (max-width: 900px) { .an-col-12, .an-col-7, .an-col-6, .an-col-5 { grid-column: span 12; } }
.an-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r1); padding: var(--s16); }
.an-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--s12); }
.an-card-h h3 { font-size: var(--t-15); font-weight: 600; color: var(--ink-1); margin: 0; }
.an-sub { font-size: var(--t-12); color: var(--ink-3); }
.an-note { font-size: var(--t-12); color: var(--ink-3); margin-top: var(--s12); line-height: 1.5; }
.an-note b { color: var(--ink-2); font-weight: 600; }
.an-note code { font-family: var(--font-mono); font-size: 0.92em; color: var(--ink-2); }
.an-empty { color: var(--ink-3); font-size: var(--t-13); padding: 16px 4px; text-align: center; }

/* KPI meta (complète .kpi-card) */
.kpi-card__meta { font-size: var(--t-12); color: var(--ink-2); margin-top: 2px; }

/* ── Barres horizontales ── */
.an-bars { display: flex; flex-direction: column; gap: 11px; }
.an-bar { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; }
.an-bl { font-size: var(--t-13); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bl-sub { color: var(--ink-3); font-size: var(--t-11); }
.an-track { height: 14px; background: var(--track); border-radius: var(--r1); overflow: hidden; }
.an-fill { height: 100%; border-radius: var(--r1); background: var(--seq); min-width: 2px; }
.an-bv { font-size: var(--t-12); font-weight: 600; color: var(--ink-1); min-width: 56px; text-align: right; }
.an-bar--stack { grid-template-columns: 110px 1fr auto; }
.an-stack { display: flex; height: 16px; border-radius: var(--r1); overflow: hidden; background: var(--track); }
.an-stack span { display: block; height: 100%; box-shadow: inset -1px 0 0 var(--surface); }
@media (max-width: 520px) { .an-bar, .an-bar--stack { grid-template-columns: 96px 1fr auto; } }

/* Légendes */
.an-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.an-li { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-12); color: var(--ink-2); }
.an-sw { width: 11px; height: 11px; border-radius: var(--r1); flex: none; }

/* Badges d'usage */
.an-badge { font-size: var(--t-11); font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); display: inline-flex; align-items: center; gap: 5px; }
.an-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.an-badge.b-fort { color: var(--good); background: var(--good-wash); }
.an-badge.b-mod { color: var(--warn); background: var(--warn-wash); }
.an-badge.b-faible { color: var(--crit); background: var(--crit-wash); }

/* Graphe d'aire */
.an-area { width: 100%; height: auto; display: block; }
.an-area text { font-size: 11px; fill: var(--muted); }

/* Schéma en étoile (modèle de données) */
.an-star { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 820px) { .an-star { grid-template-columns: repeat(2, 1fr); } }
.an-dim { background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--r1); padding: 12px 13px; }
.an-dim h4 { margin: 0 0 4px; font-size: var(--t-13); color: var(--ink-1); }
.an-dim p { margin: 0; font-size: var(--t-12); color: var(--ink-3); line-height: 1.5; }
.an-dim code { font-family: var(--font-mono); font-size: 0.9em; color: var(--ink-2); }
.an-fact { background: var(--accent-dim); border-color: var(--accent-mid); }
.an-fact h4 { color: var(--accent); }

/* Table capacité : compacte + défilement vertical (beaucoup de prestations) */
.an-cap-scroll { max-height: 460px; overflow-y: auto; }
.an-cap-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
