/* =========================================================
   ChatMeet — interface
   ========================================================= */

:root {
  --bg: #070b14;
  --bg-soft: #0b1120;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-solid: #0f172a;
  --panel-2: #111c33;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #e8edf7;
  --muted: #93a1b8;
  --muted-2: #6b7a93;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --ok: #34d399;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.55);
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Inter", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(124, 92, 255, 0.2), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(34, 211, 238, 0.13), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

::selection {
  background: rgba(124, 92, 255, 0.45);
}

*:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.32) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================ LOBBY ============================ */

.lobby {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 26px 40px 18px;
  overflow-y: auto;
}

.lobby-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-area {
  display: flex;
  align-items: center;
}

.auth-login {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  color: #e8edf7;
  text-decoration: none;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.3);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-login:hover {
  background: rgba(124, 92, 255, 0.28);
  border-color: rgba(124, 92, 255, 0.5);
}

.auth-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--line);
}

.auth-chip .avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.auth-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #dbe4f3;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-chip a {
  font-size: 11.5px;
  font-weight: 600;
  color: #a5b4fc;
  text-decoration: none;
  padding: 0 2px;
}

.auth-chip a:hover {
  text-decoration: underline;
}

.auth-chip-out {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
}

.auth-chip-out:hover {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.lobby-top {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7c5cff, #22d3ee);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  color: #0a0f1e;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-name span {
  background: linear-gradient(100deg, #a78bfa, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.badge-soft {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #b6c2d9;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--line);
}

.download-badge {
  color: #a5f3fc;
  border-color: rgba(34, 211, 238, 0.25);
  text-decoration: none;
}

.download-badge:hover {
  color: #ecfeff;
  background: rgba(34, 211, 238, 0.12);
}

.lobby-main {
  width: 100%;
  max-width: 1120px;
  margin: auto;
  padding: 48px 0 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.78fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9fb0ca;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
  animation: pulse 2.4s ease-in-out infinite;
  flex: none;
}

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.grad {
  background: linear-gradient(100deg, #a78bfa 0%, #7c5cff 42%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 520px;
  margin: 22px 0 0;
  color: #a9b6cc;
  font-size: 16.5px;
  line-height: 1.65;
}

.hero-sub strong {
  color: #e8edf7;
}

.features {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 22px;
  max-width: 540px;
}

.features li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feature-ico {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #c4b5fd;
  background: linear-gradient(160deg, rgba(124, 92, 255, 0.18), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(124, 92, 255, 0.22);
}

.feature-ico svg {
  width: 19px;
  height: 19px;
}

.features strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.features span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 1px;
}

/* Carte de connexion */
.join-card {
  position: relative;
  padding: 30px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.9), rgba(12, 19, 35, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.join-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.45), transparent 38%, rgba(34, 211, 238, 0.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.join-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.card-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: #b6c2d9;
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 11, 20, 0.72);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input::placeholder {
  color: var(--muted-2);
}

.input:hover {
  border-color: rgba(148, 163, 184, 0.34);
}

.input:focus {
  outline: none;
  border-color: rgba(124, 92, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.16);
  background: rgba(7, 11, 20, 0.92);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 14.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  width: 100%;
  margin-top: 16px;
  color: #0a0f1e;
  background: linear-gradient(135deg, #a78bfa, #7c5cff 55%, #22d3ee 130%);
  box-shadow: 0 12px 30px rgba(124, 92, 255, 0.32);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(124, 92, 255, 0.42);
}

.btn-icon {
  width: 48px;
  flex: none;
  padding: 0;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line-strong);
}

.btn-icon:hover {
  background: rgba(124, 92, 255, 0.22);
  border-color: rgba(124, 92, 255, 0.55);
  color: #fff;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted-2);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.join-row {
  display: flex;
  gap: 8px;
}

.join-row .input {
  min-width: 0;
}

.hint {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted-2);
}

.hint.error {
  color: #fca5a5;
}

.server-line {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted-2);
  word-break: break-all;
}

.server-line span {
  color: #8ea0bb;
}

.lobby-foot {
  width: 100%;
  max-width: 1180px;
  margin: 8px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
}

.lobby-foot strong {
  color: #a9b6cc;
  font-weight: 600;
}

/* ============================ SALLE ============================ */

.room {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
}

.room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.66);
  backdrop-filter: blur(16px);
  z-index: 5;
}

