/* Spectate — folha de estilo
   Paleta grafite com um único sinal de cor: o "tally" vermelho de transmissão ao vivo.
   Tipografia: IBM Plex Sans (interface) + IBM Plex Mono (leituras: nome de sala, fps, tamanhos). */

:root {
  --bg: #121316;
  --surface: #191b1f;
  --surface-2: #202329;
  --surface-3: #282c33;
  --line: #2a2e35;
  --line-strong: #3b4049;
  --text: #e9eaed;
  --text-2: #b6bac3;
  --muted: #7f848e;
  --tally: #e5484d;
  --tally-soft: rgba(229, 72, 77, .14);
  --online: #3dd68c;
  --amber: #e9b44c;
  --focus: #8ab4ff;
  --danger: #e5484d;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --topbar-h: 52px;
  --panel-w: 320px;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--focus); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-variant-ligatures: none; }
.muted { color: var(--muted); }
.help { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: rgba(138, 180, 255, .3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- marca ---------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  color: var(--text);
}
.wordmark.small { font-size: 15px; gap: 8px; }
.tally {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--tally);
  box-shadow: 0 0 0 3px var(--tally-soft);
}
.wordmark.small .tally { width: 8px; height: 8px; }
.room .wordmark .tally, .live .tally { animation: tally 2.4s ease-in-out infinite; }
@keyframes tally {
  0%, 100% { box-shadow: 0 0 0 3px var(--tally-soft); }
  50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, .05); }
}

/* ---------- controles ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .06s ease;
  user-select: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: #f2f3f5; border-color: #f2f3f5; color: #131417; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--tally); border-color: var(--tally); color: #fff; }
.btn.danger:hover { background: #d63f44; }
.btn.live { background: var(--tally-soft); border-color: rgba(229, 72, 77, .5); color: #ff8a8e; }
.btn.live:hover { background: rgba(229, 72, 77, .22); }
.btn.icon { width: 36px; padding: 0; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn.small.icon { width: 30px; }
.btn.block { width: 100%; height: 40px; }
.btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--online); color: var(--online); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  height: 36px;
  padding: 0 12px;
  min-width: 0;
  transition: border-color .12s ease, background .12s ease;
}
input::placeholder { color: var(--muted); }
input:hover, select:hover { border-color: #4a505a; }
input:focus, select:focus { outline: none; border-color: var(--focus); background: var(--surface-2); }
select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f848e' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  cursor: pointer;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
}
.tag.amber { color: var(--amber); border-color: rgba(233, 180, 76, .4); background: rgba(233, 180, 76, .1); }
.tag.p2p { color: var(--text-2); }
.tag.sfu { color: var(--amber); border-color: rgba(233, 180, 76, .4); background: rgba(233, 180, 76, .1); }

.form-error { color: #ff8a8e; font-size: 13px; min-height: 18px; }
.form-error:empty { display: none; }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .02em;
}
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.conn[data-state="on"] i { background: var(--online); }
.conn[data-state="on"] { color: var(--text-2); }
.conn[data-state="warn"] i { background: var(--amber); }
.conn[data-state="bad"] i { background: var(--tally); }
.conn[data-state="bad"] { color: #ff8a8e; }

.count { font-size: 12px; color: var(--muted); }
.pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
  justify-content: center;
}
.pill.hot { background: var(--tally); color: #fff; }

/* ---------- autenticação ---------- */

