/* BizNC Premium — composants du design system (lot 1).
   Dépend de tokens.css. Préfixe .pm- ; nommage .pm-{composant}[--variante].
   Un seul bouton primaire par contexte ; actions secondaires en boutons à
   icône ronds avec nom accessible et info-bulle. */

/* ---------- Base ---------- */

.pm-root,
.pm-root *,
.pm-root *::before,
.pm-root *::after { box-sizing: border-box; }

.pm-root {
  margin: 0;
  background: var(--pm-bg);
  color: var(--pm-fg);
  font-family: var(--pm-font);
  font-size: var(--pm-text-md);
  line-height: var(--pm-leading-text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Spécificité nulle : les classes des composants gardent la main. */
:where(.pm-root) :where(button, input, select, textarea) { font: inherit; color: inherit; }

.pm-root :focus-visible {
  outline: 2px solid var(--pm-focus);
  outline-offset: 3px;
}

.pm-num { font-variant-numeric: tabular-nums; }

.pm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Lien d'évitement : invisible tant qu'il n'a pas le focus clavier. */
.pm-skip {
  position: absolute;
  left: var(--pm-space-4);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--pm-radius-sm);
  background: var(--pm-inverse);
  color: var(--pm-on-inverse);
  font-weight: 600;
  text-decoration: none;
}
.pm-skip:focus-visible { top: var(--pm-space-4); }

/* ---------- Icônes ---------- */

.pm-icon {
  width: var(--pm-icon);
  height: var(--pm-icon);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.pm-icon--sm { width: var(--pm-icon-sm); height: var(--pm-icon-sm); }
.pm-icon--fill { fill: currentColor; }

/* ---------- Typographie ---------- */

.pm-display {
  margin: 0;
  font-size: var(--pm-display-lg);
  font-weight: 800;
  line-height: var(--pm-leading-display);
  letter-spacing: var(--pm-tracking-display);
  text-wrap: balance;
}
.pm-display--md { font-size: var(--pm-display-md); }
.pm-display--sm { font-size: var(--pm-display-sm); letter-spacing: -0.035em; line-height: 1; }
.pm-display .pm-quiet { color: var(--pm-muted); }

.pm-title { margin: 0; font-size: var(--pm-text-xl); font-weight: 700; line-height: var(--pm-leading-title); letter-spacing: -0.02em; }
.pm-subtitle { margin: 0; font-size: var(--pm-text-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.pm-text { margin: 0; font-size: var(--pm-text-md); }
.pm-meta { margin: 0; font-size: var(--pm-text-sm); color: var(--pm-muted); }
.pm-label {
  margin: 0;
  font-size: var(--pm-text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pm-muted);
}

/* ---------- Boutons à texte ---------- */

.pm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pm-space-2);
  min-height: var(--pm-control-h);
  padding: 0 18px;
  border: 1px solid var(--pm-line-strong);
  border-radius: var(--pm-radius-sm);
  background: transparent;
  color: var(--pm-fg);
  font-weight: 600;
  font-size: var(--pm-text-md);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--pm-dur) var(--pm-ease), border-color var(--pm-dur) var(--pm-ease), transform var(--pm-dur-fast) var(--pm-ease);
}
.pm-btn:hover { background: var(--pm-surface-2); }
.pm-btn:active { transform: scale(0.98); }
.pm-btn--primary {
  background: var(--pm-inverse);
  border-color: var(--pm-inverse);
  color: var(--pm-on-inverse);
}
.pm-btn--primary:hover { background: var(--pm-fg-2); border-color: var(--pm-fg-2); }
.pm-btn--ghost { border-color: transparent; color: var(--pm-fg-2); }
.pm-btn--ghost:hover { color: var(--pm-fg); }
.pm-btn--danger { color: var(--pm-bad); }
.pm-btn--sm { min-height: var(--pm-control-h-sm); padding: 0 14px; font-size: var(--pm-text-sm); }
.pm-btn--block { width: 100%; }
.pm-btn:disabled,
.pm-btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; transform: none; }
.pm-btn[aria-busy="true"] { cursor: progress; }
.pm-btn[aria-busy="true"] .pm-icon { animation: pm-spin 0.9s linear infinite; }

/* ---------- Boutons à icône seule (ronds) ---------- */