.room-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.room-heading h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-code {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted-2);
  font-family: "Cascadia Code", "Consolas", monospace;
  letter-spacing: 0.06em;
}

.room-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.conn-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: #fbbf24;
}

.conn-pill.ok {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.22);
}
.conn-pill.ok::before {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.conn-pill.warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
}
.conn-pill.warn::before {
  background: #fbbf24;
}

.conn-pill.err {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
}
.conn-pill.err::before {
  background: var(--danger);
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--line);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip-btn svg {
  width: 15px;
  height: 15px;
}

.chip-btn:hover {
  background: rgba(148, 163, 184, 0.16);
  border-color: var(--line-strong);
  color: #fff;
}

.chip-btn.danger:hover {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.room-body {
  display: flex;
  min-height: 0;
  min-width: 0;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  display: flex;
}

.video-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  overflow-y: auto;
  padding: 2px;
}

.video-grid[data-count="0"] {
  display: none;
}

.video-grid[data-count="1"] {
  max-width: 980px;
  margin: 0 auto;
  grid-template-columns: 1fr;
}

.video-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1180px;
  margin: 0 auto;
}

.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1180px;
  margin: 0 auto;
}

/* Tuile */
.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 130px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(124, 92, 255, 0.16), transparent 55%),
    #0d1424;
  border: 1px solid rgba(148, 163, 184, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  isolation: isolate;
}

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0f1c;
}

.tile[data-local="true"][data-source="camera"] video {
  transform: scaleX(-1);
}

.tile[data-source="screen_share"],
.tile[data-source="screen"] {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  height: var(--screen-height, min(64vh, 720px));
  background: #05080f;
}

.tile[data-source="screen_share"] video,
.tile[data-source="screen"] video {
  object-fit: contain;
}

.tile.screen-large {
  --screen-height: min(88vh, 1200px);
}

.tile:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: 0;
  background: #000;
}

.tile-screen-tools {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(5, 10, 20, 0.9);
  backdrop-filter: blur(8px);
}

.tile-screen-tools button,
.tile-screen-tools select {
  height: 25px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.9);
  color: #dbeafe;
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

.tile-screen-tools button:hover,
.tile-screen-tools select:hover {
  border-color: rgba(34, 211, 238, 0.5);
}

.tile:fullscreen .tile-screen-tools {
  bottom: 18px;
  left: 18px;
}

.tile.speaking {
  border-color: rgba(34, 211, 238, 0.85);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25), 0 12px 40px rgba(34, 211, 238, 0.12);
}

.tile.video-off video {
  opacity: 0;
}

.tile-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 90% at 50% 10%, rgba(124, 92, 255, 0.28), transparent 70%),
    #101a2e;
  z-index: 1;
}

.tile-avatar span {
  width: clamp(52px, 9vw, 84px);
  height: clamp(52px, 9vw, 84px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #4f8cff 55%, #22d3ee);
  box-shadow: 0 12px 34px rgba(79, 140, 255, 0.35);
  letter-spacing: 0.02em;
}

.tile.has-video .tile-avatar {
  display: none;
}

.tile-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 22px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(180deg, transparent, rgba(3, 7, 18, 0.82));
}

.tile-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-mic {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.55);
  color: #8ee8c4;
  position: relative;
}

.tile-mic svg {
  width: 13px;
  height: 13px;
}

.tile-mic.muted {
  color: #fca5a5;
}

.tile-mic.muted::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
  border-radius: 2px;
}

.tile-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cffafe;
  background: rgba(8, 47, 73, 0.8);
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: none;
}

