/* ────────────────────────────────────────────────────────────
   FSPCS — DA Plum & Citron (inspirée du mockup Claude Design)
   ──────────────────────────────────────────────────────────── */

:root {
  /* Light theme */
  --bg:           #f4f2f7;
  --bg-elev:      #ffffff;
  --bg-deep:      #ebe7f0;
  --surface:      #ffffff;
  --line:         #e0dbe6;
  --line-strong:  #c8bfd1;

  --rail:         #2a1f3d;
  --rail-ink:     #d8d2e5;
  --rail-mute:    #8f86a3;
  --rail-line:    #3d3155;

  --pane:         #efeaf3;
  --pane-deep:    #e4dceb;

  --ink:          #1a1623;
  --ink-2:        #4a4458;
  --mute:         #6b6478;
  --faint:        #a39db0;

  --accent:       #6b3fd4;
  --accent-ink:   #ffffff;
  --accent-soft:  #ede4ff;

  --citron:       #b8d62b;
  --citron-deep:  #8aa31a;

  --ok:           #2f8d57;
  --warn:         #d49a1f;
  --live:         #d63a3a;

  --radius:       6px;
  --radius-lg:    10px;
  --radius-xl:    14px;

  --shadow-sm:    0 1px 0 rgba(40,30,60,.04), 0 1px 2px rgba(40,30,60,.05);
  --shadow-md:    0 4px 16px -6px rgba(40,30,60,.14), 0 2px 6px rgba(40,30,60,.08);
  --shadow-modal: 0 32px 80px -16px rgba(20,10,40,.40), 0 8px 24px rgba(20,10,40,.18);

  --font-sans:    "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

[data-theme="dark"] {
  --bg:          #16131c;
  --bg-elev:     #1f1b29;
  --bg-deep:     #0f0c16;
  --surface:     #1f1b29;
  --line:        #2c2638;
  --line-strong: #3d3550;
  --rail:        #0d0a14;
  --rail-ink:    #c5beda;
  --rail-mute:   #6e6781;
  --rail-line:   #1f1a2c;
  --pane:        #1b1725;
  --pane-deep:   #161220;
  --ink:         #ede9f6;
  --ink-2:       #c2bcd0;
  --mute:        #8b8499;
  --faint:       #5e576c;
  --accent:      #9b75ff;
  --accent-ink:  #14102a;
  --accent-soft: #2a1f50;
  --citron:      #c9e445;
  --citron-deep: #9bbb29;
  --ok:          #6dc18e;
  --warn:        #e0b04a;
  --live:        #e85a5a;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ─── Scrollbars ─────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; border: 2px solid transparent; }

/* ─── Type helpers ─────────────────────────────── */
.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--mute);
  font-weight: 500;
}
.mono--sm { font-size: 10px; }
.mono--accent { color: var(--accent); }
.upper { text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Buttons ─────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
  user-select: none;
}
.btn:hover { background: var(--bg-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); border-color: color-mix(in oklab, var(--accent) 88%, black); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--bg-deep); }
.btn--icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }
.btn--danger { background: var(--live); color: white; border-color: var(--live); }

/* ─── Inputs ─────────────────────────────── */
.input {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--mute); }

/* ─── Layout helpers ─────────────────────────────── */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 6px; }
.gap-3 { gap: 10px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; min-width: 0; min-height: 0; }
.spacer { flex: 1; }

/* ─── Icon helpers (inline SVG) ─────────────────────────────── */
.icon { width: 16px; height: 16px; stroke-width: 1.75; flex-shrink: 0; vertical-align: middle; }
.icon-sm { width: 14px; height: 14px; stroke-width: 1.75; }
.icon-lg { width: 20px; height: 20px; stroke-width: 1.6; }

/* ─── Avatar ─────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  user-select: none;
}

/* ─── Animations ─────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .22s ease both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: .85; } }

/* ─── Login modal ─────────────────────────────── */
.login-stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  overflow: hidden;
}
.login-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 22% 28%, color-mix(in oklab, var(--accent) 28%, transparent) 0%, transparent 38%),
    radial-gradient(circle at 80% 76%, color-mix(in oklab, var(--citron) 24%, transparent) 0%, transparent 42%),
    var(--bg);
  animation: backdropIn .4s ease both;
}
[data-theme="dark"] .login-backdrop {
  background:
    radial-gradient(circle at 22% 28%, color-mix(in oklab, var(--accent) 18%, transparent) 0%, transparent 38%),
    radial-gradient(circle at 80% 76%, color-mix(in oklab, var(--citron) 10%, transparent) 0%, transparent 42%),
    var(--bg);
}
.login-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modalIn .28s cubic-bezier(.2,.7,.2,1) both;
}
.login-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.login-modal-body {
  padding: 26px 26px 22px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.login-h { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 0; }
.login-sub { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; margin: 0 0 8px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login-link { font-size: 12px; color: var(--accent); text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; }
.login-link:hover { text-decoration: underline; }
.login-pwd { position: relative; }
.login-pwd-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 8px;
  color: var(--mute); cursor: pointer; border-radius: 4px;
}
.login-pwd-toggle:hover { color: var(--ink); background: var(--bg-deep); }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.login-remember input { accent-color: var(--accent); width: 14px; height: 14px; }
.login-submit { justify-content: center; padding: 11px 14px; font-size: 14px; margin-top: 6px; }
.login-server {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--mute);
}
.login-error {
  background: color-mix(in oklab, var(--live) 12%, var(--bg-elev));
  color: var(--live);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  border: 1px solid color-mix(in oklab, var(--live) 30%, transparent);
}

/* ─── App layout grid ─────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 76px 300px 1fr;
  grid-template-rows: 44px 1fr;
  grid-template-areas:
    "top  top   top"
    "rail pane  content";
  height: 100vh;
  background: var(--bg);
  color: var(--ink);
  min-height: 0;
}

/* Vues sans pane (admin, mon compte) : le content prend toute la largeur,
   pas de colonne de 300px vide. */
