/* Conversas — estilos (sem build). Claro e escuro pelo sistema. */
:root {
  --ink: #111B21;
  --ink-2: #54656F;
  --ink-3: #667781;
  --bg: #FFFFFF;
  --bg-2: #F0F2F5;
  --bg-hover: #F5F6F6;
  --bg-active: #F0F2F5;
  --line: #E9EDEF;
  --line-2: #D1D7DB;
  --brand: #00A884;
  --brand-ink: #FFFFFF;
  --brand-soft: #D9FDD3;
  --unread: #25D366;
  --thread: #EFEAE2;
  --thread-dot: rgba(17, 27, 33, .045);
  --bubble-in: #FFFFFF;
  --bubble-out: #D9FDD3;
  --quote-bg: rgba(11, 20, 26, .05);
  --warn: #B86E12;
  --warn-soft: #FDF1DE;
  --danger: #EA0038;
  --read: #53BDEB;
  --focus: #00A884;
  --rail: #F0F2F5;
  --rail-ink: #54656F;
  --rail-border: #D1D7DB;
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --font: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E9EDEF; --ink-2: #AEBAC1; --ink-3: #8696A0;
    --bg: #111B21; --bg-2: #202C33; --bg-hover: #202C33; --bg-active: #2A3942;
    --line: #222D34; --line-2: #313D45;
    --brand: #00A884; --brand-ink: #111B21; --brand-soft: #005C4B; --unread: #00A884;
    --thread: #0B141A; --thread-dot: rgba(255, 255, 255, .025);
    --bubble-in: #202C33; --bubble-out: #005C4B; --quote-bg: rgba(0, 0, 0, .18);
    --warn: #E5A54B; --warn-soft: #3A2A12; --danger: #F15C6D; --read: #53BDEB; --focus: #00A884;
    --rail: #202C33; --rail-ink: #AEBAC1; --rail-border: #313D45;
    --shadow: 0 1px .5px rgba(11, 20, 26, .13);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
svg { flex: none; }

/* ── Componentes ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.07); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg);
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.hint { margin: 0; font-size: 13px; color: var(--ink-3); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }
.form-error { margin: 0; color: var(--danger); font-size: 14px; }
.form-error:empty { display: none; }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; translate: -50% 0;
  max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); display: none;
}
.toast.show { display: block; }
dialog {
  width: min(94vw, 460px); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--bg); color: var(--ink); box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgb(8 16 18 / .5); }
.dialog-body { display: grid; gap: 16px; padding: 22px; }
.dialog-body h2 { margin: 0; font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.lightbox { width: auto; max-width: 96vw; background: transparent; border: 0; box-shadow: none; }
.lightbox img { display: block; max-width: 96vw; max-height: 92vh; border-radius: 8px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 16px;
  background: var(--av, #CFE3DA); color: #1A2A2E; user-select: none;
}
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.group { border-radius: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.dot.on { background: #34B37A; }

/* ── Caixa de conversas ──────────────────────────────────────── */
.app {
  display: grid; grid-template-columns: 68px minmax(300px, 380px) minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden;
}
.app > * { min-height: 0; min-width: 0; }   /* deixa cada painel rolar por dentro */

.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; overflow-y: auto; }
.rail .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); margin-bottom: 8px; }
.rail .logo svg { width: 22px; height: 22px; }
.rail-item {
  position: relative; width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; text-decoration: none; font-weight: 700; font-size: 14px;
  color: var(--rail-ink); background: color-mix(in srgb, var(--rail-ink) 12%, transparent); border: 0; cursor: pointer;
}
.rail-item:hover { background: color-mix(in srgb, var(--rail-ink) 20%, transparent); }
.rail-item[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.rail-item .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--rail); width: 13px; height: 13px; }
.rail-item svg { width: 20px; height: 20px; }
.rail .spacer { flex: 1; }
.rail form { margin: 0; }

.list { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); }
.list-head { padding: 14px 16px 8px; display: grid; gap: 10px; }
.list-title { display: flex; align-items: center; gap: 4px; }
.list-title .names { flex: 1; min-width: 0; }
.list-title h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.015em; }
.channel-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-line.off { color: var(--warn); }
.channel-line a { color: inherit; font-weight: 600; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 38px; min-height: 38px; background: var(--bg-2); border-color: transparent; border-radius: 10px; }
.filters { display: flex; gap: 6px; }
.chip { border: 0; border-radius: 999px; padding: 5px 12px; background: var(--bg-2); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--bg-hover); }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.notice { margin: 0 16px 8px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 13px; }