.tile[data-source="screen_share"] .tile-badge,
.tile[data-source="screen"] .tile-badge {
  display: inline-flex;
}

.tile-hand {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: none;
  place-items: center;
  font-size: 15px;
  background: rgba(250, 204, 21, 0.95);
  box-shadow: 0 4px 14px rgba(250, 204, 21, 0.35);
  color: #111827;
}

.tile.hand .tile-hand {
  display: grid;
}

#handBtn[data-on="true"] {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
}

#recordBtn[data-on="true"] {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.32);
  animation: recPulse 1.8s ease-in-out infinite;
}

@keyframes recPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.person-hand {
  font-size: 13px;
  color: #fbbf24;
}

/* Écran vide / connexion */
.stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  pointer-events: none;
}

.captions {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 8;
  max-width: min(820px, calc(100% - 40px));
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.86);
  border: 1px solid var(--line-strong);
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 36px rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(8px);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid rgba(148, 163, 184, 0.18);
  border-top-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}

/* ============================ PANNEAU ============================ */

.side-panel {
  width: 336px;
  flex: none;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.66), rgba(9, 14, 26, 0.86));
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.room.chat-closed .side-panel {
  width: 0;
  opacity: 0;
  border-left: 0;
  overflow: hidden;
  pointer-events: none;
}

.panel-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 12px 0;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.tab {
  position: relative;
  padding: 9px 12px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: #cbd5e1;
}

.tab.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

.tab .count,
.tab .unread {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.tab .unread {
  background: var(--accent);
  color: #fff;
}

.panel-view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.panel-view.active {
  display: flex;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-intro {
  margin: auto 8px;
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.chat-intro-ico {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #c4b5fd;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.2);
}

.chat-intro-ico svg {
  width: 19px;
  height: 19px;
}

.chat-intro p {
  margin: 0;
}

.msg {
  max-width: 88%;
  animation: rise 0.18s ease both;
}

.msg.self {
  align-self: flex-end;
}

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 4px;
  padding: 0 2px;
}

.msg-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #c4b5fd;
}

.msg-time {
  font-size: 10.5px;
  color: var(--muted-2);
}

.msg-body {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.09);
  border: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg.self .msg-body {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.32), rgba(79, 140, 255, 0.24));
  border-color: rgba(124, 92, 255, 0.3);
}

.msg.self .msg-head {
  justify-content: flex-end;
}

.msg.self .msg-name {
  order: 2;
  color: #a5f3fc;
}

.msg-system {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-2);
  padding: 2px 8px;
}

.chat-form {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
}

.chat-form .input {
  height: 42px;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
}

.send-btn {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #0a0f1e;
  background: linear-gradient(135deg, #a78bfa, #22d3ee);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.send-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.people-list {
  list-style: none;
  margin: 0;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.person {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 12px;
}

.person:hover {
  background: rgba(148, 163, 184, 0.06);
}

.avatar-sm {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #4f8cff 55%, #22d3ee);
  text-transform: uppercase;
}

.person-info {
  min-width: 0;
  flex: 1;
}

.person-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-sub {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
}

.person-status {
  display: flex;
  gap: 5px;
  flex: none;
}

.status-ico {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.08);
  color: #8ee8c4;
}

.status-ico svg {
  width: 13px;
  height: 13px;
}

.status-ico.off {
  color: #fca5a5;
  background: var(--danger-soft);
}

.person-mic-action {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  transition: background 0.15s ease, color 0.15s ease;
}

.person-mic-action svg {
  width: 13px;
  height: 13px;
}

.person-mic-action:hover:not(:disabled) {
  color: #fff;
  background: rgba(239, 68, 68, 0.28);
}

.person-mic-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  border-color: transparent;
}

.panel-note {
  flex: none;
  margin: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted-2);
}

.panel-note strong {
  color: #cbd5e1;
}

/* ============================ CONTRÔLES ============================ */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 20px 18px;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(14px);
}

