/* ============================================
   OPERIA v2 — Composants UI
   ============================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  letter-spacing: -0.01em;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease),
              background var(--t-base) var(--ease), color var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-brand);
  color: white;
  box-shadow: var(--sh-brand);
}
.btn-primary:hover { box-shadow: 0 16px 40px rgba(15, 23, 42, 0.38); }

.btn-secondary {
  background: var(--white);
  color: var(--ink-800);
  border-color: var(--ink-200);
  box-shadow: var(--sh-xs);
}
.btn-secondary:hover { border-color: var(--violet-300); color: var(--primary); }

.btn-ghost {
  background: transparent;
  color: var(--ink-700);
}
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #DC2626; }

.btn-soft {
  background: var(--violet-50);
  color: var(--violet-700);
}
.btn-soft:hover { background: var(--violet-100); }

.btn-sm { height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-xs); }
.btn-lg { height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-icon.btn-lg { width: 52px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-group label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}
.form-hint { font-size: var(--fs-xs); color: var(--ink-500); }
.form-error { font-size: var(--fs-xs); color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--ink-900);
  border: 1px solid var(--ink-200);
  font-size: var(--fs-sm);
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--sh-ring);
}
.textarea { height: auto; min-height: 120px; padding: var(--sp-3) var(--sp-4); line-height: 1.5; resize: vertical; }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .input { padding-left: 44px; }
.input-group-icon {
  position: absolute;
  left: var(--sp-4);
  color: var(--ink-400);
  pointer-events: none;
}

.checkbox, .radio {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  border: 2px solid var(--ink-300);
  background: white;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.radio { border-radius: 50%; }
.checkbox:checked, .radio:checked {
  border-color: var(--primary);
  background: var(--grad-brand);
}
.checkbox:checked::after {
  content: '';
  width: 6px; height: 10px;
  border: 2px solid white;
  border-top: 0; border-left: 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.radio:checked::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: white;
}

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border-radius: var(--r-xl);
  border: 1px solid var(--ink-100);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.card-header h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.card-body { padding: var(--sp-6); }
.card-body.tight { padding: var(--sp-4); }
.card-body.compact { padding: var(--sp-2); }
.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--ink-100);
  background: var(--ink-50);
}

.card-soft {
  background: var(--grad-brand-soft);
  border: 1px solid var(--violet-100);
}

/* ---------- KPI cards ---------- */
.kpi {
  position: relative;
  padding: var(--sp-6);
  border-radius: var(--r-xl);
  background: var(--white);
  border: 1px solid var(--ink-100);
  box-shadow: var(--sh-xs);
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: var(--fw-semibold);
}
.kpi-value {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  color: var(--ink-900);
  margin-top: var(--sp-2);
  line-height: 1;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  margin-top: var(--sp-3);
}
.kpi-trend.up { background: var(--success-soft); color: #047857; }
.kpi-trend.down { background: var(--danger-soft); color: #B91C1C; }
.kpi-trend.neutral { background: var(--ink-100); color: var(--ink-600); }

.kpi-icon {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--grad-brand-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.kpi.accent-blue .kpi-icon { background: var(--blue-50); color: var(--blue-600); }
.kpi.accent-green .kpi-icon { background: var(--success-soft); color: #047857; }
.kpi.accent-amber .kpi-icon { background: var(--warning-soft); color: #B45309; }
.kpi.accent-red .kpi-icon { background: var(--danger-soft); color: #B91C1C; }
.kpi.accent-cyan .kpi-icon { background: var(--info-soft); color: #0E7490; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-primary { background: var(--violet-50); color: var(--violet-700); }
.badge-blue { background: var(--blue-50); color: var(--blue-700); }
.badge-green { background: var(--success-soft); color: #047857; }
.badge-amber { background: var(--warning-soft); color: #B45309; }
.badge-red { background: var(--danger-soft); color: #B91C1C; }
.badge-gray { background: var(--ink-100); color: var(--ink-700); }
.badge-cyan { background: var(--info-soft); color: #0E7490; }

.badge-lg { padding: 6px 14px; font-size: var(--fs-sm); }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: var(--fw-bold);
  color: white;
  font-size: var(--fs-sm);
  background: var(--grad-brand);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar-xl { width: 88px; height: 88px; font-size: var(--fs-2xl); }

.avatar-group { display: flex; }
.avatar-group .avatar {
  border: 2px solid var(--white);
  margin-left: -10px;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--ink-100);
  background: white;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-5);
  background: var(--ink-50);
  color: var(--ink-500);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ink-100);
  white-space: nowrap;
}
.table td {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-800);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover { background: var(--ink-50); }
.table tbody tr.clickable { cursor: pointer; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

/* ---------- Reference badge (CLI-/CON-/COL- identifiers) ---------- */
.ref-badge {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 2px 6px;
  background: var(--ink-100);
  color: var(--ink-700);
  border-radius: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--ink-100);
  border-radius: var(--r-lg);
  gap: 2px;
}
.segmented button {
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink-600);
  transition: all var(--t-base);
}
.segmented button.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--sh-sm);
}
.segmented button:hover:not(.active) { color: var(--ink-800); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--ink-100);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs button {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--t-base);
}
.tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tabs button:hover:not(.active) { color: var(--ink-800); }

/* ---------- Modal / Drawer ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 26, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fade 220ms var(--ease);
}
.modal {
  background: white;
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 2rem);
  box-shadow: var(--sh-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 260ms var(--ease);
}
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1200px; }

.modal-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
}
.modal-header h3 { font-size: var(--fs-xl); }
.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1 1 auto;
}
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--ink-100);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: var(--ink-50);
}

/* Easing iOS-style — démarrage doux, vitesse soutenue, fin caressée.
   Beaucoup plus naturel que le cubic-bezier par défaut pour les panneaux. */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 26, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-drawer);
  animation: fadeIn 320ms cubic-bezier(.32, .72, 0, 1);
  transition: opacity 220ms cubic-bezier(.32, .72, 0, 1);
  will-change: opacity;
}
.drawer-backdrop.is-closing { animation: none; opacity: 0; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  /* Drawer plus large par défaut pour voir toutes les rubriques sans
     troncature des onglets (ex: Équipe/Signalements/Rapports/Avenants/
     Documents/Photos/Historique sur un contrat). */
  max-width: min(1280px, 80vw);
  background: white;
  box-shadow: -24px 0 48px -12px rgba(15, 23, 42, 0.18), -1px 0 0 rgba(15, 23, 42, 0.04);
  z-index: calc(var(--z-drawer) + 1);
  animation: drawerIn 360ms cubic-bezier(.32, .72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 280ms cubic-bezier(.36, 0, .66, -0.56), opacity 200ms ease-out;
  will-change: transform;
}
.drawer.is-closing {
  transform: translateX(100%);
  /* Léger fade pendant le slide pour adoucir la sortie */
  opacity: 0.85;
  animation: none;
}
@keyframes drawerIn {
  0% { transform: translateX(100%); opacity: 0.6; }
  60% { opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* Tighter on small desktops & tablets, full width on phones */
@media (max-width: 1280px) {
  .drawer { max-width: min(1080px, 88vw); }
}
@media (max-width: 1024px) {
  .drawer { max-width: min(920px, 94vw); }
}
@media (max-width: 768px) {
  .drawer { max-width: 100%; }
}

/* Modales : taille 'xl' élargie de la même manière — les wizards
   client/contrat affichent un stepper à gauche qui prend 220px ; on
   a besoin de suffisamment de place à droite pour le contenu. */
.modal-xl { max-width: min(1400px, 92vw) !important; }

/* Onglets responsive : conteneur scrollable horizontalement si trop
   large, avec indicateur visuel de scroll (ombre à droite). Sur
   mobile, UI.makeResponsiveTabs() remplace à la volée le conteneur
   par un <select> (voir ui.js). Ce CSS sert de fallback. */
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 2px; }

/* Select qui remplace les onglets sur mobile — visuellement aligné
   sur .select mais avec une icône chevron custom. */
.tabs-select-mobile {
  display: none;
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: white;
  font-size: var(--fs-sm);
  color: var(--ink-800);
  font-weight: 600;
}
@media (max-width: 768px) {
  .tabs-select-mobile.is-active { display: block; }
  .tabs.is-hidden-mobile { display: none !important; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1); } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}
.toast {
  background: white;
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--sh-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 280px;
  max-width: 420px;
  border-left: 4px solid var(--primary);
  pointer-events: auto;
  animation: slideIn 220ms var(--ease);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.toast-msg { font-size: var(--fs-xs); color: var(--ink-500); }

/* ---------- Draft warning icon + popover ---------- */
/* Petit bouton orange sur la carte contrat qui signale des champs
   manquants. Clic → popover positionnée en body (cf. contracts.js). */
.draft-warn-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning, #b45309);
  cursor: pointer;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
  padding: 0;
  font-size: 12px;
}
.draft-warn-btn:hover { background: rgba(245, 158, 11, 0.22); transform: scale(1.08); }
.draft-warn-btn .draft-warn-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--warning, #b45309);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draft-reasons-popover {
  position: fixed;
  z-index: calc(var(--z-modal) + 20);
  min-width: 280px;
  max-width: 360px;
  background: white;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  border: 1px solid var(--ink-200);
  overflow: hidden;
  animation: pop 180ms var(--ease);
}

/* Focus mode : on floute tout sauf la carte concernée.
   Le backdrop est en position fixed, la carte .is-draft-focused remonte
   au-dessus via z-index + position:relative.
   Les cartes sous le backdrop restent visibles mais atténuées. */
.draft-focus-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 26, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: calc(var(--z-modal) + 5);
  animation: fade 180ms var(--ease);
}

.item-card.is-draft-focused,
.contract-card.is-draft-focused {
  position: relative;
  z-index: calc(var(--z-modal) + 10);
  outline: 3px solid var(--warning, #b45309);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.18), var(--sh-xl);
  transform: scale(1.015);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  color: var(--ink-500);
}
.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--r-2xl);
  background: var(--grad-brand-soft);
  color: var(--primary);
  margin: 0 auto var(--sp-4);
  display: grid;
  place-items: center;
  font-size: 32px;
}
.empty h4 { color: var(--ink-900); margin-bottom: var(--sp-2); }

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 0%, var(--ink-50) 50%, var(--ink-100) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Dropdown ---------- */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-100);
  box-shadow: var(--sh-lg);
  padding: var(--sp-2);
  min-width: 220px;
  z-index: var(--z-drawer);
  animation: pop 180ms var(--ease);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--ink-700);
  cursor: pointer;
  transition: background var(--t-fast);
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--ink-50); color: var(--ink-900); }

