/* ============================================================
   Composants du design system — boutons pilule, cartes,
   pastilles de statut, formulaires, tables, modals, dropdowns,
   toasts. Compatibles avec le JS Bootstrap (modal/dropdown/
   collapse) mais 100% stylés DS.
   ============================================================ */

/* ===== BOUTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  color: var(--text-primary);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  padding: 11px 18px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
  background: transparent;
}
.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.btn .lucide { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover, .btn-primary:focus { background: var(--accent-hover); color: #fff; }

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-light,
.btn-outline-dark {
  background: #fff;
  color: var(--text-primary);
  border-color: var(--gray-200);
}
.btn-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-light:hover,
.btn-outline-dark:hover {
  border-color: var(--gray-300);
  color: var(--text-primary);
  background: #fff;
}
.btn-outline-primary { color: var(--accent); border-color: #D6D8FC; }
.btn-outline-primary:hover { color: var(--accent-hover); border-color: var(--accent); background: #fff; }

.btn-ghost, .btn-link {
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
}
.btn-ghost:hover, .btn-link:hover { color: var(--text-primary); background: var(--gray-100); }

.btn-danger, .btn-outline-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-fg);
}
.btn-danger:hover, .btn-outline-danger:hover {
  background: #FBDDD9;
  color: var(--status-danger-fg);
}

.btn-success {
  background: var(--status-success-bg);
  color: var(--status-success-fg);
}
.btn-success:hover { background: #D3F0E0; color: var(--status-success-fg); }

.btn-sm {
  padding: 8px 14px;
  font-size: var(--text-sm);
}
.btn-sm .lucide { width: 13px; height: 13px; }
.btn-lg {
  padding: 13px 22px;
  font-size: var(--text-md);
}

/* Bouton d'ajout en pointillés (pattern DS « + ajouter ») */
.btn-dashed {
  border: 1.5px dashed #C9CCEC;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}
.btn-dashed:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* ===== PASTILLES (badges de statut) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  color: var(--status-neutral-fg);
  background: var(--status-neutral-bg);
}
.badge.bg-danger, .badge.text-bg-danger { background: var(--status-danger-fg) !important; color: #fff; }
.badge.bg-success, .badge.text-bg-success { background: var(--status-success-fg) !important; color: #fff; }
.badge.bg-primary, .badge.text-bg-primary { background: var(--accent) !important; color: #fff; }

/* Tons DS explicites */
.badge--success { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge--warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.badge--danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.badge--info { background: var(--status-info-bg); color: var(--status-info-fg); }
.badge--violet { background: var(--status-violet-bg); color: var(--status-violet-fg); }
.badge--neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.badge--accent { background: var(--brand-indigo-tint); color: var(--accent); }

/* ===== ALERTES ===== */
.alert {
  border: none;
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
  background: var(--status-neutral-bg);
  color: var(--status-neutral-fg);
  position: relative;
}
.alert-success { background: var(--status-success-bg); color: var(--status-success-fg); }
.alert-warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.alert-danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.alert-info { background: var(--status-info-bg); color: var(--status-info-fg); }
.alert .alert-link { color: inherit; font-weight: var(--weight-semibold); text-decoration: underline; }
.alert-dismissible { padding-right: 44px; }
.alert-dismissible .btn-close { position: absolute; top: 12px; right: 12px; }

/* ===== CARTES ===== */
.ds-card {
  background: var(--surface-card);
  border: 1px solid var(--gray-150);
  border-radius: 24px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.ds-card--flat { box-shadow: none; }
.ds-card--flush { padding: 0; overflow: hidden; }
.ds-card--sunken {
  background: var(--surface-sunken);
  border-color: #ECEEF2;
  box-shadow: none;
}
.ds-card--cta {
  background: var(--accent);
  border: none;
  color: #fff;
  box-shadow: 0 14px 30px -18px rgba(86, 93, 246, 0.5);
}

/* En-tête interne d'une carte liste */
.ds-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 22px 14px;
}
.ds-card__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.ds-card__meta {
  font-size: var(--text-sm);
  color: var(--gray-500);
}
/* Mode d'emploi sous un titre de carte : le ciblage l'employait depuis les
   documents à signer sans qu'aucune règle n'existe, et la phrase sortait à la
   taille et à la couleur du corps de texte. La carte porte déjà son retrait
   horizontal — ce bloc ne s'occupe que du vertical, pour rapprocher l'aide de
   son titre. */
.ds-card__hint {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin: 0 0 var(--space-3);
}

/* Ligne de liste dans une carte flush */
.ds-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  border-top: 1px solid #F4F5F9;
}
a.ds-row { color: inherit; }
.ds-row--hover { cursor: pointer; transition: background 0.16s ease; }
.ds-row--hover:hover { background: #FAFAFC; color: inherit; }
.ds-row__body { flex: 1; min-width: 0; }
.ds-row__title { font-size: var(--text-base); font-weight: var(--weight-medium); }
.ds-row__hint { font-size: var(--text-sm); color: var(--gray-500); margin-top: 2px; }
/* Conséquences d'une action irréversible, listées avant de la déclencher. */
.ds-checklist { list-style: none; margin: 0; padding: 0; }
.ds-checklist li {
  position: relative;
  padding-left: 22px;
  font-size: var(--text-sm);
  color: var(--gray-600);
  margin-bottom: 6px;
}
.ds-checklist li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Ligne présente mais non sélectionnable : elle reste lisible, pour qu'on
   voie le motif de son exclusion et qu'on puisse le corriger. */
.ds-row.is-disabled { background: #FBFBFD; }
.ds-row.is-disabled .ds-row__title { color: var(--gray-500); }

/* Vignette d'icône teintée */
.ds-chip {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-indigo-tint);
  color: var(--accent);
}
.ds-chip .lucide { width: 16px; height: 16px; }
.ds-chip--success { background: var(--status-success-bg); color: var(--status-success-fg); }
.ds-chip--warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.ds-chip--danger { background: var(--status-danger-bg); color: var(--status-danger-fg); }
.ds-chip--violet { background: var(--status-violet-bg); color: var(--status-violet-fg); }
.ds-chip--neutral { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }

/* Carte statistique */
.stat-card__label {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 10px;
}
.stat-card__figure {
  font-size: 34px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}
.stat-card__unit { font-size: var(--text-base); color: var(--text-secondary); }
.stat-card__hint { font-size: 12px; color: var(--gray-500); margin-top: 9px; }

/* État vide */
.ds-empty {
  background: var(--surface-sunken);
  border: 1px solid #ECEEF2;
  border-radius: 24px;
  padding: 44px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.ds-empty .lucide { width: 34px; height: 34px; color: var(--gray-300); margin-bottom: 12px; }
.ds-empty__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); }
.ds-empty__hint { font-size: var(--text-sm); color: var(--gray-500); margin-top: 4px; }

/* Avatar à initiales */
.ds-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-indigo-tint);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  overflow: hidden;
}
.ds-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ds-avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.ds-avatar--sm { width: 26px; height: 26px; font-size: 10px; }
.ds-avatar--success { background: var(--status-success-bg); color: var(--status-success-fg); }
.ds-avatar--warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.ds-avatar--violet { background: var(--status-violet-bg); color: var(--status-violet-fg); }

/* ===== BARRES DE PROGRESSION ===== */
.progress {
  height: 6px;
  border-radius: 4px;
  background: #EDEEF8;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress-bar--success { background: #2AA870; }
.progress-bar--muted { background: #D3D7DE; }

/* ===== FORMULAIRES ===== */
.form-label {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control, .form-select {
  display: block;
  width: 100%;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  appearance: none;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--brand-indigo-tint);
}
.form-control:disabled, .form-select:disabled {
  background: var(--gray-50);
  color: var(--text-muted);
}
textarea.form-control {
  border-radius: var(--radius-lg);
  min-height: 88px;
  line-height: var(--leading-relaxed);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.form-select-sm, .form-control-sm { padding: 7px 10px; font-size: var(--text-sm); }
.form-control-plaintext {
  display: block;
  width: 100%;
  padding: 9px 0;
  color: var(--text-secondary);
  background: transparent;
  border: none;
}
.form-text { font-size: var(--text-sm); color: var(--gray-500); }

/* État d'erreur d'un champ. Le message remplace la bulle native du navigateur
   (voir le contrôleur Stimulus form-validation) : il vit dans le flux, aux
   couleurs du DS, et fonctionne aussi pour les groupes de choix dont l'input
   réel est masqué (cartes, segments). */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--status-danger-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-danger-fg) 14%, transparent);
}
.invalid-feedback {
  display: none;
  font-size: var(--text-sm);
  color: var(--status-danger-fg);
  margin-top: 6px;
}
.invalid-feedback.is-shown {
  display: flex;
  align-items: center;
  gap: 6px;
}
.invalid-feedback.is-shown::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--status-danger-fg);
  /* Point d'exclamation détouré dans la pastille — pas d'icône à charger. */
  mask: radial-gradient(circle at 50% 78%, #000 0 1.2px, transparent 1.3px),
        linear-gradient(#000 0 0) 50% 28% / 1.8px 6px no-repeat;
  mask-composite: exclude;
  -webkit-mask: radial-gradient(circle at 50% 78%, #000 0 1.2px, transparent 1.3px),
                linear-gradient(#000 0 0) 50% 28% / 1.8px 6px no-repeat;
  -webkit-mask-composite: xor;
}

/* Groupe de choix en erreur : on souligne le conteneur, l'input étant masqué. */
[data-validation-group].is-invalid .abs-seg,
[data-validation-group].is-invalid .abs-types .abs-type {
  border-color: var(--status-danger-fg);
}
[data-validation-group].is-invalid .abs-seg {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-danger-fg) 14%, transparent);
}

/* Cases et radios */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 20px;
  padding-left: 0;
  margin-bottom: 6px;
}
.form-check-inline { display: inline-flex; margin-right: 14px; }
.form-check-input {
  appearance: none;
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 2px;
  border: 1.5px solid var(--gray-300);
  border-radius: 5px;
  background: #fff;
  transition: border 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 11px;
  background-position: center;
  background-repeat: no-repeat;
}
.form-check-input[type="radio"]:checked {
  background-image: none;
  border-width: 5.5px;
  background-color: #fff;
}
.form-check-input:focus-visible { outline: 2px solid var(--brand-indigo-tint); outline-offset: 1px; }
.form-check-label { font-size: var(--text-base); color: var(--text-primary); cursor: pointer; }

