:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #16a34a;
  --brand-ink: #ffffff;
  --brand-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info-soft: #e0f2fe;
  --bubble-me: #d9fdd3;
  --bubble-them: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1117;
    --panel: #111a22;
    --panel-2: #0f1720;
    --border: #1f2c38;
    --text: #e6edf3;
    --muted: #8b9bab;
    --brand: #22c55e;
    --brand-ink: #04200f;
    --brand-soft: #0f2e1c;
    --danger: #f87171;
    --danger-soft: #3b1414;
    --warn: #fbbf24;
    --warn-soft: #3a2c0b;
    --info-soft: #0c2a3b;
    --bubble-me: #134d37;
    --bubble-them: #1a2632;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji"; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 16px; }
.brand img { width: 28px; height: 28px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.main { padding: 24px 28px 48px; min-width: 0; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.btn.menu-btn { display: none; margin-bottom: 8px; }
.nav-ico { width: 22px; text-align: center; flex: 0 0 22px; }
.side-toggle { margin-left: auto; border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1; }
.side-toggle:hover { background: var(--panel-2); color: var(--text); }
/* Menu recolhido: só os ícones (o nome aparece ao parar o mouse em cima). */
.shell.side-collapsed { grid-template-columns: 68px 1fr; }
.shell.side-collapsed .side { padding: 16px 8px; }
.shell.side-collapsed .nav-text, .shell.side-collapsed .nav-label, .shell.side-collapsed .app-version { display: none; }
.shell.side-collapsed .brand { flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.shell.side-collapsed .side-toggle { margin: 0; transform: rotate(180deg); }
.shell.side-collapsed .nav a { justify-content: center; padding: 9px 0; }
.shell.side-collapsed .nav-label + a, .shell.side-collapsed .nav-label { margin-top: 0; }
.shell.side-collapsed .nav-label { display: block; height: 1px; padding: 0; margin: 8px 6px; background: var(--border); font-size: 0; }
.shell.side-collapsed .side-foot { padding: 12px 0 0; text-align: center; }
.shell.side-collapsed .side-foot .btn { padding: 4px 6px; }

/* ---------- componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.btn { appearance: none; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; width: 100%; }
input[type=checkbox] { width: auto; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.connected { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.connected::before { background: var(--brand); }
.badge.connecting { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.connecting::before { background: var(--warn); }
.badge.disconnected::before { background: var(--danger); }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--info-soft); }
.alert.warn { background: var(--warn-soft); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: var(--brand); }
.stack > p, .stack > h2, .stack > h3 { margin: 0; }
.kv { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; padding-bottom: 8px; font-size: 20px; }

/* ---------- conexão ---------- */
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; width: 280px; max-width: 100%; }
.qr img { width: 256px; height: 256px; image-rendering: pixelated; }
.paircode { font: 700 34px/1 ui-monospace, Consolas, monospace; letter-spacing: .15em; padding: 16px 20px; background: var(--panel-2); border: 1px dashed var(--brand); border-radius: 12px; text-align: center; }

/* ---------- conversas ---------- */
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 140px); min-height: 420px; padding: 0; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: center; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.chat-item:hover, .chat-item.active { background: var(--panel-2); }
.chat-item .meta { min-width: 0; flex: 1; }
.chat-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread { background: var(--brand); color: var(--brand-ink); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.conv { display: flex; flex-direction: column; min-width: 0; }
.conv-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); }
.msg { max-width: 72%; padding: 7px 10px 5px; border-radius: 10px; background: var(--bubble-them); box-shadow: var(--shadow); white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--bubble-me); }
.msg .when { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg .type { font-size: 12px; color: var(--muted); font-style: italic; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.composer textarea { min-height: 42px; height: 42px; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); max-height: 90vh; overflow-y: auto; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- responsivo ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .btn.menu-btn { display: inline-flex; }
  /* No celular o menu já abre por cima (☰ Menu): recolher não se aplica. */
  .shell.side-collapsed { grid-template-columns: 1fr; }
  .side-toggle { display: none; }
  .shell.side-collapsed .nav-text, .shell.side-collapsed .app-version { display: revert; }
  .shell.side-collapsed .nav-label { display: block; height: auto; padding: 14px 10px 4px; margin: 0; background: none; font-size: 11px; }
  .shell.side-collapsed .brand { flex-direction: row; }
  .shell.side-collapsed .nav a { justify-content: flex-start; padding: 8px 10px; }
  .shell.side-collapsed .side { padding: 16px 12px; }
  .shell.side-collapsed .side-foot { padding: 12px 8px 0; text-align: left; }
  .main { padding: 16px; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--border); }
  .msgs { min-height: 360px; }
}
a.btn { text-decoration: none; }
/* Tabelas largas rolam dentro do card no celular, sem estourar a página. */
.card:has(> .table) { overflow-x: auto; }
.table td .row { flex-wrap: nowrap; }

/* ---------- v2: campos copiáveis, servidor, switches, chips ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 600; font-size: 13px; }
.field-box { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; min-height: 40px; overflow: hidden; }
.field-box .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--brand); background: var(--brand-soft); }
.server-card { display: flex; gap: 16px; align-items: stretch; }
.big-action { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: var(--radius); min-width: 140px; font: inherit; font-weight: 700; font-size: 28px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.big-action span { font-size: 14px; }
.big-action:hover { filter: brightness(1.07); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.count { color: var(--warn); font-weight: 800; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; padding: 6px 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--info-soft); }
.tag.method { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.switch-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .15s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel-2); cursor: pointer; }
.chip:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.phone-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }
.center { align-items: center; text-align: center; }
.code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; margin: 0; }
.danger-zone { border-color: var(--danger-soft); }
@media (max-width: 860px) {
  .server-card { flex-direction: column; }
  .big-action { min-height: 64px; flex-direction: row; font-size: 22px; }
}
/* Filhos de grid podem encolher: impede que IDs/URLs longos estourem a largura no celular. */
.grid > *, .stack > * { min-width: 0; }

