/*
 * UVCW UI — composants d'interface communs aux applications de l'UVCW.
 *
 * À charger après uvcw-tokens.css. Toutes les classes commencent par `uvcw-` : aucune collision avec
 * les styles propres d'une application, qui garde son design mais partage ces éléments communs.
 * Aucune valeur visuelle écrite en dur : tout passe par les jetons.
 * Vitrine : composants.html.
 */

/* =========================================================================
   Base (facultative) : à appliquer sur <body class="uvcw-base"> pour une page neuve.
   ========================================================================= */

.uvcw-base {
  margin: 0;
  color: var(--uvcw-ink);
  background: var(--uvcw-bg);
  font-family: var(--uvcw-font);
  font-size: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.uvcw-base *,
.uvcw-base *::before,
.uvcw-base *::after {
  box-sizing: border-box;
}

.uvcw-base a {
  color: inherit;
  text-decoration: none;
}

.uvcw-base :focus-visible {
  outline: 2px solid color-mix(in srgb, var(--uvcw-ink) 45%, transparent);
  outline-offset: 2px;
}

/* =========================================================================
   Mise en page et textes
   ========================================================================= */

.uvcw-page {
  max-width: var(--uvcw-page-max);
  margin: 0 auto;
  padding: var(--uvcw-space-6) var(--uvcw-page-gutter) 64px;
}

.uvcw-section + .uvcw-section {
  margin-top: var(--uvcw-space-8);
}

/* En-tête de page ou de section : titre à gauche, outils à droite. */
.uvcw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--uvcw-space-4);
  margin-bottom: var(--uvcw-space-5);
}

.uvcw-title-1,
.uvcw-title-2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.uvcw-title-1 {
  font-size: var(--uvcw-title-1);
}

.uvcw-title-2 {
  font-size: var(--uvcw-title-2);
}

/* Petit intitulé en capitales (« APPLICATIONS », « AIDE »). */
.uvcw-eyebrow {
  margin: 0 0 var(--uvcw-space-3);
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.uvcw-muted {
  color: var(--uvcw-ink-muted);
}

.uvcw-note {
  margin: var(--uvcw-space-3) 0 0;
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-sm);
}

/* =========================================================================
   Boutons
   ========================================================================= */

/* Pilule. Variantes : --primary (noir maximum), --secondary (blanc, contour fin), --publish (vert unique),
   --danger (rouge, pour supprimer), --ghost (texte seul). Taille : --sm. Icône + texte : gap automatique. */
.uvcw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border: 0;
  border-radius: var(--uvcw-radius-pill);
  font: inherit;
  font-size: var(--uvcw-text-md);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--uvcw-duration-fast),
    color var(--uvcw-duration-fast),
    box-shadow var(--uvcw-duration-fast),
    transform var(--uvcw-duration-fast);
}

.uvcw-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.uvcw-btn:disabled,
.uvcw-btn[aria-disabled='true'] {
  opacity: 0.4;
  cursor: default;
}

.uvcw-btn--sm {
  padding: 6px 14px;
  font-size: var(--uvcw-text-sm);
}

.uvcw-btn--primary {
  color: var(--uvcw-accent-contrast);
  background: var(--uvcw-accent);
}

.uvcw-btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uvcw-accent) 82%, var(--uvcw-accent-contrast));
}

.uvcw-btn--secondary {
  color: var(--uvcw-ink);
  background: var(--uvcw-surface);
  box-shadow: inset 0 0 0 1px var(--uvcw-hairline);
}

.uvcw-btn--secondary:hover:not(:disabled) {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uvcw-ink) 22%, transparent);
}

.uvcw-btn--publish {
  color: var(--uvcw-on-color);
  background: var(--uvcw-green);
}

.uvcw-btn--publish:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uvcw-green) 88%, var(--uvcw-black));
}

.uvcw-btn--danger {
  color: var(--uvcw-danger);
  background: var(--uvcw-surface);
  box-shadow: inset 0 0 0 1px var(--uvcw-hairline);
}

/* Filtre à bascule (tableau de bord) : transparent, gris au survol ; actif (aria-pressed) : blanc en relief,
   comme le segment actif d'un interrupteur. */
.uvcw-btn--filter {
  color: var(--uvcw-ink);
  background: none;
}

.uvcw-btn--filter:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uvcw-ink) 6%, transparent);
}

.uvcw-btn--filter[aria-pressed='true'] {
  background: var(--uvcw-surface);
  box-shadow: var(--uvcw-shadow-raised);
}

