/* Vetossimo — composants : boutons, cartes, champs, badges, onglets, modales, toasts, timeline, tableaux. */

/* ───────────────────────── Boutons ───────────────────────── */
.btn {
  --btn-bg: transparent; --btn-fg: var(--text); --btn-border: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-4);
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-border); border-radius: var(--r-md);
  font-weight: 600; font-size: var(--text-md); line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; }

.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--primary-contrast); box-shadow: var(--shadow-1); }
.btn--primary:hover:not(:disabled) { --btn-bg: var(--primary-hover); }

.btn--secondary { --btn-bg: var(--surface-2); --btn-fg: var(--primary); --btn-border: var(--border); box-shadow: var(--shadow-1); }
.btn--secondary:hover:not(:disabled) { --btn-bg: var(--surface-tint); --btn-border: var(--primary); }

.btn--ghost { --btn-fg: var(--text-muted); }
.btn--ghost:hover:not(:disabled) { --btn-bg: var(--surface-sunken); --btn-fg: var(--text); }

/* Bouton doré : réservé au geste « Patte blanche » (QR). Icône et texte en vert 900 — 4,64:1 */
.btn--accent { --btn-bg: var(--accent); --btn-fg: var(--on-accent); box-shadow: var(--shadow-2); }
.btn--accent:hover:not(:disabled) { --btn-bg: var(--gold-400); }

.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn--danger-ghost { --btn-fg: var(--danger); --btn-border: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn--danger-ghost:hover:not(:disabled) { --btn-bg: var(--danger-bg); }

.btn--sm { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--text-lg); }
/* Action primaire du vétérinaire en consultation */
.btn--xl { min-height: 56px; padding: 0 var(--sp-6); font-size: var(--text-lg); border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--tap); min-width: var(--tap); }

.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ───────────────────────── Cartes ───────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: clip;
}
.card__header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card__heading { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.card__icon { color: var(--primary); flex: none; margin-top: 2px; }
.card__title { font-size: var(--text-lg); }
.card__subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.card__actions { display: flex; gap: var(--sp-2); flex: none; }
.card__content { padding: var(--sp-5); }
.card__content > * + * { margin-top: var(--sp-4); }
.card--flat { box-shadow: none; }
.card--tint { background: var(--surface-tint); }

/* ───────────────────────── Champs ───────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.field__required { color: var(--danger); }
.field__hint { font-size: var(--text-xs); color: var(--text-muted); }

.input {
  width: 100%; min-height: var(--tap);
  padding: var(--sp-3);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: var(--text-faint); }
.input:hover:not(:disabled) { border-color: var(--primary); }
.input:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); outline: none; }
.input:disabled { background: var(--surface-sunken); color: var(--text-muted); }
.input--textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.input--select { appearance: none; padding-right: var(--sp-8);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input--invalid { border-color: var(--danger); }
.input--valid { border-color: var(--success); }

.field--checkbox { flex-direction: row; align-items: flex-start; gap: var(--sp-3); cursor: pointer; padding: var(--sp-1) 0; }
.checkbox { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.field__checkbox-label { font-size: var(--text-sm); }

.radio-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.radio { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; min-height: var(--tap); }
.radio input { accent-color: var(--primary); width: 18px; height: 18px; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-md);
}
.segmented__item {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 38px; padding: 0 var(--sp-4); border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.segmented__item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented__item:has(input:checked) { background: var(--surface-2); color: var(--primary); box-shadow: var(--shadow-1); }
.segmented__item:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form__intro { font-size: var(--text-sm); color: var(--text-muted); }
.form__error { color: var(--danger); font-size: var(--text-sm); font-weight: 600; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); }
.form__section-title {
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-top: var(--sp-2);
}

/* ───────────────────────── Badges ───────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px var(--sp-2); border-radius: var(--r-pill);
  font-size: var(--text-xs); font-weight: 650; line-height: 1.4; white-space: nowrap;
  background: var(--surface-sunken); color: var(--text-muted);
}
.badge--neutral  { background: var(--surface-sunken); color: var(--text-muted); }
.badge--primary  { background: var(--green-100); color: var(--green-800); }
.badge--accent   { background: var(--accent-soft); color: var(--text-accent); }   /* or 100 + bronze : 5,27:1 */
.badge--success  { background: var(--success-bg); color: var(--success); }
.badge--warning  { background: var(--warning-bg); color: var(--warning); }
.badge--danger   { background: var(--danger-bg);  color: var(--danger); }
.badge--info     { background: var(--info-bg);    color: var(--info); }
.badge--outline  { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }

/* ───────────────────────── Bandeaux ───────────────────────── */
.notice {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4); border-radius: var(--r-md);
  background: var(--info-bg); color: var(--text);
  border-left: 3px solid var(--info);
  font-size: var(--text-sm);
}
.notice__icon { flex: none; margin-top: 1px; color: var(--info); }
.notice__body { flex: 1 1 auto; min-width: 0; }
.notice__title { font-weight: 650; margin-bottom: 2px; }
.notice--warning { background: var(--warning-bg); border-left-color: var(--warning-icon); }
.notice--warning .notice__icon { color: var(--warning-icon); }
.notice--danger  { background: var(--danger-bg);  border-left-color: var(--danger); }
.notice--danger .notice__icon { color: var(--danger); }
.notice--success { background: var(--success-bg); border-left-color: var(--success); }
.notice--success .notice__icon { color: var(--success); }
.notice--neutral { background: var(--surface-sunken); border-left-color: var(--border-strong); }
.notice--neutral .notice__icon { color: var(--text-muted); }

