/* ===== leketia — styles repris de HomeBoard, bleu roi de la calebasse ===== */
/* Un élément marqué « hidden » est masqué, quel que soit son style d'affichage (grid, flex…). */
[hidden] { display: none !important; }
/* Audited against: UI/UX Pro Max (99 rules), Frontend-Design, Taste-Skill */
/* 0 emojis, staggered reveals, liquid glass, grain texture, spring physics */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Sora:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

/* Les tokens (couleurs, typographie, espacements, ombres, mouvement) sont dans tokens.css, chargé avant ce fichier. */

/* ===== RESET + BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  letter-spacing: -0.01em;
  position: relative;
}

/* Papier froissé, en pur CSS : un relief tiré d'un bruit fractal (SVG feTurbulence) éclairé de biais
   (feDiffuseLighting), posé derrière tout le contenu et fondu dans la couleur du papier. Image calculée une fois. */
body::before {
  content: '';
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='p' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0065 0.0095' numOctaves='5' seed='11' stitchTiles='stitch' result='n'/%3E%3CfeDiffuseLighting in='n' lighting-color='%23ffffff' surfaceScale='3.4' diffuseConstant='1.2'%3E%3CfeDistantLight azimuth='225' elevation='55'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  background-size: 900px 900px;
  mix-blend-mode: multiply;
  opacity: var(--paper-crumple, 0.85);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: soft-light; opacity: 0.55; } }
:root[data-theme="dark"] body::before { mix-blend-mode: soft-light; opacity: 0.55; }

/* Keyboard focus ring (UI/UX Pro Max §1) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ===== REDUCED MOTION (UI/UX Pro Max §7) ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
  letter-spacing: -0.01em; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent-fill); color: var(--on-accent);
  box-shadow: 0 1px 2px rgb(var(--accent-rgb) / 0.15);
}
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgb(var(--accent-rgb) / 0.25); } }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--r-full); width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--r-full); }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: var(--r-full); }
.btn-ghost {
  background: transparent; color: var(--ink-secondary);
  border: 1px solid var(--border-light);
}
@media (hover: hover) and (pointer: fine) { .btn-ghost:hover { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--ink); } }
.btn-danger { background: var(--danger); color: #fff; }
/* Ocre : la seule action d'un écran qui doit attirer l'œil (installer, synchroniser…). Jamais deux par écran. */
.btn-cta { background: var(--highlight); color: var(--on-highlight); font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .btn-cta:hover { background: var(--highlight-hover); } }
.btn-danger:hover { opacity: 0.88; }

/* ===== FORMULAIRES ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.form-group { margin-bottom: var(--s-4); text-align: left; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: var(--s-1);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.form-group input, .form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--r);
  font-size: 14px; font-family: var(--font);
  color: var(--ink);
  background: var(--surface-elevated);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  outline: none;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--ink-muted); }
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.1);
}

/* ===== MAIN APP ===== */
.app { display: none; }
.app.active { display: flex; flex-direction: column; min-height: 100dvh; }

/* ===== NAVBAR (liquid glass + refraction) ===== */
.navbar {
  background: var(--surface-overlay);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  padding: 0 var(--s-6);
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: var(--z-sticky);
  /* Liquid glass inner border */
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 3px rgb(var(--shadow-rgb) / 0.04);
}
.navbar-brand {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: var(--s-2);
  letter-spacing: -0.02em;
}
.navbar-right { display: flex; align-items: center; gap: var(--s-4); }

/* ===== SPACES BAR ===== */
.spaces-bar {
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border-light);
  padding: var(--s-2) 0;
  display: flex; align-items: center;
  overflow: hidden; position: relative;
}
.spaces-bar-scroll {
  display: flex; align-items: center; gap: var(--s-1);
  overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--s-6); flex: 1;
}
.spaces-bar-scroll::-webkit-scrollbar { display: none; }
.space-tab {
  padding: 7px 14px; font-size: 12px; font-weight: 500;
  color: var(--ink-secondary);
  border: none; background: none; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  border-radius: var(--r-full);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.space-tab:hover { background: var(--surface-sunken); color: var(--ink); }
.space-tab.active { background: var(--inverse); color: var(--on-inverse); font-weight: 600; }
.space-tab .count { font-size: 10px; opacity: 0.55; margin-left: 3px; }
.space-tab.active .count { opacity: 1; }
.space-tab-add {
  position: sticky; left: 0;
  padding: 7px 11px; margin-left: var(--s-3);
  color: var(--ink-muted); cursor: pointer;
  border-radius: var(--r-full);
  border: 1px solid var(--border-light);
  background: var(--surface-elevated);
  flex-shrink: 0; z-index: 2;
  box-shadow: 2px 0 6px rgb(var(--paper-rgb) / 0.9);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  /* Touch target ≥44px (UI/UX Pro Max §2) */
  min-width: 44px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.space-tab-add:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.space-tab-add svg { width: 16px; height: 16px; }

/* Réorganisation des onglets (appui long → glisser, souris + tactile) */
.space-tab.dragging {
  opacity: 0.6; transform: translateY(-2px);
  box-shadow: var(--shadow-popover); cursor: grabbing;
}
body.reordering, body.reordering .space-tab { cursor: grabbing; }
body.reordering { user-select: none; -webkit-user-select: none; }
.space-drop-indicator {
  position: absolute; top: 9px; bottom: 9px; width: 2px;
  background: var(--accent); border-radius: var(--r-full);
  pointer-events: none; z-index: 3;
  transition: left var(--dur-fast) var(--ease-out);
}

/* ===== TOOLBAR ===== */
.toolbar { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-2); padding: var(--s-3) var(--s-6); overflow: hidden; }
.type-bar { display: flex; align-items: center; gap: var(--s-1); overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; width: 100%; min-width: 0; }
.type-bar::-webkit-scrollbar { display: none; }
.type-more-btn { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--border-light); border-radius: var(--r-full); background: var(--surface-elevated); color: var(--ink-secondary); cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.type-more-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.type-more-btn svg { width: 16px; height: 16px; }
.filter-chip {
  padding: 8px 14px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 500; flex-shrink: 0;
  border: 1px solid var(--border-light);
  background: var(--surface-elevated); cursor: pointer;
  color: var(--ink-secondary);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  /* Touch target */
  min-height: 40px;
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--ink); }
.filter-chip.active { background: var(--inverse); color: var(--on-inverse); border-color: var(--inverse); }

