/*
 * Pilote — design system V2 : composants partagés par le site et le cockpit.
 * Boutons, champs, badges et pastilles, cartes, tableaux, listes, puces, jauges, états vides,
 * fenêtres, notifications, avatars, contrôles segmentés.
 */

/* --- Icônes système (data URI : autorisées par la CSP img-src data:) ------------------------ */

:root {
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362635d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  --check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --toast-ok: #4ade80;
  --toast-err: #ff8a8a;
  --toast-info: #a8a8a0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239c9c94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    --toast-ok: #15803d;
    --toast-err: #c42b37;
    --toast-info: #62635d;
  }
}
:root[data-theme="dark"],
.theme-dark {
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239c9c94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  --toast-ok: #15803d;
  --toast-err: #c42b37;
  --toast-info: #62635d;
}

.icon {
  display: inline-block;
  vertical-align: middle;
}

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

.btn {
  --btn-h: 34px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--btn-h);
  min-height: var(--btn-h);
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: -0.003em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--dur-2) var(--ease-standard),
    border-color var(--dur-2) var(--ease-standard),
    color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard),
    transform var(--dur-1) var(--ease-standard);
}
.btn .icon {
  width: 16px;
  height: 16px;
  margin-inline: -1px;
}
.btn:hover {
  background: color-mix(in srgb, var(--surface) 92%, var(--text));
  border-color: color-mix(in srgb, var(--border-strong) 70%, var(--text));
}
.btn:active {
  transform: translateY(0.5px);
  box-shadow: none;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgb(255 255 255 / 12%);
}
.btn-primary:hover {
  background: var(--ink-hover);
  border-color: var(--ink-hover);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgb(255 255 255 / 25%);
}
.btn-accent:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-ai {
  background: var(--ai-solid);
  border-color: var(--ai-solid);
  color: var(--on-color);
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgb(255 255 255 / 18%);
}
.btn-ai:hover {
  background: var(--ai-solid-hover);
  border-color: var(--ai-solid-hover);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--surface);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--fill-hover);
  border-color: transparent;
  color: var(--text);
}

.btn-sm {
  --btn-h: 28px;
  padding: 0 9px;
  gap: 5px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}
.btn-sm .icon {
  width: 14px;
  height: 14px;
}
.btn-lg {
  --btn-h: 42px;
  padding: 0 18px;
  gap: 8px;
  font-size: var(--text-md);
  border-radius: 10px;
}
.btn-xl {
  --btn-h: 50px;
  padding: 0 22px;
  gap: 10px;
  font-size: 16px;
  border-radius: 12px;
}
.btn-icon {
  width: var(--btn-h);
  padding: 0;
}

/* Lien qui se présente comme un texte cliquable (titres de cartes, lignes de liste). */
.link-button {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--text);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--dur-2);
}
.link-button:hover {
  color: var(--accent-text);
}
.link-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.text-link {
  color: var(--accent-text);
  font-weight: var(--weight-medium);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.text-link:hover {
  text-decoration: underline;
}

/* --- Champs ------------------------------------------------------------------------------- */

label {
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  color: var(--text-2);
  line-height: 1.35;
}

input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"])),
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard),
    background-color var(--dur-2) var(--ease-standard);
}
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"])):hover,
select:hover,
textarea:hover {
  border-color: var(--text-muted);
}
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"])):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
  opacity: 1;
}
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}
input[type="date"],
input[type="datetime-local"] {
  font-variant-numeric: tabular-nums;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 16px;
  cursor: pointer;
  text-overflow: ellipsis;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  display: inline-grid;
  place-content: center;
  border: 1px solid var(--border-control);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  vertical-align: -3px;
  transition:
    background-color var(--dur-2) var(--ease-standard),
    border-color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard);
}
input[type="radio"] {
  border-radius: 50%;
}
input[type="checkbox"]::before {
  content: "";
  width: 11px;
  height: 11px;
  background: var(--on-ink);
  -webkit-mask: var(--check-mask) center / contain no-repeat;
  mask: var(--check-mask) center / contain no-repeat;
  transform: scale(0.4);
  opacity: 0;
  transition:
    transform var(--dur-2) var(--ease-out),
    opacity var(--dur-1);
}
input[type="radio"]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--on-ink);
  transform: scale(0);
  transition: transform var(--dur-2) var(--ease-out);
}
input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--text-muted);
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}
input[type="checkbox"]:checked::before {
  transform: scale(1);
  opacity: 1;
}
input[type="radio"]:checked::before {
  transform: scale(1);
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-control);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
}
input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--ink);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-control);
  box-shadow: var(--shadow-sm);
}
input[type="range"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

input[type="file"] {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 100%;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--dur-2);
}
input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--surface) 92%, var(--text));
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  color: var(--text-2);
}