/* Bouton de filtre ou de menu (« Matière ▾ ») : fond gris léger, comme un interrupteur. */
.uvcw-btn--soft {
  color: var(--uvcw-ink);
  background: color-mix(in srgb, var(--uvcw-ink) 6%, transparent);
}

.uvcw-btn--soft:hover:not(:disabled) {
  background: color-mix(in srgb, var(--uvcw-ink) 10%, transparent);
}

.uvcw-btn--ghost {
  padding-inline: 8px;
  color: var(--uvcw-ink-muted);
  background: none;
}

.uvcw-btn--ghost:hover:not(:disabled) {
  color: var(--uvcw-ink);
}

/* Bouton-lien : texte souligné discrètement (« Annuler », « Modifier », « Relancer les erreurs »). */
.uvcw-btn-link {
  padding: 0;
  border: 0;
  color: var(--uvcw-ink);
  background: none;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--uvcw-hairline);
  text-underline-offset: 3px;
  cursor: pointer;
}

.uvcw-btn-link:hover {
  text-decoration-color: currentColor;
}

/* Petit bouton d'icône sans fond (fermer ×, retirer d'une liste) : rond gris au survol.
   Toujours `aria-label` et `title`. */
.uvcw-btn-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--uvcw-ink-muted);
  background: none;
  cursor: pointer;
  transition: color var(--uvcw-duration-fast), background-color var(--uvcw-duration-fast);
}

.uvcw-btn-icon:hover {
  color: var(--uvcw-ink);
  background: color-mix(in srgb, var(--uvcw-ink) 7%, transparent);
}

/* Ligne d'action dans un cadre (Ajouter aux favoris, Copier le lien…) : icône et texte, filet dessous. */
.uvcw-action {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--uvcw-hairline);
  color: var(--uvcw-ink);
  background: none;
  font: inherit;
  font-size: var(--uvcw-text-md);
  text-align: left;
  cursor: pointer;
}

.uvcw-action:hover {
  color: var(--uvcw-ink-muted);
}

/* Navigation précédent / suivant : flèche seule dans un rond blanc à contour fin.
   Toujours `aria-label` et `title` explicites (« Photo suivante (→) »). */
.uvcw-btn-round {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--uvcw-ink);
  background: var(--uvcw-surface);
  box-shadow: inset 0 0 0 1px var(--uvcw-hairline);
  cursor: pointer;
  transition: box-shadow var(--uvcw-duration-fast), opacity var(--uvcw-duration-fast);
}

.uvcw-btn-round:hover:not(:disabled) {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uvcw-ink) 25%, transparent);
}

.uvcw-btn-round:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Bouton d'icône posé sur une photo (télécharger, favori…) : verre sombre, icône blanche. */
.uvcw-btn-overlay {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--uvcw-radius-panel);
  color: var(--uvcw-on-color);
  background: color-mix(in srgb, var(--uvcw-black) 42%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  cursor: pointer;
  transition: background-color var(--uvcw-duration-fast);
}

.uvcw-btn-overlay:hover {
  background: color-mix(in srgb, var(--uvcw-black) 62%, transparent);
}

.uvcw-btn-overlay:active {
  transform: scale(0.94);
}

/* =========================================================================
   Interrupteurs
   ========================================================================= */

/* Choix exclusif (Serré / Aéré, Lecture / Écriture, sections d'une application) : fond gris,
   segment actif blanc en léger relief. Actif : aria-pressed, aria-checked, aria-current ou .is-active. */
.uvcw-segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--uvcw-radius-pill);
  background: color-mix(in srgb, var(--uvcw-ink) 6%, transparent);
}