.chats { list-style: none; margin: 0; padding: 0 0 12px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.chat {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 0 0 16px;
  border: 0; background: transparent; text-align: left; cursor: pointer;
}
.chat:hover { background: var(--bg-hover); }
.chat[aria-current="true"] { background: var(--bg-active); }
.chat-body { flex: 1; min-width: 0; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.chat-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 12px; color: var(--ink-3); align-self: center; }
.chat-preview { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; min-width: 0; }
.chat-preview span { overflow: hidden; text-overflow: ellipsis; }
.chat-preview svg { width: 16px; height: 16px; color: var(--ink-3); }
.chat-preview svg.read { color: var(--read); }
.chat-flags { display: flex; align-items: center; gap: 6px; justify-self: end; }
.chat-flags .pin { width: 15px; height: 15px; color: var(--ink-3); }
.badge { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.chat.unread .chat-time { color: var(--brand); font-weight: 600; }
.chat.unread .chat-name { font-weight: 700; }
.chat.unread .chat-preview { color: var(--ink); }
mark { background: color-mix(in srgb, var(--warn) 28%, transparent); color: inherit; border-radius: 3px; }
.list-empty { padding: 36px 24px; text-align: center; color: var(--ink-3); font-size: 14px; }

.thread { position: relative; display: flex; flex-direction: column; background: var(--thread); }
.thread-head { display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 12px 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); flex: none; }
.thread-who { flex: 1; min-width: 0; line-height: 1.25; }
.thread-who strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-who span { font-size: 13px; color: var(--ink-3); }
.back { display: none; }

.messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  background-color: var(--thread);
  background-image: radial-gradient(var(--thread-dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
.messages-inner { max-width: 940px; margin: 0 auto; padding: 12px clamp(12px, 5%, 64px) 16px; display: flex; flex-direction: column; }
.day {
  align-self: center; margin: 12px 0 6px;
  padding: 4px 12px; border-radius: 8px; background: var(--bg); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow);
}
.unread-divider { align-self: stretch; margin: 10px -16px; padding: 6px; text-align: center; font-size: 13px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--bg) 70%, transparent); }
.older { align-self: center; margin: 6px 0 4px; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 620px); margin-top: 8px; }
.msg.same { margin-top: 2px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; }
.bubble {
  position: relative; padding: 6px 9px 7px; border-radius: 10px; background: var(--bubble-in);
  box-shadow: var(--shadow); overflow-wrap: anywhere; white-space: pre-wrap; font-size: 15px;
}
.msg.out .bubble { background: var(--bubble-out); }
/* rabinho na primeira bolha de cada sequência */
.msg:not(.same) .bubble::before {
  content: ""; position: absolute; top: 0; width: 9px; height: 12px; background: inherit;
}
.msg.in:not(.same) .bubble { border-top-left-radius: 0; }
.msg.in:not(.same) .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg.out:not(.same) .bubble { border-top-right-radius: 0; }
.msg.out:not(.same) .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.sender { margin: 0 0 1px; font-size: 13px; font-weight: 700; color: var(--sc, var(--brand)); }
.text { display: inline; }
.meta {
  float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 10px;
  font-size: 11px; color: var(--ink-3); white-space: nowrap; position: relative; top: 2px;
}
.meta svg { width: 16px; height: 16px; }
.meta svg.read { color: var(--read); }
.bubble.has-media .meta { float: none; display: flex; justify-content: flex-end; margin: 4px 0 -2px; top: 0; }
.media { display: block; border-radius: 8px; max-width: 100%; margin: -2px -4px 4px; }
img.media { width: 330px; max-height: 420px; object-fit: cover; cursor: zoom-in; background: color-mix(in srgb, var(--ink) 6%, transparent); min-height: 120px; }
img.media.sticker { width: 160px; min-height: 0; background: transparent; }
.bubble.sticker { background: transparent; box-shadow: none; padding: 0; }
.bubble.sticker::before { display: none; }
video.media { width: 330px; max-height: 420px; background: #000; }
audio.media { width: 290px; max-width: 100%; margin: 2px 0 2px; }
.doc { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 10px; margin: -1px -3px 4px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink) !important; text-decoration: none; }
.doc svg { width: 30px; height: 30px; color: var(--brand); }
.doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.note { font-style: italic; color: var(--ink-3); }
.reaction-only { font-size: 26px; line-height: 1; padding: 2px 4px; }
.msg.failed .bubble { background: var(--warn-soft); outline: 1px solid var(--warn); }
.msg.failed .meta { color: var(--warn); }
.retry { border: 0; background: none; padding: 0; color: var(--warn); font-weight: 700; font-size: 12px; text-decoration: underline; cursor: pointer; }
.msg.pending .meta { opacity: .75; }
.bubble a { color: var(--read); }
.bubble code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }

.to-bottom {
  position: absolute; right: 20px; bottom: 86px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--bg); color: var(--ink-2); box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: grid; place-items: center;
}
.to-bottom svg { width: 22px; height: 22px; }
.to-bottom .badge { position: absolute; top: -6px; right: -4px; }

