/* RavenCHAT – encre de nuit, reflets de plumage.
   Polices système (Segoe UI Variable sous Windows) : rien à télécharger. */
:root {
  --ink: #12151d;
  --night: #181c26;
  --slate: #1f2430;
  --stage: #0f1218;
  --raise: #2a3040;
  --deep: #151821;
  --text: #e4e7ef;
  --soft: #b4bccd;
  --muted: #9aa3b8;
  --plume: #7d8cff;
  --plume-2: #3fc1c9;
  --danger: #d6455b;
  --danger-soft: #3a2028;
  --danger-text: #ff8a9b;
  --ok: #45c58a;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 12px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Ubuntu, "Noto Sans", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 var(--font); background: var(--ink); color: var(--text); overflow: hidden; display: flex; flex-direction: column; user-select: none; }
.messages, .composer textarea, input { user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .45; }
input, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--plume); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Barre de titre Windows ---------- */
.titlebar { height: 36px; flex: none; display: flex; align-items: center; gap: 10px; padding-left: 12px; background: var(--ink); font-size: 12px; }
.titlebar > :not(.win-btn):not(.update-btn) { pointer-events: none; } /* tout glisse la fenêtre sauf les boutons */
.tb-logo { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--plume); color: #fff; font-weight: 800; font-size: 11px; }
.tb-name { color: var(--soft); }
.tb-space { flex: 1; align-self: stretch; }
.call-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-s); background: #17352a; color: #6fe0a6; font-weight: 600; font-variant-numeric: tabular-nums; }
.call-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.win-btn { width: 46px; height: 36px; display: grid; place-items: center; color: var(--soft); }
.win-btn svg { width: 12px; height: 12px; stroke-width: 1.2; }
.win-btn:hover { background: var(--raise); color: var(--text); }
.win-btn.close:hover { background: #c42b1c; color: #fff; }

/* ---------- Connexion ---------- */
.auth { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(440px, 1fr) minmax(0, 1fr); background: var(--ink); }
@media (max-width: 1000px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none !important; } }
.auth-left { display: grid; place-items: center; padding: 32px 24px; overflow-y: auto; background: linear-gradient(160deg, #141823 0%, #10131a 100%); }
.auth-wrap { width: min(420px, 100%); display: grid; justify-items: center; }
.wordmark { display: flex; align-items: baseline; margin-bottom: 18px; line-height: 1; }
.wm-raven { font-style: italic; font-weight: 700; font-size: 22px; color: var(--plume); margin-right: 1px; }
.wm-chat { font-weight: 900; font-size: 40px; letter-spacing: -1px; color: #fff; }
.auth-wrap h1 { margin: 0; font-size: 24px; font-weight: 700; text-align: center; }
.auth-sub { margin: 6px 0 24px; color: var(--muted); text-align: center; font-size: 14px; }
.auth-card { width: 100%; display: grid; gap: 8px; padding: 28px; background: #1b2030; border: 1px solid var(--raise); border-radius: 16px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6); }
.auth-card label { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 6px; }
.auth-card input { width: 100%; height: 46px; background: #232838; border: 1px solid #343b4e; border-radius: 10px; padding: 0 14px; font-size: 15px; }
.auth-card input::placeholder { color: #7f889d; }
.auth-card input:focus { border-color: var(--plume); box-shadow: 0 0 0 3px rgba(125, 140, 255, .22); outline: none; }
.pw { position: relative; }
.pw input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.pw-toggle:hover { color: var(--text); background: var(--raise); }
.pw-toggle svg { width: 18px; height: 18px; }
.primary { height: 48px; margin-top: 14px; background: var(--plume); color: #0d1016; border-radius: 10px; font-weight: 700; font-size: 15px; }
.primary:hover:not(:disabled) { background: #93a0ff; }
.primary:disabled { opacity: .6; cursor: wait; }
.auth-foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--raise); text-align: center; font-size: 14px; color: var(--muted); display: grid; gap: 8px; }
.auth-foot p { margin: 0; }
.auth-foot .fine { font-size: 12px; }
.link { color: #9aa6ff; padding: 0; }
.link:hover { text-decoration: underline; }
.small { font-size: 12px; }
.error { color: var(--danger-text); margin: 6px 0 0; font-size: 14px; }

.auth-hero { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: flex-end;
  background:
    radial-gradient(60% 45% at 60% 0%, rgba(125, 140, 255, .32), transparent 70%),
    radial-gradient(50% 40% at 10% 100%, rgba(63, 193, 201, .14), transparent 70%),
    #121520; }
.hero-card { position: absolute; background: rgba(27, 32, 48, .92); border: 1px solid #2f3648; border-radius: 16px; padding: 16px 18px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7); display: grid; gap: 12px; }
.hc-voice { top: 7%; left: 18%; width: 320px; }
.hc-screen { top: 40%; left: 28%; width: 300px; }
.hc-head { display: flex; align-items: center; gap: 12px; }
.hc-head > span:last-child { display: grid; line-height: 1.25; }
.hc-head strong { font-size: 15px; }
.hc-head small { font-size: 12px; color: var(--muted); }
.hc-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.hc-icon svg { width: 20px; height: 20px; }
.hc-icon.plume { background: rgba(125, 140, 255, .18); color: var(--plume); }
.hc-icon.amber { background: #e6b866; color: #2a1d05; }
.hc-avatars { display: flex; gap: 8px; }
.hc-avatars span { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.hc-avatars .talk { box-shadow: 0 0 0 2px #1b2030, 0 0 0 4px var(--plume-2); }
.hc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-chips span { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.hc-chips .ok { color: #6fe0a6; background: rgba(69, 197, 138, .12); border: 1px solid rgba(69, 197, 138, .35); }
.hc-chips .live { color: #ff9aa9; background: rgba(214, 69, 91, .14); border: 1px solid rgba(214, 69, 91, .4); }
.hc-meta { margin: 0; font-size: 12px; color: var(--soft); }
.hero-copy { position: relative; max-width: 560px; }
.hero-copy h2 { margin: 0 0 14px; font-size: clamp(34px, 3.6vw, 52px); line-height: 1.05; letter-spacing: -1.5px; font-weight: 800; }
.hero-copy h2 span { color: var(--plume); }
.hero-copy p { margin: 0 0 20px; color: var(--soft); font-size: 16px; line-height: 1.55; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chips span { padding: 6px 14px; border-radius: 999px; border: 1px solid #343b4e; background: rgba(27, 32, 48, .8); font-size: 13px; font-weight: 600; }

/* ---------- Structure ---------- */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 72px 240px 1fr 232px; }
@media (max-width: 1100px) { .app { grid-template-columns: 72px 240px 1fr; } .members { display: none; } }
@media (max-width: 700px) { .app { grid-template-columns: 200px 1fr; } .rail { display: none; } }

.rail { background: var(--ink); display: flex; flex-direction: column; align-items: center; padding: 12px 0; }
.rail-item { position: relative; width: 72px; display: grid; place-items: center; }
.rail-item.active::before { content: ""; position: absolute; left: 0; width: 4px; height: 40px; border-radius: 0 4px 4px 0; background: #fff; }
.logo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; font-weight: 800; font-size: 20px; color: #fff; background: var(--plume); }

.sidebar { background: var(--night); display: flex; flex-direction: column; min-height: 0; border-top-left-radius: var(--radius-m); }
.server-name { padding: 0 16px; height: 52px; flex: none; display: flex; align-items: center; font-weight: 700; border-bottom: 1px solid var(--ink); }
.channels { flex: 1; overflow-y: auto; padding: 8px; }
.category { display: flex; justify-content: space-between; align-items: center; padding: 14px 8px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.icon-btn { width: 22px; height: 22px; border-radius: 4px; font-size: 18px; line-height: 1; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--raise); }
.app:not(.is-admin) .admin-only { display: none; }

.channel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.channel { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: var(--radius-s); color: var(--muted); text-align: left; }
.channel svg { width: 18px; height: 18px; }
.channel:hover { background: var(--raise); color: var(--text); }
.channel.active { background: var(--raise); color: #fff; font-weight: 600; }
.channel.unread { color: #fff; font-weight: 700; }
.channel.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.channel .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .del { opacity: 0; color: var(--muted); padding: 0 4px; }
.channel:hover .del { opacity: 1; }
.channel .del:hover { color: var(--danger-text); }
.voice-users { list-style: none; margin: 0 0 4px; padding: 2px 0 4px 34px; display: grid; gap: 6px; }
.voice-users li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); }
.badge-live { font-size: 10px; font-weight: 700; color: #fff; background: var(--danger); padding: 0 5px; border-radius: 4px; }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; color: #fff; flex: none; font-size: 14px; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.speaking-ring { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--plume-2); }

.voice-panel { border-top: 1px solid var(--ink); padding: 10px 8px 10px 12px; display: flex; align-items: center; gap: 8px; }
.voice-status { flex: 1; min-width: 0; display: grid; }
.voice-status strong { color: #6fe0a6; font-size: 13px; }
.voice-status strong.pending { color: #e6b866; }
.voice-status .link { color: var(--muted); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-panel { display: flex; align-items: center; gap: 2px; padding: 8px; background: var(--deep); }
.me { flex: 1; min-width: 0; margin-left: 8px; display: grid; line-height: 1.2; }
.me-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { font-size: 12px; color: var(--muted); }
.ctl { display: grid; place-items: center; height: 32px; min-width: 32px; border-radius: var(--radius-s); color: var(--soft); }
.ctl svg { width: 18px; height: 18px; }
.ctl:hover { background: var(--raise); color: var(--text); }
.ctl.off { color: var(--danger-text); }
.ctl.danger:hover { background: var(--danger); color: #fff; }

/* ---------- Zone principale ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--slate); }
.main-header { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--ink); }
.main-header h2 { font-size: 16px; margin: 0; }
.main-icon { color: var(--muted); display: flex; }
.conn-status { margin-left: auto; font-size: 12px; color: var(--danger-text); }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; }
.empty { color: var(--muted); padding: 24px 16px; }
.msg { display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; padding: 2px 16px; }
.msg:not(.grouped) { margin-top: 14px; }
.msg:hover { background: rgba(42, 48, 64, .45); }
.msg .avatar { width: 40px; height: 40px; font-size: 16px; grid-row: span 2; }
.msg.grouped .body { grid-column: 2; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 600; }
.msg time { font-size: 12px; color: var(--muted); }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }

.composer { padding: 0 16px 20px; display: grid; gap: 0; }
.composer-box { display: flex; align-items: flex-start; gap: 4px; background: var(--raise); border-radius: var(--radius-m); padding: 4px 12px 4px 6px; }
.pending:not([hidden]) + .upload-progress[hidden] + .composer-box,
.pending:not([hidden]) ~ .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer textarea { flex: 1; resize: none; max-height: 200px; background: transparent; border: 0; padding: 9px 4px; line-height: 1.4; }
.composer textarea:focus { outline: none; }
.attach-btn { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--soft); }
.attach-btn:hover { color: var(--text); }
.attach-btn svg { width: 22px; height: 22px; }

/* Fichiers en attente d'envoi */
.pending { display: flex; gap: 10px; overflow-x: auto; padding: 12px; background: var(--raise); border-radius: var(--radius-m) var(--radius-m) 0 0; border-bottom: 1px solid #343b4e; }
.pend { position: relative; flex: none; width: 168px; background: var(--night); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.pend .thumb { height: 112px; border-radius: 6px; background: var(--ink); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.pend .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pend .thumb svg { width: 40px; height: 40px; }
.pend .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pend .size { font-size: 12px; color: var(--muted); }
.pend .rm { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--danger); color: #fff; display: grid; place-items: center; font-size: 16px; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.upload-progress { position: relative; height: 26px; background: var(--raise); border-bottom: 1px solid #343b4e; overflow: hidden; display: flex; align-items: center; padding: 0 12px; font-size: 12px; color: var(--soft); }
.upload-progress span { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(125, 140, 255, .25); transition: width .15s; }
.upload-progress em { position: relative; font-style: normal; }

/* Glisser-déposer */
.chat-view { position: relative; }
.drop-zone { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(15, 18, 24, .78); }
.drop-card { display: grid; justify-items: center; gap: 8px; padding: 36px 48px; border: 2px dashed var(--plume); border-radius: 16px; background: var(--night); text-align: center; }
.drop-card strong { font-size: 18px; }
.drop-card span { color: var(--muted); }
.drop-card svg { width: 44px; height: 44px; color: var(--plume); }

/* Pièces jointes dans les messages */
.atts { grid-column: 2; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 6px; }
.att-img { display: block; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--night); }
.att-img img { display: block; max-width: min(420px, 100%); max-height: 320px; }
.att-video { max-width: min(480px, 100%); max-height: 320px; border-radius: 8px; background: #000; }
.att-file { display: flex; align-items: center; gap: 12px; width: min(420px, 100%); padding: 12px; border-radius: 8px; background: var(--night); border: 1px solid var(--raise); }
.att-file > svg { width: 32px; height: 32px; color: var(--plume); }
.att-file .info { flex: 1; min-width: 0; display: grid; }
.att-file .info a { color: #9aa6ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .info small { color: var(--muted); font-size: 12px; }
.att-file .dl { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--soft); }
.att-file .dl:hover { background: var(--raise); color: var(--text); }
.att-file audio { width: 100%; margin-top: 6px; }
.att-file.audio { flex-wrap: wrap; }

.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .85); display: grid; place-items: center; gap: 12px; padding: 32px; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 6px; }
.lightbox-bar { display: flex; gap: 16px; align-items: center; color: var(--soft); font-size: 14px; cursor: default; }
.lightbox-bar a { color: #9aa6ff; }

.members { background: var(--night); padding: 18px 10px; overflow-y: auto; }
.members h3 { margin: 0 8px 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.members ul { list-style: none; margin: 0; padding: 0; }
.members li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-s); line-height: 1.2; }
.members li .avatar { position: relative; }
.members li .avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 3px solid var(--night); }
.members .sub { display: block; font-size: 12px; color: var(--muted); }

/* ---------- Vue vocale ---------- */
.voice-view { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 16px; background: var(--stage); }
.voice-connecting { margin: 0; text-align: center; color: #e6b866; font-size: 13px; }
/* Scène : grille qui remplit l'espace, ou partage en grand + bandeau de participants */
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-main { flex: 1; min-height: 0; display: grid; gap: 12px; place-content: center; grid-template-columns: repeat(var(--cols, 1), var(--tile-w, 320px)); grid-auto-rows: var(--tile-h, 180px); }
.stage-strip { display: none; flex: none; gap: 10px; overflow-x: auto; justify-content: safe center; padding: 2px 2px 4px; }
.stage.focus .stage-main { display: flex; }
.stage.focus .stage-strip { display: flex; }
.stage.focus .stage-strip:empty { display: none; }

.tile { position: relative; background: var(--night); border-radius: var(--radius-l); overflow: hidden; display: grid; place-items: center; cursor: pointer; transition: box-shadow .12s; }
.stage-main .tile { width: 100%; height: 100%; }
.stage.focus .stage-main .tile { flex: 1; cursor: zoom-out; }
.stage-strip .tile { flex: none; width: 200px; height: 112px; }
.stage-strip .tile .avatar { width: 44px; height: 44px; font-size: 18px; }
.stage-strip .tile .label { font-size: 12px; left: 6px; bottom: 6px; }
.tile:hover { box-shadow: 0 0 0 2px #3a4155; }
.tile.screen { background: #000; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.tile.screen video, .stage.focus .stage-main .tile video { object-fit: contain; }
.tile.has-video video { display: block; }
.tile.has-video .avatar { display: none; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar { width: 72px; height: 72px; font-size: 28px; }
.tile .label { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 3px 10px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(4px); }
.tile .label svg { width: 13px; height: 13px; color: var(--danger-text); flex: none; }
.tile .badges { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.stage-strip .tile .badges { left: 6px; top: 6px; }
.tile .live { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.tile .res { padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .62); color: #dfe3ec; font-size: 11px; font-weight: 700; }
.tile .res:empty { display: none; }
.stage-strip .tile .live { font-size: 10px; }
.stage-strip .tile .res, .stage-strip .tile .tools { display: none; }
.tile .tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.tile:hover .tools, .tile:focus-within .tools { opacity: 1; }
.tile .tools button { width: 34px; height: 34px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff; display: grid; place-items: center; backdrop-filter: blur(4px); }
.tile .tools button:hover { background: rgba(0, 0, 0, .85); }
.tile .tools svg { width: 17px; height: 17px; }
.tile:fullscreen { border-radius: 0; cursor: default; }
.tile:fullscreen video { object-fit: contain; }
.tile.speaking { box-shadow: 0 0 0 3px var(--plume-2), 0 0 20px -2px var(--plume); }
.tile.speaking:hover { box-shadow: 0 0 0 3px var(--plume-2), 0 0 20px -2px var(--plume); }

.call-bar { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.call-btn { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #262b38; color: var(--text); }
.call-btn:hover:not(:disabled) { background: var(--raise); }
.call-btn.off { background: var(--danger-soft); color: var(--danger-text); }
.call-btn.on { background: var(--plume); color: #0d1016; }
.call-btn.busy { animation: pulse 1s ease-in-out infinite; }
.call-leave { height: 52px; padding: 0 22px; border-radius: 26px; background: var(--danger); color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.call-leave:hover { background: #e5566b; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Paramètres (plein écran) ---------- */
.settings { position: fixed; inset: 0; z-index: 15; display: flex; background: var(--slate); }
html.has-titlebar .settings { top: 36px; }
.set-nav { flex: 1 0 232px; display: flex; justify-content: flex-end; background: var(--night); overflow-y: auto; }
.set-nav-inner { width: 232px; padding: 56px 10px 40px 16px; display: flex; flex-direction: column; gap: 2px; }
.set-nav h4 { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.set-nav h4:first-child { margin-top: 0; }
.set-tab { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--soft); font-size: 15px; transition: background .12s, color .12s; }
.set-tab svg { width: 18px; height: 18px; opacity: .8; }
.set-tab:hover { background: var(--raise); color: var(--text); }
.set-tab.active { background: #343b4e; color: #fff; font-weight: 600; }
.set-tab.active svg { opacity: 1; color: var(--plume); }
.set-tab.danger { color: var(--danger-text); }
.set-tab.danger:hover { background: rgba(214, 69, 91, .14); }
.set-nav hr { width: calc(100% - 20px); border: 0; border-top: 1px solid var(--raise); margin: 10px; }
.set-version { margin: 8px 10px; font-size: 12px; color: var(--muted); }
.set-main { flex: 2.6 1 0; display: flex; overflow-y: auto; }
.set-content { width: 100%; max-width: 780px; padding: 56px 40px 80px; }
.set-close { position: sticky; top: 56px; align-self: flex-start; margin: 56px 24px 0 0; display: grid; justify-items: center; gap: 6px; color: var(--muted); flex: none; }
.set-close span { width: 36px; height: 36px; border: 2px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-size: 22px; line-height: 1; transition: background .12s; }
.set-close small { font-size: 12px; font-weight: 600; }
.set-close:hover { color: var(--text); }
.set-close:hover span { background: var(--raise); }

.pane-head { margin-bottom: 20px; }
.set-pane h2 { margin: 0 0 6px; font-size: 22px; }
.pane-head p, .muted { color: var(--muted); font-size: 14px; margin: 0; }
.footnote { color: var(--muted); font-size: 13px; margin: 4px 4px 0; }

/* Cartes de réglages */
.set-card { background: var(--night); border: 1px solid #262c3b; border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.card-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; color: var(--text); }
.card-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(125, 140, 255, .14); color: var(--plume); }
.card-icon svg { width: 20px; height: 20px; }
.set-card > .check.row:first-child { padding-top: 0; }

/* Champs */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .set-grid { grid-template-columns: minmax(0, 1fr); } .set-nav { flex-basis: 190px; } .set-nav-inner { width: 190px; } }
.field { display: grid; gap: 8px; min-width: 0; margin-bottom: 18px; align-content: start; }
.set-grid { margin-bottom: 18px; }
.set-grid .field { margin-bottom: 0; }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: 12px; font-weight: 700; color: var(--soft); }
.field-row { display: flex; align-items: center; justify-content: space-between; }
.value-pill { font-size: 12px; font-weight: 700; color: var(--text); background: var(--ink); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }

/* Menu déroulant : largeur bornée, texte coupé proprement, flèche personnalisée */
.select { position: relative; display: block; min-width: 0; }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.select select { appearance: none; -webkit-appearance: none; display: block; width: 100%; min-width: 0; height: 44px; padding: 0 40px 0 14px; border-radius: 10px; background: var(--ink); color: var(--text); border: 1px solid #343b4e; font: inherit; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.select select:hover { border-color: #4a5268; }
.select select:focus { border-color: var(--plume); box-shadow: 0 0 0 3px rgba(125, 140, 255, .2); outline: none; }
.select select:disabled { opacity: .55; cursor: default; }
.select select option { background: var(--night); color: var(--text); }

/* Curseur avec remplissage */
.slider { --val: 100%; appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; margin: 8px 0; cursor: pointer;
  background: linear-gradient(to right, var(--plume) var(--val), #3a4155 var(--val)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: transform .12s; }
.slider::-webkit-slider-thumb:hover, .slider:active::-webkit-slider-thumb { transform: scale(1.15); }
.slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.slider:focus-visible { outline: 2px solid var(--plume); outline-offset: 4px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; background: var(--plume); color: #0d1016; font-weight: 700; font-size: 14px; flex: none; transition: background .12s, transform .08s; }
.btn:hover { background: #93a0ff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: #3a4155; color: #fff; }
.btn.secondary:hover { background: #4a5268; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #e5566b; }

/* Détection vocale (sensibilité du micro) */
.vad { position: relative; height: 28px; margin: 10px 0 8px; }
.vad-track, .vad-cover { position: absolute; top: 8px; bottom: 8px; border-radius: 6px; }
.vad-track { left: 0; right: 0; background: linear-gradient(90deg, #d9a93f 0 var(--thr, 50%), #45c58a var(--thr, 50%) 100%); }
.vad-cover { right: 0; width: 100%; background: rgba(18, 21, 29, .78); border-radius: 0 6px 6px 0; transition: width 50ms linear; } /* assombrit ce que la voix n'atteint pas */
.vad-marker { position: absolute; top: 2px; bottom: 2px; left: var(--thr, 50%); width: 3px; margin-left: -1px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); display: none; }
.vad.auto .vad-marker { display: block; opacity: .75; }
.vad input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: ew-resize; }
.vad input[type=range]::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.vad input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 28px; border-radius: 5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .5); }
.vad input[type=range]::-moz-range-thumb { width: 10px; height: 28px; border-radius: 5px; background: #fff; border: 0; }
.vad input[type=range]:focus-visible { outline: 2px solid var(--plume); outline-offset: 3px; border-radius: 6px; }
.vad.auto input[type=range] { display: none; }
.vad-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); margin-bottom: 4px; }
.vad-status .muted { font-size: 12px; }
.vad-spacer { flex: 1; }
.vad-dot { width: 10px; height: 10px; border-radius: 50%; background: #4e5468; transition: background .1s, box-shadow .1s; }
.vad-dot.open { background: var(--ok); box-shadow: 0 0 0 4px rgba(69, 197, 138, .2); }
.check.row.first { padding-top: 0; }

/* Interrupteurs */
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.check.row { justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--raise); }
.check.row.last { border-bottom: 0; padding-bottom: 0; }
.check.row span { display: grid; gap: 2px; }
.check.row strong { font-weight: 600; }
.check.row small { color: var(--muted); font-size: 13px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 24px; border-radius: 12px; background: #4e5468; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .15s; }
.switch:checked { background: var(--ok); }
.switch:checked::before { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--plume); outline-offset: 2px; }

/* Aperçu caméra */
.cam-preview { position: relative; aspect-ratio: 16 / 9; width: 100%; background: var(--ink); border: 1px dashed #343b4e; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.cam-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.cam-preview video.mirror { transform: scaleX(-1); }
.cam-empty { display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 56px; }
.cam-empty svg { width: 36px; height: 36px; opacity: .7; }
.cam-preview .btn { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); }
.cam-preview.live { border-style: solid; border-color: transparent; }
.cam-preview.live video { opacity: 1; }
.cam-preview.live .cam-empty { visibility: hidden; }
.cam-preview.live .btn { left: auto; right: 12px; bottom: 12px; transform: none; }

/* Mon compte */
.account-card { background: var(--night); border: 1px solid #262c3b; border-radius: 14px; overflow: hidden; }
.account-banner { height: 96px; background: linear-gradient(120deg, #3a4396, var(--plume) 60%, var(--plume-2)); }
.account-row { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -36px; }
.account-row .avatar { width: 80px; height: 80px; font-size: 32px; border: 6px solid var(--night); }
.account-row div { display: grid; padding-bottom: 8px; }
.account-row strong { font-size: 20px; }
.account-info { margin: 16px; padding: 16px; background: var(--ink); border-radius: 10px; display: grid; gap: 14px; }
.account-info div { display: grid; gap: 2px; }
.account-info dt { font-size: 12px; font-weight: 700; color: var(--muted); }
.account-info dd { margin: 0; }

/* Modes de partage d'écran */
.presets { display: grid; gap: 10px; }
.presets.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .presets.two { grid-template-columns: minmax(0, 1fr); } }
.preset { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 12px; background: var(--ink); border: 2px solid #262c3b; cursor: pointer; transition: border-color .12s, background .12s; }
.preset:hover { border-color: #3a4155; }
.preset.selected { border-color: var(--plume); background: #1c2133; box-shadow: 0 0 0 4px rgba(125, 140, 255, .12); }
.preset input { position: absolute; opacity: 0; pointer-events: none; }
.preset:has(input:focus-visible) { outline: 2px solid var(--plume); outline-offset: 2px; }
.p-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(125, 140, 255, .16); color: var(--plume); flex: none; }
.p-icon svg { width: 20px; height: 20px; }
.p-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.p-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.p-title strong { font-size: 15px; }
.p-badge { font-size: 11px; font-weight: 700; color: #6fe0a6; background: rgba(69, 197, 138, .12); padding: 1px 8px; border-radius: 999px; }
.p-body small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.p-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.p-chips span { font-size: 11px; font-weight: 700; color: var(--soft); background: var(--raise); padding: 3px 8px; border-radius: 6px; }
.p-rate { font-size: 12px; color: var(--muted); }
.p-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--plume); color: #0d1016; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.p-check svg { width: 14px; height: 14px; stroke-width: 3; }
.preset.selected .p-check { opacity: 1; transform: none; }
.modal-card.share { width: min(600px, 100%); max-height: calc(100vh - 80px); overflow-y: auto; }
.modal-card .check.row { padding: 10px 0; }
.modal-card .hint { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- Fenêtre et notifications ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-card { width: min(420px, 100%); background: var(--night); border-radius: var(--radius-m); padding: 22px; display: grid; gap: 14px; }
.modal-card h3 { margin: 0; font-size: 18px; }
.modal-card p { margin: 0; color: var(--soft); }
.modal-card input:not(.switch):not([type=radio]) { height: 42px; background: var(--ink); border: 1px solid var(--raise); border-radius: var(--radius-s); padding: 0 12px; }
.modal-card .modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-card .modal-actions button { height: 40px; padding: 0 16px; border-radius: var(--radius-s); }
.modal-card .secondary:hover { background: var(--raise); }
.modal-card .primary.danger { background: var(--danger); color: #fff; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--raise); color: var(--text); padding: 10px 16px; border-radius: var(--radius-m); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); z-index: 20; max-width: min(560px, 90vw); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Mises à jour ---------- */
.update-btn { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-s); background: var(--ok); color: #08251a; font-weight: 700; font-size: 12px; }
.update-btn:hover { background: #5fd7a0; }
.update-btn svg { width: 14px; height: 14px; }
.update-overlay { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; }
.update-overlay strong { font-size: 20px; margin-top: 8px; }
.update-bar { width: 260px; height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; margin-top: 8px; }
.update-bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; }
.about-card { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--night); border-radius: var(--radius-m); margin-bottom: 16px; }
.about-card div { display: grid; }
.about-card .muted { margin: 0; }
.about-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--plume); color: #fff; font-weight: 800; font-size: 26px; }
.about-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.about-actions .muted { margin: 0; }
.modal-card .notes { margin: 0; padding: 10px 12px; background: var(--ink); border-radius: var(--radius-s); color: var(--soft); font-size: 14px; white-space: pre-wrap; }
.update-logo { width: 72px; height: 72px; font-size: 34px; border-radius: 22px; box-shadow: 0 0 0 6px #1b1f2a, 0 0 0 8px var(--plume-2); }

/* ---------- Fenêtre de partage d'écran ---------- */
.modal-card.share { width: min(660px, 100%); padding: 0; gap: 0; overflow: hidden; }
.share-head { display: flex; gap: 14px; align-items: center; padding: 22px 24px 18px; }
.share-head h3 { margin: 0; font-size: 18px; }
.share-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.share-head .card-icon { width: 44px; height: 44px; border-radius: 12px; }
.share-body { padding: 0 24px 4px; display: grid; gap: 14px; max-height: calc(100vh - 260px); overflow-y: auto; }
.share-body .presets.two .preset small { display: none; } /* version compacte dans la fenêtre */
.share-audio { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--ink); border: 1px solid #262c3b; border-radius: 12px; cursor: pointer; }
.share-audio .card-icon { width: 36px; height: 36px; border-radius: 10px; }
.share-audio .card-icon svg { width: 18px; height: 18px; }
.share-audio > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.share-audio small { color: var(--muted); font-size: 13px; }
.share-note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13px; margin: 0; }
.share-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.share-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; margin-top: 18px; background: rgba(18, 21, 29, .55); border-top: 1px solid #262c3b; }
.btn.ghost { background: transparent; color: var(--soft); }
.btn.ghost:hover { background: var(--raise); color: var(--text); }

/* ---------- Serveur injoignable ---------- */
.offline { position: fixed; inset: 0; z-index: 40; background: var(--ink); display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
html.has-titlebar .offline { top: 36px; }
.offline h2 { margin: 18px 0 0; font-size: 22px; }
.offline-text { margin: 0; max-width: 420px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.offline-status { margin: 4px 0 8px; color: var(--soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.offline-logo { position: relative; width: 104px; height: 104px; display: grid; place-items: center; }
.offline-logo .about-logo { width: 72px; height: 72px; font-size: 32px; border-radius: 22px; animation: offline-pulse 2s ease-in-out infinite; }
.offline-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(125, 140, 255, .12); border-top-color: var(--plume); border-right-color: var(--plume-2); animation: offline-spin 1.1s linear infinite; }
.offline-tip { position: absolute; bottom: 32px; left: 24px; right: 24px; margin: 0; color: var(--muted); font-size: 13px; }
.offline-tip strong { color: var(--soft); }
@keyframes offline-spin { to { transform: rotate(360deg); } }
@keyframes offline-pulse { 50% { transform: scale(.94); opacity: .85; } }

/* ---------- Photos de profil ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.members li .avatar { overflow: visible; } /* garde la pastille « en ligne » */
.account-row { flex-wrap: wrap; }
.account-row .account-actions { display: flex; flex-basis: 100%; gap: 8px; padding: 12px 0 0; }
.avatar-edit { position: relative; flex: none; border-radius: 50%; padding: 0; }
.avatar-edit .avatar { display: grid; }
.avatar-edit-hint { position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
.avatar-edit-hint svg { width: 24px; height: 24px; }
.avatar-edit:hover .avatar-edit-hint, .avatar-edit:focus-visible .avatar-edit-hint { opacity: 1; }
.account-row .account-name { padding: 44px 0 0; }