.uvcw-segmented > * {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 15px;
  border: 0;
  border-radius: var(--uvcw-radius-pill);
  color: var(--uvcw-ink-muted);
  background: none;
  font: inherit;
  font-size: var(--uvcw-text-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    color var(--uvcw-duration-fast),
    background-color var(--uvcw-duration-fast),
    box-shadow var(--uvcw-duration-fast);
}

.uvcw-segmented > *:hover {
  color: var(--uvcw-ink);
}

.uvcw-segmented > [aria-pressed='true'],
.uvcw-segmented > [aria-checked='true'],
.uvcw-segmented > [aria-current='page'],
.uvcw-segmented > [aria-current='true'],
.uvcw-segmented > .is-active {
  color: var(--uvcw-ink);
  background: var(--uvcw-surface);
  box-shadow: var(--uvcw-shadow-raised);
  font-weight: 600;
}

/* Sections d'une application (Catalogue · Gestion · Albums) : plus grand, icône verte sur la section active. */
.uvcw-segmented--section > * {
  padding: 7px 16px 7px 13px;
  font-size: var(--uvcw-text-md);
}

.uvcw-segmented--section > [aria-current='page'] svg,
.uvcw-segmented--section > .is-active svg {
  color: var(--uvcw-active);
}

/* Variante à segment glissant : le segment blanc est un élément à part (.uvcw-segmented__indicator, placé dans
   le choix actif) que l'application anime d'un choix à l'autre (ex. Motion, layoutId). */
.uvcw-segmented--sliding > * {
  position: relative;
}

.uvcw-segmented--sliding > [aria-pressed='true'],
.uvcw-segmented--sliding > [aria-checked='true'],
.uvcw-segmented--sliding > .is-active {
  background: none;
  box-shadow: none;
}

.uvcw-segmented--sliding > * > :not(.uvcw-segmented__indicator) {
  position: relative;
  z-index: 1;
}

.uvcw-segmented__indicator {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--uvcw-surface);
  box-shadow: var(--uvcw-shadow-raised);
}

/* Choix réduit à une icône (le libellé est dans l'infobulle `title`). */
.uvcw-segmented > .uvcw-segmented__icon-only {
  padding-inline: 10px;
}

/* Bouton marche / arrêt : <input type="checkbox" class="uvcw-toggle">. Actif : le vert unique. */
.uvcw-toggle {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: var(--uvcw-radius-pill);
  background: color-mix(in srgb, var(--uvcw-ink) 18%, transparent);
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.uvcw-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--uvcw-on-color);
  box-shadow: var(--uvcw-shadow-raised);
  transition: transform 0.2s var(--uvcw-ease);
}

.uvcw-toggle:checked {
  background: var(--uvcw-green);
}

.uvcw-toggle:checked::after {
  transform: translateX(18px);
}

/* Case à cocher d'un formulaire (choix multiple), même dessin que .uvcw-check des menus :
   <div class="uvcw-checkbox-group" role="group" aria-label="…">
     <label class="uvcw-checkbox"><input type="checkbox" name="…" value="…">Libellé</label>…</div>
   Groupe en colonnes, sans cadre. Une pastille .uvcw-color-dot peut précéder le libellé. */
.uvcw-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--uvcw-space-2) var(--uvcw-space-4);
}

.uvcw-checkbox {
  display: flex;
  align-items: center;
  gap: var(--uvcw-space-2);
  font-size: var(--uvcw-text-md);
  font-weight: 400;
  cursor: pointer;
}

.uvcw-checkbox input {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border-radius: var(--uvcw-radius-sm);
  background: var(--uvcw-surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--uvcw-ink) 25%, transparent);
  appearance: none;
  cursor: pointer;
}

.uvcw-checkbox input::after {
  content: '';
  width: 10px;
  height: 6px;
  margin-top: -3px;
  border-bottom: 2px solid var(--uvcw-accent-contrast);
  border-left: 2px solid var(--uvcw-accent-contrast);
  transform: rotate(-45deg);
  opacity: 0;
}

.uvcw-checkbox input:checked {
  background: var(--uvcw-accent);
  box-shadow: none;
}

.uvcw-checkbox input:checked::after {
  opacity: 1;
}

.uvcw-checkbox input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--uvcw-ink) 45%, transparent);
  outline-offset: 2px;
}

/* =========================================================================
   Champs
   ========================================================================= */

.uvcw-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--uvcw-text-sm);
  font-weight: 500;
}

.uvcw-input,
.uvcw-textarea,
.uvcw-select {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--uvcw-hairline);
  border-radius: var(--uvcw-radius-sm);
  color: var(--uvcw-ink);
  background: var(--uvcw-surface);
  font: inherit;
  font-size: var(--uvcw-text-md);
  font-weight: 400;
}

.uvcw-input:focus-visible,
.uvcw-textarea:focus-visible,
.uvcw-select:focus-visible {
  border-color: color-mix(in srgb, var(--uvcw-ink) 40%, transparent);
  outline: none;
}

/* Champ d'une ligne : pilule, comme les boutons. Zone de texte et liste : angles de cadre. */
.uvcw-input {
  border-radius: var(--uvcw-radius-pill);
}

.uvcw-textarea {
  resize: vertical;
}

.uvcw-select {
  width: auto;
}

