/* =====================================================================
   VOLTA — interface (charte graphique du 23/11/2026)
   Jaune électrique #FFE500 réservé aux actions prioritaires, graphite #191B1F
   pour le texte, fonds neutres. Inter, grille de 8 px, transitions 120–180 ms.
   ===================================================================== */

@font-face { font-family: 'Inter'; src: url('/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: var(--font);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --accent: #FFE500;       /* jaune électrique */
  --on-accent: #191B1F;    /* graphite : jamais de blanc sur jaune */
  --online: #1FA85A;
  --tap: 44px;             /* zones cliquables d'au moins 44 px */
  --top-h: 56px;          /* mis à jour en direct par le script */
  --bottom-h: 64px;
  --col: 920px;           /* largeur de lecture de la conversation */
  --gutter: max(16px, calc((100% - var(--col)) / 2));
}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #F7F8FA;          /* blanc doux */
  --surface: #FFFFFF;     /* blanc pur */
  --surface-2: #F1F2F5;
  --raised: #FFFFFF;
  --recv: #FFFFFF;        /* messages reçus */
  --sent: #FFF9CC;        /* messages envoyés */
  --hover: rgba(25, 27, 31, .05);
  --ring: #E5E7EB;        /* gris brume */
  --line: #E5E7EB;
  --text: #191B1F;        /* graphite */
  --text-2: #626873;      /* gris ardoise */
  --text-3: #626873;
  --accent-ink: #191B1F;
  --danger: #C42B1C;
  --chrome: rgba(247, 248, 250, .82);
  --bubble-shadow: 0 1px 2px rgba(25, 27, 31, .07);
  --shadow: 0 0 0 1px var(--ring), 0 16px 40px -16px rgba(25, 27, 31, .22);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121316;
  --surface: #1B1D22;
  --surface-2: #23262C;
  --raised: #23262C;
  --recv: #1F2126;
  --sent: #343016;
  --hover: rgba(255, 255, 255, .06);
  --ring: #2C2F36;
  --line: #2C2F36;
  --text: #F7F8FA;
  --text-2: #A3A8B1;
  --text-3: #8A909A;
  --accent-ink: #FFE500;
  --danger: #FF6B5E;
  --chrome: rgba(18, 19, 22, .82);
  --bubble-shadow: none;
  --shadow: 0 0 0 1px var(--ring), 0 18px 48px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 16px/24px var(--font); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #FFF9CC; color: #191B1F; }

/* Icônes en trait */
.icon-btn svg, .searchbar svg, .attach svg, .attach-more svg, .send svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.menu summary svg { fill: currentColor; stroke: none; }

.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--text-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover, .icon-btn[aria-pressed="true"] { background: var(--hover); color: var(--text); }

/* ---------- Connexion ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: var(--s5); }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; gap: var(--s3); }
.login-logo { margin: 0 0 var(--s2); line-height: 0; }
.login-logo .logo { height: 52px; width: auto; color: var(--text); }
.login-card h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
.login-sub { margin: 0 0 var(--s5); color: var(--text-2); }
.login-card input {
  width: 100%; height: 48px; padding: 0 var(--s4); border-radius: var(--r-md); border: 0;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line); outline: none; font-size: 16px; transition: box-shadow .15s var(--ease);
}
.login-card input:focus { box-shadow: 0 0 0 2px var(--text); }
.login-card button {
  height: 48px; border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--on-accent);
  font-weight: 600; transition: filter .15s var(--ease), transform .1s var(--ease);
}
.login-card button:hover { filter: brightness(1.05); }
.login-card button:active { transform: scale(.985); }
.error { margin: 0; color: var(--danger); font-size: 13px; min-height: 1.2em; }

/* ---------- Structure : la conversation défile sous l'en-tête et la barre d'envoi ---------- */
.chat { position: relative; height: 100%; overflow: hidden; }
.chrome-top, .composer {
  position: absolute; left: 0; right: 0; z-index: 10;
  background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
}
.chrome-top { top: 0; padding-top: env(safe-area-inset-top); }
.top { display: flex; align-items: center; gap: var(--s1); height: 56px; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.brand .logo { display: block; height: 26px; width: auto; color: var(--text); }
.wordmark { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 2px; }
[data-theme="dark"] .i-sun, [data-theme="light"] .i-moon { display: none; }

/* Appareils de la conversation : compteur cliquable */
.people-count {
  display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; margin-right: 4px;
  border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
  font: 500 13px/1 var(--font); letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.people-count:hover { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.people-count b { font-weight: 650; color: var(--text); }
.pc-on { display: inline-flex; align-items: center; gap: 6px; }
.pc-on i { width: 7px; height: 7px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent); }
.pc-n { position: relative; padding-right: 10px; }
.pc-n::after { content: ''; position: absolute; right: 0; top: 50%; width: 1px; height: 14px; margin-top: -7px; background: var(--line); }
.person { display: grid; place-items: center; padding: 0; border: 0; background: none; border-radius: 50%; }
button.person { cursor: pointer; }
button.person:hover .avatar { transform: scale(1.06); }

.avatar {
  --size: 28px;
  position: relative; width: var(--size); height: var(--size); flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: color-mix(in srgb, var(--dev, #888) 55%, var(--surface));
  color: #fff; font: 600 calc(var(--size) * .36) var(--mono); letter-spacing: 0;
  /* Anneau de statut : gris = hors ligne, vert = en ligne */
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--text-3) 45%, transparent);
  transition: box-shadow .3s var(--ease), transform .15s var(--ease);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.6); opacity: .75; transition: filter .3s, opacity .3s; }
.avatar.online { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--online); }
.avatar.online img { filter: none; opacity: 1; }
.avatar.lg { --size: 30px; }
/* Vous : à part, plus grand, cerclé de jaune (rouge si la connexion est coupée) */
.me-slot { display: flex; align-items: center; margin-left: var(--s2); padding-left: var(--s3); border-left: 1px solid var(--line); height: 32px; }
.avatar.me-av { --size: 36px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.avatar.me-av img { filter: none; opacity: 1; }
.avatar.sm { --size: 28px; }
.avatar.xs { --size: 18px; font-size: 7px; }
.avatar.md { --size: 40px; }
.avatar.xl { --size: 84px; }
body.offline .person.me .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--danger); }