.app.view-admin,
.app.view-account,
.app.view-invitations,
.app.view-discover {
  grid-template-columns: 76px 1fr;
  grid-template-areas:
    "top  top"
    "rail content";
}
/* Garde-fou : jamais de pane hors vue chat (évite la bande grise résiduelle). */
.app.view-admin .pane,
.app.view-account .pane,
.app.view-invitations .pane,
.app.view-discover .pane { display: none !important; }

/* Topbar */
.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--rail);
  color: var(--rail-ink);
  border-bottom: 1px solid var(--rail-line);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand strong { color: var(--rail-ink); font-weight: 700; letter-spacing: -0.01em; font-size: 14px; }
.brand-logo { object-fit: cover; }
.topbar-brand .brand-long { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.topbar-brand .brand-short { display: none; }
.topbar-brand .mono { color: var(--rail-mute) !important; }
.topbar-search {
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in oklab, var(--rail) 50%, black);
  border: 1px solid var(--rail-line);
  border-radius: var(--radius);
  padding: 6px 12px;
  width: 100%;
  max-width: 520px;
  justify-self: center;
  color: var(--rail-mute);
}
.topbar-search input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--rail-ink); font-family: inherit; font-size: 13px;
}
.topbar-search input::placeholder { color: var(--rail-mute); }
.topbar-kbd { padding: 2px 6px; border: 1px solid var(--rail-line); border-radius: 4px; color: var(--rail-mute); }
.topbar-right { display: flex; align-items: center; gap: 6px; justify-self: end; }
.topbar-right .btn { color: var(--rail-ink); border-color: transparent; background: transparent; }
.topbar-right .btn:hover { background: color-mix(in oklab, var(--rail) 80%, white); }
.topbar-divider { width: 1px; height: 22px; background: var(--rail-line); margin: 0 4px; }
.topbar-me {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius);
  color: var(--rail-ink); cursor: pointer; font-family: inherit;
}
.topbar-me:hover { background: color-mix(in oklab, var(--rail) 80%, white); }

/* Rail */
.rail {
  grid-area: rail;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  gap: 4px;
  background: var(--rail);
  color: var(--rail-ink);
  border-right: 1px solid var(--rail-line);
  overflow-y: auto;
}
.rail::-webkit-scrollbar { width: 0; }
.rail-tile {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 4px 2px;
  background: none; border: 0;
  color: var(--rail-mute);
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  flex-shrink: 0;
}
.rail-tile:hover { color: var(--rail-ink); }
.rail-tile-bar {
  position: absolute; left: -6px; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 22px;
  background: var(--citron);
  border-radius: 0 2px 2px 0;
  transition: transform .15s;
}
.rail-tile--active .rail-tile-bar { transform: translateY(-50%) scaleY(1); }
.rail-tile-glyph {
  position: relative;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--rail) 80%, white);
  color: var(--rail-ink);
  border-radius: 10px;
  overflow: visible;
  transition: border-radius .15s;
  font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
}
.rail-tile:hover .rail-tile-glyph { border-radius: 14px; }
.rail-tile--active .rail-tile-glyph { outline: 2px solid var(--citron); outline-offset: 2px; }
.rail-tile-square { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; border-radius: inherit; color: white; font-weight: 700; }
.rail-tile-square--add { background: none !important; border: 1px dashed var(--rail-line); color: var(--rail-mute); }
/* Icône "Conversations privées" — bouton dédié (la liste s'affiche dans le pane) */
.rail-tile-dm {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit;
  background: var(--accent); color: #fff;
}
.rail-tile--active .rail-tile-dm { outline: 2px solid var(--citron); outline-offset: 2px; }
.rail-sep { width: 28px; height: 1px; background: var(--rail-line); margin: 6px auto; flex-shrink: 0; }
/* Popover du bouton + (rail) — fixed pour échapper à l'overflow du rail */
.rail-add { position: relative; width: 100%; }
.rail-addmenu {
  position: fixed; left: 84px; bottom: 70px; width: 230px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
  padding: 6px; z-index: 200;
}
.rail-tile-badge {
  position: absolute; top: -4px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--live); color: white;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px;
  border: 2px solid var(--rail);
}

/* Pane channels */
.pane {
  grid-area: pane;
  display: flex; flex-direction: column;
  background: var(--pane);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.pane-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.pane-team-square {
  width: 32px; height: 32px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12px;
}
.pane-title { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-filter {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 10px;
}
.pane-filter input { flex: 1; background: none; border: 0; outline: none; font: inherit; color: var(--ink); }
.pane-list { flex: 1; overflow: auto; padding: 10px 8px 16px; }

.activity-pill {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  margin-bottom: 4px;
}
.activity-pill:hover { border-color: var(--line-strong); }
.activity-pill--active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.activity-pill-icon {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-pill--active .activity-pill-icon { background: color-mix(in oklab, var(--accent-ink) 18%, transparent); color: var(--accent-ink); }
.activity-pill-name { font-size: 13.5px; font-weight: 600; }
.activity-pill-sub { font-family: var(--font-mono); font-size: 10px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-pill--active .activity-pill-sub { color: color-mix(in oklab, var(--accent-ink) 70%, transparent); }

.chan-section { margin: 10px 0 4px; }
.chan-section-head {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  background: none; border: 0;
  color: var(--mute); cursor: pointer; font: inherit;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
}
.chan-section-list { list-style: none; margin: 4px 0; padding: 0; }

.chan-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 12px;
  background: none; border: 0;
  color: var(--ink-2);
  font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer;
  border-radius: var(--radius);
  margin: 1px 0;
}
.chan-row:hover { background: var(--pane-deep); color: var(--ink); }
.chan-row--unread { color: var(--ink); font-weight: 700; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-left: 4px;
}
.rail-tile-dot {
  position: absolute; top: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--live); border: 2px solid var(--rail);
}
.chan-row--active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chan-row--active:hover { background: var(--accent); }
.chan-glyph { display: inline-flex; align-items: center; justify-content: center; width: 16px; color: inherit; }
.chan-hash { font-family: var(--font-mono); font-weight: 500; opacity: 0.6; }
.chan-row--active .chan-hash { opacity: 0.95; }
.chan-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-unread { background: var(--accent); color: var(--accent-ink); padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 600; font-family: var(--font-mono); }

.pane-add {
  margin: 14px 4px 0;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  width: calc(100% - 8px);
  padding: 9px 12px;
  background: none; border: 1px dashed var(--line-strong);
  color: var(--mute);
  border-radius: var(--radius);
  cursor: pointer; font: inherit; font-size: 13px;
}
.pane-add:hover { color: var(--ink); border-color: var(--ink-2); }

/* Content */
.content {
  grid-area: content;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
}
.content-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--mute);
  text-align: center;
  padding: 40px;
}
.content-empty h1 { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0 0 8px; }
.content-empty p { margin: 0; max-width: 420px; line-height: 1.5; }