/* Champ de recherche en pilule, loupe à gauche :
   <label class="uvcw-search"><svg…/><input type="search" placeholder="…"></label> */
.uvcw-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: var(--uvcw-radius-pill);
  color: var(--uvcw-ink-muted);
  background: var(--uvcw-surface);
  box-shadow: 0 0 0 1px var(--uvcw-hairline);
}

.uvcw-search:focus-within {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--uvcw-ink) 40%, transparent);
}

.uvcw-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  color: var(--uvcw-ink);
  background: transparent;
  font: inherit;
}

.uvcw-search input::-webkit-search-cancel-button {
  display: none;
}

.uvcw-search input::placeholder {
  color: var(--uvcw-ink-muted);
}

/* Compact (barre d'outils, liste) : moins haut. */
.uvcw-search--sm {
  gap: 7px;
  padding: 7px 14px;
  font-size: var(--uvcw-text-md);
}

/* Grand champ posé sur une photo (accueil) : verre clair, contour blanc décalé, plus marqué à la saisie. */
.uvcw-search--hero {
  gap: 12px;
  padding: 18px 26px;
  border: 1px solid var(--uvcw-glass-border);
  color: var(--uvcw-ink);
  background: var(--uvcw-glass-bg);
  box-shadow: var(--uvcw-shadow-float);
  font-size: var(--uvcw-text-xl);
  outline: 3px solid var(--uvcw-glass-focus);
  outline-offset: 2px;
}

.uvcw-search--hero:focus-within {
  box-shadow: var(--uvcw-shadow-float);
  outline-color: var(--uvcw-glass-focus-strong);
}

.uvcw-search--hero input::placeholder {
  color: var(--uvcw-ink-faint);
}

@media (max-width: 600px) {
  .uvcw-search--hero {
    padding: 14px 20px;
    font-size: var(--uvcw-text-base);
  }
}

/* Recherche à vignettes : chaque mot-clé ou filtre validé devient une vignette (.uvcw-chip) dans le champ,
   suivie de la saisie ; bouton rond « tout effacer » à droite.
   <div class="uvcw-search uvcw-search--tokens"><svg…/>
     <ul class="uvcw-search__tokens"><li class="uvcw-chip">…</li><li class="uvcw-search__input"><input…></li></ul>
     <button class="uvcw-search__clear" aria-label="Tout effacer">×</button></div> */
.uvcw-search--tokens {
  position: relative;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px 6px 18px;
  cursor: text;
}

.uvcw-search__tokens {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.uvcw-search__input {
  display: flex;
  flex: 1;
  min-width: 140px;
}

.uvcw-search__input input {
  padding: 6px 0;
}

/* Tout effacer : rond plein discret, comme le champ de recherche de macOS. */
.uvcw-search__clear {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  color: var(--uvcw-surface);
  background: color-mix(in srgb, var(--uvcw-ink) 45%, transparent);
  font: inherit;
  font-size: var(--uvcw-text-md);
  line-height: 1;
  cursor: pointer;
}

.uvcw-search__clear:hover {
  background: var(--uvcw-ink);
}

/* Champ de formulaire (fiche, gestion) : fond gris, blanc pendant la saisie ; angles de cadre, pour aller
   avec les zones de texte. S'applique à <input>, <textarea> et à la liste d'une saisie assistée. */
.uvcw-field {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--uvcw-hairline);
  border-radius: var(--uvcw-radius-sm);
  color: var(--uvcw-ink);
  background-color: var(--uvcw-bg);
  font: inherit;
  font-size: var(--uvcw-text-md);
  transition:
    border-color var(--uvcw-duration-fast),
    background-color var(--uvcw-duration-fast);
}

.uvcw-field:focus {
  border-color: color-mix(in srgb, var(--uvcw-accent) 40%, transparent);
  background-color: var(--uvcw-surface);
  outline: none;
}

/* Champ refusé (aria-invalid) et son message, sous le champ ; vide, le message ne prend pas de place. */
.uvcw-field[aria-invalid='true'] {
  border-color: var(--uvcw-danger);
}
.uvcw-field-error {
  margin: 0;
  color: var(--uvcw-danger-text);
  font-size: var(--uvcw-text-sm);
  font-weight: 400;
}
.uvcw-field-error:empty {
  display: none;
}

textarea.uvcw-field {
  resize: vertical;
}

/* Liste : même hauteur que les autres champs (sans le dessin du système, que Safari garde plus bas) ;
   chevron dessiné à la couleur du texte. */