/* Menu ⋯ */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: 44px; z-index: 20; min-width: 220px; padding: 6px;
  background: var(--raised); border-radius: var(--r-md); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: pop .14s var(--ease);
}
.menu-list button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.menu-list button:hover { background: var(--hover); }
.menu-list .danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--hover); margin: 4px 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Recherche ---------- */
.searchbar { position: relative; display: flex; align-items: center; gap: var(--s2); height: 56px; padding: 8px var(--gutter); border-bottom: 1px solid var(--line); animation: slide .16s var(--ease); }
.searchbar > svg { width: 18px; height: 18px; color: var(--text-3); flex: none; position: absolute; left: calc(var(--gutter) + 13px); top: 19px; pointer-events: none; }
.searchbar input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px 0 38px; border: 0; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line); outline: none; font-size: 16px;
}
.searchbar input::-webkit-search-cancel-button { display: none; }
.search-count { font: 500 11.5px var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
mark { background: var(--accent); color: var(--on-accent); border-radius: 3px; padding: 0 1px; }

/* ---------- Messages ---------- */
.list {
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--top-h) + var(--s4)) var(--gutter) calc(var(--bottom-h) + var(--s3));
  display: flex; flex-direction: column; gap: 10px;
}
/* Barre de défilement : fine, et arrêtée avant l'en-tête et la barre d'envoi (qui flottent au-dessus) */
.list::-webkit-scrollbar { width: 12px; }
.list::-webkit-scrollbar-track { background: transparent; margin-top: var(--top-h); margin-bottom: var(--bottom-h); }
.list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-2) 35%, transparent); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
.list::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text-2) 55%, transparent); }
.empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty img { margin-bottom: var(--s3); border-radius: 14px; }
.empty-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.empty-hint { margin: 0; font: 500 12px var(--font); letter-spacing: 0; color: var(--text-3); }

.day { align-self: center; margin: var(--s2) 0 var(--s1); }
.day span {
  display: block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-2);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 500 12px var(--font); letter-spacing: 0; color: var(--text-2);
}