/* Tag perso : bouton × de retrait, dans la puce */
.tag-remove {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 5px; margin-right: -3px;
  width: 18px; height: 18px; border-radius: var(--r-full);
  font-size: 15px; line-height: 1; opacity: 0.6;
  transition: opacity var(--dur-fast), background var(--dur-fast);
}
.tag-remove:hover { opacity: 1; background: var(--surface-sunken); }
.filter-chip.active .tag-remove:hover { background: rgba(255,255,255,0.22); }
/* Champ inline de création d'un tag perso */
.tag-input {
  flex-shrink: 0; min-height: 40px; width: 150px;
  padding: 8px 14px; border-radius: var(--r-full);
  border: 1px solid var(--accent);
  background: var(--surface-elevated); color: var(--ink);
  font-size: 11px; font-weight: 500; font-family: var(--font);
  outline: none; box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.1);
}
.tag-input::placeholder { color: var(--ink-muted); }

/* ===== FAB (bouton flottant d'ajout) ===== */
.fab {
  position: fixed; right: var(--s-6);
  bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-sticky); width: 56px; height: 56px;
  border: none; border-radius: var(--r-full);
  background: var(--accent-fill); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 4px 14px rgb(var(--accent-rgb) / 0.32), 0 2px 6px rgba(0,0,0,0.12);
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgb(var(--accent-rgb) / 0.40), 0 3px 8px rgba(0,0,0,0.14); }
.fab:active { transform: scale(0.94); }
.fab:focus-visible { outline: none; box-shadow: 0 4px 14px rgb(var(--accent-rgb) / 0.32), 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }

/* ===== CONTENT + MASONRY ===== */
.content-area { flex: 1; padding: var(--s-3) var(--s-6) calc(var(--s-16) + var(--s-6) + env(safe-area-inset-bottom, 0px)); }

.masonry {
  column-count: 5;
  column-gap: var(--s-4);
}
@media (max-width: 1400px) { .masonry { column-count: 4; } }
@media (max-width: 1100px) { .masonry { column-count: 3; } }
@media (max-width: 750px) { .masonry { column-count: 2; } }

/* Staggered card reveal (taste-skill §4: stagger 30ms) */
.card {
  break-inside: avoid;
  margin-bottom: var(--s-4);
  background: var(--surface-elevated);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer; position: relative;
  transition: box-shadow var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);

}
/* Entrée en cascade : au premier affichage seulement (jamais à chaque filtre) */
.masonry.reveal .card {
  opacity: 0; transform: translate(var(--nx, 0px), 12px) rotate(var(--tilt, 0deg));
  animation: cardReveal 300ms var(--ease-out) forwards;
  animation-delay: min(calc(var(--card-index, 0) * 35ms), 350ms);
}
@keyframes cardReveal {
  to { opacity: 1; transform: translate(var(--nx, 0px), 0) rotate(var(--tilt, 0deg)); }
}
@media (hover: hover) and (pointer: fine) {
  .card:hover .card-image { transform: scale(1.04); }
}
.card:active { transform: translate(var(--nx, 0px), 0) rotate(var(--tilt, 0deg)) scale(0.99); }

.card-image-wrap {
  position: relative; width: 100%;
  background: var(--surface-sunken); overflow: hidden;
}
.card-image, .card-video {
  width: 100%; display: block;
  max-height: 420px; object-fit: cover;
}
.card-image { transition: transform 300ms var(--ease-out); }
.card-video { background: #000; max-height: 480px; }
/* Facade "play" : lecteur intégré sans miniature (remplace l'ancienne zone grise) */
.card-play-facade {
  width: 100%; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.card-play-facade svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35)); }