select.uvcw-field {
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentcolor 50%),
    linear-gradient(135deg, currentcolor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 55%,
    calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  cursor: pointer;
}

/* =========================================================================
   Vignettes, étiquettes, voyants
   ========================================================================= */

/* Vignette (mot-clé, filtre actif) : <span class="uvcw-chip">vélo <button class="uvcw-chip__remove">×</button></span>.
   --proposed : proposition à valider (IA). */
.uvcw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--uvcw-radius-pill);
  color: var(--uvcw-ink);
  background: color-mix(in srgb, var(--uvcw-ink) 7%, transparent);
  font-size: var(--uvcw-text-sm);
  line-height: 1.3;
}

/* Vignette cliquable (mot-clé qui lance une recherche) : se remplit au survol. */
.uvcw-chip--link {
  cursor: pointer;
  transition:
    background-color var(--uvcw-duration-fast),
    color var(--uvcw-duration-fast);
}

.uvcw-chip--link:hover {
  color: var(--uvcw-accent-contrast);
  background: var(--uvcw-accent);
}

.uvcw-chip--proposed {
  padding: 3px 11px;
  border: 1px dashed color-mix(in srgb, var(--uvcw-ink) 35%, transparent);
  background: transparent;
}

/* Ajout manuel pas encore validé : contour plein. */
.uvcw-chip--added {
  padding: 3px 11px;
  border: 1px solid color-mix(in srgb, var(--uvcw-ink) 35%, transparent);
  background: transparent;
}

.uvcw-chip > svg {
  color: var(--uvcw-ink-muted);
}

.uvcw-chip__remove {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--uvcw-ink-muted);
  background: none;
  font-size: var(--uvcw-text-sm);
  line-height: 1;
  cursor: pointer;
}

/* Préfixe d'un filtre dans une vignette (« Commune : ») : <small> ou .uvcw-chip__prefix. */
.uvcw-chip__prefix,
.uvcw-chip small {
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-xs);
}

.uvcw-chip__remove:hover {
  color: var(--uvcw-ink);
  background: color-mix(in srgb, var(--uvcw-ink) 10%, transparent);
}

/* Étiquette d'état (« À venir », « Brouillon »). --success : vert ; --new : rouge de notification. */
.uvcw-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px;
  border-radius: var(--uvcw-radius-pill);
  color: var(--uvcw-ink-muted);
  background: color-mix(in srgb, var(--uvcw-ink) 6%, transparent);
  font-size: var(--uvcw-text-xs);
  font-weight: 600;
}

.uvcw-pill--success {
  color: var(--uvcw-on-color);
  background: var(--uvcw-green);
}

.uvcw-pill--new {
  color: var(--uvcw-on-color);
  background: var(--uvcw-red);
}

/* Version douce de --success (« ✓ Publiée » dans une barre) : texte vert sur fond vert pâle. */
.uvcw-pill--success-soft {
  color: var(--uvcw-green);
  background: color-mix(in srgb, var(--uvcw-green) 12%, transparent);
}

/* Étiquette posée sur une photo (« Brouillon ») : verre sombre, texte blanc. Avec --success : vert. */
.uvcw-pill--overlay {
  padding: 3px 9px;
  color: var(--uvcw-on-color);
  background: color-mix(in srgb, var(--uvcw-black) 50%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: var(--uvcw-text-2xs);
  letter-spacing: 0.02em;
}

.uvcw-pill--overlay.uvcw-pill--success {
  background: color-mix(in srgb, var(--uvcw-green) 85%, transparent);
}

/* Voyant d'avancement : <span class="uvcw-dot" data-status="todo|partial|done"></span>.
   --halo : auréole de la même couleur (tableau de bord). */
.uvcw-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  color: var(--uvcw-ink-faint);
  background: currentColor;
}

.uvcw-dot--halo {
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* Pastille de couleur d'une catégorie (matière…) : couleur donnée par --dot-color. */
.uvcw-color-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-color, var(--uvcw-ink-muted));
}

.uvcw-dot[data-status='todo'] {
  color: var(--uvcw-status-todo);
}

.uvcw-dot[data-status='partial'] {
  color: var(--uvcw-status-partial);
}

.uvcw-dot[data-status='done'] {
  color: var(--uvcw-status-done);
}

/* Pastille de notification, à poser en haut à droite d'un élément en position relative. */
.uvcw-notify {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--uvcw-red);
  box-shadow: 0 0 0 2px var(--uvcw-bg);
}