/* Profile menu (topbar) — version épurée du dropdown */
.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-100);
  box-shadow: var(--sh-lg);
  min-width: 240px;
  z-index: var(--z-drawer, 100);
  animation: pop 180ms var(--ease);
  overflow: hidden;
}
.profile-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-100);
  background: var(--ink-50);
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  font-size: 13.5px;
  color: var(--ink-700);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast, 0.12s);
}
.profile-menu-item:hover { background: var(--ink-50); color: var(--ink-900); }
.profile-menu-item i { width: 18px; text-align: center; color: var(--ink-400); }
.profile-menu-item:hover i { color: var(--ink-700); }
.profile-menu-danger { color: #dc2626; }
.profile-menu-danger i { color: #dc2626; }
.profile-menu-danger:hover { background: #fef2f2; color: #b91c1c; }
.profile-menu-sep { border: none; border-top: 1px solid var(--ink-100); margin: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-divider { height: 1px; background: var(--ink-100); margin: var(--sp-2) 0; }

/* ---------- Progress ---------- */
.progress {
  height: 8px;
  background: var(--ink-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width 500ms var(--ease);
}

/* ---------- Switch ---------- */
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--ink-200);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-base);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--sh-sm);
  transition: transform var(--t-base) var(--ease);
}
.switch.on { background: var(--grad-brand); }
.switch.on::after { transform: translateX(18px); }

/* ── Combobox recherchable (UI.searchSelect) ──────────────────────────
   Remplace un <select> par un champ où l'on peut écrire pour filtrer.
   Le <select> natif reste dans le DOM (masqué) et garde la valeur. */
.ss-wrap { position: relative; display: inline-block; width: 100%; }
.ss-native { display: none !important; }
.ss-field {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--ink-200, #D6DBE5); border-radius: 10px;
  background: #fff; padding: 0 10px; height: 38px; cursor: text;
  transition: border-color .12s, box-shadow .12s;
}
.ss-field:focus-within,
.ss-wrap.is-open .ss-field { border-color: var(--primary, #4F46E5); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.ss-ico { font-size: 12px; color: var(--ink-400, #94A3B8); flex-shrink: 0; }
.ss-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 13px; color: var(--ink-900, #0F172A); padding: 0;
}
.ss-input::placeholder { color: var(--ink-400, #94A3B8); }
.ss-chev { font-size: 11px; color: var(--ink-400, #94A3B8); flex-shrink: 0; transition: transform .15s; }
.ss-wrap.is-open .ss-chev { transform: rotate(180deg); }
.ss-list {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto; background: #fff;
  border: 1px solid var(--ink-150, #E7EAF0); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .14); padding: 5px;
}
.ss-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--ink-800, #1E293B);
}
.ss-opt:hover, .ss-opt.is-active { background: var(--ink-50, #F7F8FA); }
.ss-opt.is-sel { color: var(--primary, #4F46E5); font-weight: 600; }
.ss-opt.is-sel i { font-size: 11px; }
.ss-empty { padding: 16px 12px; text-align: center; font-size: 13px; color: var(--ink-400, #94A3B8); }