.composer { flex: none; padding: 10px 16px 12px; background: var(--bg-2); border-top: 1px solid var(--line); }
.attachment { display: none; align-items: center; gap: 12px; margin: 0 auto 8px; max-width: 940px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.attachment.show { display: flex; }
.attachment img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.attachment .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-row { display: flex; align-items: flex-end; gap: 6px; max-width: 940px; margin: 0 auto; }
.compose-row textarea {
  flex: 1; min-height: 44px; max-height: 168px; resize: none; padding: 11px 14px;
  border-radius: 12px; border: 1px solid transparent; background: var(--bg); line-height: 1.4;
}
.compose-row textarea:focus { outline: none; border-color: var(--line-2); }
.send { width: 44px; height: 44px; background: var(--brand); color: var(--brand-ink); }
.send:hover { background: var(--brand); color: var(--brand-ink); filter: brightness(1.07); }
.send:disabled { opacity: .45; cursor: default; }

.empty-thread { flex: 1; display: grid; place-items: center; padding: 24px; text-align: center; }
.empty-thread .card { max-width: 380px; }
.empty-thread svg { width: 56px; height: 56px; color: var(--brand); margin-bottom: 8px; }
.empty-thread h2 { margin: 0 0 6px; font-size: 22px; }
.empty-thread p { margin: 0 0 18px; color: var(--ink-2); }

/* ── Topo das páginas (números) ──────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.topbar .brand span { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); }
.topbar .brand svg { width: 18px; height: 18px; }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.topbar nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.topbar form { margin: 0; }
.page-bg { min-height: 100vh; background: var(--bg-2); }
.page { max-width: 980px; margin: 0 auto; padding: 28px 20px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.page-head .grow { flex: 1; }
.flash { margin-bottom: 16px; padding: 11px 14px; border-radius: 12px; background: var(--brand-soft); font-size: 14px; }
.flash.warn { background: var(--warn-soft); }
.flash.err { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); }
.channels { display: grid; gap: 12px; }
.channel { display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.channel .avatar { width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); }
.channel .info { flex: 1; min-width: 0; }
.channel h2 { margin: 0 0 2px; font-size: 17px; }
.channel .status { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.channel .status .sep { color: var(--ink-3); }
.channel .status .off { color: var(--warn); font-weight: 600; }
.channel .status .on { color: var(--brand); font-weight: 600; }
.channel .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; min-width: 220px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.menu-list button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 14px; cursor: pointer; }
.menu-list button:hover { background: var(--bg-hover); }
.menu-list form { margin: 0; }
.menu-list .danger { color: var(--danger); }
.empty-page { padding: 56px 24px; text-align: center; background: var(--bg); border: 1px dashed var(--line-2); border-radius: 16px; }
.empty-page h2 { margin: 0 0 6px; font-size: 20px; }
.empty-page p { margin: 0 auto 18px; max-width: 46ch; color: var(--ink-2); }
.qr-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: center; }
.qr { width: 260px; height: 260px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; text-align: center; color: #4E5F66; font-size: 14px; }
.qr img, .qr canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; display: grid; gap: 6px; }
dialog.wide { width: min(94vw, 640px); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }

/* ── Login ───────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg-2); }
.login { width: min(100%, 390px); display: grid; gap: 16px; padding: 30px 26px; background: var(--bg); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.login .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.login .brand span { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); }
.login .brand svg { width: 20px; height: 20px; }
.login h1 { margin: 6px 0 0; font-size: 22px; letter-spacing: -.015em; }
.login .hint { margin-top: -10px; }
.login .btn-primary { width: 100%; min-height: 44px; font-size: 15px; }

/* ── Celular ─────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .thread { display: none; }
  .app.in-thread .list { display: none; }
  .app.in-thread .thread { display: flex; }
  .back { display: inline-grid; }
  .msg { max-width: 88%; }
  img.media, video.media { width: 100%; }
  .messages-inner { padding-left: 12px; padding-right: 12px; }
  .to-bottom { right: 14px; }
  .channel { flex-wrap: wrap; }
  .channel .actions { width: 100%; justify-content: flex-start; }
  .qr-wrap { grid-template-columns: 1fr; justify-items: center; }
  .topbar nav { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .msg.fresh { animation: arrive .16s ease-out; }
  @keyframes arrive { from { opacity: 0; transform: translateY(4px); } }
}
.list-head > *, .search, .filters { min-width: 0; }
.search .input { width: 100%; }
input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }
.media-missing { display: flex; align-items: center; gap: 8px; min-width: 200px; padding: 14px 12px; margin: -2px -4px 4px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink-3); font-size: 14px; font-style: italic; }
@media (max-width: 820px) {
  img.media, video.media { width: min(300px, 70vw); }
}
.channel-line .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Estilo WhatsApp Web (sobrepõe o que vem acima) ─────────── */
body { font-size: 14.2px; }
.app { grid-template-columns: 64px minmax(320px, 30%) minmax(0, 1fr); }
@media (min-width: 1300px) { .app { grid-template-columns: 64px minmax(380px, 30%) minmax(0, 1fr); } }

.rail { background: var(--rail); border-right: 1px solid var(--rail-border); padding: 10px 0; gap: 8px; }
.rail .logo { background: transparent; color: var(--ink-2); margin-bottom: 4px; }
.rail-item { width: 42px; height: 42px; border-radius: 50%; background: transparent; color: var(--rail-ink); font-size: 13px; }
.rail-item:hover { background: rgba(11, 20, 26, .08); }
@media (prefers-color-scheme: dark) { .rail-item:hover { background: rgba(255, 255, 255, .08); } }
.rail-item[aria-current="page"] { background: rgba(11, 20, 26, .1); color: var(--ink); }
@media (prefers-color-scheme: dark) { .rail-item[aria-current="page"] { background: rgba(255, 255, 255, .1); } }
.rail-item .dot { border-color: var(--rail); }
.rail-item.rail-chan { border: 2px solid transparent; }
.rail-item.rail-chan[aria-current="page"] { border-color: var(--brand); background: transparent; }

.list { border-right: 1px solid var(--line); }
.list-head { padding: 10px 16px 6px; gap: 8px; }
.list-title h1 { font-size: 22px; font-weight: 700; letter-spacing: 0; }
.search .input { border-radius: 8px; min-height: 35px; padding-top: 6px; padding-bottom: 6px; background: var(--bg-2); font-size: 14px; }
.chip { padding: 6px 12px; font-weight: 500; font-size: 14px; color: var(--ink-3); background: var(--bg-2); }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: #008069; }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #D9FDD3; } }
.chat { padding-left: 13px; height: 72px; }
.chat .avatar { width: 49px; height: 49px; }
.chat-body { padding: 0 15px 0 0; height: 100%; align-content: center; border-bottom-color: var(--line); }
.chat:hover .chat-body, .chat[aria-current="true"] .chat-body { border-bottom-color: transparent; }
.chat-name { font-weight: 400; font-size: 17px; color: var(--ink); }
.chat-time { font-size: 12px; color: var(--ink-3); }
.chat-preview { font-size: 14px; color: var(--ink-3); }
.chat.unread .chat-name { font-weight: 500; }
.chat.unread .chat-time { color: var(--unread); font-weight: 400; }
.chat.unread .chat-preview { color: var(--ink); }
.badge { background: var(--unread); color: #fff; min-width: 20px; height: 20px; font-size: 12px; font-weight: 500; }
@media (prefers-color-scheme: dark) { .badge { color: #111B21; } }

/* avatares com foto */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.default { background: #DFE5E7; color: #FFFFFF; }
@media (prefers-color-scheme: dark) { .avatar.default { background: #6A7175; color: #CFD4D6; } }
.avatar.default svg { width: 62%; height: 62%; }

.thread-head { height: 59px; padding: 0 16px; background: var(--bg-2); border-bottom: 0; }
.thread-who strong { font-weight: 400; font-size: 16px; }
.thread-who span { font-size: 13px; }

.messages { background-color: var(--thread); background-size: 18px 18px; }
.messages-inner { max-width: none; padding: 12px 6% 10px; }
@media (min-width: 1440px) { .messages-inner { padding-left: 8%; padding-right: 8%; } }
.day { padding: 5px 12px 6px; border-radius: 7.5px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); background: var(--bg); text-transform: uppercase; }
@media (prefers-color-scheme: dark) { .day { background: #182229; color: #8696A0; } }
.unread-divider { margin: 10px -6%; background: rgba(255,255,255,.25); color: var(--ink-3); font-weight: 400; }
.msg { max-width: 65%; margin-top: 12px; }
.msg.same { margin-top: 2px; }
.bubble { padding: 6px 7px 8px 9px; border-radius: 7.5px; font-size: 14.2px; line-height: 19px; box-shadow: var(--shadow); }
.msg.in:not(.same) .bubble::before, .msg.out:not(.same) .bubble::before { width: 8px; height: 13px; }
.meta { font-size: 11px; color: var(--ink-3); margin: 8px 0 -5px 12px; top: 3px; }
@media (prefers-color-scheme: dark) { .msg.out .meta { color: rgba(233, 237, 239, .6); } }
.meta svg { width: 16px; height: 15px; }
.sender { font-size: 12.8px; font-weight: 500; line-height: 22px; margin: -2px 0 0; }

/* foto sem legenda: horário por cima, como no WhatsApp */
.bubble.photo { padding: 3px; }
.bubble.photo .media { margin: 0; border-radius: 6px; }
.bubble.photo .meta { position: absolute; right: 9px; bottom: 7px; margin: 0; top: auto; float: none; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.bubble.photo .meta::before { content: ""; position: absolute; inset: -16px -10px -8px -40px; background: radial-gradient(ellipse at 100% 100%, rgba(11,20,26,.45), transparent 70%); z-index: -1; border-radius: 0 0 6px 0; }
.bubble.photo .meta svg.read { color: #fff; }
.bubble.has-media:not(.photo) .media { margin: -3px -4px 6px -6px; }
img.media { width: 330px; max-height: 338px; border-radius: 6px; }

/* resposta citada */
.quote { display: block; margin: -2px -4px 6px -6px; padding: 6px 10px 7px 11px; border-left: 4px solid var(--qc, #06CF9C); border-radius: 6px; background: var(--quote-bg); cursor: pointer; overflow: hidden; }
.quote strong { display: block; font-size: 12.8px; font-weight: 500; color: var(--qc, #06CF9C); line-height: 20px; }
.quote span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); font-size: 13.2px; line-height: 18px; white-space: pre-wrap; }
.msg.flash .bubble { animation: flashbg 1.2s ease-out; }
@keyframes flashbg { 0%, 40% { filter: brightness(.88); } 100% { filter: none; } }

/* reações embaixo da bolha */
.reactions { align-self: flex-start; display: inline-flex; gap: 2px; align-items: center; margin: -6px 0 0 8px; padding: 2px 6px; border-radius: 12px; background: var(--bg); box-shadow: 0 1px 3px rgba(11,20,26,.15); font-size: 14px; line-height: 18px; position: relative; z-index: 1; }
.msg.out .reactions { align-self: flex-end; margin: -6px 8px 0 0; }
.reactions .n { font-size: 12px; color: var(--ink-3); margin-left: 2px; }
@media (prefers-color-scheme: dark) { .reactions { background: #202C33; } }

.poll { white-space: pre-wrap; }

.composer { padding: 5px 16px; background: var(--bg-2); border-top: 0; }
.compose-row, .attachment { max-width: none; }
.compose-row { align-items: center; gap: 8px; }
.compose-row textarea { min-height: 42px; padding: 10px 12px; border-radius: 8px; border: 0; font-size: 15px; background: var(--bg); }
.compose-row .icon-btn { color: var(--ink-2); }
.send { background: transparent; color: var(--ink-2); }
.send:not(:disabled) { color: var(--ink-2); }
.send:hover { background: transparent; filter: none; color: var(--ink); }
.send:disabled { opacity: .5; }

.empty-thread { background: var(--bg-2); border-bottom: 6px solid var(--brand); }
.empty-thread h2 { font-weight: 300; font-size: 32px; color: var(--ink); }
.empty-thread svg { color: var(--ink-3); }

.to-bottom { width: 42px; height: 42px; bottom: 80px; right: 18px; }
.to-bottom .badge { background: var(--unread); }

/* visualizador de imagem em tela cheia, sempre centralizado */
.viewer { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: rgba(233, 237, 239, .96); }
@media (prefers-color-scheme: dark) { .viewer { background: rgba(11, 20, 26, .96); } }
.viewer[hidden] { display: none !important; }
.viewer-top { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; flex: none; }
.viewer-top .who { flex: 1; min-width: 0; line-height: 1.3; }
.viewer-top strong { display: block; font-weight: 400; font-size: 16px; color: var(--ink); }
.viewer-top span { font-size: 13px; color: var(--ink-3); }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px 24px 24px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.viewer-caption { flex: none; text-align: center; padding: 0 24px 22px; color: var(--ink); font-size: 15px; white-space: pre-wrap; }
.viewer-caption:empty { display: none; }

@media (max-width: 820px) {
  .messages-inner { padding-left: 10px; padding-right: 10px; }
  .unread-divider { margin-left: -10px; margin-right: -10px; }
  .msg { max-width: 85%; }
  .app { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-color-scheme: dark) { .unread-divider { background: rgba(17, 27, 33, .55); color: #8696A0; } }
.avatar.default.group { border-radius: 50%; }
.avatar.group { border-radius: 50%; }

/* ── gravação de áudio ───────────────────────────────────────── */
.composer.has-content .mic, .composer:not(.has-content) #sendBtn { display: none; }
.mic { width: 44px; height: 44px; color: var(--ink-2); }
.composer.recording .compose-row, .composer.recording .attachment { display: none; }
.record-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 52px; }
.record-row[hidden] { display: none; }
.record-row #recCancel { color: var(--ink-2); }
.record-row #recCancel:hover { color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s ease-in-out infinite; }
.composer.paused .rec-dot { animation: none; opacity: .35; }
.rec-time { min-width: 44px; color: var(--ink); font-size: 15px; }
.rec-wave { width: min(260px, 40vw); height: 32px; }
#recPause .i-resume, .composer.paused #recPause .i-pause { display: none; }
.composer.paused #recPause .i-resume { display: block; color: var(--danger); }
@keyframes rec-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.rec-wave { color: var(--ink-3); }

/* ── editar / apagar mensagem ────────────────────────────────── */
.bubble { position: relative; }
.msg-more {
  position: absolute; top: 2px; right: 2px; z-index: 1;
  display: grid; place-items: center; width: 26px; height: 22px; padding: 0;
  border: 0; border-radius: 0 6px 0 12px; cursor: pointer; color: var(--ink-3);
  background: linear-gradient(to right, transparent, var(--bubble-out) 35%);
  opacity: 0; transition: opacity .12s;
}
.msg-more svg { width: 18px; height: 18px; }
.msg:hover .msg-more, .msg-more:focus-visible, .msg-more[aria-expanded="true"] { opacity: 1; }
.bubble.photo .msg-more { color: #fff; background: linear-gradient(to bottom left, rgba(11, 20, 26, .45), transparent 70%); }
@media (hover: none) { .msg-more { opacity: .75; } }

.msg-menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 6px 0;
  background: var(--bg); border-radius: 10px; box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
}
.msg-menu[hidden] { display: none; }
.msg-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 18px;
  border: 0; background: none; color: var(--ink); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
}
.msg-menu button svg { flex: none; width: 18px; height: 18px; color: var(--ink-2); }
.msg-menu button > span { display: grid; }
.msg-menu button:hover:not(:disabled), .msg-menu button:focus-visible { background: var(--bg-hover); outline: none; }
.msg-menu button.danger { color: var(--danger); }
.msg-menu button.danger svg { color: var(--danger); }
.msg-menu button:disabled { cursor: default; color: var(--ink-3); }
.msg-menu button:disabled svg { color: var(--ink-3); }
.msg-menu .why { font-size: 12px; color: var(--ink-3); }
.msg-menu .why:empty { display: none; }

.editing {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  padding: 8px 8px 8px 12px; border-left: 4px solid var(--brand); border-radius: 8px;
  background: var(--bg);
}
.editing[hidden] { display: none; }
.editing-body { display: grid; flex: 1; min-width: 0; }
.editing-body strong { color: var(--brand); font-size: 13px; font-weight: 600; }
.editing-body span { overflow: hidden; color: var(--ink-2); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.composer.is-editing #attachBtn, .composer.is-editing .attachment { display: none; }
.msg.flash-edit .bubble { animation: edit-flash 1.2s ease-out; }
@keyframes edit-flash { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 45%, transparent); } }

.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(1.07); }
.btn-danger-solid:disabled { opacity: .6; }
.delete-preview {
  margin: 0; padding: 8px 12px; border-left: 4px solid var(--line-2); border-radius: 6px;
  background: var(--bg-2); color: var(--ink-2); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 120px; overflow: auto;
}
.delete-preview:empty { display: none; }

/* Data flutuante: só uma, aparece enquanto rola (como no WhatsApp Web) */
.float-day {
  position: absolute; left: 50%; z-index: 4; transform: translate(-50%, -4px);
  padding: 5px 12px 6px; border-radius: 7.5px; box-shadow: var(--shadow);
  background: var(--bg); color: var(--ink-3); font-size: 12.5px; text-transform: uppercase;
  pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s;
}
.float-day.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-color-scheme: dark) { .float-day { background: #182229; color: #8696A0; } }
@media (prefers-reduced-motion: reduce) { .float-day { transition: none; } }

/* ═══ Perfil, grupos, respostas, reações, avisos e organização ═══ */
[hidden] { display: none !important; }
.link { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.muted { color: var(--ink-3); }

/* Ícones da barra lateral: iniciais coloridas e foto por cima, como os contatos */
.rail-item.rail-chan, .rail-item.me { padding: 0; }
.rail-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--av, #DFE5E7); color: #3B4A54; font-size: 13.5px; font-weight: 600; letter-spacing: .02em; }
.rail-item.rail-chan { border-width: 2px; }
.rail-item .dot { right: -1px; bottom: -1px; width: 12px; height: 12px; }
.rail-item.me[aria-current="page"] { box-shadow: 0 0 0 2px var(--brand); background: transparent; }

/* Lista: opções da conversa, arquivadas, avisos */
.chat-li { position: relative; }
.chat-more {
  position: absolute; right: 10px; bottom: 12px; z-index: 1; display: grid; place-items: center;
  width: 26px; height: 22px; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--bg-hover); color: var(--ink-3); opacity: 0; transition: opacity .12s;
}
.chat-more svg { width: 18px; height: 18px; }
.chat-li:hover .chat-more, .chat-more:focus-visible, .chat-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .chat-more { display: none; } }
.archived-row {
  display: flex; align-items: center; gap: 22px; width: 100%; padding: 12px 20px 12px 28px;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 16px; cursor: pointer; text-align: left;
}
.archived-row:hover { background: var(--bg-hover); }
.archived-row svg { width: 20px; height: 20px; color: var(--brand); }
.archived-row .label { flex: 1; }
.archived-row .count { color: var(--brand); font-size: 13px; }
.archived-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 16px; }
.notify-banner { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 12px 12px 16px; background: #53BDEB; color: #fff; }
@media (prefers-color-scheme: dark) { .notify-banner { background: #134D6B; } }
.notify-banner .nb-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #53BDEB; flex: none; }
.notify-banner .nb-icon svg { width: 22px; height: 22px; }
.notify-banner .nb-text { display: grid; flex: 1; font-size: 14px; }
.notify-banner .link { color: #fff; text-decoration: underline; font-size: 13.5px; }
.notify-banner .icon-btn { color: #fff; }

/* Menu da mensagem: reações rápidas no topo */
.react-bar { display: flex; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.msg-menu .react { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; font-size: 21px; line-height: 1; }
.msg-menu .react[aria-pressed="true"] { background: var(--bg-2); box-shadow: inset 0 0 0 2px var(--brand); }
.msg.in .msg-more { background: linear-gradient(to right, transparent, var(--bubble-in) 35%); }
.composer.is-replying #attachBtn, .composer.is-replying .attachment { display: none; }
.composer.is-replying #editing { border-left-color: #06CF9C; }

/* Cabeçalho da conversa clicável */
.thread-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.thread-info .thread-who { display: block; }
.thread-info .thread-who > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Painel lateral do contato / grupo */
.side-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 6; width: min(420px, 100%);
  display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--line);
  box-shadow: -2px 0 8px rgba(11, 20, 26, .06);
}
.panel-head { display: flex; align-items: center; gap: 16px; height: 59px; padding: 0 16px; background: var(--bg); flex: none; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 400; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 1100px) {
  .app.with-panel .thread { padding-right: 420px; }
  .app.with-panel .side-panel { box-shadow: none; }
}
.pn-sec, .pn-hero { background: var(--bg); padding: 14px 24px 16px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(11, 20, 26, .05); }
.pn-hero { display: grid; justify-items: center; gap: 6px; padding: 28px 24px 22px; text-align: center; }
.pn-photo { position: relative; }
.avatar.xl { width: 200px; height: 200px; font-size: 56px; border-radius: 50%; }
.avatar.xl.default svg { width: 60%; height: 60%; }
.pn-photo-btn {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px;
  border: 0; border-radius: 50%; background: rgba(11, 20, 26, .55); color: #fff; font: inherit; font-size: 13px;
  text-transform: uppercase; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.pn-photo-btn svg { width: 26px; height: 26px; }
.pn-photo:hover .pn-photo-btn, .pn-photo-btn:focus-visible { opacity: 1; }
@media (hover: none) { .pn-photo-btn { opacity: .85; inset: auto 0 0 auto; width: 48px; height: 48px; font-size: 0; } }
.pn-name { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 22px; font-weight: 400; overflow-wrap: anywhere; }
.pn-sub { margin: 0; color: var(--ink-3); font-size: 15px; }
.pn-sec h4 { margin: 0 0 10px; font-size: 14px; font-weight: 400; color: var(--ink-3); }
.pn-row-head { display: flex; align-items: center; justify-content: space-between; }
.pn-row-head h4 { margin: 0; }
.pn-text { margin: 4px 0 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pn-meta { margin: 10px 0 0; color: var(--ink-3); font-size: 13px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.pn-search { position: relative; display: block; }
.pn-search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-3); }
.pn-search .input { padding-left: 40px; }
.pn-results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 300px; overflow-y: auto; }
.pn-results li.muted { padding: 10px 2px; font-size: 14px; }
.pn-results button { display: grid; gap: 2px; width: 100%; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pn-results button:hover { background: var(--bg-hover); }
.pn-results small { color: var(--ink-3); font-size: 12px; }
.pn-results span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pn-thumb { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border: 0; border-radius: 6px; background: var(--bg-2); cursor: pointer; }
.pn-thumb img, .pn-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pn-thumb.video svg { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.pn-docs { list-style: none; margin: 10px 0 0; padding: 0; }
.pn-docs a { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--ink); text-decoration: none; }
.pn-docs a:hover strong { text-decoration: underline; }
.pn-docs svg { width: 22px; height: 22px; color: var(--ink-3); flex: none; }
.pn-docs span { display: grid; min-width: 0; }
.pn-docs strong { font-weight: 400; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-docs small { color: var(--ink-3); font-size: 12px; }
.pn-setting { display: grid; gap: 6px; margin: 0 0 14px; font-size: 14px; }
.pn-setting select { max-width: 100%; }
.pn-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; cursor: pointer; }
.pn-switch span { display: grid; gap: 2px; }
.pn-switch small { color: var(--ink-3); font-size: 12.5px; }
.pn-switch input { width: 40px; height: 22px; accent-color: var(--brand); flex: none; }
.pn-action { display: flex; align-items: center; gap: 18px; width: 100%; padding: 12px 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.pn-action svg { width: 22px; height: 22px; color: var(--ink-2); flex: none; }
.pn-action:hover { color: var(--brand); }
.pn-action.danger, .pn-action.danger svg { color: var(--danger); }
.pn-sec > .pn-action:first-of-type:not(:only-child) + .pn-action { border-top: 0; }
.pn-invite { display: grid; gap: 8px; padding: 4px 0 12px 40px; }
.pn-invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pn-people { list-style: none; margin: 8px 0 0; padding: 0; }
.pn-people li { display: flex; align-items: center; gap: 8px; min-height: 60px; border-top: 1px solid var(--line); }
.pn-person { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.pn-pname { display: grid; flex: 1; min-width: 0; }
.pn-pname strong { font-weight: 400; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-pname small { color: var(--ink-3); font-size: 13px; }
.pn-badge { flex: none; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-size: 12px; }

/* Diálogos genéricos */
.field .counter { justify-self: end; color: var(--ink-3); font-size: 12px; }
.field .counter:empty { display: none; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.4; font-family: inherit; }
.new-group-link { display: inline-flex; align-items: center; gap: 10px; margin-top: -4px; font-size: 14.5px; }
.new-group-link svg { width: 20px; height: 20px; }

/* ── Página "Meu perfil" ───────────────────────────────────── */
.profile-page { max-width: 760px; }
.profile-card { display: grid; gap: 18px; padding: 24px; margin-bottom: 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.profile-card h2 { margin: 0; font-size: 17px; }
.profile-card .hint { margin-top: -10px; }
.profile-photo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-photo .avatar { width: 96px; height: 96px; font-size: 30px; border-radius: 50%; }
.profile-photo .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.profile-card form { display: grid; gap: 14px; }
.profile-card .actions-row { display: flex; justify-content: flex-end; gap: 8px; }
.number-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; padding: 18px 0; border-top: 1px solid var(--line); }
.number-card:first-of-type { border-top: 0; padding-top: 0; }
.number-card .avatar { width: 84px; height: 84px; font-size: 26px; border-radius: 50%; position: relative; overflow: hidden; }
.number-card .photo-col { display: grid; justify-items: center; gap: 6px; }
.number-card .fields { display: grid; gap: 12px; min-width: 0; }
.number-card .who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.number-card .who strong { font-size: 16px; }
.number-card .who span { color: var(--ink-3); font-size: 14px; }
.number-card .state { color: var(--ink-3); font-size: 14px; }
@media (max-width: 560px) { .number-card { grid-template-columns: 1fr; justify-items: start; } }
.channel .avatar.ch-av { background: var(--av); color: #3B4A54; border-radius: 50%; font-size: 17px; }
.who-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.who-link:hover { text-decoration: underline; }
.number-card.is-target { animation: target-glow 2.4s ease-out; border-radius: 10px; }
@keyframes target-glow { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 45%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }
.rail-item.rail-chan, .rail-item.me { width: 44px; height: 44px; border-radius: 50%; background: transparent; }
.rail-item.rail-chan:hover .rail-av, .rail-item.me:hover .rail-av { filter: brightness(.96); }
.link:disabled { color: var(--ink-3); cursor: default; text-decoration: none; }
.number-card[data-connected="0"] .field, .number-card[data-connected="0"] .actions-row, .number-card[data-connected="0"] .photo-col .link { display: none; }

/* ── Contatos ─────────────────────────────────────────────── */
.list { position: relative; }
.drawer { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--bg); }
.drawer-head { display: flex; align-items: flex-end; gap: 20px; height: 108px; padding: 0 20px 16px; background: var(--brand); color: #fff; flex: none; }
@media (prefers-color-scheme: dark) { .drawer-head { background: #202C33; } }
.drawer-head .icon-btn { color: #fff; }
.drawer-head h2 { margin: 0 0 6px; font-size: 19px; font-weight: 500; }
.drawer-search { margin: 10px 12px 6px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; }
.drawer-action { display: flex; align-items: center; gap: 16px; width: 100%; padding: 10px 16px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.drawer-action:hover { background: var(--bg-hover); }
.da-icon { display: grid; place-items: center; width: 49px; height: 49px; border-radius: 50%; background: var(--brand); color: #fff; flex: none; }
.da-icon svg { width: 24px; height: 24px; }
.drawer-label { margin: 18px 0 6px; padding: 0 24px; color: var(--brand); font-size: 15px; }
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts-letter { padding: 18px 24px 8px; color: var(--brand); font-size: 15px; }
.contact-li { position: relative; }
.contact { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 6px 48px 6px 16px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.contact:hover { background: var(--bg-hover); }
.contact .avatar { width: 46px; height: 46px; }
.contact-body { display: grid; flex: 1; min-width: 0; }
.contact-body strong { font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-body small { color: var(--ink-3); font-size: 13.5px; }
.contact-li .chat-more { bottom: auto; top: 50%; transform: translateY(-50%); }
.contact-li:hover .chat-more { opacity: 1; }

.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.picker { display: grid; gap: 8px; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chips:empty { display: none; }
.pk-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 16px; background: var(--bg-2); font-size: 13.5px; }
.pk-chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer; }
.pk-chip button:hover { background: var(--line-2); color: var(--ink); }
.pk-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pk-list .list-empty { padding: 16px; }
.pk-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; }
.pk-item:hover { background: var(--bg-hover); }
.pk-item input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.pk-other { display: flex; gap: 8px; }
.pk-other .input { flex: 1; min-width: 0; }
#groupDialog, #pickDialog { width: min(520px, calc(100vw - 32px)); }
.danger-text { color: var(--danger); margin-right: auto; }

/* ═══ Empresas, equipe, respostas rápidas, etiquetas e responsável ═══ */
.label-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--lc, var(--ink-3)); flex: none; }
.label-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 12px; background: color-mix(in srgb, var(--lc) 16%, var(--bg)); color: var(--ink); font-size: 13px; }
.label-pill .label-dot { background: var(--lc); }
.chat-labels { display: inline-flex; gap: 3px; margin-right: 2px; }
.chat-labels .label-dot { width: 9px; height: 9px; }
.mini-av { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: var(--av, #DFE5E7); color: #3B4A54; font-size: 11px; font-weight: 600; flex: none; vertical-align: middle; }
.mini-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini-av.xs { width: 20px; height: 20px; font-size: 9px; }
.mini-av.none { background: var(--bg-2); color: var(--ink-3); }
.chat-flags { display: inline-flex; align-items: center; gap: 4px; }

.filters { flex-wrap: wrap; }
.chip-label { display: inline-flex; align-items: center; gap: 6px; }
.chip-label svg { width: 14px; height: 14px; }

.assign-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; flex: none; }
.assign-btn:hover { background: var(--bg-hover); }
.assign-btn.empty { padding-left: 12px; color: var(--ink-2); border-style: dashed; }
.assign-btn .assign-text { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .assign-btn .assign-text { display: none; } .assign-btn { padding: 0 4px; } .assign-btn.empty::before { content: '+'; } }

.msg-menu .menu-title { margin: 2px 18px 6px; color: var(--ink-3); font-size: 12.5px; }
.msg-menu [aria-checked="true"] { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.msg-menu [aria-checked="true"] .label { font-weight: 600; }
.msg-menu .menu-check { display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer; font-size: 14.5px; }
.msg-menu .menu-check:hover { background: var(--bg-hover); }
.msg-menu .menu-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.msg-menu .menu-link { display: block; margin-top: 4px; padding: 10px 18px 6px; border-top: 1px solid var(--line); color: var(--brand); font-size: 14px; text-decoration: none; }
.msg-menu .mini-av { margin-right: -2px; }

.pn-work .pn-row-head + .pn-text { margin: 2px 0 12px; display: flex; align-items: center; gap: 8px; }
.pn-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Respostas rápidas na caixa de mensagem */
.composer { position: relative; }
.qr-popup { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 4px); z-index: 7; max-height: 320px; overflow-y: auto; padding: 6px 0; background: var(--bg); border-radius: 10px; box-shadow: 0 2px 10px rgba(11, 20, 26, .2); }
.qr-item { display: grid; gap: 2px; width: 100%; padding: 9px 16px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.qr-item strong { font-size: 14px; color: var(--brand); }
.qr-item span { font-size: 14px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qr-item[aria-selected="true"], .qr-item:hover { background: var(--bg-hover); }
.qr-empty { margin: 0; padding: 12px 16px; color: var(--ink-3); font-size: 14px; }

/* Troca de empresa */
.company-switch select { max-width: 220px; }
.company-switch.inline select { padding: 2px 4px; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.company-name { color: var(--ink-2); font-size: 14px; font-weight: 600; }

/* Telas de administração */
.crumb { margin: 0 0 2px; font-size: 14px; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.table-card { overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { padding: 12px 16px; text-align: left; color: var(--ink-3); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .6; }
.person { display: flex; align-items: center; gap: 12px; }
.person .avatar { position: relative; overflow: hidden; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg-2); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.role-badge.admin { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
div.row-actions { display: flex; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
td.row-actions { text-align: right; white-space: nowrap; }
td.row-actions > * { display: inline-block; vertical-align: middle; }
.row-actions form { margin: 0; }
.reply-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reply-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.reply-item .label-dot { width: 16px; height: 16px; margin-top: 3px; }
.reply-item .grow { flex: 1; min-width: 0; }
.reply-item p { margin: 4px 0 0; }
.shortcut { color: var(--brand); font-size: 15px; }
.reply-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); font-size: 14.5px; }
.input-prefix { display: flex; align-items: center; }
.input-prefix span { padding: 0 10px; color: var(--ink-3); font-weight: 600; }
.input-prefix .input { flex: 1; }
.check-list, .plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
fieldset.field { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
kbd { padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--bg); font-size: 13px; }
code { padding: 1px 5px; border-radius: 4px; background: var(--bg-2); font-size: 13px; }
@media (max-width: 720px) {
  .table thead { display: none; }
  .table tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 4px 16px; }
  div.row-actions { justify-content: flex-start; }
  td.row-actions { text-align: left; white-space: normal; }
}
