:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --border-soft: #eef0f3;
  --text: #1c2024;
  --muted: #6b7280;
  --accent: #2f6feb;
  --accent-soft: #e8f0fe;
  --accent-softer: #dbe6fb;
  --ok: #1e7a34;
  --ok-soft: #e6f4ea;
  --warn: #b45309;
  --warn-soft: #fff3e0;
  --danger: #c8362f;
  --danger-soft: #fdecea;
  --neutral-soft: #eef0f3;
  --radius: 8px;
  --topbar-h: 56px;
  /* Largeur maximale de l'application : au-delà, elle est centrée entre deux marges. */
  --app-max: 1600px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --panel: #1b1f26;
    --border: #2b313b;
    --border-soft: #232831;
    --text: #e6e9ee;
    --muted: #98a1b0;
    --accent: #7aa2f7;
    --accent-soft: #223049;
    --accent-softer: #2b3d5c;
    --ok: #7ee2a0;
    --ok-soft: #1d3327;
    --warn: #f0b429;
    --warn-soft: #3a2c14;
    --danger: #f07178;
    --danger-soft: #3a2023;
    --neutral-soft: #262c35;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.muted {
  color: var(--muted);
}

/* --- Barre du haut -------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 max(20px, calc((100% - var(--app-max)) / 2 + 20px));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.brand-mark {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand h1 {
  font-size: 16px;
  margin: 0;
  white-space: nowrap;
}

/* La pastille dit l'état du serveur d'un coup d'œil : couleur + mot, jamais la couleur seule. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: var(--muted);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill--ko {
  background: var(--danger-soft);
  color: var(--danger);
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 12px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

.topbar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-left: auto;
}

/* Interrupteur du rafraîchissement : la case native est masquée, pas retirée. */
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--border);
  padding: 2px;
  transition: background 0.15s;
}