.pm-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--pm-hit);
  height: var(--pm-hit);
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--pm-fg-2);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--pm-dur) var(--pm-ease), color var(--pm-dur) var(--pm-ease), transform var(--pm-dur-fast) var(--pm-ease);
}
.pm-icon-btn:hover { background: var(--pm-surface-2); color: var(--pm-fg); }
.pm-icon-btn:active { transform: scale(0.94); }
.pm-icon-btn--outline { border-color: var(--pm-line); }
.pm-icon-btn--solid { background: var(--pm-inverse); color: var(--pm-on-inverse); }
.pm-icon-btn--solid:hover { background: var(--pm-fg-2); color: var(--pm-on-inverse); }
.pm-icon-btn--sm { width: var(--pm-control-h-sm); height: var(--pm-control-h-sm); }
/* Sélectionné / actif (bascule) */
.pm-icon-btn[aria-pressed="true"],
.pm-icon-btn.is-selected,
.pm-icon-btn[aria-expanded="true"] { background: var(--pm-surface-3); color: var(--pm-fg); }
.pm-icon-btn[aria-pressed="true"] .pm-icon--toggle { fill: currentColor; }
.pm-icon-btn:disabled,
.pm-icon-btn[aria-disabled="true"] { opacity: 0.38; cursor: not-allowed; background: transparent; transform: none; }
/* Pastille de compteur (notifications) */
.pm-icon-btn .pm-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 8px;
  height: 8px;
  border-radius: var(--pm-radius-pill);
  background: var(--pm-accent);
}

/* ---------- Info-bulle (desktop : survol et focus clavier) ---------- */

[data-tooltip] { position: relative; }
/* Le pseudo-élément n'existe qu'au survol ou au focus : au repos il ne pèse
   pas dans la mise en page (pas de défilement horizontal près des bords). */
@media (hover: hover) and (pointer: fine) {
  [data-tooltip]:hover::after,
  [data-tooltip]:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    z-index: 50;
    padding: 5px 9px;
    border-radius: var(--pm-radius-xs);
    background: var(--pm-inverse);
    color: var(--pm-on-inverse);
    font-size: var(--pm-text-xs);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(-50%);
    animation: pm-tooltip-in var(--pm-dur-fast) var(--pm-ease) var(--pm-tooltip-delay) both;
  }
  [data-tooltip-pos="top"]:hover::after,
  [data-tooltip-pos="top"]:focus-visible::after { top: auto; bottom: calc(100% + 6px); }
  [data-tooltip-align="end"]:hover::after,
  [data-tooltip-align="end"]:focus-visible::after { left: auto; right: 0; transform: none; }
  [data-tooltip][aria-expanded="true"]::after { display: none; }
}
@keyframes pm-tooltip-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Champs ---------- */

.pm-field { display: grid; gap: 6px; min-width: 0; }
.pm-field > label,
.pm-field-label { font-size: var(--pm-text-sm); font-weight: 600; color: var(--pm-fg-2); }
.pm-input,
.pm-textarea,
.pm-select {
  width: 100%;
  min-height: var(--pm-control-h);
  padding: 10px 14px;
  border: 1px solid var(--pm-line-strong);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface);
  color: var(--pm-fg);
  transition: border-color var(--pm-dur) var(--pm-ease), background-color var(--pm-dur) var(--pm-ease);
}
.pm-textarea { min-height: 88px; resize: vertical; line-height: var(--pm-leading-text); }
.pm-input::placeholder,
.pm-textarea::placeholder { color: var(--pm-muted); }
.pm-input:hover,
.pm-textarea:hover,
.pm-select:hover { border-color: var(--pm-muted); }
.pm-input:focus-visible,
.pm-textarea:focus-visible,
.pm-select:focus-visible { outline-offset: 1px; border-color: var(--pm-fg); }
.pm-input[aria-invalid="true"] { border-color: var(--pm-bad); }
.pm-input:disabled { opacity: 0.45; cursor: not-allowed; }
.pm-hint { font-size: var(--pm-text-xs); color: var(--pm-muted); }
.pm-error { font-size: var(--pm-text-xs); color: var(--pm-bad); }

/* ---------- Champ de recherche (composer) ---------- */