.chan-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.chan-header h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.chan-header h1 .chan-hash { opacity: 0.5; margin-right: 2px; }
.chan-topic { color: var(--ink-2); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-stream {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.msg {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius); position: relative;
}
.msg:hover { background: var(--bg-deep); }
.msg--flash { animation: msgFlash 1.2s ease; }
@keyframes msgFlash { 0%,100% { background: transparent; } 25% { background: var(--accent-soft); } }
.msg-older { text-align: center; color: var(--faint); font-size: 12px; padding: 8px; }
.msg-head { position: relative; }
.msg-edited { color: var(--faint); font-size: 10px; font-style: italic; }
.msg-tools {
  display: none; gap: 2px; margin-left: auto;
}
.msg:hover .msg-tools { display: inline-flex; }
.msg-tools button {
  background: none; border: 0; cursor: pointer; color: var(--mute);
  font-size: 13px; padding: 2px 5px; border-radius: 5px; line-height: 1;
}
.msg-tools button:hover { background: var(--bg-elev); color: var(--accent); }
.react-pop {
  position: absolute; right: 0; top: 100%; z-index: 30; margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 2px; max-width: 220px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow-modal);
}
.react-pop button { background: none; border: 0; cursor: pointer; font-size: 17px; padding: 3px 4px; border-radius: 5px; }
.react-pop button:hover { background: var(--bg-deep); }
.msg-quote {
  display: flex; gap: 6px; align-items: baseline; max-width: 100%;
  background: none; border: 0; border-left: 2px solid var(--accent);
  padding: 1px 8px; margin-bottom: 2px; cursor: pointer; text-align: left;
  color: var(--mute); font: inherit; font-size: 12px;
}
.msg-quote:hover { color: var(--accent); }
.msg-quote-a { font-weight: 600; flex-shrink: 0; }
.msg-quote-b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-edit { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.msg-edit textarea { width: 100%; resize: vertical; }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 1px 8px; cursor: pointer;
  font-size: 13px; color: var(--ink);
}
.react-chip:hover { border-color: var(--accent); }
.react-chip--mine { background: var(--accent-soft); border-color: var(--accent); }
.react-n { font-size: 11px; color: var(--mute); font-family: var(--font-mono); }
.reply-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-top: 1px solid var(--line);
  background: var(--bg-deep); font-size: 12px;
}
.reply-bar-a { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.reply-bar-b { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.reply-bar button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--mute); font-size: 13px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; font-size: 14px; color: var(--ink); }
.msg-time { color: var(--mute); font-family: var(--font-mono); font-size: 10px; }
.msg-body { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.msg-body--err { color: var(--live); font-family: var(--font-mono); font-size: 11px; }

/* ─── Pièces jointes ─────────────────────────────── */
.msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-card {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; max-width: 280px;
  background: var(--bg-deep); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--ink);
}
.att-card:hover { border-color: var(--accent); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 20px; border-top: 1px solid var(--line);
}
.pending-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px;
}
.pending-chip button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 12px; }
.dropzone-hint {
  position: sticky; bottom: 0;
  margin: 8px auto 0; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); font-size: 13px; font-weight: 600;
  text-align: center; width: fit-content;
}
.preview-modal { max-width: 860px; width: 92vw; }
.preview-body {
  padding: 18px; max-height: 75vh; overflow: auto;
  display: flex; align-items: center; justify-content: center;
}
.preview-body img, .preview-body video { max-width: 100%; max-height: 70vh; border-radius: var(--radius); }
.editor-area {
  width: 100%; min-height: 50vh; resize: vertical;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.5;
}