/* Interrupteur (pattern DS toggle) */
.form-switch { padding-left: 0; }
.form-switch .form-check-input {
  width: 36px;
  height: 21px;
  border-radius: var(--radius-full);
  background: var(--gray-300);
  border: none;
  position: relative;
  transition: background 0.18s ease;
}
.form-switch .form-check-input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.18s ease;
}
.form-switch .form-check-input:checked {
  background: var(--accent);
  background-image: none;
}
.form-switch .form-check-input:checked::after { left: 17px; }

/* ===== TABLES ===== */
.table {
  width: 100%;
  font-size: var(--text-base);
  color: var(--text-primary);
  border-color: #F4F5F9;
  margin-bottom: 0;
}
.table thead th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--gray-150);
  padding: 12px 14px;
  background: transparent;
}
.table tbody td {
  padding: 13px 14px;
  border-top: 1px solid #F4F5F9;
  vertical-align: middle;
}
.table tbody tr:first-child td { border-top: none; }
.table-hover tbody tr { transition: background 0.14s ease; }
.table-hover tbody tr:hover { background: #FAFAFC; }
.table-sm thead th { padding: 9px 11px; }
.table-sm tbody td { padding: 9px 11px; }
.table-bordered th, .table-bordered td { border: 1px solid var(--gray-150); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Carte enveloppant une table */
.ds-table-card {
  background: var(--surface-card);
  border: 1px solid var(--gray-150);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.ds-table-card .table thead th { padding: 15px 22px 11px; }
.ds-table-card .table tbody td { padding: 13px 22px; }
.ds-table-card .table tfoot td { padding: 13px 22px; }

/* ===== MODALS (compatibles JS Bootstrap) ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}
.modal-dialog {
  position: relative;
  width: auto;
  max-width: 520px;
  margin: 8vh auto;
  padding: 0 16px;
  pointer-events: none;
}
.modal.fade .modal-dialog {
  transform: translateY(8px);
  transition: transform 0.2s ease;
}
.modal.show .modal-dialog { transform: none; }
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #fff;
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 70px -24px rgba(16, 24, 40, 0.55);
  pointer-events: auto;
  outline: 0;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-150);
}
.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.modal-body { padding: 18px 22px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--gray-150);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(24, 26, 34, 0.34);
}
.modal-backdrop.fade { opacity: 0; transition: opacity 0.15s linear; }
.modal-backdrop.show { opacity: 1; }
.modal.fade { opacity: 0; transition: opacity 0.15s linear; }
.modal.show { opacity: 1; }
.modal-lg { max-width: 720px; }

.btn-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center/14px no-repeat;
  cursor: pointer;
  transition: background-color 0.15s ease;
  padding: 0;
}
.btn-close:hover { background-color: var(--gray-100); }

/* ===== DROPDOWNS (compatibles JS Bootstrap) ===== */
.dropdown, .dropup { position: relative; }
.dropdown-toggle::after { display: none; }
.dropdown-menu {
  position: absolute;
  z-index: 1060;
  display: none;
  min-width: 200px;
  padding: 6px;
  margin: 0;
  font-size: var(--text-base);
  background: #fff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel-strong);
  list-style: none;
}
.dropdown-menu.show { display: block; }
.dropdown-menu-end { right: 0; left: auto; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-100); color: var(--text-primary); }
.dropdown-item .lucide { width: 15px; height: 15px; color: var(--gray-500); }
/* Drapeau du sélecteur de langue. Il occupe la place d'une icône Lucide pour
   que les libellés restent alignés, et porte un liseré : sans lui, les bandes
   blanches du drapeau français et du drapeau russe se perdraient dans le menu. */
.locale-flag {
  flex: none;
  width: 16px;
  height: 11px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%);
}
.locale-flag svg { display: block; width: 100%; height: 100%; }

/* La langue active : libellé appuyé, et la coche repoussée au bout de la ligne. */
.dropdown-item.is-current { font-weight: var(--weight-semibold); }
.dropdown-item__mark {
  margin-left: auto;
  color: var(--accent);
}
.dropdown-item .dropdown-item__mark { color: var(--accent); }

.dropdown-item-text {
  display: block;
  padding: 8px 11px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.dropdown-divider {
  height: 0;
  margin: 5px 6px;
  border-top: 1px solid var(--gray-150);
}

/* ===== COLLAPSE (compatible JS Bootstrap) ===== */
.collapse:not(.show) { display: none; }
.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.25s ease;
}

/* ===== NAV PILLS (filtres) ===== */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}
.nav-pills .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
  text-decoration: none;
}
.nav-pills .nav-link:hover { border-color: var(--gray-300); color: var(--text-primary); }
.nav-pills .nav-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: var(--weight-semibold);
  box-shadow: 0 6px 14px -6px rgba(86, 93, 246, 0.55);
}