.pm-search {
  display: flex;
  align-items: center;
  gap: var(--pm-space-2);
  min-height: 56px;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--pm-line-strong);
  border-radius: 22px;
  background: var(--pm-surface);
  transition: border-color var(--pm-dur) var(--pm-ease), box-shadow var(--pm-dur) var(--pm-ease);
}
.pm-search:focus-within { border-color: var(--pm-muted); box-shadow: 0 0 0 4px var(--pm-accent-soft); }
.pm-search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--pm-fg);
  font-size: 16px; /* évite le zoom iOS */
  outline: none;
}
.pm-search input::placeholder { color: var(--pm-muted); }
.pm-search input::-webkit-search-cancel-button { display: none; }
.pm-search .pm-icon-btn--solid:disabled { background: var(--pm-surface-3); color: var(--pm-muted); opacity: 1; }

/* ---------- Puces de filtre ---------- */

.pm-chips { display: flex; flex-wrap: wrap; gap: var(--pm-space-2); }
.pm-chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pm-chips--scroll::-webkit-scrollbar { display: none; }
.pm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--pm-control-h-sm);
  padding: 0 14px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-pill);
  background: transparent;
  color: var(--pm-fg-2);
  font-size: var(--pm-text-sm);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--pm-dur) var(--pm-ease), border-color var(--pm-dur) var(--pm-ease), color var(--pm-dur) var(--pm-ease);
}
.pm-chip:hover { border-color: var(--pm-line-strong); color: var(--pm-fg); }
.pm-chip[aria-pressed="true"],
.pm-chip[aria-checked="true"],
.pm-chip.is-active { background: var(--pm-surface-3); border-color: var(--pm-line-strong); color: var(--pm-fg); }
.pm-chip .pm-count { color: var(--pm-muted); font-variant-numeric: tabular-nums; }
.pm-chip .pm-icon { width: 14px; height: 14px; }
/* Puce supprimable : l'icône est un vrai bouton nommé */
.pm-chip--removable { padding-right: 4px; cursor: default; }
.pm-chip__remove {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pm-muted);
  cursor: pointer;
}
.pm-chip__remove:hover { background: var(--pm-surface-2); color: var(--pm-fg); }

/* ---------- Tags et statuts ---------- */

.pm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-pill);
  background: var(--pm-surface);
  color: var(--pm-fg-2);
  font-size: var(--pm-text-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-tag__remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pm-muted);
  cursor: pointer;
}
.pm-tag__remove:hover { background: var(--pm-surface-3); color: var(--pm-fg); }
.pm-tag__remove .pm-icon { width: 12px; height: 12px; }

.pm-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px 0 9px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-pill);
  background: transparent;
  color: var(--pm-fg);
  font-size: var(--pm-text-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.pm-status:hover { border-color: var(--pm-line-strong); }
.pm-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--pm-muted);
}
.pm-status[data-category="doing"]::before { border-color: var(--pm-accent); background: linear-gradient(90deg, var(--pm-accent) 50%, transparent 50%); }
.pm-status[data-category="done"]::before { border-color: var(--pm-ok); background: var(--pm-ok); }
.pm-status--empty { color: var(--pm-muted); border-style: dashed; }

/* Visibilité Personnel / Équipe, toujours lisible */
.pm-visibility {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--pm-text-xs);
  color: var(--pm-muted);
}
.pm-visibility .pm-icon { width: 14px; height: 14px; }

/* ---------- Saisie de tags (combobox) ---------- */

.pm-taginput {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: var(--pm-control-h);
  padding: 7px 10px;
  border: 1px solid var(--pm-line-strong);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface);
  cursor: text;
}
.pm-taginput:focus-within { border-color: var(--pm-fg); }
.pm-taginput input {
  flex: 1;
  min-width: 120px;
  height: 28px;
  border: 0;
  background: transparent;
  outline: none;
}
.pm-taginput input::placeholder { color: var(--pm-muted); }
/* Le focus est porté par le conteneur (bordure), pas par le champ interne. */
.pm-taginput input:focus-visible,
.pm-search input:focus-visible { outline: none; }

/* ---------- Listes déroulantes, menus, popovers ---------- */