/* ─── Onglets channel + explorateur ─────────────────────────────── */
.chan-tabs {
  display: flex; gap: 2px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: var(--bg-elev);
  flex-shrink: 0;
}
.ctab {
  padding: 10px 16px; border: 0; background: none;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--mute);
  cursor: pointer; border-bottom: 2px solid transparent;
}
.ctab:hover { color: var(--ink); }
.ctab--active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.explorer { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg-elev); }
.fs-toggle {
  flex-shrink: 0; width: 20px; height: 20px; padding: 0;
  background: none; border: 0; cursor: pointer; color: var(--faint);
  font-size: 10px; line-height: 20px; text-align: center; border-radius: 4px;
}
.fs-toggle:hover { color: var(--accent); background: var(--bg-elev); }
.fs-toggle--empty { cursor: default; visibility: hidden; }
.explorer-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.crumb { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 2px 4px; }
.crumb:hover { text-decoration: underline; }
.crumb--active { color: var(--ink); font-weight: 600; cursor: default; }
.crumb--active:hover { text-decoration: none; }
.crumb-sep { color: var(--faint); display: inline-flex; align-items: center; gap: 4px; }
.explorer-list { flex: 1; overflow: auto; padding: 10px 14px; }
.fs-row { border-radius: var(--radius); }
.fs-row:hover { background: var(--bg-deep); }
.fs-row--sel { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.fs-row--sel:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.fs-line { display: flex; align-items: center; gap: 4px; user-select: none; cursor: default; }
.fs-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; cursor: pointer;
  font-size: 13.5px; color: var(--ink); text-align: left;
}
.fs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-marquee {
  position: absolute; z-index: 5; pointer-events: none;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.ctx-backdrop { position: fixed; inset: 0; z-index: 200; }
.ctx-menu {
  position: fixed; min-width: 210px; padding: 6px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.ctx-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink); border-radius: 6px;
}
.ctx-item:hover { background: var(--bg-deep); }
.ctx-item--danger { color: var(--live); }
.ctx-sep { height: 1px; margin: 5px 6px; background: var(--line); }
.xfer-track { height: 10px; background: var(--bg-deep); border-radius: 6px; overflow: hidden; }
.xfer-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .15s linear; }
.xfer-fill--indet { width: 35%; animation: xferIndet 1.1s ease-in-out infinite; }
@keyframes xferIndet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.explorer-empty { text-align: center; color: var(--faint); padding: 40px 20px; font-size: 13px; }
.md-render {
  width: 100%; min-height: 40vh; max-height: 60vh; overflow: auto;
  padding: 16px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 14px; line-height: 1.6;
}
.md-render h1 { font-size: 22px; margin: 12px 0 8px; }
.md-render h2 { font-size: 18px; margin: 12px 0 6px; }
.md-render h3 { font-size: 15px; margin: 10px 0 6px; }
.md-render p { margin: 6px 0; }
.md-render code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-deep); padding: 1px 5px; border-radius: 4px; }
.md-render pre { background: var(--bg-deep); padding: 12px; border-radius: var(--radius); overflow: auto; }
.md-render pre code { background: none; padding: 0; }
.md-render a { color: var(--accent); }
.md-render ul { padding-left: 22px; margin: 6px 0; }

@media (max-width: 720px) {
  .chan-tabs { padding: 0 12px; }
  .explorer-bar { padding: 10px 12px; }
  .explorer-list { padding: 8px; }
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px 20px 14px;
  background: var(--bg-elev);
  display: flex; gap: 10px; align-items: flex-end;
}
.composer textarea {
  flex: 1; resize: none;
  font: inherit; font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  min-height: 38px; max-height: 200px;
  outline: none;
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─── Modals (invite, create-team, setup wizard) ─────────────────────────────── */
.modal-stage {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,10,40,0.45);
  backdrop-filter: blur(4px);
  animation: backdropIn .2s ease both;
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%; max-width: 480px; margin: 20px;
  animation: modalIn .25s cubic-bezier(.2,.7,.2,1) both;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--mute); font-family: var(--font-mono); }

/* Carnet de contacts — chips sélectionnables dans les modals */
.contact-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 140px; overflow-y: auto;
  padding: 2px;
}
.contact-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: inherit; font-size: 12.5px; color: var(--ink);
  cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s;
}
.contact-chip:hover { border-color: var(--accent); }
.contact-chip--on {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
  font-weight: 600;
}
.contact-chip-av {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}

.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink); color: var(--bg-elev);
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; box-shadow: var(--shadow-md);
  animation: modalIn .2s ease both;
  max-width: 360px;
}
.toast--ok { background: var(--ok); color: white; }
.toast--err { background: var(--live); color: white; }

/* ─── Panneau participants (conversation privée) ─────────────────────────────── */
.btn--on { background: var(--accent-soft); color: var(--accent); }
.members-backdrop {
  position: fixed; inset: 44px 0 0 0; z-index: 39;
  background: transparent;
}
.members-panel {
  position: fixed; top: 44px; right: 0; bottom: 0;
  width: 290px; z-index: 40;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  animation: fadeIn .18s ease both;
}
.members-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.members-head h3 { font-size: 15px; font-weight: 700; margin: 0; }
.members-list { flex: 1; overflow-y: auto; padding: 10px; }
.members-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius);
}
.members-row:hover { background: var(--bg-deep); }
.members-row strong { font-size: 14px; }
.members-foot { padding: 14px; border-top: 1px solid var(--line); }
.discover-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius); background: var(--bg-deep);
}
.discover-av {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #fff;
  background-size: cover; background-position: center;
}
.perm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; font-size: 13.5px; color: var(--ink);
  cursor: pointer; border-bottom: 1px solid var(--line);
}
.perm-row:last-of-type { border-bottom: 0; }
.perm-row input { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 720px) {
  .members-backdrop { inset: 0; background: rgba(20,10,40,.4); }
  .members-panel { top: 0; width: 100%; border-left: 0; }
}

/* ─── Brand badge ─────────────────────────────── */
.brand-badge {
  display:inline-flex;align-items:center;justify-content:center;
  width:26px;height:26px;border-radius:6px;
  background:var(--accent);color:var(--accent-ink);
  font-weight:800;font-size:11px;letter-spacing:.02em;
}