.switch-knob {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track .switch-knob {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-label {
  font-size: 13px;
  color: var(--muted);
}

/* --- Boutons -------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--icon {
  padding: 7px;
}

.btn--ghost {
  border-color: transparent;
  background: none;
  color: var(--muted);
}

.btn--link {
  border-color: transparent;
  background: none;
  color: var(--accent);
  padding: 7px 4px;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  padding: 10px 12px;
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--block {
  width: 100%;
}

/* Une seule action détruit dans cette console : elle est la seule à porter cette couleur. */
.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  font-weight: 600;
}

.btn--danger:hover {
  border-color: var(--danger);
  filter: brightness(1.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

/* --- Purge des boîtes inactives ------------------------------------------- */

.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(12, 15, 20, 0.55);
}

.modal-card {
  padding: 18px 20px 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.modal-sub {
  margin: 8px 0 16px;
  color: var(--muted);
}

/* Un critère par ligne, son bouton au bout : les deux nettoyages se lisent en parallèle. */
.purge-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 0;
}

.purge-controls + .purge-controls {
  border-top: 1px solid var(--border-soft);
}

.purge-controls .field,
.purge-criterion {
  margin: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.purge-hint {
  font-size: 12px;
  color: var(--muted);
}

.purge-result {
  margin-top: 14px;
  max-height: 42vh;
  overflow-y: auto;
}

.purge-count,
.purge-empty,
.purge-done,
.purge-error {
  margin: 0 0 8px;
}

.purge-done {
  color: var(--ok);
}

.purge-error {
  color: var(--danger);
}

.purge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.purge-item + .purge-item {
  border-top: 1px solid var(--border-soft);
}

.purge-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.purge-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.purge-name {
  font-weight: 600;
}

.purge-text .mono,
.purge-meta {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.purge-meta {
  color: var(--muted);
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* --- Connexion ------------------------------------------------------------ */

.login {
  display: flex;
  justify-content: center;
  padding: 120px 20px 20px;
}

.card {
  width: 420px;
  max-width: 100%;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.card-badge {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-badge .icon {
  width: 22px;
  height: 22px;
}

.card h2 {
  margin: 0;
  font-size: 18px;
}

.card-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.card-note {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}

.field {
  display: block;
  margin: 24px 0 16px;
  text-align: left;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
}

.field-input:focus-within {
  border-color: var(--accent);
}

.field-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  outline: none;
}

.field-eye {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
}

.field-error {
  display: block;
  margin-top: 8px;
  min-height: 16px;
  font-size: 12px;
  color: var(--danger);
}

/* Le champ vire au rouge en même temps que le message : l'erreur est portée par les deux. */
.field.is-invalid .field-input {
  border-color: var(--danger);
}

/* --- Console -------------------------------------------------------------- */

/*
  Largeurs des panneaux. Ce sont des variables parce qu'elles se déplacent : les
  séparateurs les réécrivent au glissé, et le navigateur les retient d'une visite à
  l'autre. La colonne du lecteur prend ce qui reste, elle n'a donc pas de variable.
*/
.console {
  --w-agents: 240px;
  --w-threads: 400px;
  --w-gutter: 5px;
  display: grid;
  grid-template-columns: var(--w-agents) var(--w-gutter) var(--w-threads) var(--w-gutter) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
}

.console,
.links {
  max-width: var(--app-max);
  margin: 0 auto;
}

@media (min-width: 1601px) {
  .console,
  .links {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

.console.is-collapsed {
  grid-template-columns: 57px var(--w-gutter) var(--w-threads) var(--w-gutter) minmax(0, 1fr);
}

/* --- Séparateurs déplaçables ---------------------------------------------- */

.resizer {
  cursor: col-resize;
  background: none;
  /* La zone saisissable déborde du trait : viser 5 pixels à la souris est pénible. */
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  background-clip: padding-box;
  margin: 0 -4px;
  z-index: 1;
}

.resizer:hover,
.resizer:focus-visible,
.resizer.is-active {
  background-color: var(--accent);
  background-clip: padding-box;
  outline: none;
}

/* Colonne repliée : il n'y a plus de largeur à régler, seulement un rail d'avatars. */
.console.is-collapsed #resize-agents {
  cursor: default;
  pointer-events: none;
}

/* Pendant le glissé, rien d'autre ne doit réagir : ni sélection de texte, ni survol. */
.console.is-resizing {
  cursor: col-resize;
  user-select: none;
}

.console.is-resizing .agents,
.console.is-resizing .threads,
.console.is-resizing .reader {
  pointer-events: none;
}

/* --- Colonne des agents --------------------------------------------------- */

.agents {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.agents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 12px 8px 20px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.agent-list {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  flex: 1;
}

.agent {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agent:hover {
  background: var(--border-soft);
}

.agent.is-selected {
  background: var(--accent-soft);
}

.agent:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.agent-text {
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Le nom de la boîte dit de quoi la session s'occupe : sous le nom de l'agent, en second. */
.agent-box {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-box.is-absent {
  font-style: italic;
}

.agent--muted .agent-name {
  color: var(--muted);
}

/* --- Agent et ses boîtes --------------------------------------------------- */

/* Deux zones de clic sur une même ligne : le chevron ouvre, le reste filtre. */
.agent-head {
  display: flex;
  align-items: center;
}

.agent-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}

.agent-toggle:hover {
  color: var(--text);
}

.agent-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.agent-toggle .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}

.agent-head.is-open .agent-toggle .icon {
  transform: rotate(90deg);
}

/* Le chevron mange sa gouttière : la ligne d'agent reste alignée sur « Tous les agents ». */
.agent-head .agent {
  padding-left: 4px;
}

/* Les boîtes vivent sous leur agent : un cran d'indentation et un filet de rattachement. */
.box-list {
  list-style: none;
  margin: 0 0 4px 22px;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--border);
}

.box {
  padding: 7px 10px;
}

/* La ligne d'une boîte et son bouton de suppression, côte à côte. */
.box-line {
  display: flex;
  align-items: center;
  gap: 2px;
}

.box-line .box {
  flex: 1;
  min-width: 0;
}

/*
  Le bouton ne se montre qu'au survol ou au clavier : une corbeille par ligne, affichée en
  permanence, transformerait la colonne en champ de mines. Il reste dans le flux — révélé
  par l'opacité et non par `display` — pour que la ligne ne change pas de largeur.
*/
.box-delete {
  display: flex;
  padding: 5px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
}

.box-line:hover .box-delete,
.box-delete:focus-visible {
  opacity: 1;
}

.box-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.box-delete:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Colonne repliée : il n'y a plus de boîtes affichées, donc rien à supprimer. */
.is-collapsed .box-delete {
  display: none;
}

.box .agent-name {
  font-weight: 500;
  font-size: 13px;
}

/* Une boîte sans nom se lit à son adresse : en mono, pour ce que c'est. */
.box .agent-name.is-absent {
  font-weight: 400;
  color: var(--muted);
}

.box .agent-box {
  font-size: 11px;
}

/* Les boîtes vides sont repliées derrière ce bouton : le lien ferme la liste plutôt que
   d'aligner des sessions qui n'ont jamais rien échangé. */
.box-empty-toggle {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.box-empty-toggle:hover {
  background: var(--border-soft);
  color: var(--accent);
}

.box-empty-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Le même geste un cran plus haut : il se détache donc de la liste des agents. */
.agents-empty-toggle {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0;
}

/* Colonne repliée : plus de place pour une phrase, et rien à replier de toute façon. */
.is-collapsed .agents-empty-toggle {
  display: none;
}

/* Une boîte vide reste lisible mais s'efface : elle est là pour être retrouvée, pas lue. */
.box.is-empty .agent-name {
  color: var(--muted);
  font-weight: 400;
}

.box.is-empty .avatar {
  opacity: 0.5;
}

.agents-foot {
  padding: 16px 20px;
  font-size: 12px;
  border-top: 1px solid var(--border-soft);
}

/* Avatar : les initiales de l'agent, teintées par son adresse. Pas de couleur seule — le
   nom reste écrit à côté partout où l'avatar n'est pas le seul repère. */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  flex: none;
}

.avatar--sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar--stack {
  box-shadow: 0 0 0 2px var(--panel);
}

.avatar--c0 { background: #2f6feb; }
.avatar--c1 { background: #7c3aed; }
.avatar--c2 { background: #0f9d58; }
.avatar--c3 { background: #d9480f; }
.avatar--c4 { background: #0b7285; }
.avatar--c5 { background: #b02a6f; }
.avatar--c6 { background: #5b6472; }
.avatar--c7 { background: #7048e8; }

/* Boîte jamais connectée : contour au lieu d'aplat, pour la distinguer sans l'effacer. */
.avatar--absent {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
}

.count {
  min-width: 24px;
  padding: 0 7px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: var(--neutral-soft);
  color: var(--muted);
  flex: none;
}

.count--accent {
  background: var(--accent);
  color: #ffffff;
}

.count--soft {
  background: var(--accent-softer);
  color: var(--accent);
}

/* Colonne repliée : il ne reste que les avatars d'agents, nom en info-bulle. La
   hiérarchie n'y tient pas — les boîtes se retrouvent en dépliant la colonne. */
.is-collapsed .agent-text,
.is-collapsed .agents-foot,
.is-collapsed .agent-toggle,
.is-collapsed .box-list,
.is-collapsed .agent .count {
  display: none;
}

/* Le bouton de repli survit au repli : c'est la seule commande qui déplie la colonne, la
   cacher enfermerait la console dans son état réduit. Seul son intitulé s'efface. */
.is-collapsed .agents-head {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.is-collapsed .agents-head .section-label {
  display: none;
}

/* Le pictogramme se retourne : replié, il montre le sens dans lequel il va rouvrir. */
.is-collapsed #collapse .icon {
  transform: scaleX(-1);
}

.is-collapsed .agent-list {
  padding: 16px 6px;
}

.is-collapsed .agent {
  padding: 8px;
  justify-content: center;
}

.is-collapsed .agent-head .agent {
  padding-left: 8px;
}

/*
  Colonne repliée, deux signes distincts et souvent simultanés.

  L'anneau dit ce qui est **sélectionné** : c'est un contour, il entoure, il désigne — la
  teinte de fond qui sert à ça dans la colonne dépliée n'a plus de place ici. La pastille
  dit qu'il reste du **non-lu** : un point posé sur l'avatar, la même convention que la
  liste des fils. L'un n'implique pas l'autre, ils doivent donc se lire séparément.
*/
.is-collapsed .agent.is-selected {
  background: none;
}

.is-collapsed .agent.is-selected .avatar {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.is-collapsed .agent.has-unread .avatar {
  position: relative;
}

.is-collapsed .agent.has-unread .avatar::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  /* Le liseré détache la pastille de l'avatar, quelle que soit la couleur de celui-ci. */
  box-shadow: 0 0 0 2px var(--bg);
}

.is-collapsed .agents {
  overflow-x: hidden;
}

/* --- Colonne des fils ----------------------------------------------------- */

.threads {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-width: 0;
}

.threads-head {
  padding: 16px 20px 12px;
}

/* L'agent filtré est le sujet de la liste : sa pastille et son nom ouvrent le panneau. */
.threads-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.threads-heading {
  min-width: 0;
}

.threads-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.threads-head p {
  margin: 2px 0 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar--lg {
  width: 40px;
  height: 40px;
  font-size: 15px;
  flex: 0 0 auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  font: inherit;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--panel);
  font-weight: 600;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread {
  display: block;
  width: 100%;
  padding: 12px 16px 12px 32px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  position: relative;
}

.thread:hover {
  background: var(--border-soft);
}

.thread.is-selected {
  background: var(--accent-soft);
  border-top-color: transparent;
}

/* Barre d'accent à gauche : le fil ouvert, repérable sans lire. */
.thread.is-selected::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}

.thread:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Point bleu du fil non lu, dans la gouttière réservée à gauche. */
.thread.is-unread::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 19px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.thread.is-selected.is-unread::after {
  left: 17px;
}

.thread-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.thread-title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread.is-unread .thread-title {
  font-weight: 700;
}

.thread-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.thread.is-unread .thread-time {
  color: var(--accent);
}

/* Les pastilles des deux correspondants, puis leurs noms : on voit qui parle avant de lire. */
.thread-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
}

.thread-names {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dans une liste, la pastille sert de repère, pas de portrait : elle est plus petite. */
.thread-who .avatar--sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

/*
  Ici les pastilles ne se chevauchent pas. Le chevauchement du lecteur dit « ces gens vont
  ensemble » quand la place manque ; dans une liste qui se survole, il mange les initiales,
  et ce sont justement elles qui identifient la boîte. L'anneau qui détachait les pastilles
  superposées n'a alors plus rien à détacher.
*/
.thread-who .avatar-stack {
  gap: 4px;
}

.thread-who .avatar-stack .avatar + .avatar {
  margin-left: 0;
}

.thread-who .avatar--stack {
  box-shadow: none;
}

.thread-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.thread-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread.is-unread .thread-preview {
  color: var(--text);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--neutral-soft);
  color: var(--muted);
  flex: none;
}

.tag--high {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag .icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.5;
}

/* --- Lecteur du fil ------------------------------------------------------- */

.reader {
  overflow-y: auto;
  background: var(--panel);
  min-width: 0;
}

.reader-head {
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--border);
}

.reader-head h2 {
  margin: 0;
  font-size: 18px;
}

.reader-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.reader-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.avatar-stack {
  display: flex;
}

.avatar-stack .avatar + .avatar {
  margin-left: -8px;
}

.reader-participants {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.messages {
  list-style: none;
  margin: 0;
  /* Le retrait latéral du texte vient d'ici plus du cadre d'un message : 20 + 12. */
  padding: 12px 20px 40px;
}

/*
  Un trait entre deux messages, et non un simple blanc.

  Repliés, les messages se suivent de près : sans démarcation, on devine où l'un s'arrête
  à la seule présence de la pastille suivante. Le trait court sur toute la largeur de la
  liste, et l'écart de part et d'autre vient du cadre des messages eux-mêmes.
*/
.messages > li + li {
  border-top-width: 1px;
  border-top-style: solid;
  border-top-color: var(--border);
}

.message {
  padding: 12px;
  border-radius: var(--radius);
}

/* Le dernier message du fil : posé sur un fond discret, sans bordure ni couleur d'état. */
.message.is-last {
  background: var(--bg);
}

.message.is-open {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.message-body-col {
  min-width: 0;
}

/*
  Le bandeau qui ouvre et referme le message.

  Il tient tout ce qu'un message replié montre : la pastille, qui écrit à qui, l'heure, et
  la ligne de résumé. Rien n'y ressemble à un bouton tant qu'on ne le survole pas — c'est
  le fond gris qui dit alors que la zone entière est une cible, mieux qu'un chevron.

  Deux colonnes, deux lignes : la pastille tient sur les deux, le texte occupe la seconde
  colonne — qui écrit à qui sur la première ligne, l'objet du message sur la seconde.
*/
.message-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  padding: 6px;
  margin: -6px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.message-head:hover {
  background: var(--neutral-soft);
}

.message-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/*
  L'information s'ouvre depuis la ligne sans la replier. Visuellement c'est un bouton posé
  dans un autre ; dans le balisage, non — il est rangé au bout de la ligne d'identité, et
  son clic ne remonte pas au bandeau.
*/
.message-info {
  display: flex;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.message-info:hover {
  color: var(--accent);
}

.message-info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.message-head > .avatar {
  grid-row: span 2;
}

/* Qui écrit à qui, et quand : l'heure est poussée au bout de la ligne. */
.message-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

/*
  L'objet du message, sur sa ligne, replié comme déplié : c'est ce qui identifie le
  message, et le bandeau ne doit pas changer de forme en s'ouvrant. Il se lit sans graisse
  — c'est déjà la ligne la plus longue du bandeau, l'appuyer en ferait un titre de section.
  Ce qui dépasse est coupé : la ligne suivante appartient au message suivant.
*/
.message-subject {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Le corps s'aligne sous le texte du bandeau, jamais sous la pastille. */
.message-content {
  padding-left: 40px;
}

/* Non lu : le même point que dans la liste des fils, et non un anneau ni une couleur. */
.message-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.message-from {
  font-weight: 600;
}

.message-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.message-text {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Le markdown est déjà mis en forme : plus besoin de conserver les blancs du source. */
.message-text.markdown {
  white-space: normal;
}

/* --- Corps de message rendu en markdown --- */

.markdown > *:first-child {
  margin-top: 0;
}

.markdown > *:last-child {
  margin-bottom: 0;
}

.md-p {
  margin: 0 0 8px;
}

.markdown .md-heading {
  margin: 14px 0 6px;
  line-height: 1.35;
  font-weight: 600;
}

.markdown h1.md-heading {
  font-size: 17px;
}

.markdown h2.md-heading {
  font-size: 15px;
}

.markdown h3.md-heading,
.markdown h4.md-heading,
.markdown h5.md-heading,
.markdown h6.md-heading {
  font-size: 14px;
}

.markdown h4.md-heading,
.markdown h5.md-heading,
.markdown h6.md-heading {
  color: var(--muted);
}

.md-list {
  margin: 0 0 8px;
  padding-left: 20px;
}

.md-item {
  margin: 2px 0;
}

/* Un article qui porte une sous-liste passe par un paragraphe : il ne doit pas s'en écarter. */
.md-item > .md-p {
  margin-bottom: 2px;
}

.md-list .md-list {
  margin: 2px 0;
}

.md-quote {
  margin: 0 0 8px;
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.md-rule {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* La langue annoncée par l'agent, posée en coin du bloc : elle dit ce qu'on lit. */
.md-code[data-language]::before {
  content: attr(data-language);
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.md-code {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--neutral-soft);
  overflow-x: auto;
}

.md-code code {
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.md-inline-code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--neutral-soft);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.md-link {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.md-strong {
  font-weight: 600;
}

.md-del {
  color: var(--muted);
}

.md-table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 0 8px;
  border-collapse: collapse;
  overflow-x: auto;
}

.md-table th,
.md-table td {
  padding: 5px 10px;
  border: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: var(--neutral-soft);
  font-weight: 600;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
}

.attachment:hover {
  background: var(--accent-soft);
  border-color: var(--accent-softer);
}

.attachment .icon {
  flex: none;
  color: var(--muted);
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-size {
  flex: none;
  color: var(--muted);
}

.message-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.message-foot .btn--link {
  margin-left: auto;
  font-size: 12px;
}

/* --- Détails d'un message ------------------------------------------------- */

/* L'objet, sous le titre de la modale : il dit de quel message on lit les détails. */
.details-subject {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.details-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}

.details-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.details-section .section-label {
  display: block;
  margin-bottom: 12px;
}

.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.kv:last-child {
  margin-bottom: 0;
}

.kv-key {
  font-size: 12px;
  color: var(--muted);
}

.kv-value {
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Une pastille est large de son texte : en cellule de grille, elle s'étirerait sinon. */
.kv > .tag {
  justify-self: start;
}

/* Les adresses ne se recopient pas à la main : elles s'affichent en mono, avec un bouton. */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.party {
  display: flex;
  gap: 10px;
}

.party-name {
  font-size: 13px;
  font-weight: 600;
}

.party-box {
  font-size: 12px;
  color: var(--muted);
}

.party-addr {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
}

.copy {
  border: 0;
  background: none;
  padding: 2px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  border-radius: 4px;
}

.copy:hover {
  color: var(--accent);
}

.copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.copy .icon {
  width: 14px;
  height: 14px;
}

.deliveries {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.deliveries th {
  text-align: left;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  padding: 0 8px 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.deliveries td {
  padding: 8px 8px 8px 0;
  vertical-align: middle;
}

.deliveries td.role,
.deliveries td.folder {
  font-size: 12px;
  color: var(--muted);
}

/* --- Onglets de la barre du haut ------------------------------------------ */

.tabs {
  display: flex;
  align-self: stretch;
  gap: 4px;
  flex: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

/* --- Liaisons -------------------------------------------------------------- */

.links {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: calc(100vh - var(--topbar-h));
}

.links.is-linking {
  cursor: crosshair;
  user-select: none;
}

.links-map {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.links-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
}

.links-toolbar h2 {
  margin: 0;
  font-size: 17px;
}

.links-toolbar p {
  margin: 2px 0 0;
  font-size: 12px;
}

.links-window {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-size: 13px;
  color: var(--muted);
}

.links-window select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.links-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 20px 12px 0;
}

.links-canvas {
  position: relative;
}

.links-canvas > * {
  position: absolute;
}

.links-canvas > .empty {
  position: static;
}

.links-lane {
  z-index: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.links-lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
}

.links-lane-text {
  min-width: 0;
}

.links-lane-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-lane-last {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.links-lane-last.is-fresh {
  color: var(--ok);
}

.links-tick {
  z-index: 1;
  pointer-events: none;
  border-top: 1px solid var(--border-soft);
}

.links-tick--now {
  border-top: 2px solid var(--ok);
}

.links-separator {
  z-index: 1;
  border-top: 2px solid var(--border);
}

.links-axis-label {
  z-index: 1;
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}

.links-axis-label strong {
  font-weight: 600;
}

.links-axis-label .mono {
  font-size: 10px;
}

.links-axis-label--now {
  color: var(--ok);
}


.links-axis-old {
  color: var(--text);
}

.links-axis-old span {
  color: var(--muted);
  font-size: 10px;
}

.links-wires {
  z-index: 2;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.links-wire {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  opacity: 0.7;
}

.links-wire.is-active {
  stroke: var(--accent);
  stroke-width: 3;
  opacity: 1;
}

.links-wire.is-drawing {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 6 4;
  opacity: 1;
}

.links-card {
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.links-card:hover,
.links-card.is-linked {
  border-color: var(--accent);
}

.links-card:focus-visible,
.links-old-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.links-card.is-selected {
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}

.links-rank {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--panel);
  background: var(--muted);
}

.links-rank.is-top {
  background: var(--text);
}

.links-card.is-selected .links-rank {
  background: var(--accent);
  color: #ffffff;
}

.links-rank.is-old {
  background: none;
  color: var(--muted);
}

.links-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.links-card-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-card-name.is-absent,
.links-old-name.is-absent {
  font-weight: 400;
  color: var(--muted);
}

.links-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.links-card-meta .mono {
  font-size: 11px;
}

.links-card-ago {
  color: var(--muted);
  font-weight: 600;
}

.links-card-ago.is-fresh {
  color: var(--ok);
}

.links-card-count {
  position: absolute;
  top: 4px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}

.links-card-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.links-card:has(.links-card-count) .links-card-line {
  padding-right: 24px;
}

.links-card-count .icon {
  width: 11px;
  height: 11px;
}

/* Poignée à cheval sur le bord droit de la carte : c'est d'elle que part le fil. */
.links-handle {
  position: absolute;
  right: -7px;
  top: calc(50% - 7px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--border);
  cursor: crosshair;
  touch-action: none;
}

.links-card:hover .links-handle,
.links-card.is-selected .links-handle {
  background: var(--accent);
}

.links-old-row {
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--bg);
  font: inherit;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.links-old-row:hover,
.links-old-row.is-linked {
  border-color: var(--accent);
}

.links-old-row.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.links-old-row .icon {
  width: 11px;
  height: 11px;
  color: var(--muted);
}

.links-old-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-old-date {
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

/* Poignée d'une boîte ancienne : discrète tant que la ligne n'est pas survolée ou choisie. */
.links-old-row .links-handle {
  opacity: 0;
}

.links-old-row:hover .links-handle,
.links-old-row.is-selected .links-handle {
  opacity: 1;
  background: var(--accent);
}

.links-card.is-renaming .links-handle,
.links-old-row.is-renaming .links-handle {
  display: none;
}

/* Crayon de renommage, montré au survol de la boîte. */
.links-rename {
  display: none;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: pointer;
}

.links-rename:hover {
  background: var(--accent-soft);
}

.links-rename .icon {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

.links-card:hover .links-rename,
.links-old-row:hover .links-rename {
  display: inline-grid;
}

.links.is-linking .links-rename {
  display: none;
}

.links-rename-input {
  z-index: 4;
  box-sizing: border-box;
  padding: 0 6px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  background: var(--panel);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.links-rename-input.is-invalid {
  border-color: var(--danger);
}

.links-rename-hint {
  z-index: 4;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--panel);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.links-rename-hint.is-error {
  background: var(--danger);
}

/* Pendant un glissé : la boîte survolée est la cible, les autres s'estompent. */
.links.is-linking .links-card:not(.is-drag-source, .is-drop-target),
.links.is-linking .links-old-row:not(.is-drag-source, .is-drop-target) {
  opacity: 0.6;
}

.links-card.is-drop-target,
.links-old-row.is-drop-target {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-softer);
}

.links-old-none {
  z-index: 3;
  font-size: 11px;
  font-style: italic;
  color: var(--muted);
  padding: 4px 10px;
}

.links-old-more {
  z-index: 3;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  color: var(--accent);
  text-align: left;
  padding: 2px 10px;
  cursor: pointer;
}

.links-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--muted);
}

.links-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.links-legend .links-rank {
  width: 18px;
  height: 18px;
  font-size: 10px;
  background: var(--text);
}

.links-legend-line {
  display: inline-block;
  width: 24px;
  border-top: 2px solid var(--muted);
}

.links-legend-line.is-new {
  border-top: 3px solid var(--accent);
}

.links-panel {
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.links-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.links-panel-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.links-panel-agent {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-panel-identity .party-addr {
  font-size: 13px;
  flex-wrap: wrap;
}

.links-panel-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.links-panel-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
}

.links-panel-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.links-panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
}

.links-panel-links,
.links-candidates {
  list-style: none;
  margin: 0;
  padding: 0;
}

.links-panel-none {
  font-size: 12px;
  color: var(--muted);
}

.links-panel-link + .links-panel-link {
  border-top: 1px solid var(--border-soft);
  margin-top: 10px;
  padding-top: 10px;
}

.links-panel-link-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.links-unlink.btn--danger {
  padding: 4px 10px;
  font-size: 12px;
}

.links-panel-note {
  margin: 6px 0 0 32px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}

.links-panel-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0 32px;
  font-size: 11px;
}

.links-input,
.links-search {
  width: 100%;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  font: inherit;
  font-size: 13px;
  color: var(--text);
}

.links-input {
  padding: 0 10px;
  margin-bottom: 8px;
}

.links-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
}

.links-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  outline: none;
}

.links-input:focus,
.links-search:focus-within {
  border-color: var(--accent);
  outline: none;
}

.links-error {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--danger);
}

.links-error:empty {
  display: none;
}

.links-candidates {
  margin-top: 8px;
}

.links-candidate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: var(--radius);
}

.links-candidate:hover {
  background: var(--accent-soft);
}

.links-candidate .agent-box.is-fresh {
  color: var(--ok);
}

.links-link {
  padding: 4px 12px;
  flex: none;
}

.links-candidate:hover .links-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.links-candidates-sep {
  margin: 12px 6px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.links-delivery {
  display: flex;
  gap: 8px;
  margin: auto 0 0;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12px;
  color: var(--muted);
}

/* --- États vides et erreurs ----------------------------------------------- */

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-title {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

.banner {
  margin: 16px 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

/* --- Menu du compte ------------------------------------------------------- */

.pill--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.account {
  position: relative;
  flex: none;
  margin-left: auto;
}

/* Les contrôles des boîtes, quand ils sont là, poussent déjà le menu au bord droit. */
.topbar-controls:not([hidden]) + .account {
  margin-left: 0;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: var(--accent);
}

.account-button[aria-expanded="true"] {
  background: var(--accent-soft);
}

.account-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.account-button .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--text);
  color: var(--panel);
  font-size: 11px;
  font-weight: 700;
}

.account-avatar--lg {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 200px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.account-item .icon {
  color: var(--muted);
}

.account-item:hover,
.account-item:focus-visible {
  background: var(--bg);
  outline: none;
}

.account-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.account-item.is-active .icon {
  color: var(--accent);
}

.account-sep {
  height: 1px;
  margin: 6px -6px;
  background: var(--border-soft);
}

/* --- Formulaires d'identifiants ------------------------------------------- */

.field--tight {
  margin: 16px 0 0;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
}

.field-hint.is-weak {
  color: var(--danger);
}

.field-hint.is-strong {
  color: var(--ok);
}

.field-input input.mono {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.field-input--spaced {
  gap: 10px;
}

.field-input--area {
  height: auto;
  margin-top: 12px;
  padding: 8px 12px;
}

.field-input textarea,
.inline-area {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  resize: vertical;
  outline: none;
}

.inline-area {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
}

.inline-input--small {
  height: 30px;
  font-size: 13px;
  font-weight: 400;
}

.props-value {
  line-height: 1.4;
}

.props-edit {
  flex: none;
  padding: 4px;
}

.field-tag {
  font-size: 12px;
  color: var(--accent);
  flex: none;
}

.card-rule {
  height: 1px;
  margin: 20px 0 4px;
  background: var(--border-soft);
}

.card-note--rule {
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.card-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

/* Robustesse d'un mot de passe : quatre segments, colorés selon le niveau atteint. */
.meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.meter span {
  height: 4px;
  border-radius: 2px;
  background: var(--neutral-soft);
}

.meter[data-level="1"] span:nth-child(-n + 1) {
  background: var(--danger);
}

.meter[data-level="2"] span:nth-child(-n + 2) {
  background: var(--warn);
}

.meter[data-level="3"] span:nth-child(-n + 3),
.meter[data-level="4"] span {
  background: var(--ok);
}

.form-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  background: var(--danger-soft);
  color: var(--danger);
}

.form-banner .icon {
  margin-top: 1px;
}

.form-banner--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.form-banner--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.login .btn--block {
  margin-top: 20px;
}

/* --- Pages (clés, compte) -------------------------------------------------- */

.page {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 32px 40px 48px;
}

.page--narrow {
  max-width: 800px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
}

.page-head p {
  margin: 4px 0 0;
  font-size: 13px;
}

.page-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 16px;
}

.page-tools .chips {
  margin: 0;
}

.chip-count {
  margin-left: 4px;
  font-weight: 400;
  opacity: 0.7;
}

.page-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
}

.page-search:focus-within {
  border-color: var(--accent);
}

.page-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.page-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--neutral-soft);
  color: var(--muted);
  font-size: 13px;
}

/* Liste des clés : une grille de colonnes fixes, une ligne par clé. */
.key-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(200px, 2.4fr) minmax(130px, 1.3fr) minmax(150px, 1.6fr) minmax(140px, 1.5fr) minmax(120px, 1.3fr) 130px;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px 20px 10px 24px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  cursor: pointer;
}

.key-row:hover,
.key-row:focus-visible {
  background: var(--bg);
  outline: none;
}

.key-row.is-selected {
  background: var(--accent-soft);
}

.key-row--head {
  min-height: 40px;
  border-top: 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
}

.key-row--head:hover {
  background: none;
}

.key-row--head + .key-row {
  border-top: 0;
}

.key-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.key-name strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-sub,
.key-muted {
  font-size: 12px;
  color: var(--muted);
}

.key-recent {
  color: var(--ok);
}

.key-agent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.key-agent.is-muted {
  color: var(--muted);
}

.key-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
}

.key-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
}

/* « Révoquer » n'apparaît qu'au survol : la liste se lit d'abord, elle s'édite ensuite. */
.key-revoke {
  visibility: hidden;
  padding: 5px 12px;
  color: var(--danger);
  font-weight: 600;
}

.key-row:hover .key-revoke,
.key-row:focus-within .key-revoke {
  visibility: visible;
}

.key-revoke:hover {
  border-color: var(--danger);
}

.key-empty {
  margin: 0;
  padding: 28px 24px;
  color: var(--muted);
  font-size: 13px;
}

.tag--muted {
  background: var(--neutral-soft);
  color: var(--muted);
}

/* --- Volet des clés -------------------------------------------------------- */

.drawer {
  position: fixed;
  inset: var(--topbar-h) 0 0 auto;
  width: min(480px, 100vw);
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.drawer::backdrop {
  background: rgba(28, 32, 36, 0.28);
}

.drawer-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.drawer-title h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-title p {
  margin: 6px 0 0;
  font-size: 13px;
}

.drawer-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-name .btn--icon {
  padding: 4px;
}

.inline-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 32px 24px;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-top: 1px solid var(--border-soft);
}

.drawer-tags {
  display: flex;
  gap: 8px;
  margin: 20px 0 4px;
}

.drawer-tags .tag {
  font-size: 12px;
  padding: 2px 10px;
}

.drawer-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

.drawer-section h3 {
  margin: 0;
  font-size: 14px;
}

.drawer-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.drawer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-row p {
  margin: 6px 0 0;
}

.drawer-row .btn {
  flex: none;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--neutral-soft);
}

.segmented-item {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.segmented-item.is-active {
  border-color: var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
}

.choice {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.choice-item {
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.choice-item:hover {
  border-color: var(--accent);
}

.choice-item.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.segmented-item:focus-visible,
.choice-item:focus-visible,
.subtab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.notice {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 12px;
}

.notice .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.notice div {
  display: grid;
  gap: 2px;
}

.notice strong {
  font-size: 13px;
}

.notice--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.secret {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.secret-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: all;
}

.secret-warning {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--warn);
}

.secret-warning .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.btn--small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn--primary.btn--small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn--danger-text {
  color: var(--danger);
  font-weight: 600;
}

.btn--danger-text:hover {
  border-color: var(--danger);
}

.btn--link.btn--danger-text {
  padding-left: 0;
  font-weight: 400;
}

.subtabs {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.subtab {
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.subtab.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Bloc de code sombre dans les deux thèmes : c'est ce qui se colle dans un fichier. */
.code-block {
  position: relative;
  border-radius: var(--radius);
  background: #1c2024;
}

.code-block pre {
  margin: 0;
  padding: 14px 44px 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #e6e9ee;
  white-space: pre;
}

.code-block .copy {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #98a1b0;
}

.props {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}

.props dt {
  padding: 7px 0;
  color: var(--muted);
}

.props dd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 7px 0;
  min-width: 0;
}

/* Prolonger : l'action courante en un clic, les autres durées derrière la flèche. */
.split {
  position: relative;
  display: inline-flex;
}

.split-main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  font-weight: 600;
}

.split-more {
  margin-left: -1px;
  padding: 5px 6px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.split-more .icon {
  width: 12px;
  height: 12px;
}

.split-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 190px;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.split-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.split-item:hover {
  background: var(--bg);
}

.key-boxes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.key-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  margin: 0 -8px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.key-box:hover {
  background: var(--bg);
}

.key-box .key-name {
  flex: 1;
}

.key-box strong {
  font-size: 13px;
}

.key-box > .icon {
  color: var(--muted);
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-zone h3 {
  margin: 0;
  font-size: 14px;
}

.danger-zone p {
  margin: 4px 0 0;
  font-size: 12px;
}

/* --- Confirmation de révocation ------------------------------------------- */

.modal--confirm {
  width: min(440px, calc(100vw - 32px));
}

.modal--confirm .modal-card {
  padding: 24px 24px 16px;
}

.confirm-head {
  display: flex;
  gap: 16px;
}

.confirm-head h2 {
  margin: 0;
  font-size: 17px;
}

.confirm-head p {
  margin: 4px 0 0;
}

.confirm-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-list {
  list-style: none;
  margin: 20px 0 0 56px;
  padding: 0;
  display: grid;
  gap: 12px;
  font-size: 13px;
}

.confirm-list li {
  display: flex;
  gap: 8px;
}

.confirm-list .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  stroke-width: 2.5;
}

.confirm-list .is-lost .icon {
  color: var(--danger);
}

.confirm-list .is-kept .icon {
  color: var(--ok);
}

.confirm-note {
  margin: 12px 0 0 56px;
  font-size: 12px;
  color: var(--muted);
}

.modal--confirm .modal-foot {
  margin: 20px -24px 0;
  padding: 16px 24px 0;
  border-top: 1px solid var(--border-soft);
}

/* --- Mon compte ------------------------------------------------------------ */

.panel-card {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.panel-card h3 {
  margin: 0;
  font-size: 15px;
}

.panel-card h3 + .key-muted {
  margin: 4px 0 0;
}

.panel-card--row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.panel-card-main {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.panel-card-title {
  font-size: 15px;
}

.panel-card--flush {
  padding: 0;
}

.panel-card-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.panel-card-foot--start {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin: 0;
  padding: 8px 24px 16px;
}

.panel-card-foot--start .form-banner {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
  max-width: 680px;
}

.form-grid-full {
  grid-column: 1 / -1;
  max-width: calc(50% - 12px);
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0 24px;
}

.session {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  font-size: 13px;
}

.session + .session {
  border-top: 1px solid var(--border-soft);
}

.session > .icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.session .key-name {
  flex: 1;
}

.session .key-name strong {
  font-size: 13px;
}

.session .tag {
  font-size: 12px;
  padding: 2px 10px;
}

/* --- Écrans étroits ------------------------------------------------------- */

@media (max-width: 1000px) {
  .page {
    padding: 24px 20px 40px;
  }

  .key-row {
    grid-template-columns: minmax(160px, 2fr) minmax(120px, 1.2fr) minmax(0, 1.4fr) 100px;
  }

  .key-row > :nth-child(4),
  .key-row > :nth-child(5) {
    display: none;
  }

  .topbar-search {
    max-width: 240px;
  }

  .console,
  .console.is-collapsed {
    grid-template-columns: 57px var(--w-gutter) 300px var(--w-gutter) minmax(0, 1fr);
  }

  .links {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}