.pm-popover {
  margin: 0;
  padding: 6px;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  max-height: min(420px, 70vh);
  overflow: auto;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface);
  color: var(--pm-fg);
  box-shadow: var(--pm-shadow);
}
.pm-popover[popover] { position: fixed; inset: auto; }
.pm-popover:popover-open { animation: pm-pop-in var(--pm-dur) var(--pm-ease-out); }
.pm-listbox { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; }
.pm-menu-label { padding: 8px 10px 4px; }
.pm-menu-sep { height: 1px; margin: 6px 4px; background: var(--pm-line); border: 0; }
.pm-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--pm-fg);
  font-size: var(--pm-text-sm);
  text-align: left;
  cursor: pointer;
}
.pm-menu-item .pm-icon { color: var(--pm-fg-2); }
.pm-menu-item:hover,
.pm-menu-item:focus-visible,
.pm-menu-item[aria-selected="true"],
.pm-menu-item.is-active { background: var(--pm-surface-2); outline: none; }
.pm-menu-item[aria-checked="true"]::after,
.pm-menu-item[aria-current="true"]::after {
  content: "";
  width: 14px;
  height: 8px;
  margin-left: auto;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}
.pm-menu-item--create { color: var(--pm-fg-2); }
.pm-menu-item--danger { color: var(--pm-bad); }
.pm-menu-item kbd { margin-left: auto; color: var(--pm-muted); font: inherit; font-size: var(--pm-text-xs); }

/* ---------- Contrôle segmenté (Personnel / Équipe, vues, thème) ---------- */

.pm-segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-bg);
}
.pm-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.pm-segmented label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 11px;
  color: var(--pm-muted);
  font-size: var(--pm-text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--pm-dur) var(--pm-ease), color var(--pm-dur) var(--pm-ease);
}
.pm-segmented label:hover { color: var(--pm-fg); }
.pm-segmented input:checked + label { background: var(--pm-surface-3); color: var(--pm-fg); }
.pm-segmented input:focus-visible + label { outline: 2px solid var(--pm-focus); outline-offset: 1px; }
.pm-segmented .pm-icon { width: 16px; height: 16px; }

/* ---------- Case à cocher ---------- */

.pm-check {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--pm-line-strong);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--pm-dur-fast) var(--pm-ease), border-color var(--pm-dur-fast) var(--pm-ease);
}
.pm-check:hover { border-color: var(--pm-muted); }
.pm-check::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--pm-on-inverse);
  border-bottom: 2px solid var(--pm-on-inverse);
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform var(--pm-dur-fast) var(--pm-ease);
}
.pm-check:checked,
.pm-check:indeterminate { background: var(--pm-inverse); border-color: var(--pm-inverse); }
.pm-check:checked::before { transform: translateY(-1px) rotate(-45deg) scale(1); }
.pm-check:indeterminate::before { width: 9px; height: 0; border-left: 0; transform: none; }
.pm-check:disabled { opacity: 0.4; cursor: not-allowed; }
/* Zone tactile de 44 px autour de la case */
.pm-check-hit {
  display: inline-grid;
  place-items: center;
  width: var(--pm-hit);
  height: var(--pm-hit);
  margin: -13px;
  cursor: pointer;
}

/* ---------- Barre de sélection (action principale : Enregistrer) ---------- */

.pm-selbar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--pm-space-2);
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--pm-line-strong);
  border-radius: 22px;
  background: var(--pm-surface-2);
  box-shadow: var(--pm-shadow);
  transform: translate(-50%, 0);
  transition: transform var(--pm-dur-slow) var(--pm-ease-out), opacity var(--pm-dur) var(--pm-ease);
}
.pm-selbar[hidden] { display: flex !important; transform: translate(-50%, 140%); opacity: 0; pointer-events: none; visibility: hidden; }
.pm-selbar__count { font-size: var(--pm-text-sm); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; margin-right: var(--pm-space-2); }
.pm-selbar--inline { position: static; transform: none; box-shadow: none; }

/* ---------- Toasts ---------- */