/* ===== SEGMENTED CONTROL ===== */
.seg-control {
  display: inline-flex;
  gap: 3px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 3px;
}
.seg-control__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
  text-decoration: none;
}
.seg-control__item:hover { color: var(--text-primary); }
.seg-control__item.is-active {
  background: #fff;
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
  box-shadow: 0 2px 8px -2px rgba(16, 24, 40, 0.16);
}

/* Navigation secondaire de page : bascule entre les sections d'un même espace,
   posée sous le titre. Le composant segmenté reste inline — il sert aussi en
   barre d'outils — c'est donc ce conteneur qui porte le rythme vertical :
   il se cale près du titre et laisse respirer avant le contenu. */
.page-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: calc(var(--space-1) * -1);
  margin-bottom: var(--space-8);
}

/* ===== PAGINATION ===== */
.ds-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}
.ds-pager__btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 13px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border: 1px solid var(--gray-200);
  background: #fff;
  text-decoration: none;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.ds-pager__btn:hover { border-color: var(--gray-300); color: var(--text-primary); }
.ds-pager__btn.is-disabled { opacity: 0.45; pointer-events: none; }
.ds-pager__info {
  font-size: var(--text-sm);
  color: var(--gray-500);
  padding: 0 8px;
}

/* ===== TOASTS (flash) =====
   Bannière façon notification push iOS : rectangle arrondi sur le fond
   pâle de la sidebar (#FAFAFD + liseré), tombe du haut avec un léger
   rebond, se replie vers le haut. Auto-fermeture 4 s (toast_controller). */