/* Type badge */
.card-type-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--surface-overlay);
  backdrop-filter: blur(6px);
  border-radius: var(--r-sm); padding: 3px 7px;
  font-size: 10px; font-weight: 600;
  color: var(--ink-secondary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  display: flex; align-items: center; gap: 3px;
}
.card-type-badge svg { width: 11px; height: 11px; opacity: 0.7; }

.card-body { padding: var(--s-3) var(--s-4) var(--s-4); }
.card-body .space-label {
  font-size: 10px; font-weight: 600; color: var(--ink-muted);
  margin-bottom: var(--s-1);
  letter-spacing: 0.02em; text-transform: uppercase;
}
.card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  line-height: 1.25; margin-bottom: 2px;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 12px; color: var(--ink-secondary);
  margin-bottom: var(--s-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.35;
}
.card-price {
  font-size: 15px; font-weight: 700; color: var(--ink);
  margin-bottom: var(--s-2);
  letter-spacing: -0.02em;
}
.card-footer { display: flex; align-items: center; justify-content: space-between; }

/* Status pills */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 10px; font-weight: 600;
}
.status-pill::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; display: inline-block;
}
.status-a-voir { background: var(--surface-sunken); color: var(--ink-secondary); }
.status-a-voir::before { background: var(--ink-muted); }
.status-vu { background: var(--info-soft); color: var(--info); }
.status-vu::before { background: var(--info); }
.status-favori { background: var(--accent-soft); color: var(--accent); }
.status-favori::before { background: var(--accent); }
.card-buyer { font-size: 10px; color: var(--ink-muted); font-weight: 500; }

