:root {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-soft: #141821;
  --card: #171a21;
  --line: #262b36;
  --fg: #e7e9ee;
  --muted: #8b93a3;
  --accent: #6ea8fe;
  --accent-strong: #4d8dfb;
  --danger: #f0717a;
  --radius: 14px;
  --maxw: 460px;
  /* Surfaces enfoncées (champs, puces) — variabilisées pour le thème clair */
  --inset: #11141b;
  --chip: #20242e;
  /* Accents dérivés (suivent la palette caméléon via color-mix) :
     --accent-ink  = accent utilisé comme TEXTE/icône (assez foncé pour le contraste)
     --accent-soft = fond teinté léger (puces, halos)
     --accent-line = bordure teintée
     --on-accent   = texte posé SUR un fond accent (pastel) */
  --accent-ink: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 42%, transparent);
  --on-accent: #0b0d12;
  /* Vert sémantique (statuts « en ligne / public / ami / libre / ok ») */
  --success: #7fdca0;
}

/* Mode clair — bascule via data-theme="light" sur <html> */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-soft: #eef1f7;
  --card: #ffffff;
  --line: #dce1ea;
  --fg: #1b2030;
  --muted: #5d6675;
  --danger: #d6454e;
  --inset: #f1f4f9;
  --chip: #e9edf4;
  /* En clair, on assombrit l'accent pour le texte (les pastels passent ~2.3:1
     sur blanc → illisibles). Mix vers un encre sombre → contraste ≥ 4.5:1
     tout en gardant la teinte choisie (suit la palette caméléon). */
  --accent-ink: color-mix(in srgb, var(--accent) 52%, #131a2b);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, #ffffff);
  --accent-line: color-mix(in srgb, var(--accent) 50%, #ffffff);
  /* Le vert pastel sombre devient illisible sur blanc → vert profond (≈5:1). */
  --success: #0e7048;
}

* { box-sizing: border-box; }

html, body { overflow-x: hidden; max-width: 100%; } /* garde-fou : rien ne dépasse horizontalement */

/* Bannière BETA */
#beta-banner {
  flex: none; display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
  border-bottom: 1px solid var(--line); color: var(--fg);
  font-size: .82rem; padding: .4rem 2.2rem .4rem 1rem; position: relative; text-align: center;
}
#beta-banner strong { color: var(--accent-ink); letter-spacing: .04em; }
#beta-banner.hidden { display: none; }
#beta-close { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: .2rem .4rem; }
#beta-close:hover { color: var(--fg); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent-ink); }

#app { width: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; }
#app[data-view="profile"], #app[data-view="private"] { justify-content: center; }

