/**
 * Chrome commun PrestaIA — identité utilisateur (haut de page).
 * Style Kommandia : avatar + nom + rôle ; clic → modal déco.
 * Le bascule clair/sombre reste dans delta-theme.css (.delta-theme-toggle).
 */

.delta-who {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--muted, #8b9bb4);
}

button.delta-who--btn,
.delta-who .who-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.15rem 0.35rem 0.15rem 0.15rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-width: 0;
}

button.delta-who--btn:hover,
.delta-who .who-btn:hover {
  background: rgba(56, 189, 248, 0.1);
}

button.delta-who--btn:focus-visible,
.delta-who .who-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45);
}

.delta-who__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #f4fbff;
  background: radial-gradient(circle at 35% 30%, #16324a, #0a1424 70%);
  border: 2px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

.delta-who__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  line-height: 1.15;
  min-width: 0;
}

.delta-who__name {
  color: var(--text, var(--ink, #e8eef8));
  font-weight: 600;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta-who__role {
  font-size: 0.62rem;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  text-transform: lowercase;
}

.delta-who__logout-form {
  display: contents;
  margin: 0;
}

/* Plus de bouton « porte » : déconnexion via modal (clic sur le user) */
.delta-who__out {
  display: none !important;
}

/* Le libellé « Déconnexion » reste pour les lecteurs d’écran, pas dans le cercle */
.delta-who__out > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  font-size: 0.8rem;
}

.delta-who__out svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.delta-who__out:hover,
.delta-who__out:focus-visible {
  color: #041018;
  background: linear-gradient(145deg, #ff8aa3, #ef4444);
  border-color: #ffd0da;
  transform: translateY(-1px);
  text-decoration: none;
}

html[data-theme="light"] .delta-who {
  color: #5b6b82;
}

html[data-theme="light"] .delta-who__avatar {
  color: #0f172a;
  background: radial-gradient(circle at 35% 30%, #e0f2fe, #f8fafc 70%);
  border-color: rgba(14, 116, 144, 0.45);
  box-shadow: 0 0 0 2px rgba(14, 116, 144, 0.1);
}

html[data-theme="light"] .delta-who__name {
  color: #122033;
}

html[data-theme="light"] .delta-who__role {
  background: rgba(14, 116, 144, 0.1);
  color: #0e7490;
}

html[data-theme="light"] .delta-who__out {
  color: #0e7490;
  border-color: rgba(14, 116, 144, 0.35);
  background: rgba(255, 255, 255, 0.9);
}

/* Alias : les apps existantes peuvent garder leur markup en ajoutant .delta-who */
.top-user.delta-who,
.who.delta-who,
.who-block.delta-who {
  /* hérite de .delta-who */
}

/* Modal déconnexion (commun) */
.delta-who-dialog {
  border: 0;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  max-width: calc(100vw - 2rem);
}
.delta-who-dialog::backdrop {
  background: rgba(10, 12, 18, 0.55);
}
.delta-who-dialog__box {
  margin: 0;
  padding: 1rem 1.1rem 1.05rem;
  width: min(380px, 100%);
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.delta-who-dialog__box h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}
.delta-who-dialog__box p {
  margin: 0 0 0.9rem;
  color: #94a3b8;
}
.delta-who-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}
.delta-who-dialog__btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.delta-who-dialog__btn--danger {
  background: linear-gradient(180deg, #e35a4f, #c0392b);
  border-color: #a93226;
  color: #fff;
}
html[data-theme="light"] .delta-who-dialog__box {
  background: #fff;
  color: #0f172a;
  border-color: #e2e8f0;
}
html[data-theme="light"] .delta-who-dialog__box p {
  color: #64748b;
}
html[data-theme="light"] .delta-who-dialog__btn {
  color: #0f172a;
  border-color: #cbd5e1;
}

/* FlotIA : who injecté dans le header sticky */
.delta-who--injected {
  margin-left: 0.75rem;
}

@media (max-width: 720px) {
  .delta-who__meta {
    display: none;
  }
}