.msg {
  --dev: #8A8F96;
  --dev-ink: color-mix(in oklab, var(--dev) 75%, var(--text));
  display: flex; align-items: flex-end; gap: var(--s2); max-width: min(75%, 720px); flex: none;
}
.msg.enter { animation: msgIn .16s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg.mine { align-self: flex-end; }
.msg.grouped { margin-top: -5px; }
.msg-avatar { width: 28px; flex: none; align-self: flex-end; }
.msg-avatar .avatar { box-shadow: none; }
.msg-avatar .avatar img { filter: none; opacity: 1; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.mine .msg-body { align-items: flex-end; }

.line { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.mine .line { flex-direction: row-reverse; }

/* Bulles pleines, sans bordure */
.bubble {
  max-width: 100%; padding: 8px 14px;
  background: var(--recv); box-shadow: var(--bubble-shadow); color: var(--text);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 6px;
  overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}
.mine .bubble { background: var(--sent); border-radius: var(--r-lg) var(--r-lg) 6px var(--r-lg); }
.grouped .bubble { border-radius: var(--r-lg); }
.sender { display: block; padding: 0; border: 0; background: none; text-align: left; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--dev-ink); cursor: pointer; }
.sender:hover { text-decoration: underline; text-underline-offset: 2px; }
.msg-avatar { cursor: pointer; }
.text { white-space: pre-wrap; font-size: 16px; line-height: 24px; }
.bubble a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
/* Heure en bas à droite, dans la bulle */
.time {
  float: right; position: relative; top: 8px; margin: 0 -4px 0 12px;
  font: 400 12px/1.5 var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: 0;
  user-select: none; -webkit-user-select: none;
}

/* Messages longs repliés */
.text.clamp {
  max-height: 192px; overflow: hidden; /* 8 lignes */
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
          mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.bubble-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: 2px; }
.bubble-foot .time { float: none; top: 0; margin: 0 -3px 0 0; }
.fold {
  display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 0; border: 0; background: none;
  font: 500 13px var(--font); letter-spacing: 0; color: var(--text);
}
.fold svg { width: 14px; height: 14px; transition: transform .18s var(--ease); }
.fold.open svg { transform: rotate(180deg); }

/* Boutons-icônes rapides (copier, télécharger) */
.quick {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--text-3);
  text-decoration: none; opacity: 0; transition: opacity .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.quick svg { width: 16px; height: 16px; }
.msg:hover .quick, .quick:focus-visible { opacity: 1; }
.quick:hover { color: var(--text); background: var(--hover); }
.quick.ok { color: var(--online); opacity: 1; }

/* Fichiers */
.file {
  display: flex; flex-direction: column; max-width: 100%; overflow: hidden; cursor: grab;
  background: var(--recv); box-shadow: var(--bubble-shadow);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 6px;
}
.mine .file { background: var(--sent); border-radius: var(--r-lg) var(--r-lg) 6px var(--r-lg); }
.grouped .file { border-radius: var(--r-lg); }
.file:active { cursor: grabbing; }
.file img, .file video { display: block; max-width: 100%; max-height: 380px; object-fit: contain; background: var(--surface-2); }
.file audio { display: block; width: 300px; max-width: 100%; margin: 10px; }
.file-row { display: flex; align-items: center; gap: var(--s3); padding: 9px 8px 9px 10px; min-width: 250px; }
.ext {
  flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line);
  font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .02em;
}
.file-info { min-width: 0; flex: 1; }
.file-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.file-size { display: flex; align-items: baseline; gap: var(--s3); font: 400 12px var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; margin-top: 2px; }
.file-size .time { float: none; position: static; margin: 0 0 0 auto; }
.file-row .dl { width: 44px; height: 44px; opacity: 1; color: var(--text); background: var(--surface-2); }
.file-row .dl:hover { background: var(--accent); color: var(--on-accent); }
.progress { height: 3px; background: var(--hover); margin: 0 12px 10px; border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.pending { cursor: default; }

/* ---------- Saisie ---------- */
.composer { bottom: 0; padding: var(--s2) var(--gutter) max(var(--s3), env(safe-area-inset-bottom)); }
.field {
  display: flex; align-items: flex-end; gap: 2px; padding: 4px;
  background: var(--surface); border-radius: 26px; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s var(--ease);
}
.field:focus-within { box-shadow: 0 0 0 1.5px var(--text-2); }
.attach-group { position: relative; display: flex; align-items: center; flex: none; }
.attach {
  width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; color: var(--text-2); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.attach svg { width: 22px; height: 22px; }
.attach:hover { background: var(--hover); color: var(--text); }
.attach-more { width: 16px; height: var(--tap); display: grid; place-items: center; padding: 0; margin-left: -4px; border: 0; background: none; color: var(--text-3); border-radius: 6px; }
.attach-more svg { width: 13px; height: 13px; }
.attach-more:hover, .attach-group.open .attach-more { color: var(--text); }
.field textarea {
  flex: 1; min-width: 0; resize: none; max-height: 40vh; min-height: var(--tap); padding: 7px 6px;
  border: 0; background: none; outline: none; overflow-y: hidden; line-height: 24px; font-size: 16px; padding-top: 10px;
}
.field textarea::placeholder { color: var(--text-3); }
.send {
  flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); transition: transform .1s var(--ease), filter .15s var(--ease);
}
.send svg { width: 22px; height: 22px; stroke-width: 2.2; }
.send:hover { filter: brightness(1.06); }
.send:active { transform: scale(.92); }

/* ---------- Menus d'actions (clic droit / appui long) ---------- */
.popover-layer { position: fixed; inset: 0; z-index: 80; }
.popover {
  position: fixed; min-width: 220px; max-width: 300px; padding: 6px;
  background: var(--raised); border-radius: var(--r-md); box-shadow: var(--shadow); animation: pop .12s var(--ease);
}
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .4); animation: fade .16s var(--ease);
}
.sheet {
  width: min(520px, 100%); padding: 10px 10px max(14px, env(safe-area-inset-bottom));
  background: var(--raised); border-radius: 22px 22px 0 0; animation: rise .18s var(--ease);
}
.sheet::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--text-3); opacity: .5; margin: 0 auto 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
.sheet-title {
  padding: 4px 12px 8px; font: 500 12px var(--font); letter-spacing: 0; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 40px;
  border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14.5px;
}
.sheet .sheet-item { height: 52px; font-size: 16px; }
.sheet-item svg { width: 19px; height: 19px; color: var(--text-2); flex: none; }
.sheet-item:hover, .sheet-item:focus-visible { background: var(--hover); outline: none; }
.sheet-item.danger, .sheet-item.danger svg { color: var(--danger); }
.sheet-sep { height: 1px; background: var(--hover); margin: 4px 10px; }