.pm-toasts {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: grid;
  gap: var(--pm-space-2);
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}
.pm-toast {
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  min-height: 48px;
  padding: 6px 6px 6px 16px;
  border-radius: 16px;
  background: var(--pm-inverse);
  color: var(--pm-on-inverse);
  font-size: var(--pm-text-sm);
  box-shadow: var(--pm-shadow);
  pointer-events: auto;
  animation: pm-toast-in var(--pm-dur-slow) var(--pm-ease-out);
}
.pm-toast.is-leaving { animation: pm-toast-out var(--pm-dur) var(--pm-ease) forwards; }
.pm-toast__action {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pm-toast__action:hover { background: rgba(127, 127, 127, 0.18); }
.pm-toast :focus-visible { outline-color: var(--pm-on-inverse); }

/* ---------- Panneau latéral et feuille mobile (dialog) ---------- */

.pm-panel,
.pm-sheet,
.pm-modal {
  padding: 0;
  border: 1px solid var(--pm-line);
  background: var(--pm-surface);
  color: var(--pm-fg);
  box-shadow: var(--pm-shadow);
}
.pm-panel::backdrop,
.pm-sheet::backdrop,
.pm-modal::backdrop { background: var(--pm-scrim); }
.pm-panel {
  position: fixed;
  inset: 8px 8px 8px auto;
  width: min(440px, calc(100vw - 16px));
  height: auto;
  max-height: none;
  margin: 0;
  border-radius: var(--pm-radius-xl);
}
.pm-panel[open] { animation: pm-panel-in var(--pm-dur-slow) var(--pm-ease-out); }
.pm-sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  margin: 0 auto;
  border-bottom: 0;
  border-radius: var(--pm-radius-xl) var(--pm-radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pm-sheet[open] { animation: pm-sheet-in var(--pm-dur-slow) var(--pm-ease-out); }
.pm-sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: var(--pm-radius-pill);
  background: var(--pm-line-strong);
}
.pm-modal {
  width: min(480px, calc(100vw - 32px));
  border-radius: var(--pm-radius-xl);
}
.pm-modal[open] { animation: pm-pop-in var(--pm-dur) var(--pm-ease-out); }
.pm-dialog__inner { display: flex; flex-direction: column; gap: var(--pm-space-4); height: 100%; padding: var(--pm-space-5) var(--pm-space-6) var(--pm-space-6); }
.pm-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--pm-space-3); margin-right: -10px; }
.pm-dialog__body { display: grid; gap: var(--pm-space-4); align-content: start; flex: 1; overflow: auto; }
.pm-dialog__foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--pm-space-3); flex-wrap: wrap; }

/* ---------- Tableau ---------- */

.pm-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-lg);
}
.pm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--pm-text-sm);
}
.pm-table th,
.pm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--pm-line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.pm-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--pm-surface);
  color: var(--pm-muted);
  font-size: var(--pm-text-xs);
  font-weight: 600;
}
.pm-table th button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -6px -8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.pm-table th button:hover { background: var(--pm-surface-2); color: var(--pm-fg); }
.pm-table th[aria-sort] button { color: var(--pm-fg); }
.pm-table tbody tr { transition: background-color var(--pm-dur-fast) var(--pm-ease); }
.pm-table tbody tr:hover { background: var(--pm-surface); }
.pm-table tbody tr[aria-selected="true"],
.pm-table tbody tr.is-selected { background: var(--pm-accent-soft); }
.pm-table tbody tr:last-child td { border-bottom: 0; }
.pm-table .pm-col-check { width: 44px; padding-right: 0; }
.pm-table .pm-col-title { white-space: normal; min-width: 260px; color: var(--pm-fg); font-weight: 500; }
.pm-table .pm-col-num { text-align: right; font-variant-numeric: tabular-nums; }
.pm-table .pm-col-muted { color: var(--pm-muted); }

/* ---------- Résultat (ligne de liste / carte) ---------- */

.pm-results { display: grid; }
.pm-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--pm-space-3);
  align-items: start;
  padding: 14px 8px;
  border-bottom: 1px solid var(--pm-line);
  border-radius: 0;
  transition: background-color var(--pm-dur-fast) var(--pm-ease);
}
.pm-result:hover { background: var(--pm-surface); }
.pm-result.is-selected { background: var(--pm-accent-soft); }
.pm-result__type {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--pm-line);
  border-radius: 12px;
  color: var(--pm-fg-2);
}
.pm-result__title { margin: 0 0 4px; font-size: var(--pm-text-md); font-weight: 600; line-height: 1.3; }
.pm-result__title a { color: inherit; text-decoration: none; }
.pm-result__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pm-result__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--pm-text-xs); color: var(--pm-muted); }
.pm-result__meta .is-stale { color: var(--pm-warn); }
.pm-result__actions { display: flex; align-items: center; gap: 2px; margin: -6px -4px 0 0; }
.pm-result mark { background: var(--pm-accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.pm-result--card {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--pm-space-4);
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface);
}