/* Card menu (aria-label + touch target ≥44px) */
.card-menu-btn {
  position: absolute; top: 8px; right: 8px;
  width: 36px; height: 36px;
  border-radius: var(--r);
  background: var(--surface-overlay);
  backdrop-filter: blur(6px);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-secondary);
  opacity: 0; transition: opacity var(--dur-fast), background var(--dur-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@media (hover: hover) and (pointer: fine) { .card:hover .card-menu-btn { opacity: 1; } }
/* Au doigt il n'y a pas de survol : le bouton reste visible */
@media (hover: none) { .card-menu-btn { opacity: 1; } }
.card-menu-btn:focus-visible { opacity: 1; }
.card-menu-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.card-menu-btn svg { width: 16px; height: 16px; }

/* Actions dropdown */
.actions-dropdown {
  position: absolute; top: 46px; right: 8px;
  background: var(--surface-elevated);
  border-radius: var(--r-md); box-shadow: var(--shadow-popover);
  min-width: 190px; z-index: var(--z-dropdown);
  border: 1px solid var(--border-light);
  overflow: hidden; display: none;
  animation: scaleIn 0.12s var(--ease-out);
  transform-origin: top right;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.actions-dropdown.active { display: block; }
.actions-dropdown button {
  display: block; width: 100%; padding: 9px 14px; text-align: left;
  font-size: 12px; font-weight: 500; font-family: var(--font);
  border: none; background: none; cursor: pointer; color: var(--ink);
  transition: background var(--dur-fast);
}
.actions-dropdown button:hover { background: var(--surface-sunken); }
.actions-dropdown button.danger { color: var(--danger); }
.actions-dropdown button.danger:hover { background: var(--danger-soft); }
.actions-dropdown .divider { height: 1px; background: var(--border-light); margin: 3px 0; }

/* ===== MODAL (with close button + escape) ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface-elevated);
  border-radius: var(--r-xl); padding: var(--s-8);
  width: 100%; max-width: 500px;
  max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-dialog);
  animation: fadeUp 0.2s var(--ease-out);
  position: relative;
  border: 1px solid var(--border-light);
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: var(--r-sm); border: none;
  background: var(--surface-sunken); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-secondary);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.modal-close::before { content: ""; position: absolute; inset: -6px; }
@media (hover: hover) and (pointer: fine) { .modal-close:hover { background: var(--border-light); color: var(--ink); } }
.modal-close svg { width: 16px; height: 16px; }
.modal h2 {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-5); color: var(--ink);
  padding-right: var(--s-8);
}
.modal-tabs {
  display: flex; gap: var(--s-1); margin-bottom: var(--s-5);
  background: var(--surface-sunken); border-radius: var(--r); padding: 3px;
}
.modal-tab {
  flex: 1; padding: 8px 14px; text-align: center;
  font-size: 12px; font-weight: 500; font-family: var(--font);
  border: none; background: none; cursor: pointer;
  color: var(--ink-secondary); border-radius: var(--r-sm);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.modal-tab.active {
  background: var(--surface-elevated); color: var(--ink);
  font-weight: 600; box-shadow: var(--shadow-card);
}
.modal-body { margin-bottom: var(--s-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-2); }
.link-preview {
  border: 1px solid var(--border-light); border-radius: var(--r-md);
  padding: var(--s-3); margin-bottom: var(--s-4);
  text-align: center; background: var(--surface-sunken);
}
.link-preview img { max-width: 100%; max-height: 170px; border-radius: var(--r-sm); }
.link-preview .desc { font-size: 12px; color: var(--ink-secondary); margin-top: 5px; }
.link-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-4); }
.file-input-wrapper {
  border: 2px dashed var(--border-light);
  border-radius: var(--r-md); padding: var(--s-8) var(--s-4);
  text-align: center; cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  background: var(--surface-sunken); margin-bottom: var(--s-4);
}
.file-input-wrapper:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-input-wrapper input[type=file] { display: none; }
.file-input-wrapper .icon svg { width: 28px; height: 28px; margin: 0 auto var(--s-2); color: var(--ink-muted); }
.file-input-wrapper p { font-size: 13px; color: var(--ink-secondary); font-weight: 500; }
#photoPreview img { max-width: 100%; max-height: 200px; border-radius: var(--r); margin-bottom: var(--s-4); }

/* ===== EMPTY STATE (designed illustration-style) ===== */
.empty-state {
  column-span: all;
  text-align: center; padding: var(--s-16) var(--s-6);
  color: var(--ink-secondary);
}
.empty-state .illustration {
  width: 80px; height: 80px; margin: 0 auto var(--s-5);
  background: var(--accent-soft);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .illustration svg { width: 36px; height: 36px; color: var(--accent); }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  color: var(--ink); margin-bottom: var(--s-1);
}
.empty-state p { font-size: 14px; margin-bottom: var(--s-5); }
.empty-state .btn { margin: 0 auto; }

/* ===== CONFIRMATION DIALOG (designed, replaces confirm()) ===== */
.confirm-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  z-index: calc(var(--z-modal) + 10);
  align-items: center; justify-content: center;
}
.confirm-overlay.active { display: flex; }
.confirm-dialog {
  background: var(--surface-elevated);
  border-radius: var(--r-xl); padding: var(--s-8);
  max-width: 360px; width: 90%;
  box-shadow: var(--shadow-dialog);
  text-align: center;
  animation: popIn 160ms var(--ease-out);
  border: 1px solid var(--border-light);
}
.confirm-dialog p {
  margin-bottom: var(--s-5); font-size: 15px;
  color: var(--ink); font-weight: 400; text-align: left;
  line-height: 1.5;
}
.confirm-dialog .btns { display: flex; gap: var(--s-2); justify-content: center; }
.confirm-dialog .btns .btn { flex: 1; min-height: 44px; font-size: 14px; }
@keyframes popIn { from { opacity: 0; transform: scale(0.96); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
.modal-overlay.active, .confirm-overlay.active { animation: fadeIn 200ms var(--ease-out); }

/* ===== TOAST (aria-live region) ===== */
.toast-container {
  position: fixed; bottom: calc(var(--s-6) + 64px + env(safe-area-inset-bottom, 0px)); right: var(--s-6);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: var(--r);
  font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-popover);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  max-width: 320px; pointer-events: auto;
}
.toast-success { background: var(--inverse); color: var(--on-inverse); }
.toast-error { background: var(--danger); color: white; }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }

/* ===== SKELETON ===== */
.skeleton-card {
  break-inside: avoid; margin-bottom: var(--s-4);
  border-radius: var(--r-lg);
  background: var(--border-light);
  aspect-ratio: 3/4;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0% { opacity: 0.45; }
  50% { opacity: 0.9; }
  100% { opacity: 0.45; }
}
.spinner { /* chargement : les 7 bits du « l » de leket (1101100) qui respirent */
  display: inline-block; width: 53px; height: 5px; vertical-align: middle;
  background: linear-gradient(var(--accent) 0 0) 0px 0 / 5px 5px no-repeat,
    linear-gradient(var(--accent) 0 0) 8px 0 / 5px 5px no-repeat,
    linear-gradient(rgb(var(--accent-rgb) / 0.18) 0 0) 16px 0 / 5px 5px no-repeat,
    linear-gradient(var(--accent) 0 0) 24px 0 / 5px 5px no-repeat,
    linear-gradient(var(--accent) 0 0) 32px 0 / 5px 5px no-repeat,
    linear-gradient(rgb(var(--accent-rgb) / 0.18) 0 0) 40px 0 / 5px 5px no-repeat,
    linear-gradient(rgb(var(--accent-rgb) / 0.18) 0 0) 48px 0 / 5px 5px no-repeat;
  animation: bits 600ms linear infinite alternate;
}
@keyframes bits { from { opacity: .35; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ===== LECTEUR INTÉGRÉ (embed badge + lightbox) ===== */
.embed-badge {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px 4px 6px; border-radius: var(--r-full);
  background: rgba(0,0,0,0.72); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 1;
  text-transform: capitalize; backdrop-filter: blur(4px);
  pointer-events: none;
}
.embed-badge svg { flex: none; }
.embed-badge-tiktok   { background: rgba(0,0,0,0.82); }
.embed-badge-instagram{ background: linear-gradient(135deg,#f09433,#e6683c 30%,#dc2743 55%,#cc2366 75%,#bc1888); }
.embed-badge-twitter  { background: #000; }
.embed-badge-youtube  { background: #c00; }
.embed-badge-pinterest{ background: #bd081c; }
.card.is-embeddable { cursor: pointer; }
.card.is-embeddable .card-image-wrap::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.12), transparent 60%);
  opacity: 0; transition: opacity var(--dur) var(--ease-out); pointer-events: none;
}
.card.is-embeddable:hover .card-image-wrap::after { opacity: 1; }

.embed-overlay { background: rgba(0,0,0,0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 16px; }
.embed-shell { display: flex; flex-direction: column; width: 100%; max-width: 440px; max-height: 94dvh; }
.embed-header { display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; color: #fff; }
.embed-title { flex: 1; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.embed-open { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.embed-open:hover { color: #fff; }
.embed-close {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: var(--r-full);
  background: rgba(255,255,255,0.15); color: #fff; font-size: 15px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.embed-close:hover { background: rgba(255,255,255,0.28); }
.embed-box {
  position: relative; width: 100%; background: #000;
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-dialog);
}
.embed-box iframe { display: block; width: 100%; border: 0; }
/* Formats verticaux (TikTok, Reels, posts, tweets) */
.embed-tiktok iframe, .embed-instagram iframe, .embed-twitter iframe, .embed-pinterest iframe { height: 74dvh; }
/* YouTube : 16:9 */
.embed-youtube { aspect-ratio: 16 / 9; }
.embed-youtube iframe { height: 100%; }

/* ===== Catégories multiples (chips de sélection) ===== */
/* .cat-check est un <label> dans .form-group : on scope sous .cat-checks pour
   l'emporter sur `.form-group label` (display/font-weight/margin). */
.cat-checks { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.cat-checks .cat-check {
  position: relative; margin: 0;
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--border-light); border-radius: var(--r-full);
  background: var(--surface-elevated); color: var(--ink-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer; user-select: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.cat-checks .cat-check:hover { border-color: var(--border-strong); color: var(--ink); }
/* Case native masquée mais présente (a11y + getCheckedCats via input:checked) */
.cat-checks .cat-check input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
/* Coche repliée hors sélection, révélée à la sélection (sans saut de texte) */
.cat-checks .cat-check svg {
  flex: none; width: 0; height: 14px; opacity: 0; transform: scale(0.6);
  transition: width var(--dur-fast) var(--ease-out), margin-right var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
/* Sélectionné */
.cat-checks .cat-check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cat-checks .cat-check:has(input:checked) svg { width: 14px; margin-right: 5px; opacity: 1; transform: scale(1); }
.cat-checks .cat-check:has(input:checked):hover { background: var(--accent-light); }
/* Focus clavier (le focus porte sur l'input masqué) */
.cat-checks .cat-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { color: var(--ink-muted); font-weight: 400; font-size: 11px; }

/* Puces catégories sur la carte */
.card-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.cat-chip {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--ink-secondary); background: var(--surface-sunken); padding: 2px 7px; border-radius: var(--r-sm);
}

/* Badge vidéo + lightbox média local */
.embed-badge-video { background: rgba(0,0,0,0.78); }
.embed-video video { width: 100%; max-height: 82dvh; display: block; background: #000; }
/* Photo locale : ratio libre (souvent paysage) alors que .embed-shell est calibré pour le
   portrait des embeds (440px). On élargit le shell pour elle seule, et la boîte s'ajuste à
   l'image (width:auto + align-self) plutôt que d'imposer 100% : paysage large, portrait sans
   bandes noires. La hauteur reste bornée à 82dvh comme la vidéo. */
.embed-shell:has(.embed-image) { max-width: 880px; }
.embed-image { width: auto; align-self: center; max-width: 100%; }
.embed-image img { display: block; max-width: 100%; max-height: 82dvh; }

/* Onglet + cartes corbeille */
.space-tab-trash { opacity: 0.9; }
.trash-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; flex-wrap: wrap; }
.trash-note { font-size: 11px; color: var(--ink-muted); margin-right: auto; }

/* ===== leketia : marque, sauvegarde ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.brand-mark { display: inline-flex; width: 26px; height: 26px; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.empty-state .illustration svg { width: 44px; height: 44px; }

.backup-btn { position: relative; min-height: 40px; }
.backup-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--highlight); margin-left: 2px; }
.backup-btn.needs-backup { border-color: var(--accent); color: var(--accent); }
.backup-btn.needs-backup .backup-dot { display: inline-block; }
.backup-status { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: var(--s-2); }
.backup-status.is-stale { color: var(--accent-hover); }
.backup-explain { font-size: 13px; color: var(--ink-secondary); line-height: 1.5; margin-bottom: var(--s-5); }
.backup-actions { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-2); }
.backup-actions .btn, .backup-import { min-height: 44px; width: 100%; }
.backup-action:disabled { opacity: 0.45; cursor: progress; }
.backup-sep { border: 0; border-top: 1px solid var(--border-light); margin: var(--s-5) 0 var(--s-4); }
.backup-import { cursor: pointer; }
.backup-import:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-group select {
  width: 100%; padding: 10px 14px; min-height: 44px;
  border: 1px solid var(--border-light); border-radius: var(--r);
  font-size: 14px; font-family: var(--font); color: var(--ink);
  background: var(--surface-elevated);
}
.form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.1); outline: none; }

/* ===== Mise en page leketia : moderne et épurée (revue emil-design-eng) =====
   Une seule couleur d'accent, du blanc cassé, des traits fins. Moins de cadres, plus d'air. */

.navbar {
  height: 64px; padding: 0 var(--s-6);
  background: rgb(var(--paper-rgb) / 0.86); box-shadow: none; border-bottom: 0;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.navbar-brand { font-size: 21px; font-weight: 700; gap: 10px; letter-spacing: -0.035em; }
.navbar-brand .brand-mark { width: 48px; height: 48px; display: block; margin: 0 -2px; }
.backup-btn { border-radius: var(--r-full); background: var(--surface-elevated); }

/* Collections : des onglets texte soulignés, sans pastilles */
.spaces-bar { background: transparent; border-bottom: 1px solid var(--border-light); padding: 0; }
.spaces-bar-scroll { gap: var(--s-6); padding: 0 var(--s-6) 0 var(--s-3); }
.space-tab {
  position: relative; border-radius: 0; padding: 14px 0 13px; background: none;
  font-size: 14px; font-weight: 500; color: var(--ink-muted);
}
.space-tab::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--ink); border-radius: 2px; transform: scaleX(0);
  transition: transform 200ms var(--ease-out);
}
.space-tab.active { background: none; color: var(--ink); font-weight: 600; }
.space-tab.active::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) { .space-tab:hover { background: none; color: var(--ink); } }
.space-tab .count { font-size: 12px; font-weight: 500; opacity: 1; color: var(--ink-muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.space-tab-trash { margin-left: auto; }
.space-tab-add { margin-left: var(--s-5); min-height: 32px; min-width: 32px; padding: 0; box-shadow: none; background: transparent; }

/* Filtres : petites pastilles discrètes */
.toolbar { padding: var(--s-4) var(--s-6) var(--s-2); }
.filter-chip { min-height: 32px; padding: 6px 12px; font-size: 12px; background: transparent; }

.type-more-btn { width: 32px; height: 32px; background: transparent; }

/* Cartes : l'image d'abord, un texte court dessous, un contour d'un pixel au lieu d'une ombre */
.content-area { padding-top: var(--s-2); }
.masonry { column-gap: var(--s-5); }
.card {
  margin-bottom: var(--s-5); border-radius: 16px;
  box-shadow: 0 0 0 1px var(--border-light);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--border-strong), 0 12px 28px -12px rgb(var(--shadow-rgb) / 0.22); }
  .card:hover .card-image { transform: scale(1.03); }
}
.card-body { padding: var(--s-3) var(--s-4) var(--s-4); }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--ink-muted); margin-bottom: var(--s-3); }
.card-footer { margin-top: 0; }
.status-pill { padding: 0; background: none; font-size: 11px; font-weight: 500; color: var(--ink-muted); }
.cat-chip { background: var(--accent-soft); color: var(--accent); text-transform: none; font-size: 11px; letter-spacing: 0; }

/* Bouton d'ajout : le bleu roi de la calebasse, appui franc */
.fab { width: 60px; height: 60px; box-shadow: 0 10px 24px -8px rgb(var(--accent-rgb) / 0.55); }

/* État vide : le logo, sans cadre */
.empty-state .illustration { width: auto; height: auto; background: none; margin-bottom: var(--s-4); }
.empty-state .illustration img { width: 96px; height: 96px; display: block; margin: 0 auto; }
.empty-state h3 { font-family: var(--font-display); font-weight: 800; font-size: var(--text-2xl); line-height: 1.1; letter-spacing: -0.035em; text-wrap: balance; }

/* Fenêtres : coins plus doux, en feuille depuis le bas sur téléphone */
.modal { border-radius: 20px; }
@media (max-width: 640px) {
  .modal-overlay:not(.embed-overlay) { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: none; border-radius: 20px 20px 0 0; padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 0px)); animation: sheetUp 280ms cubic-bezier(0.32, 0.72, 0, 1); }
  .navbar, .toolbar { padding-left: var(--s-4); padding-right: var(--s-4); }
  .spaces-bar-scroll { padding-right: var(--s-4); }
  .content-area { padding-left: var(--s-3); padding-right: var(--s-3); }
  .masonry { column-gap: var(--s-3); }
  .card { margin-bottom: var(--s-3); }
}

/* ===== Installation (protocole repris de l'app de la Biennale) =====
   Registre « réglage du téléphone » : gris système, coins arrondis, cibles de 44 px. */
.install-banniere { position: sticky; top: 64px; z-index: calc(var(--z-sticky) - 1); display: grid; gap: 8px;
  padding: 8px var(--s-4); background: var(--surface-sunken); border-bottom: 1px solid var(--border-light); color: var(--ink); }
.install-ligne { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px; }
.install-bouton { grid-column: 2; width: 100%; min-height: 44px; border-radius: 12px; background: var(--surface-elevated);
  color: var(--ink); border: 1px solid var(--border-strong); font-size: 14px; font-weight: 600; }
.install-bouton { animation: install-rebond 900ms ease-in-out 600ms 3; }
@keyframes install-rebond { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-7px); } 55% { transform: translateY(0); } 75% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .install-bouton { animation: none; } }
.install-fermer { grid-column: 3; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-secondary); cursor: pointer; }
.install-rappel, .install-fait { margin: 0; font-size: 13px; text-align: center; }
.install-deja { justify-self: center; min-height: 32px; padding: 0 8px; border: 0; background: none; color: var(--ink-secondary); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.share-hint { margin: -6px 0 var(--s-4); line-height: 1.45; }

/* Guide à étapes : fenêtre blanche, une étape par vue ; le geste à faire est cerclé. */
/* Guide d'installation : imite l'interface du téléphone (iOS, Android), donc toujours en clair, hors tokens. */
.gi { color-scheme: light; width: min(100%, 480px); max-width: 100%; max-height: 100dvh; margin: auto auto 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  border: 0; border-radius: 20px 20px 0 0; background: #fff; color: #000; }
.gi::backdrop { background: rgba(0,0,0,0.35); }
.gi-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.gi-tete h2 { margin: 0; font-family: var(--font-display); font-size: 18px; }
.gi-fermer { position: static; flex: none; }
.gi-nav { margin: 2px 0 0; color: var(--ink-secondary); font-size: 13px; }
.gi-compte { margin: 14px 0 6px; font-size: 13px; font-weight: 700; }
.gi-points { display: flex; gap: 6px; margin-bottom: 16px; }
.gi-points i { flex: 1; height: 4px; border-radius: 2px; background: #ddd; }
.gi-points i.is-on { background: var(--accent); }
.gi-etape { display: grid; gap: 14px; min-height: 150px; align-content: start; }
.gi-texte { margin: 0; font-size: 1.125rem; line-height: 1.4; font-weight: 600; }
.gi-barre { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #e6e6e6; border-radius: 16px; }
.gi-url { flex: 1; min-width: 0; height: 36px; border-radius: 18px; background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #444; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 10px; }
.gi-rond { width: 40px; height: 40px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #333; }
.gi-url .gi-menu { width: 26px; height: 26px; min-width: 26px; margin-right: 8px; font-size: 16px; }
.gi-ligne { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px;
  background: #f7f7f7; border: 1px solid #ddd; border-radius: 12px; color: #111; }
.gi-cible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gi-bascule { width: 44px; height: 26px; border-radius: 13px; background: #34c759; position: relative; flex: none; }
.gi-bascule::after { content: ""; position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
.gi-extra { display: grid; gap: 10px; }
.gi-extra:empty { display: none; }
.gi-note { margin: 0; font-size: 13px; color: var(--ink-secondary); }
.gi-actions { display: grid; gap: 10px; margin-top: 20px; }
.gi-actions .btn, .gi-extra .btn { width: 100%; min-height: 48px; }

/* Google Drive : sauvegarde cachée et restauration */
.drive-zone { display: grid; gap: var(--s-2); padding-bottom: var(--s-2); }
.drive-zone .hint { margin: -2px 0 var(--s-1); }
.drive-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.drive-item { width: 100%; min-height: 44px; padding: 8px 14px; text-align: left; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-elevated); border: 1px solid var(--border-light); border-radius: var(--r); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
.drive-item:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .drive-item:hover { border-color: var(--accent); background: var(--accent-soft); } }
.drive-empty { font-size: 13px; color: var(--ink-secondary); }
.empty-state .empty-restore { margin: var(--s-3) auto 0; display: flex; }
.empty-actions { display: grid; gap: 8px; width: min(100%, 320px); margin: var(--s-4) auto 0; }
.empty-actions .btn { width: 100%; min-height: 44px; margin: 0; justify-content: center; }

/* Fenêtre Sauvegarde : Drive d'abord, la copie en fichier repliée */
.backup-file { margin-top: var(--s-4); border-top: 1px solid var(--border-light); padding-top: var(--s-3); }
.backup-file > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--ink); list-style: none; }
.backup-file > summary::-webkit-details-marker { display: none; }
.backup-file > summary::after { content: '›'; margin-left: auto; font-size: 20px; color: var(--ink-muted); transition: transform var(--dur-fast) var(--ease-out); }
.backup-file[open] > summary::after { transform: rotate(90deg); }
.backup-file .form-group { margin-top: var(--s-2); }
.backup-legal { text-align: center; margin-top: var(--s-3); }

/* ===== Partager ===== */
.share-btn { min-height: 40px; border-radius: var(--r-full); background: var(--surface-elevated); }
@media (max-width: 420px) { .share-btn-label { display: none; } .share-btn { padding: 0 12px; } }
.share-tabs { margin: var(--s-2) 0 var(--s-4); }
.share-pane { display: grid; gap: var(--s-2); min-height: 120px; align-content: start; }
.share-pane .spinner { justify-self: center; margin: var(--s-6) 0; }
/* Fond blanc fixe : un QR code se lit mal sur fond sombre. */
.share-qr { justify-self: center; width: min(100%, 280px, 36dvh); aspect-ratio: 1; background: #fff; border-radius: var(--r); padding: 6px; }
.share-qr svg { width: 100%; height: 100%; display: block; }
.share-note { text-align: center; margin: 0; line-height: 1.45; }
.share-md { margin: 0; max-height: 180px; overflow: auto; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--r);
  font: 12px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.share-pane .btn { width: 100%; min-height: 44px; }

.share-url { justify-self: center; max-width: 100%; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-light); font-weight: 600; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; text-align: center; }
.share-danger { color: var(--danger); }
@media (hover: hover) and (pointer: fine) { .btn-ghost.share-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); } }
.share-tabs .modal-tab { min-height: 44px; padding: 8px 4px; white-space: nowrap; }

/* Synchronisation entre appareils */
.sync-zone { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); padding-bottom: var(--s-4); border-bottom: 1px solid var(--border-light); }
.sync-line { margin: 0; font-size: 14px; color: var(--ink-secondary); line-height: 1.45; }
.sync-line.is-on { color: var(--ink); }
.sync-line.is-on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 8px; vertical-align: 1px; }
.sync-zone .btn { min-height: 44px; justify-content: center; }
.sync-off { color: var(--ink-secondary); }

/* Partage : options de protection */
.share-options { margin: 0 0 var(--s-3); border: 1px solid var(--border-light); border-radius: var(--r); padding: 0 var(--s-3); }
.share-options > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-secondary); list-style: none; }
.share-options > summary::-webkit-details-marker { display: none; }
.share-options[open] { padding-bottom: var(--s-3); }
.share-options input[type="date"] { margin-top: var(--s-2); }

/* Sélection au clic */
.select-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: var(--s-2); width: min(calc(100% - 32px), 520px); padding: 8px 8px 8px 16px;
  background: var(--surface-elevated); border: 1px solid var(--border-light); border-radius: 18px; box-shadow: var(--shadow-dialog);
  animation: popIn 160ms var(--ease-out); }
.select-bar .select-count { flex: 1; font-size: 14px; font-weight: 600; }
.select-bar .btn { min-height: 44px; }
body.selecting .fab, body.selecting .add-fab { display: none; }
body.selecting .card { cursor: pointer; position: relative; }
body.selecting .card::after { content: ""; position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,0.25); box-shadow: 0 1px 3px rgba(0,0,0,0.3); z-index: 3; }
body.selecting .card.is-selected { outline: 3px solid var(--accent); outline-offset: -3px; }
body.selecting .card.is-selected::after { background: var(--accent-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/14px no-repeat; }

/* Synchro en direct */
.sync-btn { min-height: 40px; width: 40px; padding: 0; justify-content: center; border-radius: var(--r-full); }
.sync-btn.is-syncing svg { animation: spin 900ms linear infinite; }
.sync-btn.is-error { color: var(--danger); }
.pull-hint { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; translate: -50% 0; z-index: 70; padding: 6px 14px;
  font-size: 13px; font-weight: 600; background: var(--surface-elevated); border: 1px solid var(--border-light); border-radius: 999px; box-shadow: var(--shadow-card); }
@media (prefers-reduced-motion: reduce) { .sync-btn.is-syncing svg { animation-duration: 2.5s; } }

/* ===== Design system : motif des bits (écran vide) ===== */
.empty-state .bitline { display: flex; justify-content: center; gap: 5px; margin: 14px 0 0; }
.empty-state .bitline i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.empty-state .bitline i.o { opacity: .18; }

/* ===== Cartes épinglées sur le papier =====
   Chaque carte reçoit (dans app.js, d'après son identifiant, donc toujours la même) une légère inclinaison,
   un petit décalage et une couleur d'épingle. Au survol, elle se redresse et se soulève. */
.masonry { padding-top: 10px; }
.card {
  overflow: visible;
  transform: translate(var(--nx, 0px), 0) rotate(var(--tilt, 0deg));
  margin-bottom: calc(var(--s-5) + var(--gap-extra, 0px));
  box-shadow: 0 0 0 1px var(--border-light), 0 2px 4px rgb(var(--shadow-rgb) / 0.06), 0 10px 22px -10px rgb(var(--shadow-rgb) / 0.28);
}
.card .card-image-wrap { border-radius: 16px 16px 0 0; overflow: hidden; }
.card::before { /* l'épingle */
  content: ''; position: absolute; top: -7px; left: 50%; z-index: 4; width: 15px; height: 15px; margin-left: -7.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85) 0 2px, transparent 3px), var(--pin, var(--accent-fill));
  box-shadow: 0 2px 2px rgb(var(--shadow-rgb) / 0.35), 1px 4px 6px rgb(var(--shadow-rgb) / 0.2);
}
.card[data-pin="1"] { --pin: var(--navy); }
.card[data-pin="2"] { --pin: #ffffff; }
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translate(var(--nx, 0px), -4px) rotate(0deg);
    box-shadow: 0 0 0 1px var(--border-strong), 0 4px 8px rgb(var(--shadow-rgb) / 0.08), 0 22px 38px -16px rgb(var(--shadow-rgb) / 0.34); }
}
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; } }