/* =========================================================================
   Cadres et listes
   ========================================================================= */

/* Cadre blanc arrondi. --hover : se soulève au survol (carte cliquable). */
.uvcw-card {
  padding: var(--uvcw-space-5) 24px;
  border-radius: var(--uvcw-radius-md);
  color: inherit;
  background: var(--uvcw-surface);
  box-shadow: 0 0 0 1px var(--uvcw-hairline);
}

.uvcw-card--hover {
  transition:
    transform var(--uvcw-duration) var(--uvcw-ease),
    box-shadow var(--uvcw-duration) var(--uvcw-ease);
}

.uvcw-card--hover:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--uvcw-hairline),
    var(--uvcw-shadow-hover);
}

/* Lignes séparées par un filet (réglages, liste de liens). */
.uvcw-rows > * + * {
  border-top: 1px solid var(--uvcw-hairline);
}

/* Ligne de réglage : intitulé et explication à gauche, commande à droite. */
.uvcw-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
}

.uvcw-setting > :first-child {
  display: flex;
  flex-direction: column;
}

.uvcw-setting > :first-child span {
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-sm);
}

/* Encadré de message dans la page (résultat d'une action, information) ; --warning : alertes. */
.uvcw-callout {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--uvcw-radius-md);
  background: color-mix(in srgb, var(--uvcw-accent) 10%, var(--uvcw-surface));
  font-size: var(--uvcw-text-md);
}

.uvcw-callout--warning {
  padding: 12px 16px;
  background: color-mix(in srgb, var(--uvcw-warning) 9%, var(--uvcw-surface));
}

/* Barre de progression : <span class="uvcw-progress"><span style="width: 40%"></span></span>. */
.uvcw-progress {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: var(--uvcw-radius-pill);
  background: var(--uvcw-hairline);
}

.uvcw-progress > * {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--uvcw-accent);
}

/* Chiffres clés (tableau de bord) : <dl class="uvcw-stats"><div><dt>Photos</dt><dd>132</dd></div>…</dl>. */
.uvcw-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0;
}

.uvcw-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.uvcw-stats dt {
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.uvcw-stats dd {
  margin: 0;
  font-size: var(--uvcw-text-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* État vide (« Aucun résultat ») : centré, sobre. */
.uvcw-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 30svh;
  text-align: center;
}

.uvcw-empty strong {
  font-size: var(--uvcw-text-xl);
}

.uvcw-empty span {
  color: var(--uvcw-ink-muted);
}

/* Icône d'application : carré arrondi de la couleur de l'application, picto blanc.
   --sm : petit rond (raccourcis). <span class="uvcw-app-icon" style="--app-color: #007aff"><svg…/></span> */
.uvcw-app-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--uvcw-radius-panel);
  color: var(--uvcw-on-color);
  background: var(--app-color, var(--uvcw-ink-muted));
}

.uvcw-app-icon--sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* Icône dessinée (image fournie par l'application, `image` dans apps.json) : elle porte son propre fond
   et ses angles. Image carrée, au double de la taille affichée (88 px ou plus) pour les écrans Retina. */
.uvcw-app-icon--image {
  border-radius: 0;
  background: none;
  object-fit: contain;
}

/* Grille de tuiles : colonnes aussi nombreuses que la largeur le permet, sans trou entre groupes
   (un ordre choisi plutôt que des groupes qui coupent la grille). Espacement généreux. */
.uvcw-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  /* Toutes les rangées à la hauteur de la plus haute : un nom sur deux lignes ne décale pas la grille. */
  grid-auto-rows: 1fr;
  gap: var(--uvcw-space-5);
}

/* Tuile : icône et nom. S'utilise avec uvcw-card (--hover si lien).
   <a class="uvcw-card uvcw-card--hover uvcw-tile" href="…">
     <span class="uvcw-app-icon" style="--app-color: …">…</span><strong>Nom</strong>
   </a> */
.uvcw-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--uvcw-space-4);
}

/* Raccourci en pilule (applications récentes) : petite icône ronde et nom. */
.uvcw-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--uvcw-space-2);
}

.uvcw-shortcut {
  display: inline-flex;
  align-items: center;
  gap: var(--uvcw-space-2);
  padding: 6px 14px 6px 6px;
  border-radius: var(--uvcw-radius-pill);
  color: inherit;
  background: var(--uvcw-surface);
  box-shadow: 0 0 0 1px var(--uvcw-hairline);
  font-size: var(--uvcw-text-sm);
  font-weight: 500;
}