/* ─── Rail : avatar + menu déroulant ─────────────────────────────── */
.rail-user-btn { width: 100%; }
.rail-avatar {
  width:100%;height:100%;border-radius:inherit;
  background:var(--accent);color:var(--accent-ink);
  font-size:14px;font-weight:700;
}
.menu-backdrop {
  position:fixed;
  inset:0;
  z-index:190;        /* sous le menu (200), au-dessus de la bottombar (90) */
}
.rail-menu {
  position:fixed;
  left:84px;          /* rail desktop = 76px + gap */
  bottom:14px;
  width:210px;
  background:var(--bg-elev);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-modal);
  padding:6px;
  z-index:200;        /* au-dessus des modals (50) et de tout le reste */
}
/* Menu [+] : ancré verticalement au niveau du bouton (top via :style). */
.rail-menu--anchored { bottom:auto; }
.rail-menu-head {
  display:flex;flex-direction:column;gap:1px;
  padding:8px 10px 10px;
  border-bottom:1px solid var(--line);
  margin-bottom:6px;
}
.rail-menu-head strong { font-size:14px; }
.rail-menu-item {
  width:100%;display:flex;align-items:center;gap:10px;
  padding:9px 10px;border:0;background:none;
  font:inherit;font-size:13.5px;color:var(--ink);
  text-align:left;cursor:pointer;border-radius:var(--radius);
}
.rail-menu-item:hover { background:var(--bg-deep); }
.rail-menu-item--danger { color:var(--live); }
.rail-menu-item--danger:hover { background:color-mix(in oklab,var(--live) 12%,var(--bg-elev)); }
.rail-menu-sep { height:1px;background:var(--line);margin:6px 4px; }

/* ─── Vues génériques (admin / account) ─────────────────────────────── */
.view-header {
  padding:20px 28px 0;
  border-bottom:1px solid var(--line);
}
.view-header h1 { font-size:24px;font-weight:700;letter-spacing:-.02em;margin:0 0 14px; }
.view-body { flex:1;overflow:auto;padding:24px 28px; }

.tabs { display:flex;gap:4px; }
.tab {
  padding:9px 16px;border:0;background:none;
  font:inherit;font-size:13.5px;font-weight:500;color:var(--mute);
  cursor:pointer;border-bottom:2px solid transparent;
}
.tab:hover { color:var(--ink); }
.tab--active { color:var(--accent);border-bottom-color:var(--accent);font-weight:600; }

/* Tables */
.tablewrap { overflow-x:auto; }
.dtable { width:100%;border-collapse:collapse;font-size:13.5px; }
.dtable th {
  text-align:left;font-weight:600;color:var(--mute);
  font-size:11px;text-transform:uppercase;letter-spacing:.05em;
  padding:8px 12px;border-bottom:1px solid var(--line);
}
.dtable td { padding:11px 12px;border-bottom:1px solid var(--line); }
.dtable tr:hover td { background:var(--bg-deep); }
.dtable-empty { text-align:center;color:var(--faint);padding:28px!important; }
.btn--sm { padding:5px 10px;font-size:12px; }

.badge {
  display:inline-block;padding:2px 9px;border-radius:999px;
  font-size:11px;font-weight:600;
  background:var(--bg-deep);color:var(--ink-2);
}
.badge--accent { background:var(--accent-soft);color:var(--accent); }
.badge--ok { background:color-mix(in oklab,var(--ok) 18%,var(--bg-elev));color:var(--ok); }
.badge--warn { background:color-mix(in oklab,var(--warn) 20%,var(--bg-elev));color:var(--warn); }
.badge--mute { background:var(--bg-deep);color:var(--faint); }

.invite-create { display:flex;gap:10px;margin-bottom:18px;max-width:520px; }
.invite-create .input { flex:1; }

/* Cards (account) */
.card {
  background:var(--bg-elev);border:1px solid var(--line);
  border-radius:var(--radius-lg);padding:20px 22px;
  max-width:540px;margin-bottom:18px;
}
.card-title { font-size:15px;font-weight:700;margin:0 0 6px; }
.card-hint { font-size:12.5px;color:var(--mute);margin:0 0 16px;line-height:1.5; }
.card-row { display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--line); }
.card-row:last-child { border-bottom:0; }
.inv-row {
  display:flex;align-items:center;gap:12px;
  padding:12px 0;border-bottom:1px solid var(--line);
}
.inv-row:last-child { border-bottom:0; }
.inv-row .col strong { font-size:14px; }
/* Espacement des champs et du bouton dans les cartes (les modals utilisent
   déjà .modal-body gap, mais pas les .card). */
.card .field { margin-bottom:14px; }
.card .btn { margin-top:4px; }
.card-k { color:var(--mute);font-size:13px; }
.card-v { font-weight:500;font-size:13.5px; }
.ok-banner {
  background:color-mix(in oklab,var(--ok) 12%,var(--bg-elev));
  color:var(--ok);border:1px solid color-mix(in oklab,var(--ok) 30%,transparent);
  padding:10px 12px;border-radius:var(--radius);font-size:12.5px;margin-bottom:12px;
}

.pane-empty { padding:32px 16px;text-align:center;color:var(--mute);font-size:13px; }
.pane-back, .rail-back { display:none; }

/* ─── Responsive ─────────────────────────────── */

/* Tablette : rail plus fin, pane réduit */
@media (max-width: 1024px) {
  .app { grid-template-columns: 64px 248px 1fr; }
  .app.view-admin, .app.view-account, .app.view-invitations, .app.view-discover { grid-template-columns: 64px 1fr; }
  .rail-tile-glyph { width:40px;height:40px; }
  .rail-menu { left:72px; }   /* rail tablette = 64px + gap */
  /* Espace réduit → titre court. */
  .topbar-brand .brand-long { display:none; }
  .topbar-brand .brand-short { display:inline; }
}

/* ─── Bottom bar : mobile uniquement ─────────────────────────────── */
.bottombar { display:none; }