/* Mention légale discrète (« ne remplace pas le passeport européen ») */
.legal-note {
  font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5;
  padding: var(--sp-3); background: var(--surface-sunken); border-radius: var(--r-sm);
  border-left: 2px solid var(--gold-ui);
}

/* ───────────────────────── Onglets ───────────────────────── */
.tabs {
  display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); min-height: var(--tap);
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-weight: 600; font-size: var(--text-sm); white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs__badge {
  min-width: 20px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--surface-sunken); color: var(--text-muted);
  font-size: var(--text-xs); font-weight: 700; text-align: center;
}
.tabs__tab.is-active .tabs__badge { background: var(--green-100); color: var(--green-800); }

/* ───────────────────────── Modales ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: color-mix(in srgb, var(--green-900) 55%, transparent);
  backdrop-filter: blur(2px);
  animation: fade .16s ease-out;
}
.modal {
  display: flex; flex-direction: column;
  width: 100%; max-width: 560px; max-height: min(88dvh, 860px);
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.1);
  overflow: clip;
}
.modal--sm { max-width: 420px; }
.modal--lg { max-width: 780px; }
.modal--full { max-width: min(1100px, 96vw); height: min(88dvh, 900px); }
.modal__header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.modal__title { font-size: var(--text-xl); }
.modal__close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-muted);
}
.modal__close:hover { background: var(--surface-sunken); color: var(--text); }
.modal__body { padding: var(--sp-5); overflow-y: auto; flex: 1 1 auto; }
.modal__message { color: var(--text-muted); }
.modal__footer {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* En mobile : feuille basse */
@media (max-width: 640px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal--sm, .modal--lg, .modal--full {
    max-width: 100%; width: 100%; max-height: 92dvh; height: auto;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: slide-up .2s cubic-bezier(.2, .9, .3, 1);
  }
  .modal__footer { padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom)); }
  .modal__footer .btn { flex: 1 1 auto; }
}
@keyframes slide-up { from { transform: translateY(100%); } }

/* ───────────────────────── Toasts ───────────────────────── */
.toast-host {
  position: fixed; z-index: 150; bottom: calc(var(--tabbar-h) + var(--sp-4)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: min(440px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
@media (min-width: 1024px) {
  .toast-host { bottom: var(--sp-6); left: auto; right: var(--sp-6); transform: none; }
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--info);
  border-radius: var(--r-md); box-shadow: var(--shadow-3);
  pointer-events: auto; font-size: var(--text-sm);
  animation: toast-in .18s cubic-bezier(.2, .9, .3, 1);
}
.toast--out { opacity: 0; transform: translateY(6px); transition: all .18s; }
.toast__icon { flex: none; color: var(--info); }
.toast__text { flex: 1 1 auto; }
.toast__action { background: none; border: 0; color: var(--primary); font-weight: 650; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); }
.toast__close { background: none; border: 0; color: var(--text-faint); padding: var(--sp-1); border-radius: var(--r-sm); display: inline-flex; }
.toast__close:hover { color: var(--text); background: var(--surface-sunken); }
.toast--success { border-left-color: var(--success); } .toast--success .toast__icon { color: var(--success); }
.toast--error   { border-left-color: var(--danger); }  .toast--error .toast__icon   { color: var(--danger); }
.toast--warning { border-left-color: var(--warning-icon); } .toast--warning .toast__icon { color: var(--warning-icon); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ───────────────────────── Avatars ───────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: var(--r-pill); overflow: hidden;
  background: color-mix(in srgb, var(--avatar-color, var(--green-600)) 18%, var(--surface-2));
  color: var(--avatar-color, var(--green-700));
  border: 1px solid color-mix(in srgb, var(--avatar-color, var(--green-600)) 28%, transparent);
}
.avatar--photo { object-fit: cover; }
/* L'icône d'espèce occupe ~60 % de la pastille, quelle que soit la taille de l'avatar
   (les vues agrandissent la pastille par min-width / min-height, qui l'emportent sur la taille en ligne). */
.avatar > svg { width: var(--avatar-icon); height: auto; }
.avatar__initial { font-weight: 700; font-size: .95em; }
.avatar--user { background: var(--green-100); color: var(--green-800); border-color: transparent; font-size: var(--text-sm); }

/* ───────────────────────── Listes & lignes ───────────────────────── */
.data-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
}
.data-row:last-child { border-bottom: 0; }
.data-row__label { color: var(--text-muted); font-size: var(--text-sm); margin: 0; flex: none; }
.data-row__value { margin: 0; font-weight: 550; text-align: right; }
dl.data-list { margin: 0; }