/* --- Badges, pastilles, étiquettes ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-sunken);
  color: var(--text-2);
  font-size: 12px;
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge .icon {
  width: 13px;
  height: 13px;
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-info {
  background: var(--info-soft);
  color: var(--info);
}
.badge-ai {
  background: var(--ai-soft);
  color: var(--ai);
  border-color: var(--ai-border);
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.badge-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}

/* Statut d'une candidature : point de couleur et libellé (la couleur n'est jamais seule). */
.status {
  --dot: var(--st-apply);
  background: var(--st-apply-soft);
  color: var(--st-apply-text);
  border-radius: var(--radius-full);
  padding: 0 9px 0 8px;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--dot) 22%, transparent);
}
.status-sent {
  --dot: var(--st-sent);
  background: var(--st-sent-soft);
  color: var(--st-sent-text);
}
.status-followup {
  --dot: var(--st-followup);
  background: var(--st-followup-soft);
  color: var(--st-followup-text);
}
.status-interview_scheduled {
  --dot: var(--st-interview_scheduled);
  background: var(--st-interview_scheduled-soft);
  color: var(--st-interview_scheduled-text);
}
.status-interview_done {
  --dot: var(--st-interview_done);
  background: var(--st-interview_done-soft);
  color: var(--st-interview_done-text);
}
.status-waiting {
  --dot: var(--st-waiting);
  background: var(--st-waiting-soft);
  color: var(--st-waiting-text);
}
.status-accepted {
  --dot: var(--st-accepted);
  background: var(--st-accepted-soft);
  color: var(--st-accepted-text);
}
.status-rejected {
  --dot: var(--st-rejected);
  background: var(--st-rejected-soft);
  color: var(--st-rejected-text);
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--text-subtle));
}

/* Priorité : drapeau et libellé */
.priority {
  background: transparent;
  border-color: var(--border);
  padding: 0 8px 0 6px;
}
.priority-urgent {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.priority-high {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}
.priority-normal {
  color: var(--text-2);
}
.priority-low {
  color: var(--text-muted);
  border-style: dashed;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.tag::before {
  content: "#";
  color: var(--text-subtle);
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Puces (compétences, mots-clés) -------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  line-height: 1.3;
  transition:
    background-color var(--dur-2),
    border-color var(--dur-2),
    color var(--dur-2);
}
label.chip {
  cursor: pointer;
  color: var(--text);
}
label.chip:hover {
  border-color: var(--text-muted);
}
label.chip:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}
label.chip:has(input:checked) input {
  border-color: var(--on-ink);
  background: var(--on-ink);
}
label.chip:has(input:checked) input::before {
  background: var(--ink);
}
label.chip:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
label.chip input {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.chip.matched {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}
.chip.missing {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}
.chip button,
.chip .chip-action {
  all: unset;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: -5px;
  border-radius: 50%;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  transition:
    background-color var(--dur-2),
    opacity var(--dur-2);
}
.chip button:hover {
  background: var(--fill-active);
  opacity: 1;
}
.chip button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  opacity: 1;
}
.chip button .icon {
  width: 12px;
  height: 12px;
}

/* --- Cartes -------------------------------------------------------------------------------- */

.card {
  position: relative;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card > h2,
.card > h3,
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 14.5px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.card > h2 .icon,
.card > h3 .icon,
.card-title .icon {
  color: var(--text-muted);
}
.card .card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head > h2,
.card-head > h3 {
  margin: 0;
  font-size: 14.5px;
}
.card-desc {
  margin: -6px 0 14px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Tableaux ------------------------------------------------------------------------------ */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
th,
td {
  text-align: left;
  vertical-align: middle;
}
th {
  height: 38px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background-color var(--dur-1) var(--ease-standard);
}
tbody tr:hover {
  background: var(--fill-hover);
}
tbody tr.clickable {
  cursor: pointer;
}
tbody tr.clickable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
th button {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--dur-2);
}
th button:hover {
  color: var(--text);
}
th button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
th button .icon {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}
th[aria-sort] button {
  color: var(--text);
}
th[aria-sort] button .icon {
  opacity: 1;
}

/* --- Listes -------------------------------------------------------------------------------- */

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.list-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition:
    border-color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard);
}
.list-item:hover {
  border-color: var(--border-strong);
}
/* Le contenu occupe la place et passe sur plusieurs lignes ; les actions (rangée finale) gardent
   leur largeur et passent dessous sur un écran étroit. */
