/* ===== Thème : clair / sombre automatique selon le téléphone ===== */
:root {
  color-scheme: light dark;
  --accent: #2563eb;
  --accent-ink: #fff;
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #111114;
  --muted: #6c6c78;
  --line: #e2e2e8;
  --field: #f2f2f7;
  --danger: #d92d20;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --chat-bg: #efeae2;
  --in: #ffffff;
  --out: #d9fdd3;
  --bar: #ffffff;
  --adm: #1d6fe0;
  --nl: 36%;
  --meta: #667781;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #f2f2f7;
    --muted: #9a9aa6;
    --line: #2c2c2e;
    --field: #2c2c2e;
    --chat-bg: #0b141a;
    --in: #202c33;
    --out: #005c4b;
    --bar: #202c33;
    --adm: #53a6ff;
    --nl: 68%;
    --meta: #8696a0;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
html { overflow: hidden; }
body { position: fixed; inset: 0; width: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
input, textarea, select { font-size: 16px; }   /* 16 px minimum : iOS ne zoome plus au focus */
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

#app { position: absolute; top: 0; left: 0; right: 0; height: var(--app-h, 100%); overflow: hidden; }
.boot { height: 100%; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { max-width: 520px; margin: 12vh auto; padding: 0 24px; line-height: 1.5; }

/* ===== Boutons et champs ===== */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 20px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 16.5px; text-decoration: none; }
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.sec { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--danger); }
.btn + .btn { margin-top: 10px; }
.field { width: 100%; height: 50px; padding: 0 14px; margin-bottom: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); font-size: 17px; outline: none; }
.field:focus { border-color: var(--accent); }
.small { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; text-align: center; }