/* Photo dans une interface : angles à peine cassés. */
.uvcw-photo {
  display: block;
  border-radius: var(--uvcw-radius-photo);
  object-fit: cover;
}

/* =========================================================================
   Panneaux flottants, fenêtres, messages
   ========================================================================= */

/* Menu ou panneau ancré sous un bouton (position à fixer par l'application). */
.uvcw-menu {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  border-radius: var(--uvcw-radius-panel);
  color: var(--uvcw-ink);
  background: color-mix(in srgb, var(--uvcw-surface) 94%, transparent);
  box-shadow:
    var(--uvcw-shadow-float),
    0 0 0 0.5px var(--uvcw-hairline);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: var(--uvcw-text-md);
}

/* Titre d'un menu (« Ajouter à un album »). */
.uvcw-menu__heading {
  margin: 4px 10px 6px;
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Ligne de menu sans action (« Aucune matière », attente). */
.uvcw-menu__note {
  margin: 0;
  padding: 8px 10px;
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-sm);
}

.uvcw-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--uvcw-radius-sm);
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.uvcw-menu__item {
  width: 100%;
}

.uvcw-menu__item:hover,
.uvcw-menu__item:focus-visible,
.uvcw-menu__item[aria-selected='true'],
.uvcw-menu__item[aria-checked='true'] {
  background: color-mix(in srgb, var(--uvcw-ink) 8%, transparent);
  outline: none;
}

/* Nombre ou précision à droite d'une ligne de menu. */
.uvcw-menu__item small {
  margin-left: auto;
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-xs);
  font-variant-numeric: tabular-nums;
}

/* Case à cocher d'une ligne de menu (albums contenant la photo) ; --checked : cochée. */
.uvcw-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: var(--uvcw-radius-sm);
  color: var(--uvcw-ink-muted);
  box-shadow: inset 0 0 0 1px var(--uvcw-hairline);
}

.uvcw-check--checked {
  color: var(--uvcw-accent-contrast);
  background: var(--uvcw-accent);
  box-shadow: none;
}

.uvcw-menu__item svg {
  color: var(--uvcw-ink-muted);
}

.uvcw-menu__separator {
  height: 1px;
  margin: 4px 0;
  border: 0;
  background: var(--uvcw-hairline);
}

/* Fenêtre modale : voile léger, cadre blanc, pied avec Annuler / Valider à droite. */
.uvcw-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: start center;
  padding: calc(var(--uvcw-topbar-height) + 60px) 16px 16px;
  background: color-mix(in srgb, var(--uvcw-black) 18%, transparent);
}

.uvcw-dialog {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 460px);
  padding: 20px 22px 18px;
  border-radius: var(--uvcw-radius-md);
  color: var(--uvcw-ink);
  background: var(--uvcw-surface);
  box-shadow:
    var(--uvcw-shadow-float),
    0 0 0 0.5px var(--uvcw-hairline);
  animation: uvcw-rise 0.18s var(--uvcw-ease);
}

.uvcw-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.uvcw-dialog__head h2 {
  margin: 0;
  font-size: var(--uvcw-text-lg);
  font-weight: 600;
}

.uvcw-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Fiche en pleine page (ajout, modification) : à la place d'une fenêtre pour un long formulaire.
   Rubriques en cartes, titre à gauche et champs sur deux colonnes à droite ; actions à la fin, à droite
   (même rangée que .uvcw-dialog__foot : « Annuler » puis l'action principale).
   <form class="uvcw-form-page">
     <header class="uvcw-head">…titre…</header>
     <section class="uvcw-form-section">
       <div class="uvcw-form-section__title"><h3>Identité</h3><p>…</p></div>
       <div class="uvcw-form-section__fields"><label class="uvcw-label">…</label>
         <label class="uvcw-label uvcw-form-wide">…</label></div>
     </section>
     <div class="uvcw-form-actions">…boutons…</div>
   </form> */
.uvcw-form-page {
  display: flex;
  flex-direction: column;
  gap: var(--uvcw-space-4);
}

.uvcw-form-section {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: var(--uvcw-space-5) var(--uvcw-space-6);
  padding: var(--uvcw-space-5) 24px;
  border-radius: var(--uvcw-radius-md);
  background: var(--uvcw-surface);
  box-shadow: 0 0 0 1px var(--uvcw-hairline);
}

.uvcw-form-section__title h3 {
  margin: 0;
  font-size: var(--uvcw-text-md);
  font-weight: 600;
}

.uvcw-form-section__title p {
  margin: var(--uvcw-space-1) 0 0;
  color: var(--uvcw-ink-muted);
  font-size: var(--uvcw-text-sm);
}

.uvcw-form-section__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--uvcw-space-4) var(--uvcw-space-5);
  align-content: start;
}