/* Mobile : pas de rail latéral. Bottom bar persistante + drill-down pane↔content */
@media (max-width: 720px) {
  /* Cible aussi .app.view-admin/.view-account : sinon leur règle globale
     (spécificité 0,2,0) écrase cette grille mono-colonne sur mobile. */
  .app,
  .app.view-admin,
  .app.view-account,
  .app.view-invitations,
  .app.view-discover {
    grid-template-columns: 1fr;
    grid-template-rows: 44px 1fr;
    grid-template-areas:
      "top"
      "content";
  }
  .rail { display:none; }

  /* pane (channels) plein écran tant qu'on n'est pas dans le contenu */
  .pane { display:none; }
  .app.mobile-pane .pane { display:flex;grid-area:content;padding-bottom:64px; }
  .app.mobile-pane .content { display:none; }

  /* content (conversation / admin / compte) plein écran */
  .content { padding-bottom:64px; border-left:0; }
  .app.mobile-content .content { display:flex;grid-area:content; }
  .app.mobile-content .pane { display:none; }

  /* En vue admin/compte le content prend tout, indépendamment de mobilePane */
  .app.view-admin .content,
  .app.view-account .content,
  .app.view-invitations .content,
  .app.view-discover .content { display:flex !important;grid-area:content; }
  .app.view-admin .pane,
  .app.view-account .pane,
  .app.view-invitations .pane,
  .app.view-discover .pane { display:none !important; }

  /* Retour : depuis la conversation vers la liste des channels */
  .app.mobile-content .chan-header .pane-back { display:inline-flex; }
  /* Le retour pane→rail n'a plus de sens (teams dans la bottombar) */
  .pane-head .pane-back { display:none !important; }

  /* Bottom bar */
  .bottombar {
    display:flex;align-items:center;gap:8px;
    position:fixed;left:0;right:0;bottom:0;
    height:60px;padding:0 8px;
    background:var(--rail);
    border-top:1px solid var(--rail-line);
    z-index:90;
  }
  .bottombar-teams {
    flex:1;display:flex;align-items:center;gap:8px;
    overflow-x:auto;overflow-y:hidden;
    height:100%;padding:0 2px;
    scrollbar-width:none;
  }
  .bottombar-teams::-webkit-scrollbar { display:none; }
  .bottombar-tile {
    flex-shrink:0;background:none;border:0;padding:2px;cursor:pointer;
    border-radius:12px;
  }
  .bottombar-square {
    width:42px;height:42px;border-radius:11px;
    display:flex;align-items:center;justify-content:center;
    color:#fff;font-weight:700;font-size:14px;letter-spacing:.02em;
  }
  .bottombar-square--add {
    background:none !important;border:1px dashed var(--rail-line);
    color:var(--rail-mute);font-size:20px;
  }
  .bottombar-round {
    width:42px;height:42px;border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    background:var(--citron-deep);color:#fff;font-weight:700;font-size:14px;
  }
  .bottombar-badge {
    position:absolute;top:-2px;right:-2px;
    min-width:18px;height:18px;padding:0 5px;
    background:var(--live);color:#fff;
    border-radius:10px;font-size:10px;font-weight:700;
    display:inline-flex;align-items:center;justify-content:center;
    border:2px solid var(--rail);
  }
  .bottombar-tile--active .bottombar-square,
  .bottombar-tile--active .bottombar-round {
    outline:2px solid var(--citron);outline-offset:2px;
  }
  .bottombar-add { position:relative;flex-shrink:0; }
  .bottombar-addmenu {
    position:fixed; right:12px; bottom:72px; width:240px;
    background:var(--bg-elev);border:1px solid var(--line);
    border-radius:var(--radius-lg);box-shadow:var(--shadow-modal);
    padding:6px;z-index:200;
  }
  .bottombar-account {
    flex-shrink:0;background:none;border:0;cursor:pointer;
    padding:6px 8px 6px 12px;
    border-left:1px solid var(--rail-line);
    height:100%;display:flex;align-items:center;
  }

  /* Menu utilisateur : ancré au-dessus de la bottombar, pleine largeur */
  .rail-menu { left:12px;right:12px;bottom:72px;width:auto; }

  .topbar-search { display:none; }
  .topbar { grid-template-columns: 1fr auto; }
  .view-header, .view-body { padding-left:16px;padding-right:16px; }
  .modal { margin:12px; }
  .invite-create { flex-direction:column; }
}

/* Sur desktop le bouton retour mobile reste masqué */
@media (min-width: 721px) {
  .pane-back, .rail-back { display:none !important; }
}

/* ─── Appel LiveKit ──────────────────────────────────────────────── */
/* L'appel n'est PLUS un overlay plein viewport : en mode "frame" il occupe la
   colonne de contenu (rail + liste restent visibles, façon Teams) ; en "pip"
   c'est un panneau flottant déplaçable au-dessus du contenu (hors menu). */
.call-stage { display: flex; align-items: center; justify-content: center; }
/* Frame : calé APRÈS le menu (rail 76 + liste 300 = 376px), pleine hauteur.
   Positionnement déterministe (pas de dépendance au flux grid). */
/* Frame = zone de grille "content" : exactement le cadre de contenu (sous le
   topbar 44px, à droite de rail+pane), comme un contenu normal. Aucun offset
   codé en dur, robuste aux changements de layout. */
.call-stage--frame {
  grid-area: content; position: relative; z-index: 20;
  background: #0d0f14; padding: 14px; overflow: hidden;
}
.call-stage--pip {
  position: fixed; right: 18px; bottom: 18px; z-index: 320;
  width: 380px; height: 250px; min-width: 240px; min-height: 168px;
  background: #0d0f14; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-modal);
  resize: both; overflow: hidden; padding: 0; align-items: stretch;
}
.call-stage--pip .call-room { width: 100%; max-width: none; height: 100%; padding: 0; gap: 0; }
.call-stage--frame .call-room { max-width: none; padding: 0; gap: 10px; }
.call-lobby {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px; max-width: 420px;
  text-align: center; box-shadow: var(--shadow-modal);
}
.call-lobby h2 { margin: 0 0 6px; font-size: 20px; }
.call-room { width: 100%; max-width: 1100px; height: 100%; display: flex;
  flex-direction: column; gap: 14px; padding: 10px 0; }
.call-grid { flex: 1; display: grid; gap: 10px; align-content: stretch;
  justify-items: stretch; align-items: stretch; min-height: 0; }