.ctrl {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #dbe4f3;
  background: rgba(148, 163, 184, 0.09);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.ctrl:hover {
  background: rgba(148, 163, 184, 0.18);
  transform: translateY(-1px);
}

.ctrl:active {
  transform: translateY(0);
}

.ctrl .ico svg {
  width: 21px;
  height: 21px;
}

.ctrl.has-unread::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 2px #0f172a;
}

.ctrl .ico-off {
  display: none;
}

.ctrl[data-on="false"] {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.24);
}

.ctrl[data-on="false"] .ico-on {
  display: none;
}

.ctrl[data-on="false"] .ico-off {
  display: block;
}

.ctrl[data-on="false"]:hover {
  background: rgba(239, 68, 68, 0.24);
}

#screenBtn[data-on="true"] {
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.16);
  border-color: rgba(34, 211, 238, 0.3);
}

#chatToggle[data-on="false"] {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.06);
}

.hangup {
  width: 58px;
  height: 58px;
  color: #fff;
  background: linear-gradient(160deg, #f87171, #dc2626);
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.35);
}

.hangup:hover {
  background: linear-gradient(160deg, #fca5a5, #ef4444);
}

.hangup svg {
  width: 23px;
  height: 23px;
}

/* ============================ DIVERS ============================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%) translateY(10px);
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 550;
  color: #e8edf7;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(69, 10, 10, 0.96);
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1020px) {
  .lobby-main {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 36px 0 24px;
    max-width: 620px;
  }

  .hero h1 {
    font-size: clamp(36px, 8vw, 52px);
  }

  .join-card {
    max-width: 520px;
  }

  .features {
    gap: 14px 18px;
  }
}

@media (max-width: 860px) {
  .side-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 100%);
    z-index: 6;
    box-shadow: -24px 0 60px rgba(2, 6, 23, 0.55);
  }

  .room-body {
    position: relative;
  }

  .room.chat-closed .side-panel {
    width: min(360px, 100%);
    transform: translateX(102%);
    opacity: 0;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .video-grid[data-count="2"] {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .lobby {
    padding: 18px 18px 14px;
  }

  .lobby-main {
    padding-top: 28px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .hero-sub {
    font-size: 15px;
  }

  .join-card {
    padding: 22px;
    border-radius: 20px;
  }

  .room-top {
    padding: 10px 12px;
  }

  .room-top-actions .chip-btn span {
    display: none;
  }

  .chip-btn {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .conn-pill {
    display: none;
  }

  .stage {
    padding: 10px;
  }

  .video-grid {
    gap: 8px;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .tile[data-source="screen_share"],
  .tile[data-source="screen"] {
    height: var(--screen-height, 40vh);
  }

  .controls {
    gap: 10px;
    padding: 8px 10px 12px;
    flex-wrap: wrap;
  }

  .ctrl {
    width: 46px;
    height: 46px;
  }

  .hangup {
    width: 52px;
    height: 52px;
  }

  .toast {
    bottom: 92px;
  }
}

@media (max-width: 400px) {
  .controls-group {
    gap: 2px;
    padding: 5px;
  }

  .ctrl {
    width: 43px;
    height: 43px;
  }

  .lobby-top .badge-soft {
    display: none;
  }

  .lobby-top .download-badge {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Notifications */
.bell-btn {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  font-size: 15px;
  line-height: 1;
}

.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.notif-panel {
  position: fixed;
  top: 58px;
  right: 18px;
  z-index: 250;
  width: min(360px, calc(100vw - 24px));
  max-height: min(460px, 70vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0b1120;
  box-shadow: var(--shadow);
}

.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.notif-head-actions {
  display: flex;
  gap: 4px;
}

.notif-head-actions .ghost-btn {
  font-size: 10.5px;
  padding: 4px 6px;
}

.notif-list {
  overflow-y: auto;
  padding: 5px;
}

.notif-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
  color: var(--text);
}

.notif-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.notif-item.unread {
  background: rgba(124, 92, 255, 0.11);
}

.notif-item strong {
  font-size: 12px;
}

.notif-item span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: normal;
}