.flash-container {
  position: fixed;
  top: 60px; /* hauteur de .app-header : les toasts naissent sous la barre */
  right: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  width: min(456px, 100vw);
  /* overflow masque le départ de l'animation : le toast semble glisser
     de dessous la barre de recherche (et s'y replier en partant) */
  overflow: hidden;
  padding: 12px 16px 30px 20px;
}

@keyframes toastDrop {
  0% { opacity: 0; transform: translateY(-115%) scale(0.97); }
  70% { opacity: 1; transform: translateY(4px) scale(1); }
  100% { opacity: 1; transform: none; }
}

.ds-toast {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: rgba(250, 250, 253, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel-soft), 0 0 0 1px rgba(15, 23, 42, 0.05);
  padding: 11px 13px;
  pointer-events: auto;
  animation: toastDrop 0.45s cubic-bezier(0.3, 1.25, 0.5, 1);
}

/* « Icône d'app » : carré arrondi blanc, symbole coloré selon la variante */
.ds-toast__app {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--status-info-fg);
}
.ds-toast__app .lucide { width: 15px; height: 15px; }
.ds-toast--success .ds-toast__app { color: var(--status-success-fg); }
.ds-toast--danger .ds-toast__app { color: var(--status-danger-fg); }
.ds-toast--warning .ds-toast__app { color: var(--status-warning-fg); }

