/*
 * Composants : boutons, champs, avatars, modales, toasts, palette, squelettes.
 * Un composant ne connaît que ses tokens `--tb-*`.
 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--tb-rayon); border: 1px solid var(--tb-bordure-2); background: var(--tb-surface); color: var(--tb-texte); font-weight: 500; white-space: nowrap; transition: background var(--tb-duree), border-color var(--tb-duree), transform var(--tb-duree); user-select: none; }
.btn:hover { background: var(--tb-surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primaire { background: var(--tb-accent); border-color: var(--tb-accent); color: var(--tb-accent-encre); }
.btn-primaire:hover { background: color-mix(in srgb, var(--tb-accent) 88%, #000); }
.btn-icone { width: 34px; padding: 0; border-color: transparent; background: transparent; color: var(--tb-texte-2); border-radius: 50%; }
.btn-icone:hover { background: var(--tb-surface-3); color: var(--tb-texte); }
.btn-icone.btn-primaire { background: var(--tb-accent); color: var(--tb-accent-encre); }
.btn-icone.btn-primaire:hover { background: color-mix(in srgb, var(--tb-accent) 88%, #000); }
.btn-large { height: 40px; font-size: 15px; }
.btn-danger-doux { color: var(--tb-danger); }
.btn-fantome { border-color: transparent; background: transparent; }

.champ { display: flex; flex-direction: column; gap: 5px; }
.champ > span { font-size: 12.5px; font-weight: 500; color: var(--tb-texte-2); }
.champ small { font-size: 11.5px; color: var(--tb-texte-3); }
.champ input, .champ textarea { height: 36px; padding: 0 10px; border: 1px solid var(--tb-bordure-2); border-radius: var(--tb-rayon-s); background: var(--tb-surface); transition: border-color var(--tb-duree); }
.champ input:focus { border-color: var(--tb-accent); }
.champ input:disabled { color: var(--tb-texte-3); background: var(--tb-surface-2); }
.champs { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.champs legend { padding: 0; font-size: 12.5px; font-weight: 500; color: var(--tb-texte-2); margin-bottom: 4px; }
.cases { display: flex; flex-direction: column; gap: 4px; }
.case { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--tb-rayon-s); cursor: pointer; }
.case:hover { background: var(--tb-surface-2); }
.case input { accent-color: var(--tb-accent); width: 16px; height: 16px; margin: 0; }
.case-nom { font-weight: 500; }
.case-email { font-size: 12px; color: var(--tb-texte-3); }
.pli summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--tb-texte-2); padding: 4px 0; }
.pli[open] summary { margin-bottom: 8px; }
.pli .champ + .champ { margin-top: 10px; }

.avatar { --c: var(--tb-accent); display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, var(--tb-surface)); color: var(--c); font-size: 13px; font-weight: 700; letter-spacing: .02em; flex: none; position: relative; }
.avatar-s { width: 28px; height: 28px; font-size: 11px; }
.avatar-l { width: 44px; height: 44px; font-size: 15px; }
.avatar-pile { display: flex; }
.avatar-pile .avatar { box-shadow: 0 0 0 2px var(--tb-surface); }
.avatar-pile .avatar + .avatar { margin-left: -10px; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--tb-texte-3); box-shadow: 0 0 0 2px var(--tb-surface); }
.presence.est-en-ligne { background: var(--tb-ok); }

.mx { border: 1px solid var(--tb-bordure); padding: 0; background: var(--tb-surface); color: var(--tb-texte); border-radius: 14px; box-shadow: var(--tb-ombre); width: min(440px, calc(100vw - 32px)); }
.mx::backdrop { background: var(--tb-voile); backdrop-filter: blur(2px); }
.mx-corps { display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 18px; margin: 0; }
.mx-titre { font-size: 17px; }
.mx-pied { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.mx-espace { flex: 1; }
.mx-erreur { font-size: 13px; color: var(--tb-danger); }
.mx-texte { font-size: 13.5px; color: var(--tb-texte-2); line-height: 1.5; }
.mx-confirm { width: min(400px, calc(100vw - 32px)); }
.mx-confirm .mx-corps { gap: 10px; }
.mx-confirm .mx-pied { margin-top: 10px; }
.btn-danger { background: var(--tb-danger); border-color: var(--tb-danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--tb-danger) 88%, #000); }
/* Visionneuse d'image : plein écran, fond sombre, une barre discrète. Seule surface sombre de l'interface : on regarde une image, pas l'application. */
.visionneuse { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #fff; overflow: hidden; overscroll-behavior: contain; }
.visionneuse::backdrop { background: rgba(10, 12, 16, .94); }
.visionneuse[open] { display: flex; flex-direction: column; animation: visionneuse-in var(--tb-duree) ease-out; }
@keyframes visionneuse-in { from { opacity: 0; } }
.visionneuse-barre { display: flex; align-items: center; gap: 4px; padding: 14px 18px; }
.visionneuse-nom { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: rgba(255, 255, 255, .8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visionneuse-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: rgba(255, 255, 255, .85); transition: background var(--tb-duree), color var(--tb-duree); }
.visionneuse-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
/* Flex, pas grille : une piste de grille « auto » ne borne pas l'image, et la boîte défilait (vu le 2026-09-05). */
.visionneuse-scene { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 24px 28px; overflow: hidden; cursor: zoom-out; }
.visionneuse-scene img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); cursor: default; animation: visionneuse-img var(--tb-duree) ease-out; }
@keyframes visionneuse-img { from { transform: scale(.985); opacity: 0; } }
/* Page web intégrée : même coque, un cadre blanc à la place de l'image. */
.visionneuse-indice { margin: -6px 18px 8px; font-size: 12px; color: rgba(255, 255, 255, .5); }
.visionneuse-cadre { position: relative; flex: 1; min-height: 0; margin: 0 18px 18px; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.visionneuse-cadre iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.visionneuse-chargement { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; color: var(--tb-texte-3); font-size: 13px; pointer-events: none; transition: opacity var(--tb-duree); }
.visionneuse-chargement.est-fini { opacity: 0; }
@media (max-width: 560px) { .visionneuse-cadre { margin: 0; border-radius: 0; } }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; pointer-events: none; }
.toast { padding: 9px 14px; border-radius: 999px; background: var(--tb-texte); color: var(--tb-surface); font-size: 13px; box-shadow: var(--tb-ombre); animation: toast-in var(--tb-duree) ease-out; pointer-events: auto; }
.toast.est-erreur { background: var(--tb-danger); color: #fff; }
.toast.est-ok { background: var(--tb-ok); color: #fff; }
.toast.est-cliquable { cursor: pointer; font: inherit; font-size: 13px; text-align: left; max-width: min(420px, 90vw); }
.toast.est-cliquable:hover { filter: brightness(1.15); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mx-palette { width: min(560px, calc(100vw - 32px)); margin-top: 12vh; }
.mx-palette .mx-corps { padding: 10px; gap: 6px; }
.palette-champ { width: 100%; height: 42px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--tb-bordure); background: transparent; font-size: 15px; outline: none; -webkit-appearance: none; }
.palette-resultats { max-height: 52vh; overflow-y: auto; }
.palette-groupe { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tb-texte-3); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--tb-rayon-s); text-align: left; }
.palette-item:hover, .palette-item.est-actif { background: var(--tb-surface-3); }
.palette-item-texte { flex: 1; min-width: 0; }
.palette-item-titre { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-sous { font-size: 12px; color: var(--tb-texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item mark { background: color-mix(in srgb, var(--tb-accent) 25%, transparent); color: inherit; border-radius: 2px; }
.palette-vide { padding: 18px; text-align: center; color: var(--tb-texte-3); }
.raccourci { font: 11px var(--tb-mono); color: var(--tb-texte-3); border: 1px solid var(--tb-bordure-2); border-radius: 4px; padding: 1px 5px; }

.squelette { position: relative; overflow: hidden; background: var(--tb-surface-3); border-radius: var(--tb-rayon-s); color: transparent !important; }
.squelette::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tb-surface) 60%, transparent), transparent); animation: squelette 1.4s infinite; }
@keyframes squelette { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .squelette::after { animation: none; } }