.notif-item time {
  color: var(--muted-2);
  font-size: 9.5px;
}

.notif-empty {
  padding: 18px 12px;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

/* Mise à jour obligatoire du client */
.update-block-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #050a14;
}

.update-block-card {
  width: min(480px, 100%);
  padding: 28px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: #0b1120;
  box-shadow: var(--shadow);
}

.update-block-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: #1f1300;
  background: #fbbf24;
}

.update-block-card h2 {
  margin: 0 0 10px;
  font-size: 23px;
}

.update-block-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.update-block-card .btn {
  margin-top: 10px;
  display: inline-flex;
}

.update-block-note {
  margin-top: 16px;
  font-size: 11.5px !important;
  color: var(--muted-2) !important;
}

@media (max-width: 640px) {
  .notif-panel {
    top: 54px;
    right: 8px;
  }

  .app-user-name {
    display: none;
  }
}

/* Pièces jointes et emojis dans le chat de réunion */
.chat-tool {
  width: 36px;
  height: 42px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}

.chat-tool:hover {
  color: #e8edf7;
  background: rgba(148, 163, 184, 0.1);
}

.chat-tool svg {
  width: 18px;
  height: 18px;
}

.chat-file-msg {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
}

.chat-file-msg img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  display: block;
}

.chat-file-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.14);
  color: #a5f3fc;
  font-size: 10px;
  font-weight: 700;
}

.chat-file-link {
  color: #a5f3fc;
  font-size: 12px;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.chat-file-meta {
  display: block;
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 2px;
}

.emoji-popover {
  position: fixed;
  z-index: 200;
  width: 310px;
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0b1120;
  box-shadow: var(--shadow);
}

.emoji-item {
  height: 32px;
  border-radius: 7px;
  font-size: 19px;
  line-height: 1;
}

.emoji-item:hover {
  background: rgba(148, 163, 184, 0.12);
}

/* ------------------------ Périphériques média ---------------------------- */

.device-settings-btn {
  width: 100%;
  margin-top: 12px;
}

.insecure-warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.09);
  color: #fde68a;
  font-size: 11.5px;
  line-height: 1.5;
}

.insecure-warning a {
  color: #fef3c7;
  font-weight: 700;
}

.device-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(5px);
}

.device-card {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #0b1120;
  box-shadow: var(--shadow);
}

.device-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.device-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.device-head .card-sub {
  margin: 0;
}

.device-select {
  height: 42px;
  font-size: 13px;
}

.device-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 0 16px;
  flex-wrap: wrap;
}

.mic-meter {
  flex: 1;
  min-width: 100px;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
}

.mic-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34d399, #fbbf24 70%, #ef4444);
  transition: width 0.08s linear;
}

.camera-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #050a14;
  display: grid;
  place-items: center;
  margin-top: 7px;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.camera-preview.has-video video {
  display: block;
}

.camera-preview.has-video #cameraPlaceholder {
  display: none;
}

.camera-preview span {
  color: var(--muted);
  font-size: 12px;
  padding: 0 18px;
  text-align: center;
}

.device-notice {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.device-notice.show {
  display: block;
}

.device-notice.error {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
}

.device-error {
  margin-top: 12px;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.device-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Prise en main à distance */
.remote-control-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 240;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(30, 22, 10, 0.96);
  color: #fde68a;
  font-size: 12px;
  box-shadow: var(--shadow);
}

.remote-control-banner strong {
  color: #fff;
}

.tile-control-btn {
  position: absolute;
  left: 10px;
  bottom: 44px;
  z-index: 5;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(8, 20, 35, 0.88);
  color: #a5f3fc;
  font-size: 10.5px;
  font-weight: 700;
}

.tile-control-btn:hover {
  background: rgba(34, 211, 238, 0.18);
}

.remote-control-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  cursor: crosshair;
  background: rgba(34, 211, 238, 0.03);
  touch-action: none;
}

.remote-control-active {
  outline: 2px solid rgba(34, 211, 238, 0.65);
  outline-offset: -2px;
}