.list { display: flex; flex-direction: column; }
.list__item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
  min-height: var(--tap);
}
.list__item:last-child { border-bottom: 0; }
.list__item--link { cursor: pointer; text-decoration: none; color: inherit; padding-inline: var(--sp-2); margin-inline: calc(var(--sp-2) * -1); border-radius: var(--r-sm); }
.list__item--link:hover { background: var(--surface-sunken); }
.list__main { flex: 1 1 auto; min-width: 0; }
.list__title { font-weight: 600; }
.list__meta { font-size: var(--text-sm); color: var(--text-muted); }
.list__aside { flex: none; text-align: right; font-size: var(--text-sm); }

/* ───────────────────────── Timeline ───────────────────────── */
.timeline { position: relative; padding-left: 44px; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline__year {
  position: relative; margin: var(--sp-5) 0 var(--sp-3) -44px;
  font-family: var(--font-title); font-variation-settings: 'SOFT' 50, 'WONK' 0;
  font-size: var(--text-sm); font-weight: 700; color: var(--text-muted);
  letter-spacing: .06em;
}
.timeline__item { position: relative; padding-bottom: var(--sp-5); }
.timeline__dot {
  position: absolute; left: -44px; top: -4px;
  width: 32px; height: 32px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid var(--border); color: var(--text-muted);
}
.timeline__item--vaccination .timeline__dot { border-color: var(--green-300); color: var(--green-600); }
.timeline__item--consultation .timeline__dot { border-color: var(--primary); color: var(--primary); }
.timeline__item--urgence .timeline__dot { border-color: var(--danger); color: var(--danger); }
.timeline__item--owner .timeline__dot { border-style: dashed; }
.timeline__head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.timeline__title { font-weight: 650; }
.timeline__date { font-size: var(--text-sm); color: var(--text-muted); }
.timeline__body { margin-top: var(--sp-2); }
/* Signature de l'acte : praticien, n° ordinal, clinique (exigence déontologique) */
.timeline__signature {
  margin-top: var(--sp-2); font-size: var(--text-xs); color: var(--text-muted);
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
}
.timeline__item--cancelled { opacity: .6; }
.timeline__item--cancelled .timeline__title { text-decoration: line-through; }

/* ───────────────────────── Tableaux ───────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--sp-3); text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  background: var(--surface-sunken); font-weight: 650; color: var(--text-muted);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 0; z-index: 1;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-sunken); }
.table .num { text-align: right; font-variant-numeric: tabular-nums slashed-zero; }
.table caption { caption-side: bottom; padding: var(--sp-3); font-size: var(--text-xs); color: var(--text-muted); text-align: left; }

/* ───────────────────────── États vides ───────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-4); text-align: center;
}
.empty-state__icon { color: var(--green-300); }
.empty-state__title { font-size: var(--text-lg); }
.empty-state__text { color: var(--text-muted); max-width: 46ch; font-size: var(--text-sm); }

/* ───────────────────────── Divers ───────────────────────── */
.kpi {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.kpi__value {
  font-family: var(--font-title); font-variation-settings: 'SOFT' 50, 'WONK' 0, 'opsz' 60;
  font-size: var(--text-3xl); font-weight: 600; line-height: 1;
  color: var(--primary);
}
.kpi__label { font-size: var(--text-sm); color: var(--text-muted); }
.kpi__hint { font-size: var(--text-xs); color: var(--text-faint); }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Marque Vetossimo : dessin PNG transparent (vert et or) posé sur une pastille --logo-plate,
   invisible sur l'ivoire du thème clair, ivoire en thème sombre (le vert foncé y resterait illisible). */
.wordmark { display: inline-flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: inherit; flex: none; }
.wordmark__text {
  font-family: var(--font-title); font-variation-settings: 'SOFT' 50, 'WONK' 0, 'opsz' 40;
  font-size: var(--text-xl); font-weight: 600; color: var(--primary); letter-spacing: -0.01em;
}
/* « ssimo » en bronze (--text-accent, 5,95:1 sur ivoire) : jamais l'or de marque en texte sur fond clair. */
.wordmark__accent { color: var(--text-accent); }
.logo-mark {
  display: inline-grid; place-items: center; flex: none;
  padding: 4px; border-radius: var(--r-md);
  background: var(--logo-plate);
}
.logo-mark__img { display: block; max-width: none; }

.copy-field {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); background: var(--surface-sunken);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.copy-field__value { flex: 1 1 auto; font-variant-numeric: tabular-nums slashed-zero; font-weight: 650; }

.progress { height: 8px; background: var(--surface-sunken); border-radius: var(--r-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); border-radius: var(--r-pill); transition: width var(--transition); }
.progress--accent .progress__bar { background: var(--accent); }
.progress--danger .progress__bar { background: var(--danger); }

/* ───────────────────────── Tailles d'icônes ─────────────────────────
   La taille affichée d'une icône dépend de son contexte, avec les jetons --icon-* de tokens.css.
   Les width/height CSS l'emportent sur les attributs du SVG : la taille passée à icon() n'est qu'un repli.
   Spécificité (0,2,0) : les règles des vues (views/*.css, chargées après) peuvent affiner. */
.icon { flex: none; }
/* Plancher : aucune icône sous 16 px, même déclarée plus petite dans une vue. */
.icon[width="12"], .icon[width="13"], .icon[width="14"], .icon[width="15"] { width: var(--icon-xs); height: var(--icon-xs); }

.btn > .icon { width: var(--icon-md); height: var(--icon-md); }
.btn--sm > .icon { width: var(--icon-sm); height: var(--icon-sm); }
.btn--lg > .icon, .btn--xl > .icon, .btn--icon > .icon { width: var(--icon-lg); height: var(--icon-lg); }
.icon-btn > .icon { width: var(--icon-lg); height: var(--icon-lg); }
.modal__close > .icon { width: var(--icon-lg); height: var(--icon-lg); }
.toast__icon { width: var(--icon-lg); height: var(--icon-lg); }
.toast__close > .icon { width: var(--icon-sm); height: var(--icon-sm); }
.card__icon { width: var(--icon-lg); height: var(--icon-lg); margin-top: -1px; }
.notice__icon { width: var(--icon-lg); height: var(--icon-lg); margin-top: -1px; }
.tabs__tab > .icon { width: var(--icon-md); height: var(--icon-md); }
.segmented__item > .icon { width: var(--icon-md); height: var(--icon-md); }
.badge > .icon { width: var(--icon-xs); height: var(--icon-xs); }
.list__item > .icon { width: var(--icon-md); height: var(--icon-md); }
.timeline__dot > .icon { width: var(--icon-sm); height: var(--icon-sm); }
.empty-state__icon { width: var(--icon-3xl); height: var(--icon-3xl); }

/* Écrans tactiles : toute commande atteint la cible de 44 px (--tap), même en variante compacte. */
@media (pointer: coarse) {
  .btn--sm { min-height: var(--tap); }
  .modal__close { width: var(--tap); height: var(--tap); }
  .toast__close, .toast__action { min-width: var(--tap); min-height: var(--tap); justify-content: center; align-items: center; }
  .toast__action { display: inline-flex; }
  .segmented__item { min-height: var(--tap); }
}

/* ───────────────────────── Menu contextuel (ui.js : contextMenu) ───────────────────────── */
.ctx-menu {
  position: fixed; z-index: 170;   /* au-dessus des modales (100), des toasts (150) et des infobulles (160) */
  min-width: 232px; max-width: calc(100vw - 16px);
  padding: var(--sp-1);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  animation: ctx-in .12s ease-out;
}
.ctx-menu:focus { outline: none; }
.ctx-menu__title {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: var(--text-xs); font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctx-menu__item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: 48px; padding: var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--r-sm);
  background: none; color: inherit; text-align: left;
  font-size: var(--text-md); font-weight: 550;
}
.ctx-menu__item:hover,
.ctx-menu__item:focus-visible { background: var(--surface-sunken); }
.ctx-menu__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ctx-menu__icon { flex: none; color: var(--primary); }
.ctx-menu__item--danger,
.ctx-menu__item--danger .ctx-menu__icon { color: var(--danger); }
@keyframes ctx-in { from { opacity: 0; transform: scale(.97); } }

/* ─────────────── Photo modifiable : clic droit, appui long (lib/photo.js : photoAvatar) ─────────────── */
.photo-edit {
  position: relative; display: inline-flex; flex: none;
  border-radius: var(--r-pill);
  /* Pas de loupe, de sélection ni de menu « Enregistrer l'image » natif pendant l'appui long. */
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.photo-edit .avatar { -webkit-user-drag: none; }
.photo-edit--button {
  padding: 0; border: 0; background: none; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.photo-edit--button:focus-visible { outline-offset: 3px; border-radius: var(--r-pill); }
.photo-edit--button:hover .avatar { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }

/* Pastille « appareil photo » : visible au survol et au focus, toujours visible sur écran tactile. */
.photo-edit__badge {
  position: absolute; right: -3px; bottom: -3px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--primary-contrast);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-1);
  opacity: 0; transform: scale(.8);
  transition: opacity var(--transition), transform var(--transition);
  pointer-events: none;
}
.photo-edit--lg .photo-edit__badge { width: 32px; height: 32px; right: -2px; bottom: -2px; }
/* Hors bouton (cartes « Mes animaux ») : la pastille ouvre le menu au clic ou au toucher (bindContextMenu,
   clickSelector) ; sa zone sensible est élargie à 44 px sans grossir le dessin. */
.photo-edit:not(.photo-edit--button) .photo-edit__badge { pointer-events: auto; cursor: pointer; }
.photo-edit:not(.photo-edit--button) .photo-edit__badge::after {
  content: ''; position: absolute; inset: calc((var(--tap) - 28px) / -2); border-radius: var(--r-pill);
}
.photo-edit:not(.photo-edit--button) .photo-edit__badge:hover { background: var(--primary-hover); }
.photo-edit:hover .photo-edit__badge,
.photo-edit--button:focus-visible .photo-edit__badge,
a:focus-visible .photo-edit__badge { opacity: 1; transform: none; }
@media (hover: none) {
  .photo-edit__badge { opacity: 1; transform: none; }
}

/* Envoi en cours : voile et indicateur sur l'avatar. */
.photo-edit__busy {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.photo-edit.is-busy .photo-edit__busy { display: inline-flex; }
.photo-edit.is-busy .photo-edit__badge { opacity: 0; }

/* ─────────────── Installation de l'application (js/lib/installation.js) ───────────────
   Boutons et ligne « Installer l'application » : masqués (attribut hidden) tant que le navigateur ne
   propose pas l'installation, ou quand l'application est déjà installée. */
[data-installation][hidden] { display: none !important; }

/* En-tête public : discret (bouton fantôme), libellé « Installer » visible quand la place le permet ;
   le nom accessible reste « Installer l'application ». */
.install-btn--entete .install-btn__suite {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.install-btn--entete { --btn-fg: var(--primary); }
.install-btn--entete:hover:not(:disabled) { --btn-fg: var(--primary); }

/* Pied de la barre latérale : même apparence que les autres entrées, pictogramme à la couleur de marque. */
.nav-item.install-btn > .icon { color: var(--primary); }

/* Ligne de la carte « Apparence » (Mon compte) */
.install-ligne {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  padding-top: var(--sp-4); border-top: 1px solid var(--border);
}
.install-ligne__texte { flex: 1 1 18rem; min-width: 0; }
.install-ligne__titre { font-weight: 650; }
.install-ligne__aide { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

/* Aide pour iPhone et iPad : trois étapes illustrées */
.install-aide__intro, .install-aide__fin { color: var(--text-muted); }
.install-etapes {
  list-style: none; padding: 0; margin: var(--sp-4) 0;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.install-etape {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); background: var(--surface-sunken);
}
.install-etape__picto {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap); margin-top: 2px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--info);   /* rappelle le bleu des boutons d'iOS */
}
.install-etape__picto > .icon { width: var(--icon-lg); height: var(--icon-lg); }
.install-etape__num {
  position: absolute; top: -7px; left: -7px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--primary); color: var(--primary-contrast);
  font-size: var(--text-xs); font-weight: 700; line-height: 1;
  border: 2px solid var(--surface-sunken);
}
.install-etape__corps { min-width: 0; }
.install-etape__titre { font-weight: 650; }
.install-etape__texte { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