.call-tile {
  position: relative; background: #16181f; border: 2px solid transparent;
  border-radius: 12px; overflow: hidden; min-height: 0;
  aspect-ratio: 16/9; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.call-tile--speaking { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-tile-av { position:absolute; inset:0; display: flex; align-items: center; justify-content: center; }
/* Étiquette nom = petite pastille bas-gauche (pas un bandeau pleine largeur) */
.call-tile-bar {
  position: absolute; left: 8px; bottom: 8px; right: auto;
  display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 16px);
  padding: 3px 9px; font-size: 11.5px; color: #fff;
  background: rgba(8,10,16,.6); backdrop-filter: blur(3px); border-radius: 999px;
}
.call-tile-bar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-controls { display: flex; gap: 12px; justify-content: center; padding-bottom: 6px; }
.call-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 64px; padding: 10px 0; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--ink); border-radius: var(--radius);
  cursor: pointer; font: inherit;
}
.call-btn span { font-size: 20px; line-height: 1; }
.call-btn small { font-size: 11px; color: var(--mute); }
.call-btn:hover { border-color: var(--accent); }
.call-btn--on { background: var(--accent-soft); border-color: var(--accent); }
.call-btn--leave { background: color-mix(in srgb, var(--live) 18%, var(--bg-elev)); border-color: var(--live); }
.call-btn--leave span { color: var(--live); }