/* ---------- Statistique ---------- */

.pm-stat {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-lg);
}
.pm-stat__head { display: flex; align-items: center; justify-content: space-between; gap: var(--pm-space-2); margin: -6px -10px -6px 0; }
.pm-stat__value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pm-stat__delta { font-size: var(--pm-text-xs); font-weight: 600; color: var(--pm-accent); font-variant-numeric: tabular-nums; }
.pm-stat__foot { font-size: var(--pm-text-xs); color: var(--pm-muted); }
.pm-bars { display: grid; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.pm-bars li { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: var(--pm-text-xs); }
.pm-bars span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pm-fg-2); }
.pm-bar { height: 8px; border-radius: var(--pm-radius-pill); background: var(--pm-surface-3); overflow: hidden; }
.pm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--pm-line-strong); transition: width var(--pm-dur-slow) var(--pm-ease-out); }
.pm-bar i.is-key { background: var(--pm-accent); }
.pm-spark { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.pm-spark i { flex: 1; min-height: 2px; border-radius: 3px; background: var(--pm-line-strong); }
.pm-spark i.is-key { background: var(--pm-accent); }

/* ---------- Avatar ---------- */

.pm-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--pm-line-strong);
  border-radius: 50%;
  background: var(--pm-surface-2);
  color: var(--pm-fg-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pm-avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.pm-avatars { display: inline-flex; }
.pm-avatars .pm-avatar + .pm-avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--pm-bg); }

/* ---------- Commentaires et historique ---------- */

.pm-thread { display: grid; gap: var(--pm-space-4); margin: 0; padding: 0; list-style: none; }
.pm-comment { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.pm-comment__head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: var(--pm-text-sm); }
.pm-comment__head b { font-weight: 650; }
.pm-comment__body { margin: 2px 0 0; font-size: var(--pm-text-sm); color: var(--pm-fg-2); overflow-wrap: anywhere; }
.pm-mention { color: var(--pm-fg); font-weight: 600; background: var(--pm-accent-soft); border-radius: 4px; padding: 0 3px; }
.pm-history { display: grid; gap: 8px; margin: 0; padding: 0 0 0 14px; list-style: none; border-left: 1px solid var(--pm-line); }
.pm-history li { position: relative; font-size: var(--pm-text-xs); color: var(--pm-muted); }
.pm-history li::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pm-line-strong);
}
.pm-history b { color: var(--pm-fg-2); font-weight: 600; }

/* ---------- Bannières (essai, quota, données anciennes) ---------- */

.pm-banner {
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  flex-wrap: wrap;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface);
  font-size: var(--pm-text-sm);
}
.pm-banner > .pm-icon { color: var(--pm-fg-2); }
.pm-banner__text { flex: 1; min-width: 200px; }
.pm-banner__text b { font-weight: 650; }
.pm-banner--warn { border-color: color-mix(in srgb, var(--pm-warn) 45%, var(--pm-line)); }
.pm-banner--warn > .pm-icon { color: var(--pm-warn); }
.pm-banner--accent { border-color: color-mix(in srgb, var(--pm-accent) 45%, var(--pm-line)); }
.pm-banner--accent > .pm-icon { color: var(--pm-accent); }

/* ---------- États : chargement, vide ---------- */

.pm-skeleton {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pm-surface-2) 0%, var(--pm-surface-3) 50%, var(--pm-surface-2) 100%);
  background-size: 200% 100%;
  animation: pm-shimmer 1.4s ease-in-out infinite;
}
.pm-skeleton--title { height: 16px; width: 70%; }
.pm-skeleton--short { width: 40%; }

.pm-empty {
  display: grid;
  justify-items: center;
  gap: var(--pm-space-3);
  padding: var(--pm-space-12) var(--pm-space-6);
  border: 1px dashed var(--pm-line-strong);
  border-radius: var(--pm-radius-xl);
  text-align: center;
}
.pm-empty > .pm-icon { width: 28px; height: 28px; color: var(--pm-muted); }
.pm-empty p { max-width: 34em; }

/* ---------- Animations ---------- */

@keyframes pm-spin { to { transform: rotate(360deg); } }
@keyframes pm-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes pm-pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pm-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pm-toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes pm-panel-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pm-sheet-in { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .pm-skeleton { animation: none; }
  .pm-root *,
  .pm-root *::before,
  .pm-root *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