/* ============================== Mascotte Milo ============================== */
.milo { display: block; overflow: visible; }
.milo-body { fill: #43b58f; stroke: #2c7d63; stroke-width: 2.5; }
.milo-head { fill: #50c79c; stroke: #2c7d63; stroke-width: 2.5; }
.milo-belly { fill: #7fdcc0; }
.milo-crest { stroke: var(--accent); stroke-width: 4; fill: none; }
.milo-cheek { fill: var(--accent); opacity: .3; }
.milo-eyeball { fill: #f4f8ff; }
.milo-iris { fill: var(--accent); }
.milo-pupil { fill: #10141d; }
.milo-shine { fill: #ffffff; }
.milo-mouth { stroke: #1f5546; stroke-width: 3; fill: none; }
.milo-leg { stroke: #3aa17e; stroke-width: 7; fill: none; }
.milo-branch { stroke: #5a6a4a; stroke-width: 5; }
.milo-tail { stroke: #43b58f; stroke-width: 8; fill: none; }
.milo-look { transition: transform .08s linear; }

.hero-milo { display: flex; justify-content: center; margin-bottom: .25rem; }
.empty-milo { display: flex; justify-content: center; margin: .25rem auto 1rem; }

/* Scène + bulle de dialogue */
.milo-stage { position: relative; display: inline-block; }
.milo-bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 8px; background: #eef2fb; color: #10141d;
  padding: .5rem .8rem; border-radius: 14px; font-size: .85rem; font-weight: 500;
  text-align: center; max-width: 240px; white-space: normal; line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 2;
}
.milo-bubble[hidden] { display: none; }
.milo-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: #eef2fb;
}

/* Mascotte fixe (coin), visible au scroll */
#milo-fab { position: fixed; top: 62px; right: 16px; width: 76px; z-index: 90; }
#milo-fab .milo-stage { cursor: pointer; }
#milo-fab .milo-bubble {
  left: auto; right: calc(100% + 6px); bottom: auto; top: 6px;
  transform: none; margin: 0; max-width: 210px;
}
#milo-fab .milo-bubble::after {
  top: 16px; left: 100%; transform: none;
  border: 7px solid transparent; border-left-color: #eef2fb;
}
.milo-palette {
  position: absolute; top: calc(100% + 6px); right: 0;
  display: flex; gap: .4rem; padding: .5rem .6rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
}
.milo-palette { align-items: center; }
.milo-palette.show { opacity: 1; pointer-events: auto; transform: none; }
.theme-toggle {
  width: 24px; height: 24px; flex: none; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; line-height: 1; border-radius: 50%;
  background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  margin-left: .25rem; transition: transform .12s, border-color .12s;
  border-left-width: 1px;
}
.theme-toggle:hover { transform: scale(1.12); border-color: var(--accent-ink); }
.theme-toggle-fixed {
  position: fixed; left: 16px; bottom: 16px; z-index: 90;
  width: 44px; height: 44px; font-size: 1.25rem;
  background: var(--card); box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.theme-toggle-fixed:hover { transform: scale(1.08); }
@media (max-width: 600px) {
  .theme-toggle-fixed { width: 40px; height: 40px; left: 12px; bottom: 12px; }
}
@media (max-width: 600px) {
  #milo-fab { width: 60px; top: 56px; right: 10px; }
  #milo-fab .milo-bubble { display: none; }
}

/* Palette (rangée) */
.palette { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; margin: .25rem 0 1.25rem; }
.palette-label { font-size: .8rem; color: var(--muted); margin-right: .15rem; }
.swatch {
  width: 20px; height: 20px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--sw); border: 2px solid var(--line);
  transition: transform .12s, border-color .12s;
}
.swatch:hover { transform: scale(1.18); }
.swatch.active { border-color: var(--fg); box-shadow: 0 0 0 2px var(--sw); }

/* Page Statut */
.status { width: 100%; max-width: 680px; margin: 2rem auto; padding: 0 1.25rem; }
.status-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.status-head h1 { margin: 0; font-size: 1.5rem; }
.status-badge { font-size: .78rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; }
.status-badge.up { color: var(--success); background: rgba(127,220,160,.12); border: 1px solid rgba(127,220,160,.4); }
.status-badge.down { color: var(--danger); background: rgba(240,113,122,.12); border: 1px solid rgba(240,113,122,.4); }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.status-card { display: flex; align-items: center; gap: .7rem; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-card.up .status-dot { background: #7fdca0; box-shadow: 0 0 0 4px rgba(127,220,160,.18); }
.status-card.down .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(240,113,122,.18); }
.status-name { font-weight: 500; }
.status-state { color: var(--muted); font-size: .82rem; }
.status-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-top: .2rem; }
.metric { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; text-align: center; }
.metric b { display: block; font-size: 1.5rem; color: var(--accent-ink); }
.metric span { color: var(--muted); font-size: .8rem; }
.status-meta { color: var(--muted); font-size: .82rem; margin-top: 1.25rem; text-align: center; }
@media (max-width: 560px) { .status-metrics { grid-template-columns: 1fr 1fr; } }

/* ============================== Wordmark ============================== */
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 600; letter-spacing: -.01em; text-decoration: none; color: var(--fg);
}
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.brand-milo { display: inline-flex; width: 44px; height: 44px; flex: none; cursor: pointer; }
.brand-milo .milo { width: 44px; height: 44px; overflow: visible; }
.brand-palette { position: absolute; right: auto; }
.topbar {
  width: 100%; max-width: 960px; padding: 1.25rem 1.25rem 0;
  display: flex; justify-content: space-between; align-items: center;
}

/* ============================== Landing ============================== */
.hero {
  width: 100%; max-width: 720px; padding: 3.5rem 1.25rem 1rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; margin: 0 0 1rem;
  letter-spacing: -.03em;
}
.hero h1 .accent { color: var(--accent-ink); }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 34rem; margin: 0 auto 2rem; }

/* Recherche : le CTA principal du pattern annuaire */
.search {
  position: relative; max-width: 520px; margin: 0 auto;
}
.search-box {
  display: flex; align-items: center; gap: .6rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: .15rem .25rem .15rem 1rem; transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box svg { color: var(--muted); flex: none; }
.search-box input {
  flex: 1; border: none; background: none; color: var(--fg);
  font-size: 1rem; padding: .7rem 0;
}
.search-box input:focus { outline: none; }
.search-box .go {
  border: none; background: var(--accent); color: #0b0d12;
  border-radius: 999px; padding: .6rem 1.1rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.search-box .go:hover { background: var(--accent-strong); }

.results {
  position: absolute; top: calc(100% + .5rem); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; text-align: left; z-index: 20;
}
.result {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem;
  text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.result:last-child { border-bottom: none; }
.result:hover, .result:focus { background: var(--bg-soft); outline: none; }
.result .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--chip); flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.result .meta { min-width: 0; }
.result .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .hd { color: var(--muted); font-size: .82rem; }
.result .no { padding: .9rem; color: var(--muted); font-size: .9rem; }

.hero-actions { margin-top: 1.5rem; display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* Boutons génériques */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); background: var(--chip); color: var(--fg);
  border-radius: 10px; padding: .7rem 1.15rem; font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #0b0d12; border-color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; }
.btn.danger:hover { filter: brightness(1.08); }

/* Popup de confirmation in-app */
.confirm-panel { max-width: 380px; }
.confirm-msg { margin: 0 0 1.25rem; font-size: 1rem; }

/* Section features */
.features {
  width: 100%; max-width: 880px; padding: 3rem 1.25rem 4rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.feature {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem;
}
.feature .ic {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink); margin-bottom: .9rem;
}
.feature h3 { margin: 0 0 .4rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }

/* Panneau de création (overlay) */
.overlay {
  position: fixed; inset: 0; background: rgba(8,10,14,.6); backdrop-filter: blur(4px);
  /* z-index > .chat-dock (100) : une modale (confirmation, RDV, QR) reste
     toujours cliquable au-dessus d'une conversation ouverte. */
  display: flex; align-items: center; justify-content: center; padding: 1.25rem; z-index: 150;
}
.panel { position: relative; }
.panel .close {
  position: absolute; top: .9rem; right: .9rem; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--inset); color: var(--muted);
  border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.panel .close:hover { color: var(--fg); border-color: var(--accent-ink); }
.panel {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem;
}
.panel h2 { margin: 0 0 .3rem; font-size: 1.25rem; }
.panel .sub { color: var(--muted); margin: 0 0 1.25rem; font-size: .92rem; }
.panel label { display: block; font-size: .82rem; color: var(--muted); margin: 0 0 .3rem; }
.panel .group { margin-bottom: 1rem; }
.handle-input { display: flex; align-items: center; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding-left: .7rem; }
.handle-input span { color: var(--muted); }
.handle-input input { border: none; background: none; }
.panel .err { color: var(--danger); font-size: .85rem; min-height: 1.1rem; margin: -.3rem 0 .6rem; }
.panel .hint { color: var(--muted); font-size: .78rem; margin: .35rem 0 0; }
.lost-key { margin: .9rem 0 0; font-size: .85rem; }
.lost-key a { color: var(--muted); text-decoration: underline; }
.lost-key a:hover { color: var(--accent-ink); }
.trust { margin: 1rem auto 0; font-size: .82rem; color: var(--muted); display: inline-block; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-soft); }
/* Indicateur d'adoption (nombre d'identités créées) */
.adoption { margin: 1rem auto 0; font-size: .9rem; color: var(--muted); display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.adoption[hidden] { display: none; }
.adoption .adopt-num { color: var(--accent-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.adopt-trend { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; color: var(--success); background: rgba(95,211,154,.12); border: 1px solid rgba(95,211,154,.35); border-radius: 999px; padding: .1rem .45rem; }
.lbl-sm { display: block; font-size: .78rem; color: var(--muted); }

/* Notifications (cloche + popover) */
.notif-wrap { position: relative; display: inline-flex; }
#notif-bell { position: relative; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .66rem; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-badge[hidden] { display: none; }
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 120;
  width: min(320px, 90vw); max-height: 60vh; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0,0,0,.5); display: flex; flex-direction: column;
}
.notif-panel[hidden] { display: none; }
.notif-head { padding: .6rem .85rem; font-size: .8rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em; }
.notif-list { list-style: none; margin: 0; padding: .25rem; overflow-y: auto; display: grid; gap: .15rem; }
.notif { border-radius: 8px; }
.notif a, .notif > .nt, .notif-act { display: block; width: 100%; padding: .5rem .6rem; text-decoration: none; color: var(--fg); }
.notif-act { background: none; border: none; cursor: pointer; font: inherit; text-align: left; }
.notif:hover { background: var(--bg-soft); }
.notif.unread { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.notif .nt { font-size: .88rem; }
.notif .nd { display: block; font-size: .68rem; color: var(--muted); margin-top: .1rem; padding: 0 .6rem .4rem; }
.notif a .nd { padding: .1rem 0 0; }
.notif-list .empty { padding: 1rem .6rem; }
/* En colonne (deck) : pas de hauteur/scroll propres, la colonne s'en charge */
.notif-col { overflow: visible; max-height: none; padding: 0; }

/* Colonne Échanges */
.conv { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; margin-bottom: .7rem; background: var(--bg-soft); }
.conv-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.conv-head .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--chip); flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.conv-head .meta { flex: 1; min-width: 0; }
.conv-head .nm { font-weight: 500; }
.conv-head .hd { color: var(--muted); font-size: .8rem; }
.conv-msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cmsg { font-size: .85rem; padding: .35rem .5rem; border-radius: 8px; background: var(--inset); border: 1px solid var(--line); }
.cmsg.mine { border-color: var(--accent-line); }
.cm-text { display: block; word-break: break-word; }
.cm-exp { display: block; font-size: .66rem; color: var(--muted); margin-top: .15rem; }

/* Conversation éphémère */
/* Discussion : colonne latérale ancrée à droite (pas une popup modale) */
.chat-dock {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(380px, 100vw);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 34px rgba(0,0,0,.45);
  animation: chat-slide .18s ease-out;
}
@keyframes chat-slide { from { transform: translateX(100%); } to { transform: none; } }
.chat-dock .chat-panel {
  flex: 1; min-height: 0; max-width: none;
  display: flex; flex-direction: column;
  border: none; border-radius: 0; padding: 1.2rem;
}
.chat-panel { max-width: 440px; }
.chat-log {
  flex: 1; min-height: 120px; max-height: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: .4rem; padding: .6rem;
  background: var(--inset); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem;
}
.bubble {
  max-width: 82%; padding: .45rem .7rem; border-radius: 13px; font-size: .9rem; word-break: break-word;
}
.bubble.mine { align-self: flex-end; background: var(--accent); color: #0b0d12; }
.bubble.theirs { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--line); }
.bubble .t { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: .25rem; }
.bubble .t-time { font-size: .64rem; opacity: .6; cursor: pointer; user-select: none; }
.bubble .t-time:hover { opacity: 1; text-decoration: underline dotted; }
/* Compte à rebours avant suppression (déplié au clic sur l'heure) */
.b-countdown { display: block; margin-top: .2rem; font-size: .62rem; opacity: .8; font-style: italic; text-align: right; }
.b-countdown[hidden] { display: none; }
.bubble.mine .b-countdown { color: #0b0d12; }
.bubble .ticks { margin-left: .2rem; }
.bubble .ticks.read { color: #2c7d63; opacity: 1; font-weight: 700; }
.bubble.mine .ticks.read { color: #0b3d2c; }
/* Réactions */
.b-reacts { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .25rem; }
.react { font-size: .72rem; padding: .05rem .35rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; }
.react.mine { border-color: var(--accent-ink); }
/* Actions inline sur la ligne de l'heure : visibles seulement au survol du message */
.b-react-btn, .b-del { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: .8rem; line-height: 1; text-align: center; padding: 0; color: var(--fg); flex: none; opacity: 0; transition: opacity .12s ease; }
.bubble:hover .b-react-btn, .bubble:hover .b-del,
.b-react-btn:focus-visible, .b-del:focus-visible { opacity: 1; }
.bubble.mine .b-react-btn, .bubble.mine .b-del { background: rgba(0,0,0,.12); border-color: rgba(0,0,0,.2); }
.b-react-btn:hover { border-color: var(--accent-ink); }
.b-del:hover { color: var(--danger); border-color: var(--danger); }
/* Popover de sélection d'emoji (au niveau du panneau, pas dans le log) */
.react-pick {
  position: absolute; z-index: 10; display: flex; gap: .1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .4rem; box-shadow: 0 8px 22px rgba(0,0,0,.45);
}
.react-pick[hidden] { display: none; }
.react-pick button { border: none; background: none; cursor: pointer; font-size: 1.25rem; line-height: 1; padding: .15rem .25rem; border-radius: 8px; }
.react-pick button:hover { background: var(--bg-soft); transform: scale(1.15); }
.chat-form { display: flex; gap: .4rem; }
.chat-form input { flex: 1; }

/* QR code */
.qr-box {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 12px; padding: 14px; margin: .25rem auto 1rem;
  width: max-content;
}
.qr-box img, .qr-box canvas { display: block; }

/* Section MCP (landing) */
.mcp { width: 100%; max-width: 880px; padding: 1rem 1.25rem 4rem; }
.mcp-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.mcp-head .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.mcp-head h2 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.7rem); letter-spacing: -.02em; }
.mcp-lead { color: var(--muted); max-width: 48rem; }
.mcp-lead em { display: block; margin-top: .5rem; color: var(--fg); opacity: .8; }
.mcp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; }
.mcp-step { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; }
.mcp-step .num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #0b0d12; font-weight: 700; font-size: .85rem; margin-bottom: .55rem; }
.mcp-step p { margin: 0; font-size: .92rem; }
.mcp-step code { background: var(--card); padding: .1rem .4rem; border-radius: 6px; border: 1px solid var(--line); }
.mcp-tabs { display: flex; gap: .5rem; margin: 1.5rem 0 1rem; flex-wrap: wrap; }
.mcp-tab { padding: .5rem .95rem; border: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); border-radius: 999px; cursor: pointer; font: inherit; font-size: .88rem; transition: border-color .15s, background .15s, color .15s; }
.mcp-tab:hover { border-color: var(--accent-ink); }
.mcp-tab.active { background: var(--accent); color: #0b0d12; border-color: var(--accent-ink); font-weight: 600; }
.mcp-panel[hidden] { display: none; }
.mcp-panel-lead { color: var(--muted); margin: 0 0 .75rem; }
.mcp-url { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.mcp-url code { flex: 1; min-width: 200px; background: #0c0e13; border: 1px solid var(--line); padding: .55rem .7rem; border-radius: 8px; font-size: .85rem; }
.mcp-steps { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); display: grid; gap: .4rem; font-size: .9rem; }
.mcp-steps strong { color: var(--fg); }
.mcp-details summary { cursor: pointer; color: var(--accent-ink); font-size: .85rem; margin-bottom: .6rem; }
.mcp-config { background: #0c0e13; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mcp-config-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem .9rem; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.mcp-config pre { margin: 0; padding: 1rem; overflow-x: auto; font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; color: #cdd3df; }
.mcp-note { color: var(--muted); font-size: .82rem; margin-top: .8rem; }
@media (max-width: 720px) { .mcp-grid { grid-template-columns: 1fr; } }
.panel .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: .5rem; }

/* Bloc succès création */
.created .key-box {
  background: var(--inset); border: 1px dashed var(--accent); border-radius: 8px;
  padding: .7rem; word-break: break-all; font-size: .85rem; margin: .4rem 0 1rem;
}
.created .warn { color: var(--accent-ink); font-size: .85rem; }
.url-row { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.url-row code { flex: 1; background: var(--inset); border: 1px solid var(--line); padding: .5rem .6rem; border-radius: 8px; word-break: break-all; font-size: .82rem; }
.copy { padding: .5rem .7rem; }

/* ============================== Carte ============================== */
.card {
  width: 100%; max-width: var(--maxw); margin: 2.5rem auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem;
}
/* Profil public : 2 colonnes */
.profile {
  width: 100%; max-width: 920px; margin: 2rem auto; padding: 0 1.25rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start;
}
.profile .card { margin: 0; max-width: none; }
@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; max-width: var(--maxw); }
}

/* Éditeur privé : deck horizontal de 3 colonnes (desktop ET mobile), sans
   scroll vertical de page — la navigation est horizontale. */
body:has(#app[data-view="private"]) { height: 100dvh; overflow: hidden; }
#app[data-view="private"] { justify-content: flex-start; min-height: 0; }
.deck-viewport {
  width: 100%; overflow: hidden; flex: 1; min-height: 0;
}
.deck {
  display: flex; gap: 1.25rem; height: 100%; align-items: stretch;
  padding: .85rem 0; will-change: transform;
}
.deck .col {
  flex: 0 0 clamp(280px, 92vw, 520px);
  height: 100%; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;              /* Firefox : pas de scrollbar */
  opacity: .55; transition: box-shadow .4s ease;
  display: flex; flex-direction: column;
  transform-origin: center center; will-change: transform, opacity;
  border-radius: var(--radius);
}
.deck .col:not(.active) { cursor: pointer; }
.deck .col > .card { margin: auto 0; }  /* centre verticalement (sticke en haut si trop grand) */
/* Titre de la colonne active (affiché entre le header et le deck) */
.deck-title { padding-top: .75rem; text-align: center; font-size: .82rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; min-height: 1.6rem; }
/* Branche de navigation, en bas (desktop ET mobile) */
.deck-branch { width: 100%; display: flex; justify-content: center; padding: .5rem 0 1rem; flex: none; }

/* Landing en deck horizontal (panneaux larges) */
body:has(#app[data-view="landing"]) { height: 100dvh; overflow: hidden; }
#app[data-view="landing"] { justify-content: flex-start; min-height: 0; }
.deck-wide .col { flex: 0 0 clamp(280px, 92vw, 760px); }
.deck-wide .col > * { margin: auto 0; width: 100%; }
.deck-wide .hero, .deck-wide .features, .deck-wide .mcp {
  max-width: none; width: 100%; padding: 1.25rem;
}
.deck-wide .hero { text-align: center; }
.deck .col::-webkit-scrollbar { width: 0; height: 0; display: none; } /* WebKit */
/* Compactage pour tenir dans le viewport */
.deck .col .card { padding: 1.2rem; }
.deck .section-title { margin: 1rem 0 .5rem; padding-top: .85rem; }
.deck .cal-cell { font-size: .78rem; }
.deck .photo { width: 88px; height: 88px; }
.deck .event-form, .deck .add-row, .deck .rel-add { margin-top: .4rem; }
.deck .col.active { opacity: 1; }
.deck .col .card { max-width: none; }

/* ---- col-scroll : colonnes sans scrollbar apparente ----
   Éditeur (/me) : la carte remplit la hauteur de la colonne, seul le div
   .col-scroll interne déborde (scrollbar fine, invisible au repos).
   Profil public : la carte reste centrée (pas de fill-height). */
#app[data-view="private"] .deck .col {
  overflow: hidden; /* plus de scrollbar sur la colonne elle-même */
}
#app[data-view="private"] .deck .col > .card {
  flex: 1; min-height: 0; margin: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
/* Zone scrollable interne (à placer dans chaque colonne) */
.col-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.col-scroll::-webkit-scrollbar { width: 3px; }
.col-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
/* Négatif horizontal pour ne pas rogner le padding de la carte */
#app[data-view="private"] .deck .col-scroll {
  margin: 0 -1.2rem; padding: 0 1.2rem;
}

/* Navigation « branche » */
.branch-nav { overflow: visible; }
.branch-line { stroke: #5a6a4a; stroke-width: 3; }
.bud { cursor: pointer; }
.bud .bud-dot { fill: #2c7d63; stroke: #43b58f; stroke-width: 1.5; transition: fill .2s; }
.bud:hover .bud-dot { fill: var(--accent); }
.bud.active .bud-dot { fill: transparent; stroke: none; }
.bud:focus { outline: none; }
.bud:focus-visible .bud-dot { stroke: var(--accent); stroke-width: 2.5; }
.branch-marker circle { fill: var(--accent); }
.branch-marker .branch-leaf { fill: #43b58f; }
.deck-branch { position: relative; }
.bud-tip {
  position: absolute;
  bottom: calc(100% - .2rem);
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .2rem .55rem;
  font-size: .72rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px #0004;
}
.lang-select { max-width: 150px; font-size: .82rem; padding: .4rem .5rem; }

/* Sur mobile, on garde le deck HORIZONTAL (swipe), une colonne à la fois. */
@media (max-width: 760px) {
  .deck { gap: 0; padding: .5rem 0; }
  .deck .col { flex: 0 0 100vw; padding: 0 1rem; }
  .editor-header .edit-tag { display: none; }
}

/* Relations */
.rels { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.rel { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.rel-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--fg); min-width: 0; flex: 1; }
.rel .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--chip); flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.rel .meta { min-width: 0; display: flex; flex-direction: column; }
.rel-link:hover .nm { color: var(--accent-ink); }
.rel .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel .hd { color: var(--muted); font-size: .8rem; }
.rel-type { font-size: .68rem; padding: .02rem .4rem; border-radius: 999px; border: 1px solid var(--line); }
.rel-type.amis { color: var(--success); border-color: rgba(127,220,160,.4); }
.rel-type.pro { color: var(--accent-ink); border-color: var(--accent-line); }
.rel-type.autre { color: var(--muted); }
.deg { font-size: .7rem; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.rel-add { display: grid; grid-template-columns: 1fr auto auto; gap: .4rem; margin-top: .5rem; }
select { font: inherit; color: var(--fg); background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .4rem; }
select:focus { outline: none; border-color: var(--accent-ink); }
.loading { color: var(--muted); text-align: center; padding: 4rem 1rem; }

.photo-wrap { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); background: var(--chip); }
.photo.placeholder { display: flex; align-items: center; justify-content: center; color: var(--fg); background: #2a3140; font-size: 2.2rem; font-weight: 600; }
.photo.avatar { overflow: hidden; padding: 0; }
.photo.avatar svg { display: block; width: 100%; height: 100%; }
.photo.milo-photo { background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo.milo-photo svg { width: 118%; height: 118%; transform: translateY(6px); }

.card h1 { font-size: 1.4rem; margin: 0 0 .15rem; text-align: center; }
.card .handle { color: var(--muted); text-align: center; margin: 0 0 .15rem; font-size: .9rem; }
.subtitle { color: var(--muted); text-align: center; margin: .25rem 0 1.25rem; }

.fields { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .55rem; }
.field { display: grid; grid-template-columns: 110px 1fr; gap: .5rem; align-items: baseline; }
.field .k { color: var(--muted); font-size: .82rem; }
.field .v { word-break: break-word; }
.field a { color: var(--accent-ink); text-decoration: none; }

.section-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 1.5rem 0 .6rem; border-top: 1px solid var(--line); padding-top: 1rem;
}

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.event { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.event .when { color: var(--accent-ink); font-variant-numeric: tabular-nums; font-size: .82rem; white-space: nowrap; }
.event .what { flex: 1; }
.event .loc { color: var(--muted); font-size: .82rem; }
.empty { color: var(--muted); font-size: .9rem; }

/* Disponibilités */
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.slot { display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.slot .when { color: var(--accent-ink); font-variant-numeric: tabular-nums; font-size: .82rem; white-space: nowrap; }
.slot .what { flex: 1; font-size: .9rem; }
.slot.busy .when { color: var(--muted); }
.tag {
  display: inline-block; font-size: .72rem; padding: .1rem .45rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.slot.free .tag { color: var(--success); border-color: rgba(127,220,160,.4); }
.btn.book, .btn.sm { padding: .4rem .8rem; font-size: .85rem; }

/* Colonne Agenda : événements (zone fixe, scroll si besoin) + calendrier (flex-fill) */
.agenda-events {
  overflow-y: auto; overflow-x: hidden; flex: none;
  max-height: 35%; -webkit-overflow-scrolling: touch;
}
.agenda-events::-webkit-scrollbar { width: 3px; }
.agenda-events::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
/* Conteneur qui s'étire pour remplir l'espace restant de la carte */
.calendar-fill {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding-top: .2rem;
}
.calendar-fill .calendar { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.calendar-fill .cal-grid { flex: 1; min-height: 0; grid-auto-rows: 1fr; }
.calendar-fill .cal-cell { aspect-ratio: unset; min-height: 0; height: auto; }
.calendar-fill .cal-legend { flex: none; }

/* Calendrier de disponibilité (un seul mois, navigable) */
.calendar { display: block; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.cal-nav {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--line);
  background: var(--chip); color: var(--fg); border-radius: 8px; cursor: pointer;
  font-size: 1.2rem; line-height: 1; transition: border-color .15s;
}
.cal-nav:hover:not(:disabled) { border-color: var(--accent-ink); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-title { text-transform: capitalize; font-size: .95rem; color: var(--fg); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .7rem; color: var(--muted); padding-bottom: .15rem; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; font-size: .82rem; color: var(--fg); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: border-color .12s, transform .08s;
}
.cal-cell.empty { border: none; background: none; cursor: default; }
.cal-cell.free { background: rgba(127,220,160,.14); border-color: rgba(127,220,160,.3); color: var(--success); }
.cal-cell.busy { background: rgba(139,147,163,.1); border-color: var(--line); color: var(--muted); }
.cal-cell.past { opacity: .35; cursor: default; }
.cal-cell:not(:disabled):hover { border-color: var(--accent-ink); transform: translateY(-1px); }
.cal-cell:disabled { cursor: default; }
.cal-cell[data-book]:not(:disabled) { cursor: pointer; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .78rem; color: var(--muted); margin-top: .2rem; align-items: center; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.cal-legend .dot-free { background: rgba(127,220,160,.6); }
.cal-legend .dot-busy { background: rgba(139,147,163,.4); }
/* Heatmap de charge du jour : 0-1 vert · 2-3 orange · 4+ rouge */
.cal-cell.heat-0 { background: rgba(127,220,160,.14); border-color: rgba(127,220,160,.3); color: var(--success); }
.cal-cell.heat-mid { background: rgba(245,166,66,.2); border-color: rgba(245,166,66,.45); color: #f5a642; }
.cal-cell.heat-high { background: rgba(231,76,76,.24); border-color: rgba(231,76,76,.5); color: #ff6b6b; }
.cal-legend .dot-heat-0 { background: rgba(127,220,160,.6); }
.cal-legend .dot-heat-mid { background: rgba(245,166,66,.7); }
.cal-legend .dot-heat-high { background: rgba(231,76,76,.7); }

/* ---- Onglets colonne Compte ---- */
.acct-tabs, .agenda-tabs {
  display: flex; gap: 2px; flex: none;
  background: var(--inset); border-radius: 10px; padding: 3px;
  margin-bottom: .75rem;
}
.acct-tab, .agenda-tab {
  flex: 1; padding: .38rem .5rem; border: none; border-radius: 8px;
  background: none; color: var(--muted); font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s;
  white-space: nowrap;
}
.acct-tab:hover, .agenda-tab:hover { color: var(--fg); }
.acct-tab.active, .agenda-tab.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.acct-tab-danger { color: var(--danger); opacity: .75; }
.acct-tab-danger.active { color: var(--danger); opacity: 1; }
.acct-panel[hidden], .agenda-panel[hidden] { display: none; }

/* En-tête de l'éditeur */
/* Header commun toutes pages */
.site-header {
  max-width: 960px; padding: .9rem 1.25rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex: none; width: 100%;
}
.site-header-center { display: flex; justify-content: center; flex: 1; min-width: 0; }
.editor-header { max-width: 960px; padding: .9rem 1.25rem 1rem; }
.editor-head-right { display: flex; align-items: center; gap: .6rem; flex: none; }
.edit-tag { font-size: .82rem; color: var(--muted); }

/* Chip profil cliquable */
.profile-chip {
  display: flex; align-items: center; gap: .55rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: .22rem .85rem .22rem .22rem; min-width: 0; max-width: 200px;
}
.profile-chip-av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  object-fit: cover; background: var(--chip); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.profile-chip-svg svg { display: block; width: 30px; height: 30px; border-radius: 50%; }
.profile-chip-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.profile-chip-handle { font-size: .82rem; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-chip-name { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.profile-chip { text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
a.profile-chip:hover { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }

@media (max-width: 580px) {
  .brand-text { display: none; }
  .profile-chip-name { display: none; }
  .site-header-center .profile-chip { padding-right: .5rem; }
  .editor-head-right .btn.sm:not(#notif-bell):not(#qr-btn) { display: none; }
}

/* Demandes de RDV */
.requests { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.request { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .85rem; }
.req-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.req-slot, .req-meta { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.req-meta a { color: var(--accent-ink); text-decoration: none; }
.req-msg { font-size: .9rem; margin-top: .4rem; white-space: pre-wrap; }
.req-actions { display: flex; gap: .4rem; margin-top: .6rem; align-items: center; }
.req-status { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.req-status.ok { color: var(--success); border-color: rgba(127,220,160,.4); }
.req-status.no { color: var(--danger); border-color: rgba(240,113,122,.4); }
.req-status.pending { color: var(--accent-ink); border-color: var(--accent-line); }
.badge {
  display: inline-block; background: var(--accent); color: #0b0d12;
  font-size: .7rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; vertical-align: middle;
}

/* ---- édition ---- */
input, textarea { font: inherit; color: var(--fg); background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .6rem; width: 100%; min-width: 0; }
input[type="file"] { padding: 0; border: none; background: none; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; cursor: pointer; margin-right: .6rem;
  background: var(--chip); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem .9rem; transition: border-color .15s;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent-ink); }
input:focus, textarea:focus { outline: none; border-color: var(--accent-ink); }
textarea { resize: vertical; min-height: 2.2rem; }
label.row { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .82rem; width: auto; }
label.row input { width: auto; }

.edit-field { display: grid; grid-template-columns: 96px 1fr auto auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.btn-field-del { background: none; border: none; color: var(--muted); cursor: pointer; padding: .2rem .3rem; border-radius: 4px; line-height: 1; font-size: .9rem; }
.btn-field-del:hover { color: var(--danger); background: rgba(240,113,122,.1); }
.fvis { font-size: .72rem; padding: .3rem .25rem; max-width: 86px; }
.fvis.vis-public { color: var(--success); border-color: rgba(127,220,160,.45); }
.fvis.vis-contact { color: var(--accent-ink); border-color: var(--accent-line); }
.fvis.vis-private { color: var(--muted); }
.rel-via { color: var(--muted); font-size: .72rem; opacity: .85; }
.rel-date { color: var(--muted); font-size: .68rem; opacity: .75; }
.rel-mutual { color: var(--success); font-weight: 700; }
.rel-filters { display: flex; gap: .4rem; margin-bottom: .5rem; }
.rel-filters input { flex: 1; }
.rel-filters select { flex: none; }
[data-recip] { padding: .25rem .55rem; font-size: .76rem; white-space: nowrap; }
.edit-field .lbl { color: var(--muted); font-size: .8rem; }

button.icon { padding: .3rem .55rem; color: var(--muted); background: var(--chip); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
button.icon:hover { color: var(--danger); border-color: var(--danger); }

.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; margin-top: .5rem; }
.add-row .btn { padding: .55rem .8rem; }
.event-form { display: grid; gap: .4rem; margin-top: .5rem; }
.event-form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }

footer { color: var(--muted); font-size: .8rem; text-align: center; max-width: var(--maxw); width: 100%; padding: 0 1.25rem 2.5rem; }
footer code { background: var(--card); padding: .15rem .4rem; border-radius: 6px; border: 1px solid var(--line); overflow-wrap: anywhere; }
footer a { text-decoration: none; }

.toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); padding: .5rem .9rem;
  border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; }

@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .add-row { grid-template-columns: 1fr 1fr; }
  .add-row .btn { grid-column: 1 / -1; }
  .event-form .grid2 { grid-template-columns: 1fr; }
  footer code { display: inline-block; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto; }
}

/* ------------------------------ Relation switch -------------------------- */
.rel-switch {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; user-select: none; font-size: .82rem; color: var(--fg-muted);
}
.rel-switch-label { display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.toggle-track {
  position: relative; width: 36px; height: 20px; flex-shrink: 0;
  border-radius: 20px; background: var(--line);
  transition: background .2s;
}
.toggle-track.on { background: var(--accent); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.toggle-track.on .toggle-thumb { transform: translateX(16px); }

/* -------------------------------- Passkeys ------------------------------- */
.badge-sm {
  display: inline-block; font-size: .7rem; font-weight: 500; padding: .15rem .5rem;
  border-radius: 20px; background: var(--accent); color: var(--on-accent); vertical-align: middle;
  margin-left: .4rem; opacity: .85;
}
.passkey-row {
  display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center;
  gap: .5rem; padding: .5rem .6rem; border-radius: 8px; background: var(--bg-soft);
  border: 1px solid var(--line); margin-bottom: .4rem;
}
.passkey-icon { color: var(--accent-ink); display: flex; align-items: center; }
.passkey-name { font-weight: 500; font-size: .9rem; }
.passkey-meta { font-size: .78rem; color: var(--fg-muted); }
.btn.sm.danger { font-size: .78rem; padding: .25rem .5rem; background: none; color: var(--danger); border-color: var(--danger); }
.btn.sm.danger:hover { background: var(--danger); color: #fff; }

/* Onglets du dialog récupération */
.rc-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.rc-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem; border-radius: 8px; border: 1px solid var(--line);
  background: none; color: var(--fg-muted); cursor: pointer; font-size: .85rem;
  transition: background .15s, color .15s;
}
.rc-tab:hover { background: var(--bg-soft); color: var(--fg); }
.rc-tab.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent-ink); font-weight: 600; }

/* Bandeau GDPR */
.gdpr-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: var(--card); border-top: 1px solid var(--line);
  padding: .75rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  font-size: .82rem; color: var(--fg-muted);
}
.gdpr-banner p { margin: 0; flex: 1; line-height: 1.5; }

/* Zone sensible (export / suppression compte) */
.danger-title { color: var(--danger, #e05252); }

/* Actions du profil public (coins haut de la carte) */
.profile-card-actions {
  position: absolute; top: .9rem; z-index: 2;
  display: flex; align-items: center; gap: .4rem;
}
.profile-card-actions-left { left: .9rem; }
.profile-card-actions-right { right: .9rem; justify-content: flex-end; }
.profile-card-actions .rel-switch { font-size: .78rem; }

/* ---- Barre de recherche compacte dans le header (hors landing) ---- */
.hdr-search {
  position: relative; flex: 1; max-width: 340px;
}
.hdr-search-box {
  display: flex; align-items: center; gap: .4rem;
  background: var(--inset); border: 1px solid var(--line); border-radius: 999px;
  padding: .22rem .6rem .22rem .75rem; transition: border-color .15s, box-shadow .15s;
}
.hdr-search-box:focus-within {
  border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--card);
}
.hdr-search-box svg { color: var(--muted); flex: none; }
.hdr-search-box input {
  flex: 1; border: none; background: none; color: var(--fg);
  font-size: .88rem; padding: .35rem 0; min-width: 0;
}
.hdr-search-box input:focus { outline: none; }
.hdr-results {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.hdr-results[hidden] { display: none; }
.hdr-results .result {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .85rem;
  text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.hdr-results .result:last-child { border-bottom: none; }
.hdr-results .result:hover { background: var(--bg-soft); }
.hdr-results .av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--chip); flex: none; display: flex; align-items: center; justify-content: center; font-size: .82rem; color: var(--muted); }
.hdr-results .nm { font-weight: 500; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-results .hd { color: var(--muted); font-size: .76rem; }
.hdr-results .no { padding: .75rem .85rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 640px) {
  .hdr-search { max-width: 180px; }
}

/* ---- Galerie ---- */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.gal-item {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: 6px; background: var(--inset); cursor: pointer;
}
.gal-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s ease;
}
.gal-item:hover img { transform: scale(1.05); }
/* Overlay au survol */
.gal-item::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 55%);
  opacity: 0; transition: opacity .2s;
}
.gal-item:hover::after { opacity: 1; }
/* Bouton supprimer (éditeur, coin haut-droit) */
.gal-del {
  position: absolute; top: 5px; right: 5px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.6); border: none; color: #fff;
  font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.gal-item:hover .gal-del { opacity: 1; }
/* Bouton like (coin bas-gauche, par dessus l'overlay) */
.gal-like {
  position: absolute; bottom: 6px; left: 6px; z-index: 3;
  display: flex; align-items: center; gap: 3px;
  background: rgba(0,0,0,.55); border: none; border-radius: 999px;
  color: #fff; font-size: .72rem; padding: 3px 7px 3px 5px;
  cursor: pointer; opacity: 0; transition: opacity .15s, background .15s;
  backdrop-filter: blur(4px);
}
.gal-item:hover .gal-like { opacity: 1; }
.gal-like.liked { opacity: 1; background: rgba(220,50,50,.7); }
.gal-like svg { flex: none; }
.gal-count { line-height: 1; }
/* Zone de dépôt (upload) */
.gal-drop {
  border: 1.5px dashed var(--line); border-radius: 10px;
  padding: .9rem; display: flex; align-items: center; justify-content: center;
  gap: .6rem; color: var(--muted); font-size: .85rem;
  transition: border-color .15s, background .15s;
}
.gal-drop.drag-over {
  border-color: var(--accent-ink); background: var(--accent-soft);
  color: var(--accent-ink);
}
.gal-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 1.5rem 0; }
/* Lightbox */
.gal-lb {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); animation: fadein .2s ease;
}
.gal-lb-inner {
  position: relative; max-width: min(92vw, 900px); max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.gal-lb-inner img {
  max-width: 100%; max-height: 90vh; border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,.8); object-fit: contain;
}
.gal-lb-close {
  position: absolute; top: -12px; right: -12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--fg);
  font-size: .9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.gal-lb-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
/* Vue publique du profil */
.gal-public .gal-grid { gap: 3px; }
@keyframes fadein { from { opacity:0 } to { opacity:1 } }

/* ------------------------------- Tags ----------------------------------- */
.tags, .tags-edit { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags { justify-content: center; margin: .15rem 0 .5rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid var(--accent-line);
  font-size: .82rem; font-weight: 600; line-height: 1.4;
}
.tag-del {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: .85em; line-height: 1; padding: 0 .1rem; opacity: .65;
}
.tag-del:hover { opacity: 1; color: var(--danger); }
.tags-empty { color: var(--muted); font-size: .85rem; }
