/* Janja Can't Watch — tema escuro grafite com destaque vinho */
:root {
  --bg-0: #121417;
  --bg-1: #181b1f;
  --bg-2: #1e2226;
  --bg-3: #262b30;
  --bg-4: #2f353b;
  --line: #2d3238;
  --text: #e7eaed;
  --text-2: #a9b0b8;
  --text-3: #79818a;
  --accent: #8b1e3f;          /* vinho: botões, seleção, destaques de fundo */
  --accent-strong: #6f1631;
  --accent-bright: #c4426a;   /* vinho claro: foco, bordas e texto sobre fundo escuro */
  --accent-text: #e06286;
  --accent-soft: rgba(139, 30, 63, .26);
  --amber: #f0b429;
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .15);
  --online: #30c06b;
  --idle: #f0b429;
  --offline: #6b737c;
  --mention-bg: rgba(240, 180, 41, .09);
  --mention-line: #f0b429;
  --radius: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --titlebar-h: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.has-titlebar { --titlebar-h: 30px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: #5cc8ff; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.icon { display: inline-flex; flex: none; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- barra de título (desktop) ---------- */
.titlebar {
  position: fixed; inset: 0 0 auto 0; height: var(--titlebar-h);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-0); z-index: 50; -webkit-app-region: drag; user-select: none;
}
.tb-drag { display: flex; align-items: center; gap: 8px; padding-left: 12px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.tb-logo { display: inline-flex; }
.tb-logo .brand-mark { width: 18px; height: 18px; border-radius: 4px; }
.tb-logo svg { width: 16px; height: 16px; }
.tb-buttons { display: flex; height: 100%; -webkit-app-region: no-drag; }
.tb-buttons button { width: 46px; height: 100%; display: grid; place-items: center; color: var(--text-2); }
.tb-buttons button:hover { background: var(--bg-3); color: var(--text); }
.tb-buttons .tb-close:hover { background: var(--danger); color: #fff; }

/* ---------- autenticação ---------- */
.auth-screen {
  position: fixed; inset: var(--titlebar-h) 0 0 0; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(139, 30, 63, .38), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(240, 180, 41, .12), transparent 60%),
    var(--bg-0);
  overflow: auto;
}
.auth-card {
  width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.auth-brand .brand-full { width: 150px; height: 150px; object-fit: contain; }
.auth-name { font-size: 20px; font-weight: 800; color: var(--accent-text); letter-spacing: .01em; }
.auth-brand svg { width: 52px; height: 52px; }
.auth-card h1 { margin: 0; font-size: 22px; text-align: center; }
.auth-sub { margin: -8px 0 4px; text-align: center; color: var(--text-2); }
.auth-invite { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.auth-error { margin: 0; min-height: 1.2em; color: #ff8a8d; font-size: 14px; }
.auth-switch { margin: 0; text-align: center; color: var(--text-2); font-size: 14px; }

/* ---------- formulários e botões ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.input {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent-bright); }
select.input { appearance: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  background: var(--bg-4); font-weight: 600; transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #3a4148; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93a3f; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-3); }
.btn-block { width: 100%; }
.link-btn { color: #5cc8ff; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--bg-4); color: var(--text); }
.icon-btn.small { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.on { color: var(--text); }
.icon-btn.off { color: var(--danger); }
.icon-btn.danger:hover { color: #fff; background: var(--danger); }

/* ---------- layout ---------- */
.app {
  position: fixed; inset: var(--titlebar-h) 0 0 0;
  display: grid; grid-template-columns: 72px 248px minmax(0, 1fr);
}

/* trilho de servidores */
.rail { background: var(--bg-0); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; width: 100%; display: flex; justify-content: center; }
.rail-pill {
  position: absolute; left: 0; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text);
  transform: translateY(-50%); transition: height .15s;
}
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 40px; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center;
  font-weight: 700; font-size: 15px; transition: border-radius .18s, background .18s, color .18s; color: var(--text);
}
.rail-btn:hover, .rail-item.active .rail-btn { border-radius: 16px; background: var(--accent); color: #fff; }
.rail-home { overflow: hidden; padding: 0; background: var(--accent); }
.rail-mark { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-home:hover, .rail-item.active .rail-home { color: #fff; }
.rail-logo { display: inline-flex; }
.rail-action { color: var(--accent-bright); background: var(--bg-2); }
.rail-action:hover { background: var(--accent); color: #fff; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--bg-3); flex: none; }
.rail-item .badge { position: absolute; right: 10px; bottom: -2px; border: 3px solid var(--bg-0); }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; flex: none;
}

/* barra lateral */
.sidebar { background: var(--bg-1); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--bg-0); }
.sidebar-header {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--bg-0); box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.sidebar-title { font-weight: 700; font-size: 15.5px; min-width: 0; }
.sidebar-title-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; height: 100%; text-align: left; }
.sidebar-title-btn:hover { color: #fff; }
.sidebar-list { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 4px 4px 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3);
}
.section-head:first-child { padding-top: 6px; }
.empty-hint { color: var(--text-3); font-size: 13.5px; padding: 8px; }
.channel-row { position: relative; display: flex; align-items: center; border-radius: 6px; margin: 1px 0; }
.channel-row:hover { background: var(--bg-3); }
.channel-row.active { background: var(--bg-4); }
.channel {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  color: var(--text-3); text-align: left;
}
.channel-row:hover .channel, .channel:hover { color: var(--text-2); }
.channel-row.active .channel, .channel.active { color: var(--text); }
.channel-row.unread .channel, .channel.unread { color: var(--text); font-weight: 600; }
.channel-row.unread::before, .channel.dm.unread::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); transform: translateY(-50%);
}
.channel.dm { position: relative; width: 100%; padding: 6px 8px; margin: 1px 0; }
.channel.dm:hover { background: var(--bg-3); }
.channel.dm.active { background: var(--bg-4); }
.channel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-tools { display: none; gap: 2px; padding-right: 4px; }
.channel-row:hover .channel-tools, .channel-row:focus-within .channel-tools { display: flex; }
.channel-row.voice.connected .channel { color: var(--online); }
.voice-people { padding: 2px 0 6px 30px; display: flex; flex-direction: column; gap: 2px; }
.voice-person { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; color: var(--text-2); font-size: 14px; }
.voice-person .icon { color: var(--danger); margin-left: auto; }
.speak-ring { border-radius: 50%; padding: 2px; box-shadow: 0 0 0 2px transparent; transition: box-shadow .1s; flex: none; }
.speak-ring.speaking { box-shadow: 0 0 0 2px var(--online); }

.avatar {
  border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; user-select: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}
.avatar-wrap { position: relative; flex: none; }
.status-dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--bg-1); box-sizing: content-box; transform: translate(0, 0);
}
.status-online { background: var(--online); }
.status-idle { background: var(--idle); }
.status-offline { background: var(--offline); }