/* ── Appel : grille adaptative, focus, options, chat, flottant ── */
.call-bann { position:absolute; top:0; left:0; right:0; z-index:5; text-align:center;
  padding:7px 12px; background:var(--warn,#b8860b); color:#fff; font-size:13px; font-weight:600; }
.call-bann--info { background:color-mix(in srgb,var(--accent) 70%, #000); }
.call-body { flex:1; min-height:0; display:flex; gap:10px; }
.call-body .call-grid, .call-body .call-focus { flex:1; min-width:0; }
.call-tile--contain video { object-fit:contain; }       /* écran : jamais tronqué */
.call-focus { display:flex; flex-direction:column; gap:8px; }
.call-tile--main { flex:1; aspect-ratio:auto; }
.call-tile--main video { object-fit:contain; }
.call-strip { display:flex; gap:8px; height:96px; overflow-x:auto; flex:0 0 auto; }
.call-tile--mini { aspect-ratio:16/9; height:96px; flex:0 0 auto; min-height:0; }
.call-x { background:rgba(0,0,0,.4); color:#fff; border:0; border-radius:4px;
  cursor:pointer; padding:1px 6px; font-size:12px; }
.call-opts { position:absolute; bottom:74px; right:0; z-index:10; width:280px;
  background:var(--bg-elev); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-modal); padding:6px; display:flex; flex-direction:column; gap:2px; }
.call-opt { display:flex; align-items:center; gap:8px; width:100%; text-align:left;
  background:none; border:0; color:var(--ink); font:inherit; padding:8px 10px;
  border-radius:6px; cursor:pointer; }
.call-opt:hover { background:var(--bg-deep); }
/* Chat plein écran : colonne INTÉGRÉE à la surface d'appel (pas une carte
   modale) — simple filet de séparation, même fond sombre. */
.call-chat { width:320px; flex:0 0 320px; display:flex; flex-direction:column;
  border-left:1px solid rgba(255,255,255,.08); }
.call-chat-head { display:flex; justify-content:space-between; align-items:center;
  padding:10px 12px; color:#fff; font-weight:600; font-size:13px;
  border-bottom:1px solid rgba(255,255,255,.08); }
.call-chat-msgs { flex:1; overflow-y:auto; padding:12px; display:flex;
  flex-direction:column; gap:7px; font-size:13px; color:#e8e8ea; }
.call-chat-m { line-height:1.4; }
.call-chat-m b { color:var(--accent); margin-right:5px; font-weight:600; }
.call-chat-form { padding:10px; border-top:1px solid rgba(255,255,255,.08); }
.call-chat-form .input { background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.12); color:#fff; }
/* Chat flottant : overlay « léché » glissé par-dessus la vidéo du mini-panneau */
.call-chat--float { position:absolute; inset:0; z-index:8; width:auto; flex:none;
  border-left:0; background:rgba(14,16,22,.78); backdrop-filter:blur(10px);
  animation:callchatslide .16s ease-out; }
@keyframes callchatslide { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
/* Avatars (pas d'initiales) quand ni cam ni partage */
.call-av-img { width:64px; height:64px; border-radius:50%; object-fit:cover;
  border:2px solid rgba(255,255,255,.15); background:#222; }
.call-av-img--lg { width:96px; height:96px; }
.call-av-img--sm { width:38px; height:38px; border-width:1px; }
/* Barre de titre du panneau flottant (poignée de drag) */
.call-float-bar { display:flex; align-items:center; gap:6px; cursor:move;
  user-select:none; padding:6px 8px; font-size:12px; color:var(--mute);
  background:var(--bg-elev); border-bottom:1px solid var(--line); }
.call-float-bar-t { font-weight:600; }
.call-float-bar .call-x { cursor:pointer; }

/* Indicateur "appel en cours" proéminent (pastille verte pulsante) */
.call-live-pill { display:inline-flex; align-items:center; gap:8px;
  background:var(--ok,#2a9d4a); color:#fff; border:0; border-radius:999px;
  padding:7px 14px; font:inherit; font-size:13px; font-weight:600; cursor:pointer;
  box-shadow:0 0 0 0 color-mix(in srgb,var(--ok,#2a9d4a) 70%, transparent);
  animation:callpulse 1.8s ease-out infinite; }
.call-live-pill:hover { filter:brightness(1.08); }
.call-live-dot { width:9px; height:9px; border-radius:50%; background:#fff;
  box-shadow:0 0 0 0 rgba(255,255,255,.7); animation:callpulse 1.4s ease-out infinite; }
@keyframes callpulse {
  0% { box-shadow:0 0 0 0 color-mix(in srgb,var(--ok,#2a9d4a) 55%, transparent); }
  70% { box-shadow:0 0 0 12px transparent; }
  100% { box-shadow:0 0 0 0 transparent; }
}

/* Frame : occupe la cellule de contenu, remplit toute la hauteur. */
.call-interrupted { position:absolute; inset:0; z-index:30; display:flex;
  align-items:center; justify-content:center; background:rgba(8,10,16,.82);
  backdrop-filter:blur(3px); }
.call-interrupted-box { text-align:center; padding:22px 26px; max-width:340px;
  background:var(--bg-elev); border:1px solid var(--line);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-modal); }
.call-framewrap { display:flex; flex-direction:column; width:100%; height:100%;
  min-height:0; gap:10px; position:relative; }
.call-framewrap .call-body { flex:1; min-height:0; }

/* Barre de contrôle sobre (pilule centrée, style layout global) */
.call-bar { display:flex; gap:8px; justify-content:center; align-items:center;
  padding:8px; align-self:center; background:var(--bg-elev);
  border:1px solid var(--line); border-radius:999px; box-shadow:var(--shadow); }
.cbtn { width:42px; height:42px; border-radius:50%; border:1px solid var(--line);
  background:var(--bg-deep); color:var(--ink); cursor:pointer; font-size:17px;
  line-height:1; display:inline-flex; align-items:center; justify-content:center;
  transition:background .12s,border-color .12s; }
.cbtn:hover { border-color:var(--accent); }
.cbtn--on { background:var(--accent-soft); border-color:var(--accent); }
.cbtn--sm { width:30px; height:30px; font-size:13px; border-radius:8px; }
.cbtn--leave { background:color-mix(in srgb,var(--live) 20%, var(--bg-deep));
  border-color:var(--live); color:var(--live); }

/* PiP : panneau flottant mono-flux, boutons sur l'image au survol */
.call-pip { display:flex; flex-direction:column; width:100%; height:100%; position:relative; }
/* Pas de header bar : le PiP est une vidéo nette, glissable directement,
   contrôles flottants sur l'image. */
.call-pip-stage { position:relative; flex:1; min-height:0; background:#000;
  cursor:move; user-select:none; }
.call-pip-stage .call-tile--pip { position:absolute; inset:0; width:100%; height:100%;
  border:0; border-radius:0; aspect-ratio:auto; cursor:move; }
.call-pip-stage .cbtn { cursor:pointer; }
.call-pip-ctrls { position:absolute; left:50%; bottom:8px; transform:translateX(-50%);
  display:flex; gap:6px; padding:5px 7px; border-radius:999px;
  background:rgba(10,12,18,.62); backdrop-filter:blur(6px);
  opacity:0; transition:opacity .15s; pointer-events:none; }
/* Icônes flottantes haut-droite (agrandir / raccrocher) */
.call-pip-top { position:absolute; top:8px; right:8px; display:flex; gap:6px;
  opacity:0; transition:opacity .15s; pointer-events:none; z-index:2; }
.call-pip-stage:hover .call-pip-ctrls,
.call-pip-stage:hover .call-pip-top { opacity:1; pointer-events:auto; }
.call-pip-top .cbtn { width:30px; height:30px; font-size:13px;
  background:rgba(10,12,18,.62); backdrop-filter:blur(6px);
  color:#fff; border-color:rgba(255,255,255,.18); }
.call-pip-top .cbtn--leave { background:var(--live); border-color:var(--live); color:#fff; }
.call-pip-ctrls .cbtn { width:34px; height:34px; font-size:14px; background:rgba(255,255,255,.08);
  color:#fff; border-color:rgba(255,255,255,.18); }
.call-pip-ctrls .cbtn--on { background:var(--accent); border-color:var(--accent); }
.call-pip-ctrls .cbtn--leave { background:var(--live); border-color:var(--live); color:#fff; }
@media (max-width: 720px) {
  .call-grid { grid-template-columns: 1fr !important; }
  .call-room { padding: 0; }
  /* Mobile : réserver la place de la bottombar fixe (64px, cf. .content) —
     sinon la barre de contrôle de l'appel passe dessous. */
  .call-stage--frame { padding-bottom: 64px; }
  .call-stage--pip { bottom: 76px; }
}
.call-cta { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.call-cta-box {
  text-align: center; max-width: 460px; padding: 32px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.call-cta-box h2 { margin: 8px 0 4px; font-size: 20px; }

/* ── Salons vocaux : occupants en sidebar ───────────────────── */
.chan-occ-list { list-style: none; margin: 0 0 4px; padding: 2px 0 4px 30px; }
.chan-occ {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px; color: var(--ink-2); font-size: 12.5px;
  overflow: hidden;
}
.chan-occ-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-occ-av {
  flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent) center/cover no-repeat;
  color: var(--accent-ink); font-size: 9px; font-weight: 700;
  font-family: var(--font-mono);
}

/* ── Salons vocaux : page d'accueil du salon (présence + entrée) ── */
.salon-card {
  max-width: 520px; width: 100%; padding: 32px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.salon-eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--mute); margin-bottom: 6px;
}
.salon-title { margin: 0 0 6px; font-size: 22px; }
.salon-desc { margin: 0 0 18px; color: var(--mute); font-size: 13.5px; line-height: 1.5; }
.salon-empty { margin: 0 0 18px; color: var(--faint); font-size: 13px; }
.salon-occ { margin: 0 0 18px; }
.salon-occ-head {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--mute); margin-bottom: 8px;
}
.salon-occ-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.salon-occ-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--pane-deep); border-radius: 999px;
  font-size: 13px; color: var(--ink);
}
.salon-occ-av {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent) center/cover no-repeat;
  color: var(--accent-ink); font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
}
.salon-actions { display: flex; flex-wrap: wrap; gap: 10px; }
