/*
 * IMMGO — Charte : cartes, listes, avatar, badges, tuiles d'indicateurs, état vide, squelette
 * Auteur : Jacks Ngalangala
 */

/* ─── Carte ─── */
.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-grand);
  box-shadow: var(--ombre-1);
}
.carte-tete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--e-3);
  padding: var(--e-5) var(--e-6) 0;
}
.carte-titre {
  font-size: var(--taille-grand);
  font-weight: var(--graisse-forte);
}
.carte-sous-titre {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.carte-corps {
  padding: var(--e-5) var(--e-6) var(--e-6);
}
.carte-corps-plein {
  padding: var(--e-2) 0;
}
.carte-sombre {
  background: var(--nuit-surface);
  border-color: var(--nuit-trait);
  color: var(--nuit-texte);
}
.carte-sombre .carte-sous-titre {
  color: var(--nuit-texte-second);
}

/* ─── Liste et ligne de liste ─── */
.liste {
  display: flex;
  flex-direction: column;
}
.ligne {
  display: flex;
  align-items: center;
  gap: var(--e-4);
  min-height: 72px;
  padding: var(--e-3) var(--e-6);
  text-align: left;
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
}
.liste > .ligne + .ligne {
  border-top: 1px solid var(--trait);
}
button.ligne:hover,
a.ligne:hover {
  background: var(--surface-douce);
  text-decoration: none;
}
.ligne-media {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-moyen);
  background: var(--neutre-pale);
  color: var(--texte-second);
}
.ligne-media svg {
  width: 22px;
  height: 22px;
}
.ligne-texte {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ligne-titre {
  font-weight: var(--graisse-forte);
  color: var(--texte);
  overflow-wrap: anywhere;
}
.ligne-sous-titre {
  font-size: var(--taille-petit);
  color: var(--texte-second);
  overflow-wrap: anywhere;
}
.ligne-fin {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--e-1);
  text-align: right;
}
.ligne-valeur {
  font-weight: var(--graisse-titre);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ligne-chevron {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--texte-faible);
}

/* ─── Avatar (initiales) ─── */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--or-pale);
  color: var(--or-texte);
  font-weight: var(--graisse-titre);
  font-size: var(--taille-petit);
  letter-spacing: 0.02em;
}
.avatar-petit {
  width: 36px;
  height: 36px;
  font-size: var(--taille-legende);
}
.avatar-or {
  background: var(--or);
  color: var(--texte-sur-or);
}

/* ─── Badge de statut : couleur + texte (+ point), jamais la couleur seule ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pilule);
  font-size: var(--taille-legende);
  font-weight: var(--graisse-forte);
  white-space: nowrap;
  background: var(--neutre-pale);
  color: var(--neutre);
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-succes {
  background: var(--succes-pale);
  color: var(--succes);
}
.badge-attention {
  background: var(--attention-pale);
  color: var(--attention);
}
.badge-danger {
  background: var(--danger-pale);
  color: var(--danger);
}
.badge-info {
  background: var(--info-pale);
  color: var(--info);
}
.badge-or {
  background: var(--or-pale);
  color: var(--or-texte);
}

/* Teintes de média de ligne alignées sur les badges */
.ton-succes {
  background: var(--succes-pale);
  color: var(--succes);
}
.ton-attention {
  background: var(--attention-pale);
  color: var(--attention);
}
.ton-danger {
  background: var(--danger-pale);
  color: var(--danger);
}
.ton-info {
  background: var(--info-pale);
  color: var(--info);
}
.ton-or {
  background: var(--or-pale);
  color: var(--or-texte);
}

/* ─── Tuile d'indicateur (KPI) ─── */
.tuiles {
  display: grid;
  gap: var(--e-4);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.tuile {
  container-type: inline-size; /* la valeur se règle sur la largeur de la tuile */
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
  padding: var(--e-5);
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-grand);
  box-shadow: var(--ombre-1);
}
.tuile-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--e-2);
}
.tuile-libelle {
  font-size: var(--taille-petit);
  color: var(--texte-second);
  font-weight: var(--graisse-moyenne);
}
.tuile-icone {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-petit);
}
.tuile-icone svg {
  width: 20px;
  height: 20px;
}
.tuile-valeur {
  font-size: min(28px, 11cqi);
  line-height: 1.15;
  font-weight: var(--graisse-titre);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tuile-detail {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.tuile-sombre {
  background: var(--nuit-surface);
  border-color: var(--nuit-trait);
  color: var(--nuit-texte);
}
.tuile-sombre .tuile-libelle,
.tuile-sombre .tuile-detail {
  color: var(--nuit-texte-second);
}
.evolution-hausse {
  color: var(--succes);
  font-weight: var(--graisse-forte);
}
.evolution-baisse {
  color: var(--danger);
  font-weight: var(--graisse-forte);
}

/* ─── État vide ─── */
.etat-vide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-12) var(--e-6);
  text-align: center;
}
.etat-vide-icone {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: var(--e-2);
  border-radius: 50%;
  background: var(--or-pale);
  color: var(--or-texte);
}
.etat-vide-icone svg {
  width: 32px;
  height: 32px;
}
.etat-vide-texte {
  max-width: 360px;
  color: var(--texte-second);
}
.etat-vide .btn {
  margin-top: var(--e-3);
}

/* ─── Squelette de chargement ─── */
.squelette {
  display: block;
  height: 16px;
  border-radius: var(--r-petit);
  background: linear-gradient(90deg, var(--neutre-pale) 0%, var(--surface-douce) 50%, var(--neutre-pale) 100%);
  background-size: 200% 100%;
  animation: squelette-brille 1.4s ease-in-out infinite;
}
.squelette-rond {
  width: 44px;
  height: 44px;
  border-radius: var(--r-moyen);
}
.squelette-court {
  width: 40%;
}
@keyframes squelette-brille {
  to {
    background-position: -200% 0;
  }
}