.voice-panel {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 10px 14px;
  border-top: 1px solid var(--bg-0); background: var(--bg-2);
}
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.voice-actions { display: flex; gap: 6px; }
.voice-actions .btn { flex: 1; }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.live-pill {
  margin-left: auto; padding: 1px 6px; border-radius: 4px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; flex: none;
}
.live-pill:hover { filter: brightness(1.15); }
.live-pill + .icon { margin-left: 4px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; flex: none; }

/* palco de transmissões */
.stage { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; background: #0c0d0f; }
.stage-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; }
.stage-grid { flex: 1; min-height: 0; display: grid; gap: 10px; padding: 6px 12px 12px; grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }
.stage-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.stage-grid[data-count="3"], .stage-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.stage-tile { position: relative; min-height: 0; border-radius: 10px; overflow: hidden; background: #000; display: grid; place-items: center; }
.stage-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-tile:fullscreen { border-radius: 0; }
.stage-label {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 3px 8px;
  border-radius: 6px; background: rgba(0, 0, 0, .65); font-size: 13px; font-weight: 600;
}
.stage-full { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
.stage-tile:hover .stage-full, .stage-full:focus-visible { opacity: 1; }
.stage-empty { margin: auto; max-width: 360px; text-align: center; color: var(--text-3); padding: 24px; }

/* seletor de tela */
.picker-tabs { display: flex; gap: 6px; }
.picker-tab { padding: 6px 14px; border-radius: 8px; color: var(--text-2); font-weight: 600; }
.picker-tab.active, .picker-tab:hover { background: var(--bg-4); color: var(--text); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 52vh; overflow-y: auto; }
.picker-item { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: var(--bg-1); border: 2px solid transparent; text-align: left; font-size: 13px; }
.picker-item:hover, .picker-item:focus-visible { border-color: var(--accent-bright); }
.picker-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 6px; }
.voice-info { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.voice-ok { color: var(--online); font-size: 13.5px; }
.user-panel { display: flex; align-items: center; gap: 2px; padding: 8px; background: var(--bg-0); flex: none; }
.user-panel .status-dot { border-color: var(--bg-0); }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 3px; border-radius: 8px; text-align: left; }
.user-chip:hover { background: var(--bg-3); }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; font-size: 13.5px; }
.user-meta .muted { font-size: 12px; }