.list-item > :first-child {
  flex: 1 1 220px;
  min-width: 0;
}
.list-item > .row:not(:first-child) {
  flex: none;
}
.list-item.overdue {
  border-color: var(--danger-border);
  box-shadow: inset 3px 0 0 var(--danger-solid);
}
@media (max-width: 600px) {
  .list-item {
    flex-wrap: wrap;
  }
}

/* --- Jauges --------------------------------------------------------------------------------- */

.meter {
  position: relative;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width var(--dur-5) var(--ease-out);
}
.meter.warn > span {
  background: var(--warning-solid);
}
.meter.full > span {
  background: var(--danger-solid);
}
.meter.accent > span {
  background: var(--accent);
}

.gauge {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.gauge svg {
  display: block;
  transform: rotate(-90deg);
}
.gauge .gauge-track {
  stroke: var(--surface-sunken);
}
.gauge .gauge-value {
  stroke: var(--ink);
  transition: stroke-dashoffset var(--dur-5) var(--ease-out);
}
.gauge.accent .gauge-value {
  stroke: var(--accent);
}
.gauge.success .gauge-value {
  stroke: var(--success-solid);
}
.gauge-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* --- États vides --------------------------------------------------------------------------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty p {
  max-width: 46ch;
  font-size: var(--text-sm);
  line-height: 1.55;
}
.empty-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  color: var(--text-muted);
  background:
    radial-gradient(circle, var(--surface) 0 40%, transparent 41%),
    repeating-radial-gradient(circle, var(--border) 0 1px, transparent 1px 9px);
}
.empty-art .icon {
  width: 20px;
  height: 20px;
}

/* --- Fenêtres modales ----------------------------------------------------------------------- */

dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(88vh, 920px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in var(--dur-3) var(--ease-out);
}
dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
dialog[open]::backdrop {
  animation: fade-in var(--dur-3) var(--ease-out);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 16px 22px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}
.dialog-body {
  flex: 1;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}
.dialog-foot .btn-danger {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
  color: var(--on-color);
}
.dialog-foot .btn-danger:hover {
  background: color-mix(in srgb, var(--danger-strong) 88%, #000);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Notifications ------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  display: grid;
  gap: 8px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  line-height: 1.45;
  cursor: pointer;
  animation: toast-in var(--dur-4) var(--ease-out);
}
.toast .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--toast-info);
}
.toast.success .icon {
  color: var(--toast-ok);
}
.toast.error .icon {
  color: var(--toast-err);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Avatars --------------------------------------------------------------------------------- */

.avatar {
  --h: 40;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  color: oklch(0.4 0.09 var(--h));
  background: oklch(0.95 0.03 var(--h));
  border: 1px solid oklch(0.89 0.04 var(--h));
  user-select: none;
}
.avatar.round {
  border-radius: 50%;
}
.avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 10.5px;
}
.avatar-lg {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar {
    color: oklch(0.88 0.07 var(--h));
    background: oklch(0.3 0.05 var(--h));
    border-color: oklch(0.37 0.05 var(--h));
  }
}
:root[data-theme="dark"] .avatar {
  color: oklch(0.88 0.07 var(--h));
  background: oklch(0.3 0.05 var(--h));
  border-color: oklch(0.37 0.05 var(--h));
}

/* --- Contrôle segmenté ---------------------------------------------------------------------- */

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}
.segmented > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition:
    background-color var(--dur-2),
    color var(--dur-2),
    box-shadow var(--dur-2);
}
.segmented > button:hover {
  color: var(--text);
}
.segmented > button[aria-pressed="true"],
.segmented > button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--border);
}
.segmented > button .icon {
  width: 15px;
  height: 15px;
}

/* --- Indicateurs de chargement -------------------------------------------------------------- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Divers --------------------------------------------------------------------------------- */

details > summary {
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker {
  display: none;
}
.summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--weight-medium);
}
.summary::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--chevron-right-mask, var(--check-mask)) center / 14px no-repeat;
  mask: var(--chevron-right-mask, var(--check-mask)) center / 14px no-repeat;
  transition: transform var(--dur-2) var(--ease-standard);
}
details[open] > .summary::before {
  transform: rotate(90deg);
}
:root {
  --chevron-right-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}