/* ---------- Dépôt & notifications ---------- */
.drop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.drop div {
  padding: 32px 48px; border-radius: var(--r-lg); background: var(--raised); box-shadow: 0 0 0 1.5px var(--accent);
  font: 500 12px var(--font); letter-spacing: 0;
}
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 16px); z-index: 90; transform: translateX(-50%) translateY(12px); opacity: 0;
  display: flex; align-items: center; gap: var(--s3); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: var(--r-pill); background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 500; pointer-events: none; transition: .2s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.has-actions { pointer-events: auto; padding-right: 6px; }
.toast button { border: 0; padding: 5px 12px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; background: var(--accent); color: var(--on-accent); }

/* ---------- Menu rapide des dossiers (app Mac) ---------- */
.qmenu {
  position: fixed; z-index: 70; width: 300px; max-width: calc(100vw - 16px); padding: 6px;
  background: var(--raised); border-radius: var(--r-md); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: pop .14s var(--ease);
}
.qmenu-title { padding: 7px 9px 6px; font: 500 12px var(--font); letter-spacing: 0; color: var(--text-3); }
.qmenu-sep { height: 1px; background: var(--hover); margin: 4px 6px; }
.qmenu-row { position: relative; display: flex; align-items: center; }
.qmenu-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: 8px; }
.qmenu-item:hover, .qmenu-item:focus { background: var(--hover); outline: none; }
.qmenu-ic { color: var(--text-2); display: grid; place-items: center; flex: none; }
.qmenu-ic svg { width: 17px; height: 17px; }
.qmenu-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qmenu-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.qmenu-txt small { color: var(--text-3); font: 400 11px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.qmenu-tag { color: var(--text-2) !important; font: 500 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-left: 6px; font-style: normal; }
.qmenu kbd { flex: none; min-width: 20px; padding: 3px 5px; text-align: center; background: var(--hover); border-radius: 5px; font: 500 10.5px/1 var(--mono); color: var(--text-3); }
.qmenu-reveal {
  position: absolute; right: 40px; width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 6px; background: var(--surface-2); color: var(--text-2); opacity: 0; pointer-events: none; transition: opacity .1s;
}
.qmenu-reveal svg { width: 14px; height: 14px; }
.qmenu-row:hover .qmenu-reveal { opacity: 1; pointer-events: auto; }

/* ---------- Tactile : cibles plus grandes, pas de survol ---------- */
@media (pointer: coarse) {
  .quick { opacity: .9; width: 36px; height: 36px; }
  .quick.bolt-btn { display: none; } /* tactile : double appui ou appui long pour l'éclair */
  .bubble, .file { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
/* ---------- Petits écrans ---------- */
@media (max-width: 600px) {
  :root { --gutter: 10px; }
  .top { padding-right: 14px; } /* place pour l'anneau jaune de votre photo */
  .msg { max-width: 92%; }
  .file-row { min-width: 0; }
  .file-name { max-width: 50vw; }
}
@media (max-width: 560px) {
  .brand .logo { height: 22px; }
}
@media (max-width: 480px) {
  .pc-l { display: none; }
  .people-count { gap: 8px; padding: 0 10px; }
  .pc-n { padding-right: 8px; }
  .me-slot { margin-left: 2px; padding-left: 8px; }
  .avatar.lg { --size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Menu de l'avatar (votre appareil et vos réglages) ---------- */
.me-card { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.me-card .avatar.me-av { --size: 44px; box-shadow: 0 0 0 2px var(--raised), 0 0 0 4.5px var(--accent); }
.me-card strong { display: block; font-size: 15px; font-weight: 600; line-height: 20px; }
.me-card small { display: block; font-size: 13px; line-height: 18px; color: var(--text-2); }
.popover { min-width: 260px; }

/* ---------- Bouton photo ---------- */
.attach.camera { padding: 0; border: 0; background: none; }

/* ---------- Éclairs ⚡ ---------- */
.bolt { width: 16px; height: 16px; flex: none; fill: var(--accent); stroke: #191B1F; stroke-width: 1.6; stroke-linejoin: round; }
.quick.bolt-btn svg { width: 17px; height: 17px; }
.quick.bolt-btn:hover, .quick.bolt-btn.liked { color: #191B1F; }
.quick.bolt-btn:hover svg, .quick.bolt-btn.liked svg { fill: var(--accent); }
[data-theme="dark"] .quick.bolt-btn:hover, [data-theme="dark"] .quick.bolt-btn.liked { color: var(--accent); }
.likes {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; margin-top: -6px; padding: 0 8px 0 6px;
  border: 0; border-radius: var(--r-pill); background: var(--surface); color: var(--text-2);
  box-shadow: 0 0 0 2px var(--bg), var(--bubble-shadow); position: relative; z-index: 1;
  font: 600 12px/1 var(--font); letter-spacing: 0; font-variant-numeric: tabular-nums;
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.msg:not(.mine) .likes { margin-left: 10px; }
.mine .likes { margin-right: 10px; }
.likes:hover { transform: scale(1.05); }
.likes.by-me { background: #FFF3A3; color: #191B1F; }
[data-theme="dark"] .likes { background: var(--surface-2); }
[data-theme="dark"] .likes.by-me { background: #4A4317; color: var(--text); }
.likers { display: inline-flex; }
.likers .avatar { box-shadow: 0 0 0 1.5px var(--surface); margin-left: -4px; }
.likers .avatar:first-child { margin-left: 0; }
.likers .avatar img { filter: none; opacity: 1; }
.liked-pop .likes .bolt { animation: boltPop .42s cubic-bezier(.3, 1.6, .5, 1); }
.liked-pop .likes { animation: likesIn .2s var(--ease); }
@keyframes boltPop { 0% { transform: scale(.4) rotate(-12deg); } 60% { transform: scale(1.35) rotate(6deg); } 100% { transform: none; } }
@keyframes likesIn { from { opacity: 0; transform: translateY(-4px) scale(.9); } }

/* ---------- Fenêtres : profil, appareils, avatars, bio, photo ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  background: rgba(10, 11, 13, .38); animation: fade .16s var(--ease);
}
.dialog {
  position: relative; width: min(400px, 100%); max-height: min(720px, calc(100vh - 48px)); display: flex; flex-direction: column;
  background: var(--raised); border-radius: 20px; box-shadow: var(--shadow); animation: dialogIn .18s var(--ease); overflow: hidden;
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.still, .still > * { animation: none !important; }
.sheet.panel { position: relative; max-height: 88vh; display: flex; flex-direction: column; padding-left: 0; padding-right: 0; padding-bottom: 0; }
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px max(16px, env(safe-area-inset-bottom)); }
.dialog .panel-scroll { padding: 8px 16px 16px; }
.panel-close {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.panel-close:hover { color: var(--text); background: var(--hover); }
.panel-close svg { width: 16px; height: 16px; }
.sheet.panel .panel-close { top: 14px; }
.panel-head { padding: 14px 44px 12px 4px; }
.panel-head h2 { margin: 0; font-size: 19px; line-height: 26px; font-weight: 650; letter-spacing: -.02em; }
.panel-head p { margin: 2px 0 0; font-size: 13.5px; line-height: 20px; color: var(--text-2); }
.panel-menu { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.panel-menu .sheet-item { height: 44px; }
.sheet .panel-menu .sheet-item { height: 50px; }
.sheet-item:disabled { opacity: .4; cursor: default; }
.sheet-item:disabled:hover { background: none; }
.you {
  display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); font: 600 10.5px/14px var(--font); font-style: normal; letter-spacing: .02em;
}

/* Interrupteurs (notifications, son) */
.sheet-item.toggle span { flex: 1; }
.switch {
  position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: color-mix(in srgb, var(--text-3) 40%, transparent);
  transition: background .18s var(--ease);
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s var(--ease);
}
.toggle.on .switch { background: var(--text); }
.toggle.on .switch::after { transform: translateX(16px); background: var(--accent); }

/* Liste des appareils */
.people-list { display: flex; flex-direction: column; gap: 2px; }
.person-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 8px 8px 8px 10px;
  border: 0; border-radius: 14px; background: none; text-align: left;
}
.person-row:hover, .person-row:focus-visible { background: var(--hover); outline: none; }
.person-row .avatar { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px color-mix(in srgb, var(--text-3) 45%, transparent); }
.person-row .avatar.online { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--online); }
.person-row .avatar.me-av { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4.5px var(--accent); }
.pr-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pr-name { font-size: 15.5px; font-weight: 600; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-txt small { font-size: 13px; line-height: 18px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-status.is-on { color: color-mix(in oklab, var(--online) 80%, var(--text)); font-weight: 500; }
.pr-bio { color: var(--text-2); font-style: italic; }
.name-input {
  width: 100%; height: 48px; padding: 0 14px; border: 0; border-radius: 14px; outline: none;
  background: var(--surface-2); font-size: 16px; box-shadow: inset 0 0 0 1px var(--line);
}
.name-input:focus { box-shadow: inset 0 0 0 1.5px var(--text); }
.name-error { margin: 8px 2px 0; min-height: 18px; font-size: 13px; color: var(--danger); }
.name-error:empty { min-height: 0; margin: 0; }
.pr-go { width: 16px; height: 16px; color: var(--text-3); transform: rotate(-90deg); flex: none; }

/* Fiche profil */
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 4px 4px; }
.pf-photo { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; margin-bottom: 14px; }
button.pf-photo[data-act] { cursor: pointer; }
.pf-photo .avatar { box-shadow: 0 0 0 3px var(--raised), 0 0 0 6px color-mix(in srgb, var(--text-3) 45%, transparent); }
.pf-photo .avatar.online { box-shadow: 0 0 0 3px var(--raised), 0 0 0 6px var(--online); }
.pf-photo .avatar.me-av { box-shadow: 0 0 0 3px var(--raised), 0 0 0 7px var(--accent); }
.pf-photo .avatar img { filter: none; opacity: 1; }
.pf-edit {
  position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--text); color: var(--bg); box-shadow: 0 0 0 3px var(--raised); transition: transform .15s var(--ease);
}
.pf-edit svg { width: 15px; height: 15px; }
.pf-photo:hover .pf-edit { transform: scale(1.08); }
.profile-card h2 { margin: 0; font-size: 21px; line-height: 28px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.pf-status { display: inline-flex; align-items: center; gap: 7px; margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.pf-status i { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text-3) 60%, transparent); }
.pf-status.is-on { color: color-mix(in oklab, var(--online) 80%, var(--text)); }
.pf-status.is-on i { background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent); }
.bio { margin: 14px 0 0; max-width: 300px; font-size: 15px; line-height: 22px; color: var(--text); overflow-wrap: anywhere; }
.bio-none { color: var(--text-3); font-size: 14px; }
.bio-empty {
  padding: 7px 14px; border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: 14px; font-weight: 500;
}
.bio-empty:hover { color: var(--text); background: var(--hover); }
.facts { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0 4px; }
.facts div { padding: 10px 4px 9px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.facts .wide { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding: 9px 12px; }
.facts dt { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; line-height: 16px; color: var(--text-2); }
.facts dt .bolt { width: 13px; height: 13px; }
.facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 650; line-height: 20px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts div:first-child dd { font-size: 12.5px; font-weight: 600; }
.facts .wide dd { margin: 0; font-size: 13px; font-weight: 600; }

/* Grille des 50 avatars */
.av-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 4px 4px 8px; }
.av-cell { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); overflow: hidden; transition: transform .12s var(--ease), box-shadow .15s var(--ease); }
.av-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-cell:not([disabled]):hover { transform: scale(1.07); box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--text); }
.av-cell.current { box-shadow: 0 0 0 2px var(--raised), 0 0 0 5px var(--accent); }
.av-cell[disabled] { cursor: not-allowed; }
.av-cell[disabled] img { filter: grayscale(1); opacity: .28; }

/* Bio */
.bio-edit textarea {
  width: 100%; resize: none; padding: 12px 14px; border: 0; border-radius: 14px; outline: none;
  background: var(--surface-2); font-size: 16px; line-height: 24px; box-shadow: inset 0 0 0 1px var(--line);
}
.bio-edit textarea:focus { box-shadow: inset 0 0 0 1.5px var(--text); }
.bio-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.bio-foot > div { display: flex; gap: 8px; }
.bio-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bio-count.full { color: var(--danger); }
.btn-primary, .btn-ghost { height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill); font-size: 14.5px; font-weight: 600; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--hover); }

/* Photo (ordinateur) */
.dialog.camera-panel { width: min(640px, 100%); }
.camera-panel .panel-scroll { padding: 0; }
.camera-panel .panel-close { background: rgba(0, 0, 0, .45); color: #fff; }
.cam { position: relative; background: #0B0C0E; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam video.mirror { transform: scaleX(-1); }
.cam-msg { position: absolute; margin: 0; padding: 0 24px; color: #C9CDD3; font-size: 14px; text-align: center; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.cam-bar.review { justify-content: flex-end; }
.cam-side-slot { width: 44px; display: grid; place-items: center; }
.cam-side { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.cam-side svg { width: 20px; height: 20px; }
.cam-shot {
  width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--raised), 0 0 0 6px var(--text); transition: transform .1s var(--ease);
}
.cam-shot:hover { filter: brightness(1.05); }
.cam-shot:active { transform: scale(.92); }

@media (max-width: 420px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
  .av-grid { gap: 8px; }
}

/* ---------- Bandeau « Nouvelle version » (appli Android) ---------- */
.update-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px var(--gutter);
  background: var(--accent); color: var(--on-accent); animation: slide .2s var(--ease);
}
.ub-text { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; }
.ub-text b { font-weight: 650; }
.ub-go {
  flex: none; height: 34px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
  background: var(--on-accent); color: var(--accent); font-size: 14px; font-weight: 650;
}
.ub-go:active { transform: scale(.97); }
.update-bar .ub-x { width: 34px; height: 34px; color: var(--on-accent); }
.update-bar .ub-x svg { width: 18px; height: 18px; }
.update-bar .ub-x:hover { background: rgba(25, 27, 31, .08); color: var(--on-accent); }

.steps { margin: 4px 0 8px; padding: 0 4px 0 26px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 22px; }
.steps li::marker { font-weight: 700; color: var(--text); }
.steps b { font-weight: 650; }

/* ---------- Photos : image seule, heure et téléchargement en surimpression ---------- */
.file.media { position: relative; width: fit-content; max-width: 100%; }
.file.media img { max-height: 420px; width: auto; min-width: 160px; min-height: 100px; object-fit: cover; background: none; cursor: zoom-in; }
.media-sender { padding: 6px 12px 6px; }
.media-meta { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.media-meta .time {
  float: none; position: static; margin: 0; padding: 1px 8px; border-radius: var(--r-pill);
  background: rgba(10, 11, 13, .5); color: #fff; font-size: 11.5px; line-height: 20px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.media-meta .dl {
  pointer-events: auto; width: 36px; height: 36px; opacity: 1; color: #fff;
  background: rgba(10, 11, 13, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.media-meta .dl:hover { background: var(--accent); color: var(--on-accent); }
.media-meta .dl svg { width: 17px; height: 17px; }