/* área de chat */
.chat { position: relative; background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conn-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; text-align: center; padding: 4px; font-size: 13px; font-weight: 600;
  background: var(--amber); color: #2b2100;
}
.chat-header {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--bg-0); box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.chat-header .status-dot { border-color: var(--bg-2); width: 9px; height: 9px; }
.chat-title { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.chat-title > .icon { color: var(--text-3); }
.chat-sub { color: var(--text-3); font-weight: 400; font-size: 14px; }
.chat-tools { display: flex; gap: 4px; }
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-main { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-main.dropping::after {
  content: "Solte a imagem para enviar"; position: absolute; inset: 12px; border: 2px dashed var(--accent-bright); border-radius: 12px;
  display: grid; place-items: center; background: rgba(18, 20, 23, .82); font-weight: 700; font-size: 18px; z-index: 4;
}
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; overflow-anchor: none; }
.messages-loading, .messages-more { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: var(--text-3); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg-4); border-top-color: var(--accent-bright);
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.welcome { max-width: 520px; margin: 10vh auto 0; text-align: center; padding: 0 16px; color: var(--text-2); }
.welcome-logo .brand-full { width: 200px; height: 200px; object-fit: contain; }
.welcome-logo svg { width: 72px; height: 72px; }
.welcome h2 { color: var(--text); margin: 12px 0 6px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }
.channel-intro { padding: 16px 16px 8px; color: var(--text-2); }
.channel-intro h2 { color: var(--text); margin: 10px 0 4px; font-size: 26px; }
.channel-intro p { margin: 0; }
.intro-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--bg-4); display: grid; place-items: center; color: var(--text); }
.day-divider { display: flex; align-items: center; gap: 8px; margin: 18px 16px 6px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* mensagens */
.msg { position: relative; display: flex; gap: 14px; padding: 4px 48px 4px 16px; margin-top: 12px; }
.msg.grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: rgba(0, 0, 0, .12); }
.msg.mentioned { background: var(--mention-bg); box-shadow: inset 2px 0 0 var(--mention-line); }
.msg-avatar { flex: none; align-self: flex-start; margin-top: 2px; border-radius: 50%; }
.msg-hover-time {
  width: 40px; flex: none; text-align: right; font-size: 11px; color: var(--text-3); padding-top: 4px; visibility: hidden;
}
.msg:hover .msg-hover-time { visibility: visible; }
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; }
.msg-author:hover { text-decoration: underline; }
.msg-time { font-size: 12px; color: var(--text-3); }
.msg-content { color: #dfe3e7; overflow-wrap: anywhere; white-space: normal; }
.msg-content.jumbo { font-size: 40px; line-height: 1.2; }
.edited { font-size: 11px; color: var(--text-3); }
.msg-image { display: inline-block; margin-top: 6px; border-radius: 8px; overflow: hidden; max-width: min(420px, 100%); background: var(--bg-1); }
.msg-image img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px; background: var(--bg-3);
  border: 1px solid transparent; font-size: 14px;
}
.reaction:hover { border-color: var(--bg-4); }
.reaction.me { background: var(--accent-soft); border-color: var(--accent-bright); }
.reaction-count { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.msg-actions {
  position: absolute; top: -14px; right: 16px; display: none; gap: 2px; padding: 2px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 30px; height: 28px; }
.msg-edit textarea { resize: none; margin-top: 4px; background: var(--bg-3); }
.msg-edit-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.md-code { background: var(--bg-0); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; font-size: 13.5px; }
.md-code, .md-inline { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.md-inline { background: var(--bg-0); padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.md-quote { display: inline-block; border-left: 3px solid var(--text-3); padding-left: 10px; color: var(--text-2); }
.md-spoiler { background: #0b0c0e; color: transparent; border-radius: 4px; padding: 0 2px; cursor: pointer; transition: color .1s; }
.md-spoiler.revealed { color: inherit; background: var(--bg-4); cursor: text; }
.mention { background: var(--accent-soft); color: var(--accent-text); padding: 0 3px; border-radius: 4px; font-weight: 600; cursor: pointer; }
.mention:hover { background: var(--accent); color: #fff; }
.mention-me { background: rgba(240, 180, 41, .2); color: #ffd37a; }

/* composer */
.composer-wrap { position: relative; padding: 0 16px; flex: none; }
.composer { background: var(--bg-3); border-radius: var(--radius); }
.composer-row { display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px; }
.composer-row .icon-btn { margin-bottom: 2px; }
#composer-input {
  flex: 1; resize: none; border: 0; outline: none; background: transparent; padding: 9px 4px; max-height: 240px; line-height: 1.4;
}
#composer-input::placeholder { color: var(--text-3); }
.attachment-chip {
  display: flex; align-items: center; gap: 10px; margin: 10px 10px 0; padding: 8px; border-radius: 8px; background: var(--bg-2);
  max-width: 340px; font-size: 13.5px;
}
.attachment-chip img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.typing { height: 24px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); padding-left: 4px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.autocomplete {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% + 4px); background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); z-index: 6;
}
.ac-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 4px 8px; }
.ac-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; text-align: left; }
.ac-item.active, .ac-item:hover { background: var(--bg-4); }
.ac-user { color: var(--text-3); margin-left: auto; font-size: 13px; }

/* membros */
.members { width: 240px; flex: none; background: var(--bg-1); overflow-y: auto; padding: 8px; }
.members-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 16px 8px 4px; }
.member { width: 100%; display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; text-align: left; }
.member:hover { background: var(--bg-3); }
.member.offline { opacity: .45; }
.member.offline:hover { opacity: 1; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.crown { color: var(--amber); font-size: 13px; }

/* cartão de perfil */
.profile-card { width: 280px; overflow: hidden; }
.profile-banner { height: 60px; opacity: .85; }
.profile-avatar { margin: -36px 0 0 16px; }
.profile-avatar .avatar { border: 5px solid var(--bg-1); box-sizing: content-box; }
.profile-avatar .status-dot { border-color: var(--bg-1); right: 2px; bottom: 2px; width: 14px; height: 14px; }
.profile-info { padding: 8px 16px 12px; }
.profile-info strong { font-size: 18px; }
.profile-status { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.profile-tag { margin-top: 6px; font-size: 13px; color: var(--amber); }
.profile-actions { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }

/* modais, popovers, toasts */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .62); display: grid; place-items: center; padding: 16px; z-index: 100;
  animation: fade .12s ease-out;
}
.modal {
  width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--bg-2);
  border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); animation: pop .14s ease-out;
}
.modal-wide { width: min(900px, 100%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 6px 22px; }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 8px 22px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; background: var(--bg-1); border-radius: 0 0 14px 14px; }
.modal-text { margin: 0; color: var(--text-2); }
.copy-row { display: flex; gap: 8px; }
.lightbox { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.settings-section { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-section h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.settings-section p { margin: 0; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent-bright); }

.popover {
  position: fixed; z-index: 120; background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); animation: pop .1s ease-out;
}
.menu { display: flex; flex-direction: column; padding: 6px; min-width: 220px; }
.menu-item { text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); }
.menu-item:hover { background: var(--accent); color: #fff; }
.menu-item.danger { color: #ff8a8d; }
.menu-item.danger:hover { background: var(--danger); color: #fff; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 40px); gap: 2px; padding: 8px; }
.emoji-btn { width: 40px; height: 40px; border-radius: 8px; font-size: 22px; }
.emoji-btn:hover { background: var(--bg-4); }

.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast {
  background: var(--bg-4); color: var(--text); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px;
  max-width: min(480px, calc(100vw - 32px)); animation: pop .15s ease-out; transition: opacity .3s, transform .3s;
}
.toast-error { background: #4a1f22; border: 1px solid var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(6px); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }

/* barras de rolagem */
.sidebar-list, .messages, .members, .modal-body { scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* telas estreitas */
@media (max-width: 1100px) { .members { display: none; } }
@media (max-width: 720px) {
  .app { grid-template-columns: 64px 200px minmax(0, 1fr); }
  .rail-btn { width: 44px; height: 44px; }
  .msg { padding-right: 16px; }
}