/* ===== Écrans d'accueil (installation, notifications, pseudo) ===== */
.gate { height: 100%; overflow-y: auto; display: flex; padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.gate-in { width: 100%; max-width: 420px; margin: auto; }
.brand { text-align: center; margin-bottom: 18px; }
.brand img { width: 72px; height: 72px; border-radius: 16px; display: block; margin: 0 auto 10px; border: 1px solid var(--line); }
.brand h1 { margin: 0; font-size: 22px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.dots i { width: 24px; height: 4px; border-radius: 2px; background: var(--line); }
.dots i.on { background: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 18px 18px; }
.panel h2 { margin: 0 0 8px; font-size: 20px; text-align: center; }
.panel > p { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.5; text-align: center; }
.panel > p.err { color: var(--danger); font-weight: 600; margin: -6px 0 14px; }
.panel > p.note { background: var(--field); color: var(--ink); border-radius: 10px; padding: 10px 12px; text-align: left; font-size: 14px; }
.panel .ic { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--accent); }
.panel .ic svg { width: 100%; height: 100%; }
.steps { list-style: none; counter-reset: s; margin: 0 0 16px; padding: 0; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 12px 40px; font-size: 15.5px; line-height: 1.45; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--field); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.steps svg { display: inline-block; vertical-align: -5px; width: 20px; height: 20px; color: var(--accent); margin: 0 2px; }

/* ===== Chat (bulles façon messagerie) ===== */
.chat { height: 100%; display: flex; flex-direction: column; background: var(--chat-bg); }
.bar { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 8px 8px 12px; background: var(--bar); border-bottom: 1px solid var(--line); z-index: 2; }
.bar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.bar .ttl { flex: 1; min-width: 0; }
.bar .ttl b { display: block; font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .ttl span { display: block; font-size: 12.5px; color: var(--muted); min-height: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn:active { background: var(--field); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

.feed { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 8px 10px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.feed > :first-child { margin-top: auto; }
.older { align-self: center; margin: 4px 0; padding: 7px 14px; border-radius: 999px; background: var(--in); color: var(--meta); font-size: 13px; font-weight: 600; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.day { align-self: center; margin: 10px 0 8px; }
.day span { display: block; padding: 5px 13px; border-radius: 12px; background: var(--in); color: var(--meta); font-size: 12.5px; font-weight: 500; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.sys { align-self: center; max-width: 90%; margin: 6px 0; }
.sys span { display: block; padding: 5px 13px; border-radius: 12px; background: var(--in); color: var(--meta); font-size: 13px; text-align: center; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.empty { align-self: center; margin: auto; text-align: center; color: var(--meta); padding: 30px; font-size: 15px; line-height: 1.5; }
.empty b { display: block; font-size: 16.5px; color: var(--ink); margin-bottom: 4px; }

/* Une ligne = [avatar] [bulle]. Les autres à gauche, moi à droite. */
.row { position: relative; display: flex; align-items: flex-end; gap: 6px; margin-top: 2px; touch-action: pan-y; }
.row.first { margin-top: 8px; }
.row.me { justify-content: flex-end; }
.row.flash .bub { animation: flash 1.2s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 100vmax rgba(37,99,235,.22) inset; } 100% { box-shadow: none; } }
.avc { flex: none; width: 30px; align-self: flex-end; }
.av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; object-fit: cover; color: #fff; font-weight: 700; font-size: 14px; }
.col { position: relative; display: flex; flex-direction: column; min-width: 0; max-width: 82%; }
.row.me .col { align-items: flex-end; }
.rpi { position: absolute; left: 6px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: rgba(128,128,128,.28); color: var(--ink); display: grid; place-items: center; opacity: 0; transform: scale(calc(.4 + var(--sp, 0) * .6)); pointer-events: none; }
.row.swp .rpi { opacity: var(--sp, 0); }
.rpi svg { width: 17px; height: 17px; }

.bub { position: relative; min-width: 60px; padding: 7px 10px 7px; border-radius: 19px; background: var(--in); color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,.13); overflow-wrap: anywhere; cursor: pointer; }
.row.me .bub { background: var(--out); }
.row.ot.first .bub { border-top-left-radius: 5px; }
.row.me.first .bub { border-top-right-radius: 5px; }
.row.ot.first .bub::before, .row.me.first .bub::before { content: ""; position: absolute; top: 0; width: 9px; height: 13px; background: inherit; }
.row.ot.first .bub::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.row.me.first .bub::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bub .nm { font-size: 13.5px; font-weight: 700; line-height: 1.25; margin: 0 2px 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: hsl(var(--h) 70% var(--nl)); }
.row.adm .bub .nm { color: var(--adm); }
.txt { margin: 0 2px; font-size: 16px; line-height: 1.38; white-space: pre-wrap; }
.txt a { word-break: break-all; }
.txt code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: rgba(128,128,128,.22); border-radius: 4px; padding: 1px 5px; }
.txt del { opacity: .75; }
.txt .sp { display: inline-block; width: 46px; height: 1px; }
.txt .sp.w { width: 74px; }
.bub > * + .txt { margin-top: 4px; }

/* Heure (et « vu » pour l'admin) */
.meta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1; color: var(--meta); white-space: nowrap; }
.bub.hastxt > .meta { position: absolute; right: 8px; bottom: 5px; }
.meta.st { display: flex; justify-content: flex-end; margin: 3px 2px -1px; }
.row.me .meta:not(.ov) { color: color-mix(in srgb, var(--ink) 55%, transparent); }
.meta.ov { position: absolute; right: 7px; bottom: 7px; padding: 3px 8px; border-radius: 12px; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; }
.meta.ov svg { width: 13px; height: 13px; }
.meta.ov.stkm { position: static; align-self: flex-end; margin-top: 2px; background: rgba(0,0,0,.3); }
.seen { display: inline-flex; align-items: center; gap: 3px; color: inherit; font-size: 11px; font-weight: 600; padding: 0 2px; }
.seen svg { width: 14px; height: 14px; }
.meta.ov .seen { color: #fff; }

/* Réactions : petites pastilles sous la bulle */
.reacts { display: flex; flex-wrap: wrap; gap: 3px; margin: -6px 8px 0; position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px; background: var(--in); border: 1.5px solid var(--chat-bg); box-shadow: 0 1px 1px rgba(0,0,0,.18); font-size: 14px; line-height: 1.4; }
.chip small { font-size: 12px; color: var(--meta); font-weight: 700; }
.chip.on { background: color-mix(in srgb, var(--accent) 24%, var(--in)); }

/* Réponse citée */
.quote { display: flex; align-items: stretch; gap: 8px; border-radius: 11px; background: rgba(128,128,128,.17); overflow: hidden; min-width: 0; cursor: pointer; }
.quote::before { content: ""; flex: none; width: 4px; background: hsl(var(--h) 70% var(--nl)); }
.quote.adm::before { background: var(--adm); }
.quote.gone::before { background: var(--meta); }
.quote .qb { flex: 1; min-width: 0; padding: 5px 4px 5px 0; }
.quote .qn { display: block; font-size: 13px; font-weight: 700; color: hsl(var(--h) 70% var(--nl)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote.adm .qn { color: var(--adm); }
.quote .qt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; color: var(--meta); line-height: 1.3; }
.quote.gone .qt { font-style: italic; }
.quote .qth { flex: none; width: 46px; height: 46px; object-fit: cover; }
.bub > .quote { margin: 0 0 4px; }

/* Photos et vidéos : au plus ~76 % de la largeur et 50 % de la hauteur de l'écran */
.bub.media { padding: 4px; }
.bub.media .txt { margin: 4px 4px 0; }
.bub.media .nm { margin: 2px 5px 3px; }
.pic-wrap { position: relative; width: min(56vw, 240px); max-height: 34vh; border-radius: 15px; overflow: hidden; background: rgba(128,128,128,.25); cursor: zoom-in; }
.pic-wrap img, .pic-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.playbtn { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; pointer-events: none; }
.playbtn svg { width: 26px; height: 26px; margin-left: 3px; }
.playbtn.sm { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.playbtn.sm svg { width: 18px; height: 18px; }

/* Album : 2 × 2 */
.album { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: min(56vw, 240px); border-radius: 15px; overflow: hidden; }
.album .t { position: relative; aspect-ratio: 1; background: rgba(128,128,128,.25); overflow: hidden; cursor: zoom-in; }
.album .t img, .album .t video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.album.a3 .t:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }
.album .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-size: 30px; font-weight: 600; }

/* Vocal */
.aud { display: flex; align-items: center; gap: 8px; width: min(66vw, 290px); padding: 2px 2px 0; }
.vav { position: relative; flex: none; width: 42px; height: 42px; }
.vav .av { width: 42px; height: 42px; }
.vav .mic { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--in); color: var(--accent); display: grid; place-items: center; box-shadow: 0 0 0 1.5px var(--in); }
.row.me .vav .mic { background: var(--out); box-shadow: 0 0 0 1.5px var(--out); }
.vav .mic svg { width: 11px; height: 11px; }
.aud .play { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: var(--meta); }
.aud .play svg { width: 24px; height: 24px; }
.aud .wv { flex: 1; min-width: 0; }
.wave { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--meta) 55%, transparent); }
.wave i.on { background: var(--accent); }
.dur { display: block; margin-top: 1px; font-size: 11.5px; color: var(--meta); font-variant-numeric: tabular-nums; }

/* Fichiers, stickers */
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 13px; background: rgba(128,128,128,.17); color: var(--ink); text-decoration: none; min-width: 200px; }
.file svg { width: 26px; height: 26px; flex: none; color: var(--accent); }
.file b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file span { font-size: 12.5px; color: var(--meta); }
.file > div { min-width: 0; }
.row.stk .bub { background: transparent; box-shadow: none; padding: 0; }
.row.stk .bub::before { display: none; }
.stk-img { display: block; width: 150px; height: 150px; object-fit: contain; }
.stk-emoji { font-size: 76px; line-height: 1.1; }

.jump { position: absolute; right: 12px; bottom: calc(72px + var(--safe-b)); z-index: 4; min-width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; border-radius: 999px; background: var(--in); color: var(--meta); box-shadow: 0 2px 6px rgba(0,0,0,.3); font-weight: 700; font-size: 14px; }
.jump svg { width: 22px; height: 22px; }
.jump.cnt { background: var(--accent); color: var(--accent-ink); }
.kb .jump { bottom: 66px; }

/* ===== Zone de saisie ===== */
.wrap { flex: none; }
.composer { background: var(--chat-bg); padding: 6px 6px calc(6px + var(--safe-b)); }
.kb .composer, .kb .locked { padding-bottom: 6px; }
.row-in { display: flex; align-items: flex-end; gap: 4px; }
.field-wrap { position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-end; border-radius: 22px; background: var(--in); box-shadow: 0 1px 1px rgba(0,0,0,.13); }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 130px; min-height: 44px; padding: 11px 4px 11px 14px; border: 0; background: transparent; font-size: 16px; line-height: 1.3; outline: none; -webkit-appearance: none; appearance: none; }
.composer textarea::placeholder { color: var(--meta); }
.tool { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--meta); }
.tool:active { background: rgba(128,128,128,.2); }
.tool svg { width: 24px; height: 24px; }
.tool.in { width: 42px; height: 44px; }
.send { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.send svg { width: 21px; height: 21px; }
.send:active { opacity: .85; }
.fmtbar { display: flex; gap: 6px; padding: 0 2px 6px; }
.fmtbar button { min-width: 38px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--in); font-size: 15px; font-weight: 700; box-shadow: 0 1px 1px rgba(0,0,0,.13); }
.fmtbar button:active { background: var(--line); }
.replybar { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; padding: 6px 4px 6px 6px; border-radius: 14px; background: var(--in); box-shadow: 0 1px 1px rgba(0,0,0,.13); }
.replybar .quote { flex: 1; min-width: 0; cursor: default; }
.pending { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 6px 8px; border-radius: 12px; background: var(--in); }
.pending img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.pending .pi { width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent); flex: none; }
.pending .pi svg { width: 26px; height: 26px; }
.pending .pt { flex: 1; min-width: 0; font-size: 13.5px; }
.pending .pt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending .pt span { color: var(--meta); }
.bar-progress { height: 3px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.bar-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.rec { display: flex; align-items: center; gap: 6px; }
.rec .live { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; border-radius: 22px; background: var(--in); font-variant-numeric: tabular-nums; font-weight: 600; }
.rec .live i { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.locked { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 16px calc(14px + var(--safe-b)); background: var(--bar); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; line-height: 1.35; }
.locked svg { width: 18px; height: 18px; flex: none; }

/* ===== Feuilles (menus du bas) ===== */
.scrim { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88%; overflow-y: auto; background: var(--card); border-radius: 16px 16px 0 0; padding: 8px 14px calc(14px + var(--safe-b)); }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { margin: 4px 4px 10px; font-size: 18px; }
.sheet .sub { margin: -4px 4px 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.emojis { display: flex; justify-content: space-between; gap: 2px; padding: 4px; margin-bottom: 6px; background: var(--field); border-radius: 999px; }
.emo { flex: 1; aspect-ratio: 1; max-width: 44px; border-radius: 50%; font-size: 23px; display: grid; place-items: center; }
.emo:active { background: var(--line); }
.emo.on { box-shadow: inset 0 0 0 2px var(--accent); }
.item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 6px; border-radius: 10px; text-align: left; font-size: 16px; font-weight: 500; }
.item:active { background: var(--field); }
.item > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.item.danger, .item.danger > svg { color: var(--danger); }
.item small { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.35; }
.item .grow { flex: 1; min-width: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.switch { position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.row-btns { display: flex; gap: 10px; margin-top: 8px; }
.row-btns .btn { min-height: 46px; margin: 0; font-size: 15.5px; }
.stat { margin: 2px 4px 10px; padding: 10px 12px; border-radius: 10px; background: var(--field); font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.stat b { color: var(--ink); }
.members { margin: 0; padding: 0; list-style: none; }
.members li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.members li:last-child { border: 0; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; }
.members .meta { flex: 1; min-width: 0; }
.members .meta b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.members .meta span { font-size: 12.5px; color: var(--muted); }
.members .tag { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--danger); color: #fff; margin-left: 6px; vertical-align: 2px; }
.mini { padding: 6px 11px; border-radius: 8px; background: var(--field); font-size: 13px; font-weight: 600; }
.mini.danger { color: var(--danger); }
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.stk-grid button { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--field); display: grid; place-items: center; font-size: 34px; }
.stk-grid button:active { background: var(--line); }
.stk-grid img { width: 80%; height: 80%; object-fit: contain; }
.stk-grid .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 14px; display: grid; place-items: center; }
.stk-grid .add { color: var(--accent); }
.stk-grid .add svg { width: 28px; height: 28px; }
.sheet h4 { margin: 10px 4px 8px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

.lightbox { position: absolute; inset: 0; z-index: 18; background: rgba(0,0,0,.95); display: flex; flex-direction: column; color: #fff; }
.lb-top { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 8px 8px; background: linear-gradient(rgba(0,0,0,.6), transparent); position: relative; z-index: 2; }
.lb-who { flex: 1; min-width: 0; line-height: 1.25; }
.lb-who b, .lb-who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-who span { font-size: 12.5px; opacity: .75; }
.lb-cnt { font-size: 13px; opacity: .75; padding: 0 4px; }
.lb-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; color: #fff; display: grid; place-items: center; text-decoration: none; }
.lb-btn:active { background: rgba(255,255,255,.16); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin-top: -58px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-nav { position: absolute; top: 50%; width: 44px; height: 64px; margin-top: -32px; color: #fff; font-size: 38px; background: rgba(0,0,0,.25); z-index: 2; }
.lb-nav.l { left: 0; border-radius: 0 10px 10px 0; }
.lb-nav.r { right: 0; border-radius: 10px 0 0 10px; }
@media (pointer: coarse) { .lb-nav { display: none; } }

.toast { position: absolute; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); z-index: 40; max-width: 88%; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 500; text-align: center; animation: toast 2.8s ease both; pointer-events: none; }
@keyframes toast { 0% { opacity: 0; } 8%, 88% { opacity: 1; } 100% { opacity: 0; } }
.banned { height: 100%; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--muted); line-height: 1.5; }
.banned b { display: block; font-size: 21px; color: var(--ink); margin-bottom: 6px; }

@media (min-width: 760px) { #app { max-width: 720px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }

.link { display: block; margin: 12px auto 0; padding: 8px 12px; color: var(--muted); font-size: 15px; font-weight: 600; text-align: center; }

.secret { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.secret img { pointer-events: none; -webkit-user-drag: none; }
.ver { opacity: .6; font-size: 12px; }

/* ===== Messages privés, écran Discussions ===== */
.dm .avc { display: none; }
.icon-btn.back { position: relative; width: 36px; margin-left: -6px; }
.icon-btn.back svg { width: 26px; height: 26px; }
.bn { position: absolute; top: 2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font); font-style: normal; text-align: center; }
.av.hd { width: 40px; height: 40px; font-size: 17px; flex: none; }
.av.big { width: 64px; height: 64px; font-size: 28px; }
.avc.tap { cursor: pointer; }
.prof { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 10px; }
.prof b { font-size: 18px; }
.members li.pick { cursor: pointer; }
.members li.pick:active { background: var(--field); }

.chat.list { background: var(--bg); }
.lhead { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 0; }
.lhead .grow { flex: 1; }
.round { width: 54px; height: 54px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--ink); display: grid; place-items: center; }
.round svg { width: 24px; height: 24px; }
.round.plus { background: #22c55e; border-color: transparent; color: #000; }
.round.plus svg { width: 28px; height: 28px; stroke-width: 2.6; }
.ltitle { flex: none; margin: 14px 18px 8px; font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.dlist { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 calc(16px + var(--safe-b)); }
.lrow { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 18px; text-align: left; }
.lrow:active { background: var(--field); }
.lav { flex: none; width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--line); }
.lmid { flex: 1; min-width: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.ln { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp { margin-top: 2px; font-size: 15.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow.unread .lp { color: var(--ink); font-weight: 500; }
.lend { flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-left: -14px; padding-left: 14px; }
.lt { font-size: 14.5px; color: var(--muted); }
.lrow.unread .lt { color: #22c55e; font-weight: 600; }
.ubadge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: #22c55e; color: #000; font-size: 13.5px; font-weight: 700; display: grid; place-items: center; }

/* ===== Pièces jointes multiples ===== */
.pstrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; }
.pending { display: block; }
.pth { position: relative; flex: none; width: 74px; height: 74px; border-radius: 12px; overflow: hidden; background: var(--field); }
.pth img, .pth video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pth .pi { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px; font-size: 10.5px; color: var(--meta); text-align: center; overflow: hidden; }
.pth .pi svg { width: 26px; height: 26px; color: var(--accent); }
.pth .pi span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pth .playbtn { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.pth .playbtn svg { width: 14px; height: 14px; }
.prm { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.prm svg { width: 13px; height: 13px; }

/* ===== Caméra intégrée ===== */
.cam { position: absolute; inset: 0; z-index: 25; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-v.mirror { transform: scaleX(-1); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: shot .25s ease-out; }
@keyframes shot { 0% { opacity: .85; } 100% { opacity: 0; } }
.cam-top { position: relative; display: flex; justify-content: space-between; padding: calc(12px + var(--safe-t)) 14px 0; }
.cam-btn { width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; display: grid; place-items: center; }
.cam-btn svg { width: 24px; height: 24px; }
.cam-bot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 22px 26px calc(26px + var(--safe-b)); background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.cam-gal, .cam-done { width: 54px; height: 54px; border-radius: 14px; background: rgba(255,255,255,.2); border: 2px solid #fff; color: #fff; display: grid; place-items: center; position: relative; }
.cam-gal svg { width: 26px; height: 26px; }
.cam-done { background: var(--accent); border-color: transparent; border-radius: 50%; }
.cam-done svg { width: 26px; height: 26px; }
.cam-done span { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: #fff; color: #000; font: 700 12px/22px var(--font); text-align: center; padding: 0 5px; }
.cam-done[hidden] { display: block !important; visibility: hidden; }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.cam-shutter i { width: 58px; height: 58px; border-radius: 50%; background: #fff; display: block; }
.cam-shutter:active i { transform: scale(.9); }

/* v3.2 : effets de voix (admin) */
.sheet.rv { padding-top: 6px; }
.rvp { display: flex; align-items: center; gap: 12px; margin: 4px 4px 6px; }
.rvp .sub { margin: 0; flex: 1; }
.play.big { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; border: 0; }
.play.big svg { width: 24px; height: 24px; }
.fxs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 2px 8px; }
.fxc { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: transparent; color: var(--ink); font-size: 13.5px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.fxc .fe { font-size: 24px; line-height: 1; }
.fxc.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.row-btns { display: flex; gap: 10px; margin-top: 6px; }
.row-btns .btn + .btn { margin-top: 0; }
.msg a, .bubble a { text-decoration: underline; word-break: break-all; }
.sheet.rv { max-height: 92%; }
.fxadj { margin: 0 4px 6px; }
.fxr { display: block; margin: 0 0 12px; }
.fxt { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.fxt b { color: var(--accent); font-variant-numeric: tabular-nums; }
.fxr input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
.fxe { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.fxe i { font-style: normal; }
.fxreset { display: block; margin: 0 4px 10px; background: none; color: var(--accent); font-size: 14px; font-weight: 600; padding: 6px 0; }
.fxreset[hidden] { display: none; }
.sheet.rv .rvp { position: sticky; top: -8px; z-index: 2; background: var(--card); padding: 6px 4px; margin: 0; }
.sheet.rv .row-btns { position: sticky; bottom: calc(-14px - var(--safe-b)); z-index: 2; background: var(--card); padding: 10px 0 calc(14px + var(--safe-b)); margin: 0; }

/* v3.4 : coches d'envoi */
.tk { display: inline-flex; align-items: center; gap: 2px; margin-left: 1px; }
.meta .tk svg { width: 17px; height: 17px; stroke-width: 2.3; }
.meta .tk.wait svg { width: 13px; height: 13px; stroke-width: 2.2; }
.tk small { font-size: 10px; min-width: 0; }
.tk.seen { color: #34b7f1; }
.meta.ov .tk.seen { color: #5ccaff; }
.tk.fail { color: var(--danger); }
.meta.ov .tk.fail { color: #ff8a80; }
.row.pend .bub { opacity: .88; }
.row.pend .pic-wrap img, .row.pend .pic-wrap video, .row.pend .album .t img { opacity: .65; }
.hint { color: var(--muted); font-size: 13.5px; }
.nrrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 2px 8px; }
.fxc.nrb { padding: 11px 4px; }

/* v3.5 : sondages et boost de réactions */
.bub.poll { min-width: min(72vw, 300px); }
.pollb { padding: 2px 2px 0; }
.pq { display: flex; gap: 8px; align-items: flex-start; font-size: 16px; line-height: 1.3; }
.pq svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent); }
.ph { font-size: 12.5px; color: var(--muted); margin: 3px 0 8px; }
.po { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; background: rgba(128,128,128,.14); text-align: left; overflow: hidden; color: var(--ink); font-size: 15px; }
.po[disabled] { opacity: 1; }
.po .pb { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 26%, transparent); transition: width .3s; }
.po .pk { position: relative; flex: none; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 35%, transparent); display: grid; place-items: center; color: #fff; }
.po .pk.sq { border-radius: 6px; }
.po.on .pk { background: var(--accent); box-shadow: none; }
.po .pk svg { width: 14px; height: 14px; stroke-width: 3; }
.po .pt { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.po .pn { position: relative; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pf { font-size: 12.5px; color: var(--muted); margin: 2px 2px 0; }
.pforms .field { margin-bottom: 8px; }
.bxrow { display: flex; align-items: center; gap: 5px; margin: 0 0 8px; }
.bxrow .bxe { font-size: 24px; width: 34px; text-align: center; flex: none; }
.bxrow .bxn { flex: 1; min-width: 0; height: 40px; text-align: center; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font-size: 16px; font-weight: 600; outline: none; }
.bxrow .bxq { flex: none; min-width: 34px; height: 40px; padding: 0 6px; border-radius: 10px; background: rgba(128,128,128,.16); color: var(--ink); font-size: 13px; font-weight: 600; }