.ds-toast__body { flex: 1; min-width: 0; }
.ds-toast__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.25;
}
.ds-toast__message {
  font-size: var(--text-sm);
  color: var(--gray-700);
  line-height: 1.35;
}

.ds-toast__close {
  border: none;
  background: transparent;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  padding: 4px;
  margin-right: -2px;
  border-radius: 50%;
  cursor: pointer;
  flex: none;
  transition: color 0.15s ease;
  align-self: flex-start;
}
.ds-toast__close:hover { color: var(--gray-700); }
.ds-toast__close .lucide { width: 13px; height: 13px; }

.ds-toast.is-leaving {
  opacity: 0;
  transform: translateY(-115%);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.4, 0, 0.7, 0.2);
}

/* ===== LIST GROUP (documents) ===== */
.list-group {
  display: flex;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}
.list-group-item {
  padding: 13px 0;
  border-top: 1px solid #F4F5F9;
  background: transparent;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: var(--text-primary);
}
.list-group-item:first-child { border-top: none; }
a.list-group-item { text-decoration: none; transition: background 0.14s ease; }
a.list-group-item:hover { background: #FAFAFC; }

/* ===== PASTILLES DE STATUT MÉTIER ===== */
/* Entretiens */
.badge-not_started { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.badge-in_progress { background: var(--brand-indigo-tint); color: var(--accent); }
.badge-submitted { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.badge-reviewed { background: var(--status-violet-bg); color: var(--status-violet-fg); }
.badge-validated { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge-signed { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge-ready-submit { background: var(--brand-indigo-tint); color: var(--accent); }
/* Campagnes */
.badge-campaign-draft { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }
.badge-campaign-active { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge-campaign-closed { background: var(--status-neutral-bg); color: var(--status-neutral-fg); }

/* ===== SEARCHABLE SELECT (combobox Stimulus) ===== */
.searchable-select { position: relative; }
.searchable-select__button--placeholder { color: var(--text-muted); }
/* position: fixed + coordonnées calculées en JS : le panneau échappe aux
   débordements des cartes. */
.searchable-select__panel {
  position: fixed;
  z-index: 2000;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel-strong);
}
.searchable-select__search { margin-bottom: 8px; }
.searchable-select__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}
.searchable-select__option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.searchable-select__option:hover,
.searchable-select__option.is-active {
  background: var(--brand-indigo-tint-2);
  color: var(--accent);
}
.searchable-select__option.is-selected {
  font-weight: var(--weight-semibold);
  color: var(--accent);
}
.searchable-select__empty { padding: 8px 12px; }


/* ============================================================
   Sélecteur de date du design system.

   Il habille un <input type="date"> natif, laissé dans le DOM : la soumission
   du formulaire, la validation et les reports de dates entre champs continuent
   de passer par lui. Il est seulement rendu invisible, jamais retiré — un
   champ en display:none sortirait du circuit de validation.
   ============================================================ */

.ds-date {
  position: relative;
  display: inline-block;
  min-width: 200px;
}
.ds-date__native {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
}
/* Le contrôle porte la bordure ; la saisie et le bouton calendrier vivent
   dedans. Deux entrées pour une même valeur : on tape la date quand on la
   connaît, on ouvre le calendrier quand on la cherche. */
.ds-date__control {
  display: flex;
  align-items: center;
  width: 100%;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ds-date__control:hover { border-color: var(--gray-300); }
.ds-date__text {
  flex: 1;
  min-width: 0;
  padding: 9px 0 9px 13px;
  border: 0;
  background: transparent;
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text-primary);
}
.ds-date__text:focus { outline: none; }
.ds-date__text::placeholder { color: var(--gray-400); }
.ds-date__text:disabled { color: var(--gray-400); cursor: not-allowed; }
.ds-date__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 9px 13px 9px 8px;
  border: 0;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
}
.ds-date__button:hover { color: var(--accent); }
.ds-date__button .lucide { width: 17px; height: 17px; }

/* Le focus se pose sur le contrôle entier, d'où qu'il vienne : le bouton, la
   saisie, ou le champ natif écrit par un contrôleur voisin. */
.ds-date__control:has(.ds-date__text:focus),
.ds-date:has(.ds-date__native:focus) .ds-date__control,
.ds-date__control:has(.ds-date__button:focus-visible) {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.ds-date:has(.ds-date__native.is-invalid) .ds-date__control,
.ds-date__control:has(.ds-date__text.is-invalid) {
  border-color: var(--status-danger-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-danger-fg) 14%, transparent);
}

.ds-date__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: 268px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 40px rgba(23, 27, 45, .16);
}
.ds-date__panel[hidden] { display: none !important; }
.ds-date__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ds-date__zoom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s ease;
}
.ds-date__zoom:hover { background: var(--gray-100); }
.ds-date__zoom .lucide { width: 14px; height: 14px; color: var(--gray-400); }
.ds-date__month {
  font-weight: var(--weight-semibold);
  text-transform: capitalize;
}
.ds-date__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
}
.ds-date__nav:hover { background: var(--gray-100); color: var(--text-primary); }
.ds-date__nav .lucide { width: 16px; height: 16px; }