.uvcw-form-wide {
  grid-column: 1 / -1;
}

/* Actions du formulaire : simple rangée à droite, sans cadre. */
.uvcw-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--uvcw-space-2);
  margin-top: var(--uvcw-space-2);
}

/* Message ou action à gauche de la rangée (erreur générale, « Supprimer »). */
.uvcw-form-actions > :first-child:not(:last-child) {
  margin-right: auto;
}

@media (max-width: 720px) {
  .uvcw-form-section,
  .uvcw-form-section__fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Message bref de confirmation (« Lien copié »), en bas au centre de l'écran. */
.uvcw-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 110;
  translate: -50% 0;
  padding: 9px 16px;
  border-radius: var(--uvcw-radius-pill);
  color: var(--uvcw-accent-contrast);
  background: var(--uvcw-accent);
  box-shadow: var(--uvcw-shadow-float);
  font-size: var(--uvcw-text-sm);
  font-weight: 600;
  animation: uvcw-rise 0.2s var(--uvcw-ease);
}

@keyframes uvcw-rise {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

/* =========================================================================
   Utilisateurs dans un rond (avatar), indicateur d'attente
   Composants Web équivalents dans uvcw-ui.js : <uvcw-avatar>, <uvcw-spinner>.
   ========================================================================= */

/* Photo de profil, sinon initiales sur une teinte propre à la personne (--hue, de 0 à 360). */
.uvcw-avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--size, 28px);
  height: var(--size, 28px);
  overflow: hidden;
  border-radius: 50%;
  /* stylelint-disable-next-line function-disallowed-list -- teinte propre à chaque personne (--hue) */
  color: hsl(var(--hue, 210) 35% 32%);
  /* stylelint-disable-next-line function-disallowed-list -- teinte propre à chaque personne (--hue) */
  background: hsl(var(--hue, 210) 45% 88%);
  box-shadow: 0 0 0 2px var(--uvcw-surface);
  font-size: calc(var(--size, 28px) * 0.38);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.uvcw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* « +3 » au bout d'une rangée de ronds. */
.uvcw-avatar--more {
  color: var(--uvcw-ink-muted);
  background: var(--uvcw-bg);
}

/* Ronds qui se chevauchent (créateur puis membres d'un partage). */
.uvcw-avatar-stack {
  display: inline-flex;
  align-items: center;
}

.uvcw-avatar-stack > * + * {
  margin-left: -5px;
}

/* Mode sombre, en réserve (data-theme="dark"). */
:root[data-theme='dark'] .uvcw-avatar {
  /* stylelint-disable-next-line function-disallowed-list -- teinte propre à chaque personne (--hue) */
  color: hsl(var(--hue, 210) 45% 85%);
  /* stylelint-disable-next-line function-disallowed-list -- teinte propre à chaque personne (--hue) */
  background: hsl(var(--hue, 210) 25% 30%);
}

/* « +3 » : gris neutre dans les deux modes (après les teintes sombres, qui l'emporteraient sinon). */
:root[data-theme='dark'] .uvcw-avatar--more {
  color: var(--uvcw-ink-muted);
  background: var(--uvcw-bg);
}

/* Indicateur d'attente : douze rayons qui tournent par crans (dans l'esprit de macOS).
   <span class="uvcw-spinner" role="status" aria-label="Chargement"><svg…/></span> ou <uvcw-spinner>. */
.uvcw-spinner {
  display: inline-block;
  color: var(--uvcw-ink-muted);
}

.uvcw-spinner svg {
  display: block;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  animation: uvcw-spin 0.9s steps(12) infinite;
}

@keyframes uvcw-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================================
   Réduction des animations : tout reste lisible, rien ne bouge.
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .uvcw-btn,
  .uvcw-card--hover,
  .uvcw-toggle,
  .uvcw-toggle::after {
    transition: none;
  }

  .uvcw-card--hover:hover {
    transform: none;
  }

  .uvcw-dialog,
  .uvcw-toast {
    animation: none;
  }

  .uvcw-spinner svg {
    animation: uvcw-pulse 1.6s ease-in-out infinite;
  }

  @keyframes uvcw-pulse {
    50% {
      opacity: 0.4;
    }
  }
}