/* ---------- conversas estilo WhatsApp ---------- */
:root { --wa-bg: #efeae2; --wa-me: #d9fdd3; --wa-them: #ffffff; --wa-meta: #667781; --wa-link: #027eb5; }
@media (prefers-color-scheme: dark) { :root { --wa-bg: #0b141a; --wa-me: #005c4b; --wa-them: #202c33; --wa-meta: #8696a0; --wa-link: #53bdeb; } }
.msgs.wa-bg { background: var(--wa-bg); gap: 3px; padding: 14px 6%; }
.msg { position: relative; max-width: min(65%, 520px); padding: 6px 8px 18px; border-radius: 8px; background: var(--wa-them); box-shadow: 0 1px .5px rgba(11, 20, 26, .13); white-space: normal; align-self: flex-start; font-size: 14.2px; line-height: 19px; }
.msg.me { align-self: flex-end; background: var(--wa-me); }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; padding-right: 58px; }
.msg .txt a, .msg a { color: var(--wa-link); }
.msg .when { position: absolute; right: 8px; bottom: 3px; font-size: 11px; color: var(--wa-meta); display: inline-flex; gap: 2px; white-space: nowrap; }
.msg .tick.read { color: #53bdeb; }
.msg .who { font-weight: 600; font-size: 12.8px; margin-bottom: 2px; }
.msg .fwd { font-size: 12px; font-style: italic; color: var(--wa-meta); margin-bottom: 2px; }
.msg .type { font-style: italic; color: var(--wa-meta); padding-right: 58px; }
.msg .deleted { font-style: italic; color: var(--wa-meta); padding-right: 58px; }
.msg.media-only { padding: 3px 3px 3px; }
.msg.media-only .when { color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .7); bottom: 8px; right: 10px; }
.msg.bare { background: none; box-shadow: none; padding: 0 0 16px; }
.msg.media-only > .who, .msg.media-only > .fwd, .msg.media-only > .quote { margin: 3px 5px 4px; }
img.sticker:not([src]) { visibility: hidden; }
.media.video { min-width: 240px; min-height: 150px; }
.media.video .photo { width: 100%; }
.quote { border-left: 4px solid var(--brand); background: rgba(0, 0, 0, .06); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 13px; overflow: hidden; }
@media (prefers-color-scheme: dark) { .quote { background: rgba(255, 255, 255, .06); } }
.quote .q-who { font-weight: 600; font-size: 12.5px; }
.quote .q-txt { color: var(--wa-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media { position: relative; border-radius: 6px; overflow: hidden; cursor: pointer; min-width: 180px; min-height: 120px; background: rgba(0, 0, 0, .15); display: grid; place-items: center; }
.media .photo { display: block; width: 100%; max-width: 330px; max-height: 360px; object-fit: cover; }
.media.blurred .photo { filter: blur(6px); transform: scale(1.05); }
.media.loading::after { content: ""; position: absolute; width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.media.is-sticker { background: none; min-width: 0; min-height: 0; cursor: default; }
.sticker { width: 150px; height: 150px; object-fit: contain; }
.media.video .play { position: absolute; width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 22px; cursor: pointer; }
.media.video .dur { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 11px; text-shadow: 0 0 3px #000; }
.media.video video { max-width: 330px; max-height: 420px; }
.media.round { border-radius: 50%; width: 220px; height: 220px; min-width: 0; }
.media-err { padding: 16px; color: var(--wa-meta); text-align: center; font-size: 13px; }
.audio-box { display: flex; align-items: center; gap: 8px; min-width: 240px; padding-right: 50px; }
.audio-box audio { height: 36px; max-width: 260px; }
.avatar.mic { width: 42px; height: 42px; font-size: 18px; }
.play-audio { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); cursor: pointer; flex: none; }
.wave { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.wave .bar { height: 4px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--wa-meta) 0 3px, transparent 3px 6px); opacity: .6; }
.doc { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .06); border-radius: 6px; padding: 8px; min-width: 240px; margin-bottom: 2px; }
@media (prefers-color-scheme: dark) { .doc { background: rgba(255, 255, 255, .06); } }
.doc-ico { width: 38px; height: 46px; border-radius: 4px; background: #e2574c; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.doc-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 4px; }
.doc-meta { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc { display: block; text-decoration: none; color: inherit; border-radius: 6px; overflow: hidden; min-width: 240px; }
.loc-map { height: 110px; display: grid; place-items: center; font-size: 36px; background: linear-gradient(135deg, #cfe8c8, #a8d5e2); }
.loc-meta { padding: 6px 2px 0; }
.contact-card { display: flex; gap: 10px; align-items: center; min-width: 220px; padding: 4px 0; padding-right: 50px; }
.poll { display: flex; flex-direction: column; gap: 8px; min-width: 260px; padding-bottom: 4px; }
.poll-opt { display: flex; flex-direction: column; gap: 4px; }
.interactive { display: flex; flex-direction: column; gap: 6px; }
.interactive .photo { width: 100%; max-width: 360px; border-radius: 6px; }
.list-opts { margin: 0; padding-left: 18px; color: var(--wa-meta); }
.btns { margin: 6px -8px 0; border-top: 1px solid rgba(134, 150, 160, .25); }
.wa-btn { text-align: center; padding: 10px 8px; color: var(--wa-link); font-weight: 600; border-bottom: 1px solid rgba(134, 150, 160, .2); }
.wa-btn:last-child { border-bottom: 0; }
.msg:has(.btns) { padding-bottom: 0; }
.msg:has(.btns) .when { position: static; display: flex; justify-content: flex-end; margin-top: 2px; }
.msg.call { display: flex; align-items: center; gap: 10px; min-width: 220px; padding-right: 60px; }
.call-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 168, 132, .15); font-size: 18px; }
.call-ico.missed { background: rgba(234, 67, 53, .15); }
.reacts { position: absolute; bottom: -12px; left: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0 6px; font-size: 13px; box-shadow: var(--shadow); }
.msg.me .reacts { left: auto; right: 8px; }
.msg:has(.reacts) { margin-bottom: 12px; }
.day { align-self: center; background: var(--panel); color: var(--wa-meta); font-size: 12px; padding: 4px 10px; border-radius: 8px; margin: 8px 0; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.load-more { align-self: center; margin-bottom: 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); display: grid; place-items: center; z-index: 70; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; }
.lb-dl { position: fixed; top: 16px; right: 16px; }
.composer { align-items: center; background: var(--panel); }
.composer textarea { min-height: 42px; height: 42px; border-radius: 22px; padding: 10px 16px; resize: none; }
.send-btn, .attach { border-radius: 50%; width: 42px; height: 42px; padding: 0; justify-content: center; font-size: 16px; flex: none; }
@media (max-width: 860px) { .msg { max-width: 85%; } .msgs.wa-bg { padding: 12px 10px; } }

/* ----------------------------------------------------------- anexos: arrastar e soltar + prévia */
.hidden-input { display: none; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; background: var(--panel-2); transition: border-color .15s, background .15s; outline: none; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); }
.dropzone.drag { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel-2)); }
.dropzone.filled { text-align: left; cursor: default; border-style: solid; padding: 12px; }
.drop-ico { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.drop-title { font-weight: 600; margin-bottom: 2px; }
.drop-body { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dropzone.filled .drop-body { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.drop-preview { width: 150px; flex: none; }
.drop-preview .media { min-width: 0; min-height: 0; cursor: default; }
.drop-preview .photo, .drop-preview video { max-width: 150px; max-height: 150px; }
.drop-preview .audio-box, .drop-preview .doc { width: 150px; }
.drop-preview audio { width: 100%; }
.drop-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.progress.done > div { background: #16a34a; }
.error-text { color: var(--danger); }

.compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 16px; align-items: start; }
.preview-card { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.preview-box { min-height: 220px; border-radius: 10px; padding: 14px 12px !important; justify-content: flex-end; }
.preview-box .msg { max-width: 92%; }
.preview-box .media .photo, .preview-box video { max-width: 100%; }
.preview-box audio { max-width: 210px; }
@media (max-width: 960px) { .compose-grid { grid-template-columns: 1fr; } .preview-card { position: static; } }

.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 55vh; overflow: auto; }
.att-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.att-item .media { min-width: 0; min-height: 90px; cursor: default; }
.att-item .photo, .att-item video { max-width: 100%; max-height: 200px; }
.att-item audio { width: 100%; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv { position: relative; }
.drop-overlay { display: none; position: absolute; inset: 0; z-index: 5; background: color-mix(in srgb, var(--panel) 85%, transparent); border: 3px dashed var(--brand); border-radius: 12px; place-items: center; font-size: 40px; text-align: center; pointer-events: none; }
.drop-overlay > div > div { font-size: 16px; font-weight: 600; margin-top: 6px; }
.conv.dragging .drop-overlay { display: grid; }
.mic-cancel { color: var(--danger); }
.mic-cancel[hidden] { display: none; }
.mic-btn.recording { color: #fff; background: var(--danger); border-color: var(--danger); min-width: 74px; }
.doc-ico.big { width: 64px; height: 80px; font-size: 15px; flex: none; }

/* Conversa com altura fixa: só a lista de mensagens rola, o campo de digitar fica sempre visível. */
.chat { grid-template-rows: minmax(0, 1fr); }
.conv, .chat-list { min-height: 0; }
.msgs { min-height: 0; }
.msgs > * { flex-shrink: 0; }
.drop-overlay { place-items: start center; padding-top: 18vh; }
@media (max-width: 860px) { .chat { grid-template-rows: auto; } .msgs { max-height: 62vh; } }
.att-item .doc, .preview-box .doc { min-width: 0; max-width: 100%; overflow: hidden; }
.att-item .doc-meta, .preview-box .doc-meta { min-width: 0; }
.att-item .doc-name, .preview-box .doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Webhook: dono e filtro de conversas */
.owner-banner { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.seg-radio { display: flex; gap: 8px; flex-wrap: wrap; }
.pick-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-item:last-child { border-bottom: 0; }
.pick-item input { width: auto; }
.pick-item.active { background: var(--brand-soft, rgba(34,197,94,.12)); }
button.pick-item { background: transparent; border: 0; border-bottom: 1px solid var(--border); color: inherit; font: inherit; }
.pick-meta { display: flex; flex-direction: column; min-width: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.pick-item, .seg-radio .chip { flex-direction: row; align-items: center; }
.pick-item input, .seg-radio input { width: auto; flex: none; margin: 0; }
.seg-radio .chip { font-size: 13px; padding: 7px 12px; }

/* ----------------------------------------------------------- conversas: busca, abas, atendimento */
.chat-list { display: flex; flex-direction: column; overflow: hidden; }
.chat-list-head { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.chat-list-head .row { flex-wrap: nowrap; }
.chat-list-head input { flex: 1; min-width: 0; }
.chat-list-items { overflow-y: auto; min-height: 0; flex: 1; }
.chat-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-tabs:empty { display: none; }
.tab-btn { appearance: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.tab-btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chat-item .tag { margin-top: 3px; font-size: 11px; }
.tag.assigned { background: var(--brand-soft); color: var(--brand); }
.tag.queue { background: var(--danger-soft); color: var(--danger); }
.tag.locked-tag { background: var(--warn-soft); color: var(--text); }
.tag.ok { background: var(--brand-soft); color: var(--brand); }
.conv-head { flex-wrap: wrap; }
.conv-title { min-width: 0; flex: 1; }
.conv-title > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-bar { gap: 6px; flex-wrap: nowrap; }
.ticket-bar select, select.sm { width: auto; max-width: 220px; padding: 5px 8px; font-size: 13px; }
.status-wrap { font-size: 13px; }
.status-select { width: auto; }
.agent-card .row { flex-wrap: wrap; }

.grid.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-num { font-size: 28px; font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* Níveis de webhook */
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.level { display: block; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel); color: inherit; text-decoration: none; }
a.level:hover { border-color: var(--brand); }
.level.active { border-color: var(--brand); background: var(--brand-soft); }
.level-title { font-weight: 600; margin-bottom: 2px; }
.warn-banner { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

@media (max-width: 860px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
  .chat-list { max-height: none; }
  .chat-list-items { max-height: 300px; }
  .ticket-bar { width: 100%; }
}

/* ======================================================================= WhatsApp Web (v3) */
.chat.wa3 { grid-template-columns: 76px 360px minmax(0, 1fr); }
.wa-rail { display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; background: var(--panel-2); border-right: 1px solid var(--border); overflow-y: auto; }
.rail-btn { appearance: none; border: 0; background: none; color: var(--muted); border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font: inherit; }
.rail-btn:hover { background: var(--panel); color: var(--text); }
.rail-btn.active { background: var(--brand-soft); color: var(--brand); }
.rail-ico { font-size: 22px; line-height: 1; }
.rail-label { font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.1; }
.side-title { align-items: center; }
.side-title strong { font-size: 18px; }
.attendant-filter { width: 100%; }
.chat-item { position: relative; }
.chat-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 44px; }
.chat-more { opacity: 0; font-size: 16px; padding: 0 4px; }
.chat-item:hover .chat-more, .chat-item:focus-within .chat-more, .chat-item.active .chat-more { opacity: 1; }
@media (hover: none) { .chat-more { opacity: 1; } }
.mini-ico { font-size: 12px; }
.tag.done { background: var(--panel-2); color: var(--muted); }
.tab-btn.add { border-style: dashed; }
.conv-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.big-ico { font-size: 44px; line-height: 1; }

/* menu suspenso */
.pop-menu { position: fixed; z-index: 1000; min-width: 220px; max-width: 320px; max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); padding: 6px; display: flex; flex-direction: column; }
.pop-item { appearance: none; border: 0; background: none; color: var(--text); text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; font-size: 15px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.pop-item:hover, .pop-item:focus-visible { background: var(--panel-2); outline: none; }
.pop-item.danger { color: var(--danger); }
.pop-ico { width: 22px; text-align: center; }
.pop-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* bolhas: menu ⌄ */
.msg .msg-more { position: absolute; top: 2px; right: 4px; appearance: none; border: 0; border-radius: 50%; width: 22px; height: 22px; background: inherit; color: var(--wa-meta); cursor: pointer; opacity: 0; font-size: 13px; line-height: 1; }
.msg:hover .msg-more, .msg .msg-more:focus-visible { opacity: 1; }
@media (hover: none) { .msg .msg-more { opacity: .7; } }

/* resposta + composer */
.reply-bar { display: none; align-items: center; gap: 8px; padding: 8px 12px 0; background: var(--panel); }
.reply-bar.open { display: flex; }
.reply-box { flex: 1; min-width: 0; border-left: 4px solid var(--brand); background: var(--panel-2); border-radius: 8px; padding: 6px 10px; }
.reply-box .q-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.composer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.composer-text textarea { width: 100%; }
.var-hint { font-size: 12px; color: var(--brand); padding: 0 12px; }
.var-hint:empty { display: none; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { appearance: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 99px; padding: 7px 12px; font: inherit; font-size: 13.5px; cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }

/* editor de opções */
.opt-rows { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; gap: 8px; align-items: flex-start; }
.opt-num { width: 20px; text-align: center; padding-top: 10px; color: var(--muted); }
.opt-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-fields .row { flex-wrap: nowrap; gap: 6px; }
.opt-fields select { width: auto; }
.modal:has(.modal-compose) { max-width: 920px; }
.modal-compose { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
@media (max-width: 760px) { .modal-compose { grid-template-columns: 1fr; } }

/* tipos em cartões grandes */
.kind-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.kind-tile { appearance: none; border: 2px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 12px; padding: 12px 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.kind-tile:hover { border-color: var(--brand); }
.kind-tile.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.kind-ico { font-size: 28px; line-height: 1; }
.special-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.btn.big { padding: 12px 22px; font-size: 16px; }

/* telas do trilho */
.side-section { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); padding: 12px 14px 6px; }
.pad { padding: 8px 14px; }
p.pad { margin: 0; }
.big-row { appearance: none; border: 0; background: none; color: inherit; font: inherit; width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px 14px; text-align: left; cursor: pointer; border-bottom: 1px solid var(--border); }
div.big-row { cursor: default; }
button.big-row:hover { background: var(--panel-2); }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--brand); }
.avatar.missed { background: var(--danger-soft); }
.presence-wrap { position: relative; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); }
.presence.on { background: #22c55e; }
.presence.off { background: #9ca3af; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.status-view { max-height: 60vh; overflow-y: auto; border-radius: 10px; }
.big-check { font-size: 15px; padding: 6px 0; }
.big-check input { width: 20px; height: 20px; }

/* indicador de tempo real */
.rt-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.rt-off-label { display: none; }
body.rt-off .rt-dot { background: #f59e0b; }
body.rt-off .rt-on { display: none; }
body.rt-off .rt-off-label { display: inline; }

@media (max-width: 860px) {
  .chat.wa3 { grid-template-columns: 1fr; }
  .wa-rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px; }
  .rail-btn { min-width: 72px; }
}
.chip-btn.custom { border-color: var(--brand); }
.chip-btn.add { border-style: dashed; color: var(--muted); }
.field-row { flex-wrap: nowrap; align-items: center; }
.field-row input { flex: 1; }
.field-row code { white-space: nowrap; }
.conv-head .btn.sm { white-space: nowrap; }
.edited-tag { appearance: none; border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.field-box.pre { white-space: pre-wrap; word-break: break-word; }
.pre-wrap { white-space: pre-wrap; } .otp-input { font-size: 28px; letter-spacing: 8px; text-align: center; }

/* ---------- v6: fila, usuários, assinatura, backups ---------- */
.row.wrap { flex-wrap: wrap; }
.bulk-bar { display: flex; flex-direction: column; gap: 6px; padding: 8px; margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--brand-soft); }
.bulk-bar .row { gap: 6px; flex-wrap: wrap; align-items: center; }
.bulk-bar select { max-width: 100%; }
.chat-item .bulk-check { width: 18px; height: 18px; flex: 0 0 auto; margin-right: 4px; }
.chat-item.selected { background: var(--brand-soft); }
.claim-bar { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border); background: var(--warn-soft); }
.claim-btn { padding: 3px 10px; font-size: 12px; }
.tag.role-admin { background: var(--warn-soft); color: var(--warn); }
.tag.role-client { background: var(--info-soft); }
.tag.role-agent { background: var(--brand-soft); color: var(--brand); }
.total-row { border-top: 1px solid var(--border); padding-top: 8px; font-size: 16px; }
.pix-box { align-items: center; text-align: center; max-width: 420px; }
.pix-qr { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }
.pix-box input { flex: 1; min-width: 0; font-size: 12px; }
/* Campos seguros do Mercado Pago (iframes) precisam de altura de input. */
/* O iframe do MP tem fundo branco: a caixa acompanha e o iframe ocupa a caixa inteira. */
.mp-field { height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: #fff; overflow: hidden; }
.mp-field iframe { display: block; width: 100% !important; height: 100% !important; border: 0; }
.mp-form select, .mp-form input { width: 100%; }

/* ---------- v6.1: cartões de período na Assinatura ---------- */
.hidden-select { display: none; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.plan-card { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.plan-card:hover { border-color: var(--brand); }
.plan-card.active { border: 2px solid var(--brand); background: var(--brand-soft); }
.plan-name { font-weight: 700; }
.plan-price { font-size: 22px; font-weight: 800; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.plan-save { font-size: 12px; font-weight: 700; color: var(--brand); min-height: 16px; }
.presence-text.typing { color: var(--brand); font-weight: 600; }

/* Emojis e figurinhas (composer) */
.emoji-pop { position: fixed; z-index: 1000; width: min(360px, calc(100vw - 16px)); height: min(380px, 60vh); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); overflow: hidden; }
.emoji-tabs { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); }
.emoji-body { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.emoji-group .section-title { margin: 8px 0 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.emoji-btn { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 22px; line-height: 1; padding: 6px 0; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.emoji-btn:hover, .sticker-pick:hover { background: var(--panel-2); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.sticker-pick { aspect-ratio: 1; padding: 4px; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.sticker-pick img { width: 100%; height: 100%; object-fit: contain; }
.sticker-pick.loading img:not([src]) { visibility: hidden; }
.sticker-cell { position: relative; }
.sticker-cell .sticker-pick { width: 100%; }
.sticker-star { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--panel); color: var(--muted); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: pointer; font-size: 14px; line-height: 24px; padding: 0; opacity: 0; transition: opacity .15s; }
.sticker-cell:hover .sticker-star, .sticker-star:focus-visible, .sticker-star.on { opacity: 1; }
.sticker-star.on { color: #f5b301; }
.sticker-star.del:hover { color: var(--danger, #d33); }
@media (hover: none) { .sticker-star { opacity: 1; } }
.media.is-sticker { cursor: pointer; }

/* Filtros de Pagamentos recebidos / Relatos */
.pay-filters { gap: 8px; margin-bottom: 8px; }
.pay-filters > * { flex: 1 1 150px; min-width: 0; }
.table tr.row-done td { opacity: .6; }

/* ---------- v6.5: visualizador de status (como o WhatsApp) ---------- */
.status-viewer { position: fixed; inset: 0; z-index: 1000; background: #111b21; color: #fff; display: flex; flex-direction: column; align-items: center; }
.sv-bars { display: flex; gap: 4px; width: min(480px, 100% - 32px); margin-top: 12px; }
.sv-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.sv-bar i { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 10px; width: min(480px, 100% - 32px); padding: 10px 0; }
.sv-title { flex: 1; min-width: 0; }
.sv-when { font-size: 12px; opacity: .75; }
.sv-close { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.sv-stage { position: relative; flex: 1; width: min(480px, 100%); display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; }
.sv-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.sv-text { margin: 16px; padding: 32px 24px; border-radius: 12px; background: #128C7E; font-size: 22px; line-height: 1.4; text-align: center; white-space: pre-wrap; word-break: break-word; max-height: 100%; overflow: auto; }
.sv-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px 22px; background: linear-gradient(transparent, rgba(0,0,0,.75)); text-align: center; white-space: pre-wrap; }
.sv-loading { opacity: .7; }
.sv-body { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; }
.sv-body .sv-stage { flex: 0 1 480px; height: 100%; }
.sv-arrow { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 32px; line-height: 1; cursor: pointer; }
.sv-arrow:hover:not(:disabled) { background: rgba(255,255,255,.3); }
.sv-arrow:disabled { opacity: .25; cursor: default; }
.sv-people { display: flex; gap: 12px; overflow-x: auto; width: min(720px, 100% - 32px); padding: 10px 0 14px; }
.sv-person { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; background: none; border: 0; color: #fff; cursor: pointer; opacity: .65; }
.sv-person.active, .sv-person:hover { opacity: 1; }
.sv-person.active .avatar { outline: 2px solid #25d366; outline-offset: 2px; }
.sv-person-name { font-size: 11px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .sv-arrow { position: absolute; z-index: 2; } .sv-arrow-prev { left: 4px; } .sv-arrow-next { right: 4px; } .sv-body { position: relative; } }
.app-version { font-size: 10px; font-weight: 400; opacity: .55; margin-left: 6px; align-self: flex-end; letter-spacing: .02em; }

/* v6.5: chamado com código de barras e QR Code */
.ticket-codes { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 10px; padding: 12px; color: #111; }
.barcode { width: 100%; max-width: 380px; height: 64px; display: block; }
.ticket-qr { width: 132px; height: 132px; image-rendering: pixelated; }

/* v6.5: ficha do cliente */
.usage-bar { height: 8px; border-radius: 99px; background: var(--border, #2a2f3a); overflow: hidden; }
.usage-fill { height: 100%; background: var(--accent, #22c55e); }
.usage-fill.hot { background: #f59e0b; }
.usage-fill.low { background: #64748b; }
.stat { border: 1px solid var(--border, #2a2f3a); border-radius: 10px; padding: 10px 12px; }
.stat-value { font-size: 1.3rem; font-weight: 700; margin-top: 4px; }

/* v6.5: relatório de chamados para imprimir / salvar em PDF */
.print-report { display: none; }
@media print {
  body.printing > *:not(.print-report) { display: none !important; }
  body.printing .print-report { display: block; color: #000; background: #fff; font: 11px/1.4 Arial, sans-serif; }
  .print-report h1 { font-size: 18px; margin: 0 0 4px; }
  .print-report table { width: 100%; border-collapse: collapse; margin: 10px 0; }
  .print-report th, .print-report td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
  .print-report th { background: #eee; }
}

/* v6.5: IDs com clique para copiar e empresas agrupadas em Instâncias */
.id-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; padding: 1px 6px; border: 1px solid var(--border, #d0d7de); border-radius: 999px; background: transparent; color: inherit; cursor: copy; line-height: 1.6; }
.id-chip:hover { border-color: var(--brand); }
.company-group { border: 1px solid var(--border, #d0d7de); border-radius: 8px; padding: 8px 12px; }
.company-group > summary { cursor: pointer; list-style: revert; display: list-item; }
.company-group[open] > summary { margin-bottom: 8px; }

/* v6.5: Documentação da API */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.docs-toc { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.docs-toc a { padding: 4px 8px; border-radius: 6px; text-decoration: none; color: inherit; }
.docs-toc a:hover { background: var(--info-soft); }
.docs-item > summary { cursor: pointer; }
.tag.method.m-get { background: #2563eb; color: #fff; }
.tag.method.m-post { background: #16a34a; color: #fff; }
.tag.method.m-put, .tag.method.m-patch { background: #d97706; color: #fff; }
.tag.method.m-delete { background: #dc2626; color: #fff; }
@media (max-width: 800px) { .docs-layout { grid-template-columns: 1fr; } .docs-toc { position: static; flex-direction: row; flex-wrap: wrap; } }

/* v6.5: reler conversas de um backup */
.bk-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 0; padding: 0; height: calc(100vh - 220px); min-height: 420px; overflow: hidden; }
.bk-side { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-right: 1px solid var(--border); min-height: 0; }
.bk-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.bk-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.bk-check { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; cursor: pointer; }
.bk-side select { flex: 1; min-width: 0; }
.bk-row:hover, .bk-row.active { background: var(--info-soft); }
.bk-row-txt { display: flex; flex-direction: column; min-width: 0; }
.bk-row-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-pane { display: flex; flex-direction: column; min-height: 0; }
.bk-pane > .empty { margin: auto; }
.bk-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.bk-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.bk-day { align-self: center; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--info-soft); margin: 8px 0; }
.bk-msg { align-self: flex-start; max-width: 70%; padding: 6px 10px; border-radius: 10px; background: var(--info-soft); white-space: pre-wrap; word-break: break-word; }
.bk-msg.me { align-self: flex-end; background: var(--brand-soft); }
.bk-sender { font-size: 12px; font-weight: 600; color: var(--brand); }
.bk-time { font-size: 11px; opacity: .6; text-align: right; }
@media (max-width: 800px) { .bk-wrap { grid-template-columns: 1fr; height: auto; } .bk-side { border-right: 0; max-height: 40vh; } .bk-msgs { max-height: 60vh; } }
.product-preview { max-width: 160px; max-height: 160px; border-radius: 8px; object-fit: cover; margin-top: 6px; }

/* Olhinho para ver a senha */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 42px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px; opacity: .7; }
.pw-eye:hover { opacity: 1; }

/* Catálogo: galeria do produto e parcelas no editor */
.media-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.media-tile { position: relative; width: 104px; height: 104px; border-radius: 8px; overflow: hidden; background: var(--bg-soft, #eee); border: 1px solid var(--border, #ddd); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-link { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; font-size: 28px; gap: 4px; }
.media-link small { font-size: 11px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-badge { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 99px; }
.media-badge.video { left: auto; right: 4px; }
.media-actions { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.55); }
.media-actions button { flex: 1; background: none; border: 0; color: #fff; padding: 3px 0; cursor: pointer; font-size: 12px; }
.media-actions button:disabled { opacity: .3; cursor: default; }
.inst-row { gap: 6px; align-items: center; }
.inst-total { white-space: nowrap; }
.inline-ctrls { display: flex; align-items: center; gap: 6px; }
.inline-ctrls > input { flex: 1; width: auto; min-width: 0; }
.inline-ctrls > select { width: auto; flex: 0 0 auto; }
.inst-row > input { width: auto; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

/* v6.5: nova conversa (contatos como no WhatsApp) */
.new-chat-btn { position: relative; font-size: 20px; }
.nc-btn-ico { position: relative; display: inline-block; line-height: 1; }
.nc-btn-ico b { position: absolute; right: -6px; top: -6px; width: 15px; height: 15px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; line-height: 15px; text-align: center; }
.nc-scroll { overflow: auto; }
.nc-action .nc-ico { background: var(--brand); color: #fff; font-size: 18px; }
.nc-letter { padding: 14px 16px 6px; color: var(--brand); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.nc-section { color: var(--muted); }
.nc-more { margin: 10px auto; display: block; }
.pick-row { padding: 8px 10px; border-bottom: 1px solid var(--border); gap: 8px; align-items: center; }
.pick-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.contact-box { min-width: 220px; }
.contact-actions { display: flex; border-top: 1px solid var(--border); margin-top: 8px; }
.contact-actions button { flex: 1; background: none; border: 0; padding: 8px 6px 2px; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.contact-actions button + button { border-left: 1px solid var(--border); }
.contact-actions button:hover { text-decoration: underline; }
.bk-msg.deleted { outline: 1px dashed var(--danger); }
.bk-deleted { color: var(--danger); font-size: 11px; font-weight: 600; margin-bottom: 2px; }

/* Resposta rápida: janela de chat no meio da tela quando chega mensagem de cliente. */
.qr-bg { position: fixed; inset: 0; z-index: 48; background: rgba(2, 6, 23, .45); display: grid; place-items: center; padding: 16px; }
.qr-win { width: min(640px, 100%); height: min(720px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-top: 4px solid var(--brand); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .4); overflow: hidden; animation: qr-in .25s ease-out; }
@keyframes qr-in { from { transform: translateY(20px) scale(.98); opacity: .3; } to { transform: none; opacity: 1; } }
.qr-tabs { display: flex; gap: 4px; padding: 8px 8px 0; overflow-x: auto; background: var(--panel-2); border-bottom: 1px solid var(--border); flex: none; }
.qr-tabs[hidden] { display: none; }
.qr-tab { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.qr-tab.active { background: var(--panel); color: var(--text); border-color: var(--border); font-weight: 600; }
.qr-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-tab-badge { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 18px; }
.qr-panes { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qr-pop { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qr-pop[hidden] { display: none; }
.qr-pop.qr-flash .qr-head { animation: qr-flash 1s ease-out; }
@keyframes qr-flash { from { background: var(--brand-soft); } to { background: transparent; } }
.qr-pop.busy .qr-compose { opacity: .6; pointer-events: none; }
.qr-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex: none; }
.qr-title { flex: 1; min-width: 0; }
.qr-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.qr-close { font-size: 20px; }
.qr-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.qr-list.msgs.wa-bg { padding: 12px 4%; }
.qr-list .msg { max-width: 85%; }
.qr-msg { align-self: flex-start; max-width: 85%; background: var(--wa-them); border-radius: 8px; padding: 6px 9px; font-size: 14px; line-height: 19px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.qr-txt { white-space: pre-wrap; word-wrap: break-word; }
.qr-media img, .qr-media video { display: block; max-width: 100%; max-height: 220px; border-radius: 6px; }
.qr-media img.qr-sticker { max-height: 140px; background: transparent; }
.qr-media audio { width: 260px; max-width: 100%; }
.qr-status { padding: 0 14px; flex: none; }
.qr-status:not(:empty) { padding: 6px 14px 0; }
.qr-compose { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--border); flex: none; }
.qr-compose textarea { width: 100%; resize: vertical; min-height: 52px; max-height: 160px; box-sizing: border-box; }
.qr-tools { display: flex; align-items: center; gap: 6px; }
.qr-tools .spacer { flex: 1; }
@media (max-width: 640px) {
  .qr-bg { padding: 0; }
  .qr-win { width: 100%; height: 100%; border-radius: 0; }
}

/* ---------- v6.6: status com foto, Dados do contato, mídias de todas as conversas ---------- */
.avatar.ring { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--brand); }
.avatar.ring.seen { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--border); }
img.avatar { display: block; }
.status-row { padding-left: 18px; }
.avatar.xl { width: 200px; height: 200px; font-size: 72px; }
.rail-bottom { margin-top: auto; }
.conv { position: relative; }
.conv-avatar-btn { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; flex: none; }
.conv-avatar-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.conv-title.clickable { cursor: pointer; }
.star-tag { color: var(--muted); }
.msg-flash { animation: msgflash 2s ease; }
@keyframes msgflash { 0%, 60% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: none; } }

/* Painel lateral "Dados do contato" */
.contact-info { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; box-shadow: -8px 0 24px rgba(0, 0, 0, .18); }
.ci-head, .ci-sub-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.ci-body { flex: 1; overflow-y: auto; }
.ci-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px 16px; text-align: center; border-bottom: 8px solid var(--panel-2); }
.ci-photo { appearance: none; border: 0; background: none; padding: 0; cursor: zoom-in; border-radius: 50%; margin-bottom: 10px; }
.ci-name { margin: 0; font-size: 22px; font-weight: 500; word-break: break-word; }
.ci-actions { display: flex; gap: 12px; margin-top: 14px; }
.ci-action { appearance: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 12px; padding: 10px 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font: inherit; font-size: 13px; }
.ci-action:hover { border-color: var(--brand); }
.ci-action-ico { font-size: 18px; }
.ci-section { padding: 12px 0; border-bottom: 8px solid var(--panel-2); }
.ci-section-title { color: var(--muted); font-size: 13px; padding: 0 20px 6px; }
.ci-section > div:not(.ci-section-title):not(.ci-thumbs) { padding: 0 20px; }
.ci-about { white-space: pre-wrap; word-break: break-word; }
.ci-item { appearance: none; border: 0; background: none; color: inherit; font: inherit; width: 100%; display: flex; align-items: center; gap: 16px; padding: 12px 20px; text-align: left; cursor: pointer; text-decoration: none; }
.ci-item:hover { background: var(--panel-2); }
label.ci-item { flex-direction: row; font-weight: inherit; margin: 0; }
.ci-item.danger { color: var(--danger); }
.ci-ico { width: 24px; text-align: center; font-size: 18px; flex: none; color: var(--muted); }
.ci-item.danger .ci-ico { color: var(--danger); }
.ci-label { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ci-right { color: var(--muted); }
.ci-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 20px 6px; }
.ci-media { flex: 1; }
.ci-all-media { appearance: none; border: 0; border-top: 1px solid var(--border); background: var(--panel); color: var(--brand); font: inherit; font-weight: 600; padding: 16px; width: 100%; cursor: pointer; position: sticky; bottom: 0; }

/* Mídia / Documentos / Links */
.mv-tabs { display: flex; border-bottom: 1px solid var(--border); }
.mv-tabs button { flex: 1; appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 14px 8px; cursor: pointer; }
.mv-tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.mv-period { padding: 8px 16px 4px; }
.mv-period-title { padding: 10px 0 8px; text-transform: none; }
.mv-period-title strong { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.mv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mv-grid.wide { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px; }
.mv-tile { appearance: none; border: 0; padding: 0; position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--panel-2); cursor: zoom-in; display: block; width: 100%; }
.mv-grid.wide .mv-tile { border-radius: 0; }
.mv-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mv-tile.no-thumb::after { content: "🖼"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; opacity: .5; }
.mv-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.mv-sender { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: 12px; font-weight: 600; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mv-row.wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; padding: 10px 4px; }
.mv-head { color: var(--text); font-weight: 600; font-size: 13px; padding: 12px 20px !important; }
.mv-main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mv-main-txt { min-width: 0; }
.mv-main-txt strong, .mv-who-txt strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mv-main-txt a { color: inherit; text-decoration: none; }
.mv-main-txt a:hover { text-decoration: underline; }
.mv-doc { width: 46px; height: 46px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--panel-2); color: var(--muted); flex: none; }
.mv-doc.t-pdf { background: #fde2e2; color: #c81e1e; }
.mv-doc.t-doc { background: #dbe7fb; color: #1d4ed8; }
.mv-doc.t-xls { background: #d7f2df; color: #15803d; }
.mv-doc.t-ppt { background: #fde7d7; color: #c2410c; }
.mv-doc.t-zip { background: #eee5fb; color: #6d28d9; }
.mv-link-ico, .mv-link-thumb { width: 46px; height: 46px; border-radius: 6px; flex: none; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); object-fit: cover; }
.mv-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.mv-who-txt { min-width: 0; }
.mv-date { white-space: nowrap; }
.mv-acts { display: flex; gap: 2px; }
.mv-acts .icon-btn { text-decoration: none; font-size: 16px; padding: 4px 8px; }
.mv-more { padding: 16px; text-align: center; }
.mv-foot { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.mv-search-results { padding: 0 8px 12px; }
.mv-hit { appearance: none; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; font: inherit; text-align: left; width: 100%; padding: 10px 12px; cursor: pointer; }
.mv-hit:hover { background: var(--panel-2); }
.mv-hit-txt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Janela "Mídias de todas as conversas" e "Mensagens favoritas" */
.mv-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 65; display: grid; place-items: center; padding: 24px; }
.mv-window { background: var(--panel); border-radius: 14px; width: min(1280px, 100%); height: min(780px, 100%); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.mv-window.narrow { width: min(640px, 100%); }
.mv-top { display: flex; align-items: center; gap: 16px; padding: 10px 16px 0; border-bottom: 1px solid var(--border); }
.mv-top-title { min-width: 180px; padding-bottom: 10px; display: flex; flex-direction: column; }
.mv-top-title strong { font-size: 16px; }
.mv-top .mv-tabs { flex: 1; border-bottom: 0; max-width: 460px; margin: 0 auto; }
.mv-top-acts { display: flex; gap: 4px; padding-bottom: 10px; }
.mv-top-acts .icon-btn { font-size: 18px; padding: 6px 10px; }
.mv-search { margin: 10px 16px 0; width: auto; }
.mv-content { flex: 1; overflow-y: auto; }
.mv-stars { padding: 12px 16px; }
.mv-star { border-bottom: 1px solid var(--border); padding: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.mv-star-head { display: flex; gap: 8px; }
.mv-star-bubble { background: var(--wa-them); border-radius: 10px; padding: 8px 10px; max-width: 90%; display: flex; gap: 10px; align-items: flex-start; word-break: break-word; }
.mv-star-bubble.me { background: var(--wa-me); align-self: flex-end; }
.mv-star-bubble .mv-tile { width: 90px; flex: none; }

/* Foto de perfil em tela cheia */
.photo-viewer { position: fixed; inset: 0; z-index: 72; background: rgba(11, 17, 23, .94); display: flex; flex-direction: column; }
.pv-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; color: #fff; }
.pv-close { color: #fff; font-size: 22px; }
.pv-stage { flex: 1; display: grid; place-items: center; padding: 0 20px 40px; min-height: 0; }
.pv-img { max-width: min(640px, 92vw); max-height: 78vh; object-fit: contain; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.pv-none { color: #cbd5e1; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }

@media (max-width: 760px) {
  .mv-row.wide { grid-template-columns: minmax(0, 1fr) auto; }
  .mv-row.wide .mv-caption, .mv-row.wide .mv-who, .mv-head { display: none; }
  .mv-top { flex-wrap: wrap; }
  .mv-modal { padding: 0; }
  .mv-window { border-radius: 0; height: 100%; }
  .avatar.xl { width: 160px; height: 160px; }
}

/* Seta para a última mensagem (como no WhatsApp Web) + rascunhos */
.msgs-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msgs-wrap > .msgs { flex: 1; }
.msgs-wrap > .tc-msgs { flex: 1; min-height: 0; }
.tc-msgs-wrap .scroll-down { right: 12px; bottom: 10px; width: 36px; height: 36px; }
.scroll-down { position: absolute; right: 18px; bottom: 14px; z-index: 5; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); cursor: pointer; display: grid; place-items: center; padding: 0; }
.scroll-down[hidden] { display: none; }
.scroll-down::before { content: ''; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .8; }
.scroll-down:hover { filter: brightness(1.15); }
.scroll-down .down-count { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.scroll-down .down-count[hidden] { display: none; }
.draft-tag { color: var(--brand); font-weight: 600; }
.draft-tag .draft-txt { color: var(--muted); font-weight: 400; }
.draft-list { max-height: 50vh; overflow-y: auto; }
.draft-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.draft-info { min-width: 0; flex: 1; }
.draft-text { margin-top: 4px; white-space: pre-wrap; word-break: break-word; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); }
.draft-actions { gap: 6px; }

/* ---------- v6.7: Conversas no celular como o app do WhatsApp ----------
   Computador: igual antes. Celular: a lista ocupa a tela com as abas embaixo; tocar num contato
   abre a conversa em tela cheia (← volta, o Voltar do Android também). */
.conv-back, .cam-btn { display: none; }
.conv-tools { display: contents; }
.composer-pill { display: contents; }
.composer-pill > .attach:not(.cam-btn):not(:first-child) { order: -2; } /* 📎 antes do 😀, como era */
.composer-pill > .attach:first-child { order: -1; }

@media (max-width: 860px) {
  /* A tela de conversas ocupa a altura do aparelho; só a lista/mensagens rolam. */
  .main:has(> .chat.wa3) { padding: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .main:has(> .chat.wa3) > .head { margin: 0; padding: 8px 12px; align-items: center; flex-wrap: nowrap; gap: 8px; border-bottom: 1px solid var(--border); background: var(--panel); }
  .main:has(> .chat.wa3) > .head > div:first-child { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .main:has(> .chat.wa3) > .head h1 { display: none; } /* a lista já tem o título (Conversas / Meus atendimentos) */
  .main:has(> .chat.wa3) > .head .row { flex-wrap: nowrap; gap: 6px; }
  .main:has(> .chat.wa3) > .head > div:first-child { flex: 1; }
  .main:has(> .chat.wa3) .menu-btn { white-space: nowrap; flex: none; }
  .main:has(> .chat.wa3) .status-wrap { font-size: 0; gap: 0; } /* só o seletor (🟢 Disponível) */
  .main:has(> .chat.wa3) .status-wrap select { font-size: 13px; padding: 5px 6px; }
  .main:has(> .chat.wa3) .rt-badge .rt-on { display: none; } /* só a bolinha verde */
  .main:has(> .chat.wa3) .rt-badge { padding: 6px; }
  .chat.wa3 { display: flex; flex-direction: column; flex: 1; min-height: 0; height: auto; border: 0; border-radius: 0; box-shadow: none; }

  /* Lista: tela toda, com as abas (Conversas, Atualizações…) fixas embaixo. */
  .chat.wa3 > .chat-list { flex: 1; min-height: 0; max-height: none; border: 0; }
  .chat.wa3 .chat-list-items { max-height: none; flex: 1; }
  .chat.wa3 .chat-item { padding: 12px 14px; }
  .chat.wa3 .chat-item .avatar { width: 48px; height: 48px; }
  .chat.wa3 > .wa-rail { order: 2; flex: none; flex-direction: row; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--border); background: var(--panel); overflow: hidden; }
  .chat.wa3 > .wa-rail .rail-btn { min-width: 0; flex: 1; padding: 6px 2px; }
  .chat.wa3 > .wa-rail .rail-btn.active .rail-ico { background: var(--brand-soft); border-radius: 99px; padding: 3px 16px; }
  .chat.wa3 > .wa-rail .rail-btn.active { background: none; }
  .chat.wa3 > .wa-rail .rail-bottom { display: none; } /* "Mídias" fica no ⋮ da lista */
  .chat.wa3 > .conv { display: none; }

  /* Conversa aberta: só ela na tela (sem lista, abas nem o topo da página). */
  .chat.wa3:has(> .conv > .conv-head) > .chat-list,
  .chat.wa3:has(> .conv > .conv-head) > .wa-rail { display: none; }
  .chat.wa3:has(> .conv > .conv-head) > .conv { display: flex; flex: 1; min-height: 0; }
  .main:has(> .chat.wa3 > .conv > .conv-head) > .head { display: none; }
  body:has(.chat.wa3 > .conv > .conv-head) .tc-fab { display: none; }

  .conv-head { flex-wrap: wrap; gap: 8px; padding: 8px 8px 8px 4px; background: var(--panel); }
  .conv-back { display: inline-grid; place-items: center; font-size: 22px; color: var(--text); width: 36px; height: 40px; padding: 0; flex: none; }
  .conv-head .avatar { width: 40px; height: 40px; }
  .conv-head .conv-title { flex: 1; min-width: 0; }
  .conv-head .conv-title .muted.small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .conv-head > .icon-btn:not(.conv-back) { font-size: 20px; padding: 6px 8px; }
  /* Dados do cliente / passar / finalizar: uma linha fina embaixo do nome, rolando de lado. */
  .conv-tools { order: 9; display: flex; gap: 6px; flex-basis: 100%; align-items: center; overflow-x: auto; padding-left: 44px; scrollbar-width: none; }
  .conv-tools:empty { display: none; }
  .conv-tools::-webkit-scrollbar { display: none; }
  .conv-tools .ticket-bar { width: auto; flex: none; }
  .conv-tools .btn.sm, .conv-tools select.sm { flex: none; font-size: 12px; padding: 4px 8px; }

  .msgs { max-height: none; min-height: 0; }
  .conv .msgs.wa-bg { padding: 10px 8px; }

  /* Barra de digitar como no app: [😀 Mensagem 📎 📷] + 🎤/➤ redondo. */
  .composer { gap: 6px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 0; background: var(--wa-bg); align-items: flex-end; }
  .composer-pill { display: flex; flex: 1; min-width: 0; align-items: flex-end; gap: 0; background: var(--panel); border-radius: 24px; padding: 2px 4px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
  .composer-pill > .attach { order: 0 !important; background: none; border: 0; width: 40px; height: 42px; font-size: 20px; color: var(--muted); }
  .composer-pill .composer-text textarea { border: 0; background: transparent; padding: 11px 4px; min-height: 42px; border-radius: 0; box-shadow: none; font-size: 16px; }
  .composer-pill .composer-text textarea:focus { outline: none; }
  .cam-btn { display: inline-flex; }
  .composer > .mic-btn, .composer > .send-btn { width: 48px; height: 48px; font-size: 20px; background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .composer > .mic-btn.recording { background: var(--danger); border-color: var(--danger); min-width: 48px; width: auto; padding: 0 10px; border-radius: 24px; }
  .composer:not(.has-text) > .send-btn { display: none; }
  .composer.has-text > .mic-btn:not(.recording) { display: none; }
  .composer:has(.mic-btn.recording) > .send-btn { display: none; }
  .composer:has(.mic-btn.recording) .cam-btn { display: none; }
  .claim-bar { flex-wrap: wrap; }
}

/* Visualizador de fotos da conversa (como no WhatsApp Web): topo com quem mandou, setas ‹ ›, miniaturas embaixo */
.gallery-viewer { position: fixed; inset: 0; z-index: 75; background: #0b141a; color: #e9edef; display: flex; flex-direction: column; user-select: none; }
.gv-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; }
.gv-info { min-width: 0; display: flex; flex-direction: column; }
.gv-who { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-when { font-size: 12.5px; color: #aebac1; }
.gv-count { font-size: 13px; color: #aebac1; margin-right: 6px; white-space: nowrap; }
.gv-btn { background: none; border: 0; color: #e9edef; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.gv-btn:hover { background: rgba(255, 255, 255, .1); }
.gv-btn[hidden] { display: none; }
.gv-body { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.gv-center { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.gv-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y; }
.gv-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; box-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
.gv-img.blurred { filter: blur(6px); min-width: 40%; }
video.gv-img { cursor: default; }
.gv-stage.zoomed { overflow: auto; display: block; touch-action: auto; }
.gv-stage.zoomed .gv-img { max-width: none; max-height: none; cursor: zoom-out; }
.gv-loading { color: #aebac1; }
.gv-caption { max-width: min(800px, 100%); text-align: center; font-size: 14px; padding: 4px 8px 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 20vh; overflow-y: auto; }
.gv-caption[hidden] { display: none; }
.gv-arrow { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(32, 44, 51, .9); color: #e9edef; font-size: 30px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.gv-arrow:hover:not(:disabled) { background: #2a3942; }
.gv-arrow:disabled { opacity: 0; pointer-events: none; }
.gv-strip { display: flex; justify-content: safe center; gap: 6px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid rgba(255, 255, 255, .08); scrollbar-width: thin; }
.gv-thumb { position: relative; flex: none; width: 56px; height: 56px; padding: 0; border: 3px solid transparent; border-radius: 4px; overflow: hidden; background: #202c33; cursor: pointer; opacity: .6; }
.gv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gv-thumb:hover { opacity: .9; }
.gv-thumb.active { opacity: 1; border-color: #00a884; }
.gv-thumb.no-thumb img:not([src]) { visibility: hidden; }
.gv-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 16px; text-shadow: 0 1px 4px #000; }
.gallery-viewer.single .gv-strip, .gallery-viewer.single .gv-arrow { display: none; }
@media (max-width: 760px) {
  .gv-head { padding: 8px 6px; gap: 8px; }
  .gv-body { padding: 0; position: relative; }
  .gv-arrow { position: absolute; z-index: 2; width: 38px; height: 38px; font-size: 26px; }
  .gv-prev { left: 6px; }
  .gv-next { right: 6px; }
  .gv-thumb { width: 46px; height: 46px; }
}
.popup-toggle { cursor: pointer; background: var(--panel); font: inherit; font-size: 12.5px; }
.popup-toggle:hover { border-color: var(--brand); color: var(--brand); }
.popup-toggle.off { color: var(--danger); border-color: var(--danger-soft); }
.qr-off { font-size: 12px; white-space: nowrap; }
@media (max-width: 640px) { .qr-off { display: none; } }

/* ===== Ícones SVG (icons.js) no lugar dos emojis: mesma cor do texto, traço fino ===== */
.ic { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; stroke-width: 2; }
.btn .ic, .pop-item .ic, .ci-item .ic { width: 18px; height: 18px; }
.nav-ico { display: inline-flex; align-items: center; justify-content: center; }
.nav-ico .ic { width: 19px; height: 19px; stroke-width: 1.8; }
.nav a.active .nav-ico, .nav a:hover .nav-ico { color: var(--brand); }
.pop-ico { display: inline-flex; justify-content: center; color: var(--muted); }
.pop-item.danger .pop-ico { color: inherit; }
.ci-ico .ic { width: 20px; height: 20px; }
.rail-ico .ic { width: 22px; height: 22px; stroke-width: 1.8; }
.big-ico .ic { width: 48px; height: 48px; stroke-width: 1.4; color: var(--muted); }
.avatar > .ic, .tc-avatar > .ic { width: 55%; height: 55%; stroke-width: 1.8; }
.mini-ico .ic { width: 13px; height: 13px; color: var(--muted); }
.icon-btn .ic { width: 18px; height: 18px; }
.ic-star-fill { fill: #f59e0b; color: #f59e0b; }
.ic-dot-green, .ic-dot-gray, .ic-dot-yellow, .ic-dot-red, .ic-dot-blue, .ic-dot-orange, .ic-dot-purple { stroke: none; width: .9em; height: .9em; vertical-align: -0.08em; }
.ic-dot-green { fill: #22c55e; } .ic-dot-gray { fill: #94a3b8; } .ic-dot-yellow { fill: #eab308; } .ic-dot-red { fill: #ef4444; }
.ic-dot-blue { fill: #3b82f6; } .ic-dot-orange { fill: #f97316; } .ic-dot-purple { fill: #a855f7; }
.tick .ic, .tc-tick .ic { width: 15px; height: 15px; vertical-align: -0.25em; }
.tick, .tc-tick { letter-spacing: 0; }
.ic-circle-check { color: #22c55e; }
.ic-triangle-alert { color: #f59e0b; }
.ic-circle-x { color: #ef4444; }
.toast .ic { margin-right: 2px; }