.ds-date__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
/* Mois et années : quatre colonnes, des cases plus hautes — on y clique une
   fois, pas trente. */
.ds-date__grid[data-view="months"],
.ds-date__grid[data-view="years"] {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding-top: 2px;
}
.ds-date__cell {
  height: 38px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s ease;
}
.ds-date__cell:hover:not(:disabled) { background: var(--gray-100); }
.ds-date__cell.is-selected { background: var(--accent); color: #fff; font-weight: var(--weight-semibold); }
.ds-date__cell:disabled { color: var(--gray-300); cursor: not-allowed; }
.ds-date__dow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--gray-400);
}
.ds-date__day {
  height: 32px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
}
.ds-date__day:hover:not(:disabled) { background: var(--gray-100); }
.ds-date__day:disabled { color: var(--gray-300); cursor: default; }
.ds-date__day.is-today { font-weight: var(--weight-bold); color: var(--accent); }
.ds-date__day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: var(--weight-semibold);
}
.ds-date__day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.ds-date__foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-150);
  text-align: center;
}
.ds-date__today {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

/* Champ date désactivé : le déclencheur reflète l'état de l'input. */
.ds-date__button:disabled {
  background: var(--gray-50);
  color: var(--gray-400);
  cursor: default;
}


/* ===== RECHERCHE INSTANTANÉE D'UNE LISTE =====
   Partagée par toutes les listes de collaborateurs, en administration
   comme côté collaborateur : d'où le nom neutre. */
.list-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  margin-bottom: 16px;
}
.list-search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.list-search__input { padding-left: 40px; }
.list-search__count {
  flex: none;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.list-search__toggle {
  flex: none;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.list-search__toggle:hover { text-decoration: underline; }