.auth {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(229, 72, 77, .06), transparent 70%),
    var(--bg);
}
.auth-panel {
  width: min(380px, 100%);
  display: grid;
  gap: 20px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.auth-lead { color: var(--text-2); font-size: 14px; line-height: 1.5; margin-top: -8px; }
.auth-foot { display: grid; gap: 6px; justify-items: center; color: var(--muted); font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; padding-bottom: 8px; }
.dl-links a { color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.dl-links a:hover { color: var(--text); border-color: var(--text); }
.dl-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dl-buttons .btn { text-decoration: none; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.seg {
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.seg.active { background: var(--surface-3); color: var(--text); }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
.field input { height: 38px; }

.invite-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--tally-soft);
  border: 1px solid rgba(229, 72, 77, .3);
  font-size: 13.5px;
}
.invite-banner svg { color: #ff8a8e; margin-top: 2px; }
.invite-banner div { display: grid; gap: 2px; }
.invite-banner b { font-weight: 600; }
.invite-banner span { color: var(--text-2); }

.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; font-size: 12.5px; color: var(--text-2); }
.linkbox .btn { flex: none; height: 36px; }
.linkbox .btn.done { border-color: var(--online); color: var(--online); }
.block-tools { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- aplicação: topbar ---------- */

.app { height: 100%; display: grid; grid-template-rows: var(--topbar-h) 1fr; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.me-name { font-weight: 500; }

/* ---------- lobby ---------- */

.lobby {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  padding: 24px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
  align-content: start;
}
.lobby-main, .lobby-side { display: grid; gap: 24px; align-content: start; min-width: 0; }

.block { display: grid; gap: 12px; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.block-head h2 { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.block-head .btn { align-self: center; }

.rooms { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.room-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: border-color .12s ease;
}
.room-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 2px;
  background: var(--tally);
}
.room-card:hover { border-color: var(--line-strong); }
.room-card .rc-top { display: flex; align-items: center; gap: 8px; }
.room-card .rc-name { font-family: var(--mono); font-size: 15px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.room-card .rc-meta { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.room-card .rc-meta b { color: var(--text-2); font-weight: 500; }
.room-card .rc-actions { display: flex; justify-content: flex-end; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.empty b { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 2px; }
.rooms .empty { grid-column: 1 / -1; }

.create { display: grid; gap: 12px; }
.create-row { display: flex; gap: 8px; }
.create-row input { flex: 1; height: 38px; font-size: 15px; }
.create-row .btn { height: 38px; }
.mode-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s ease;
}
.mode:hover { border-color: var(--line-strong); }
.mode input { position: absolute; opacity: 0; width: 0; height: 0; }
.mode svg { color: var(--muted); margin-top: 2px; }
.mode span { display: grid; gap: 2px; }
.mode b { font-weight: 500; }
.mode small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.mode:has(input:checked) { border-color: var(--text); }
.mode:has(input:checked) svg { color: var(--text); }
.mode:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

.list { display: grid; gap: 6px; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px 6px 12px;
  border-radius: var(--r-md);
  transition: background .12s ease;
}
.row:hover { background: var(--surface); }
.row .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub.mono { font-size: 11.5px; }
.row .actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s ease; }
.row:hover .actions, .row:focus-within .actions, .row.request .actions { opacity: 1; }
.row.request { background: var(--surface); border: 1px solid var(--line); }
.row.pending { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--online); }
.dot.live { background: var(--tally); box-shadow: 0 0 0 3px var(--tally-soft); }
.list-sep { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 2px; }
.list .empty { padding: 20px 14px; }

/* ---------- mensagens privadas ---------- */
.row.clickable { cursor: pointer; }
.row .name .pill { margin-left: 8px; vertical-align: 1px; }
.dm {
  position: fixed;
  top: var(--topbar-h); right: 0; bottom: 0;
  width: min(420px, 100vw);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 45;
}
.dm-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dm-head .grow { flex: 1; min-width: 0; display: grid; }
.dm-head b { font-weight: 600; }
.dm-head .sub { color: var(--muted); font-size: 12px; }
.dm .chat-log { grid-template-rows: none; display: block; }
.dm-msgs { display: grid; gap: 10px; align-content: start; }
#dmMore { margin: 0 auto 10px; display: flex; }
.day-sep { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; padding: 6px 0 2px; }
.dm .chat-msg { justify-items: start; gap: 3px; }
.dm .chat-msg .text { display: inline-block; max-width: 92%; padding: 7px 11px; border-radius: 12px; background: var(--surface-2); white-space: pre-wrap; }
.dm .chat-msg.me { justify-items: end; }
.dm .chat-msg.cont { margin-top: -6px; }
.dm .chat-msg.cont .meta { display: none; }
.dm .chat-msg.me .text { background: #2a3142; }
.dm .chat-msg.me .meta { flex-direction: row-reverse; }
.dm .chat-file { max-width: 100%; }
.dm .chat-msg .read { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.dm .empty { margin: 20px 0; }
.dm .uploads { padding: 0 10px 8px; }

/* ---------- administração ---------- */
.admin-tabs { padding: 0; }
.admin-tabs .tab { height: 36px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  width: 30px; height: 18px; border-radius: 9px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  position: relative; transition: background .12s ease, border-color .12s ease;
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-2); transition: transform .12s ease, background .12s ease;
}
.switch input:checked + i { background: rgba(233, 180, 76, .25); border-color: var(--amber); }
.switch input:checked + i::after { transform: translateX(12px); background: var(--amber); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.row .actions .switch { opacity: 1; }
.row.admin .actions { opacity: 1; }

/* ---------- arquivos ---------- */

.quota { display: grid; gap: 6px; }
.quota-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.quota-bar i { display: block; height: 100%; width: 0; background: var(--text-2); border-radius: 2px; transition: width .3s ease; }
.quota-bar i.warn { background: var(--amber); }
.quota-bar i.full { background: var(--tally); }
.quota .mono { font-size: 11.5px; }

.file-row .ficon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  flex: none;
}
.file-row .ficon svg { width: 16px; height: 16px; }

.uploads { display: grid; gap: 6px; }
.uploads:empty { display: none; }
.upload-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.upload-item .uname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .ustat { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.upload-item .ubar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.upload-item .ubar i { display: block; height: 100%; width: 0; background: var(--text); transition: width .15s linear; }
.upload-item.err .ubar i { background: var(--tally); }
.upload-item.err .ustat { color: #ff8a8e; }
.upload-item .btn { grid-row: 1; grid-column: 2; }

.drop-hint {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 2px dashed var(--text-2);
  border-radius: var(--r-lg);
  background: rgba(18, 19, 22, .82);
  color: var(--text);
  font-weight: 500;
  z-index: 5;
  pointer-events: none;
}
.drop-hint svg { width: 28px; height: 28px; }
.dragging .drop-hint { display: grid !important; }

/* ---------- sala ---------- */

.room { grid-template-rows: var(--topbar-h) 1fr auto; }
.room-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.room-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: 6px;
  background: var(--tally-soft);
  border: 1px solid rgba(229, 72, 77, .35);
  color: #ff8a8e;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.live-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--tally); animation: tally 2.4s ease-in-out infinite; }

.room-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  min-height: 0;
  overflow: hidden;
}
.room-body.panel-hidden { grid-template-columns: minmax(0, 1fr) 0; }
.room-body.panel-hidden .panel { display: none; }

.stage { position: relative; min-height: 0; overflow-y: auto; background: #0b0c0e; }
.grid {
  display: grid;
  gap: 8px;
  padding: 8px;
  align-content: center;
  min-height: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}
.grid:has(.tile:only-child) { grid-template-columns: 1fr; }
.grid:has(.tile:only-child) .tile { max-height: calc(100vh - var(--topbar-h) - 80px); margin: 0 auto; width: 100%; }

.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}
.tile.has-video { border-color: #000; background: #000; }
.tile.has-video::before {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 2px;
  background: var(--tally);
  z-index: 2;
}
.tile.speaking { box-shadow: inset 0 0 0 2px var(--online); }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile .placeholder { display: grid; place-items: center; gap: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.tile .avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  text-transform: uppercase;
}
.tile .label {
  position: absolute;
  left: 10px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(8, 9, 10, .72);
  backdrop-filter: blur(6px);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 2;
}
.tile .label .mic-live { color: var(--online); display: none; }
.tile .label .mic-live svg { width: 13px; height: 13px; }
.tile.mic-on .label .mic-live { display: inline-flex; }
.tile .readout {
  position: absolute;
  right: 10px; bottom: 10px;
  height: 24px;
  padding: 0 8px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 6px;
  background: rgba(8, 9, 10, .72);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  z-index: 2;
}
.tile .readout:empty { display: none; }
.tile .readout .bad { color: #ff8a8e; }
.tile .tile-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 3;
}
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
.tile .tile-actions .btn { background: rgba(8, 9, 10, .72); border-color: transparent; backdrop-filter: blur(6px); }
.tile .tile-actions .btn:hover { background: rgba(40, 44, 51, .9); }
.tile .tile-actions .btn.muted { color: #ff8a8e; }

/* painel lateral */
.panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; }
.tab {
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center;
  transition: color .12s ease;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tabpanel { display: grid; grid-template-rows: 1fr auto auto; min-height: 0; }
.tabpanel[data-panel="people"], .tabpanel[data-panel="files"] { grid-template-rows: auto 1fr; padding: 10px; gap: 8px; overflow-y: auto; align-content: start; }
.panel-actions { display: flex; justify-content: flex-end; }

.chat-log { overflow-y: auto; padding: 12px; display: grid; gap: 10px; align-content: start; min-height: 0; }
.chat-msg { display: grid; gap: 2px; font-size: 13.5px; overflow-wrap: anywhere; }
.chat-msg .meta { display: flex; align-items: baseline; gap: 8px; }
.chat-msg .who { font-weight: 600; font-size: 13px; }
.chat-msg.me .who { color: var(--text-2); }
.chat-msg .when { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.chat-msg .text { color: var(--text); line-height: 1.45; }
.chat-msg.system .text { color: var(--muted); font-size: 12.5px; }
.chat-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.chat-file .grow { flex: 1; min-width: 0; display: grid; }
.chat-file .fname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-file .fsize { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chat-file .ficon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); color: var(--text-2); flex: none; }
.chat-file .ficon svg { width: 15px; height: 15px; }

.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.panel .uploads { padding: 0 10px; }
.panel .uploads:not(:empty) { padding-bottom: 8px; }

/* voz */
.row.speaking .dot.on, .row.speaking .dot.live { box-shadow: 0 0 0 3px rgba(61, 214, 140, .35); }
.row.speaking .name { color: var(--online); }
.btn.mic { position: relative; overflow: hidden; }
.btn.mic .level {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: 0;
  background: var(--online);
  transition: width .08s linear;
}
.btn.mic[aria-pressed="false"] .level { display: none; }
#micSel { max-width: 180px; }

/* barra de ferramentas */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.opt { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.opt select { height: 32px; font-size: 13px; padding: 0 26px 0 10px; }
.only-mobile { display: none; }

/* ---------- toasts e diálogos ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 60;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: #24272d;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--text);
  animation: toast-in .18s ease;
  pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; color: var(--text-2); }
.toast.error svg { color: #ff8a8e; }
.toast.ok svg { color: var(--online); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  padding: 22px;
  width: min(400px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog form { display: grid; gap: 10px; }
.dialog h3 { font-size: 15px; font-weight: 600; }
.dialog p { color: var(--text-2); font-size: 13.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- responsivo ---------- */

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; padding: 16px; gap: 20px; }
  .mode-choice { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .room-body { grid-template-columns: 1fr; }
  .panel {
    position: fixed;
    right: 0; top: var(--topbar-h); bottom: 0;
    width: min(360px, 100vw);
    z-index: 40;
    box-shadow: var(--shadow);
  }
  .room-body.panel-hidden .panel { display: none; }
  .only-mobile { display: inline-flex; }
  .btn span:not(.pill) { }
  .live-tag { display: none; }
  .toasts { bottom: 120px; }
}

@media (max-width: 520px) {
  .toolbar .btn span:not(.pill) { display: none; }
  .toolbar .btn { width: 40px; padding: 0; }
  .toolbar .opt { font-size: 0; gap: 0; }
  .opt select { font-size: 13px; }
  .topbar { padding: 0 10px; }
  .auth-panel { padding: 24px 20px; }
}
