:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e2740;
  --border: #2a3552;
  --text: #e8ecf5;
  --muted: #8b97b3;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

body { display: flex; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
}

.brand { font-size: 18px; font-weight: 700; padding: 0 8px 20px; }

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-item.active { background: var(--panel-2); color: var(--text); }
.nav-item:disabled { opacity: 0.55; cursor: default; }
.soon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.content { flex: 1; overflow-y: auto; padding: 28px 32px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
h1 { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); margin: 0; max-width: 520px; }

.add-form { display: flex; gap: 8px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 12px; color: var(--muted); }
.add-form input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  width: 240px;
  font: inherit;
}
.add-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: var(--accent); color: var(--on-accent); }
.btn.danger:hover { border-color: var(--err); color: var(--err); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name { font-weight: 600; font-size: 15px; }
.card-phone { color: var(--muted); font-size: 13px; margin-top: 2px; }

.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge.connected { color: var(--ok); border-color: var(--ok); }
.badge.connecting, .badge.qr { color: var(--warn); border-color: var(--warn); }
.badge.disconnected { color: var(--muted); border-color: var(--border); }

.qr-box { background: #fff; border-radius: 10px; padding: 8px; align-self: center; }
.qr-box img { display: block; width: 240px; height: 240px; }
.qr-hint { font-size: 12px; color: var(--muted); text-align: center; }

.error { color: var(--err); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .btn { white-space: nowrap; }

.empty { color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; padding: 32px; text-align: center; }
.hidden { display: none !important; }

.notice { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; background: var(--panel); }
.notice.ok { border-color: var(--ok); }
.notice.err { border-color: var(--err); color: var(--err); }

.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.stats b { color: var(--text); }
.stats .warn b { color: var(--warn); }

.preview { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.preview td { padding: 4px 6px; border-bottom: 1px solid var(--panel-2); }
.preview-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

h2 { font-size: 15px; margin: 22px 0 10px; }
h2:first-child { margin-top: 0; }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; font-family: Consolas, monospace; font-size: 12px; line-height: 1.5; }
select option:disabled { color: var(--muted); }
.add-form input { width: 240px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.check input { width: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; background: var(--bg); }
.chip-opt input { width: auto; }
.chip-opt.off { opacity: 0.55; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.connected { background: var(--ok); }
em { color: var(--muted); font-style: normal; font-size: 12px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
.quick summary { cursor: pointer; color: var(--muted); }
.quick-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.preview-box { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; white-space: pre-wrap; line-height: 1.5; }
.preview-box audio { width: 100%; margin-top: 8px; }
.preview-box .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); display: block; margin-bottom: 4px; }
.badge.running { color: var(--ok); border-color: var(--ok); }
.badge.paused { color: var(--warn); border-color: var(--warn); }
.badge.finished { color: var(--accent); border-color: var(--accent); }
.badge.idle { color: var(--muted); border-color: var(--border); }
.bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); transition: width 0.3s; }
.events { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); max-height: 170px; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.events .ev { display: flex; gap: 8px; }
.events .ev time { flex-shrink: 0; color: var(--muted); }
.events .ok { color: var(--ok); }
.events .bad { color: var(--err); }
.events .mid { color: var(--warn); }
.reason { color: var(--warn); font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 7px; }
.btn:disabled { cursor: default; }
.btn.danger { color: var(--err); border-color: rgba(239, 68, 68, 0.4); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); border-color: var(--err); }
.push { margin-left: auto; }
.icon { flex-shrink: 0; }

.chip-head { display: flex; align-items: center; gap: 12px; }
.wa-badge { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex-shrink: 0; }
.wa-badge.connected { background: rgba(34, 197, 94, 0.16); color: var(--ok); }
.wa-badge.connecting, .wa-badge.qr { background: rgba(245, 158, 11, 0.14); color: var(--warn); }
.card.chip.connected { border-color: rgba(34, 197, 94, 0.45); }

.btn.conn-ok, .btn.conn-ok:disabled { background: #16a34a; border-color: #16a34a; color: #fff; opacity: 1; }
.btn.conn-off { background: #4b5563; border-color: #4b5563; color: #fff; }
.btn.conn-off:hover { background: #5b6472; border-color: #5b6472; }
.btn.conn-busy, .btn.conn-busy:disabled { background: transparent; border-color: var(--warn); color: var(--warn); opacity: 1; }

dialog.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: min(440px, calc(100% - 40px)); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg p { white-space: pre-line; margin: 0 0 18px; line-height: 1.55; }
.dlg .row { justify-content: flex-end; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 8px; }

.test-out { font-size: 13px; color: var(--muted); }
.test-out.ok { color: var(--ok); font-weight: 600; }
.test-out.err { color: var(--err); font-weight: 600; }

/* ---- layout de celular: barra de cima, conteúdo no meio, abas embaixo ---- */
body { flex-direction: column; }
.content { min-height: 0; padding: 24px 28px; }
.content > section { max-width: 1180px; margin: 0 auto; }

.topbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar .brand { padding: 0; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.avatar-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; display: grid; place-items: center; overflow: hidden; cursor: pointer; }
.avatar-btn:hover { border-color: var(--accent); }
.avatar-btn img, .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 38px; overflow: hidden; border: 3px solid var(--border); }
.avatar.xl { width: 132px; height: 132px; font-size: 52px; }

.tabbar { flex: 0 0 auto; display: flex; justify-content: center; gap: 4px; padding: 8px 12px 10px; background: var(--panel); border-top: 1px solid var(--border); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; padding: 8px 12px; border: 0; border-radius: 16px; background: none; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.tab.active .tab-icon { color: var(--accent); }
.tab-icon { display: grid; place-items: center; height: 26px; }
@media (max-width: 760px) { .tab { min-width: 0; flex: 1; padding: 8px 4px; font-size: 10px; } .content { padding: 18px 16px; } }

/* ---- tela do PIN ---- */
.lock { position: fixed; inset: 0; z-index: 1000; background: radial-gradient(circle at 50% 15%, var(--glow) 0%, var(--bg) 62%); display: flex; align-items: center; justify-content: center; }
.lock.hidden { display: none; }
.lock-card { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(340px, 90vw); }
.lock-hello { font-size: 20px; font-weight: 700; margin-top: 4px; }
.lock-sub { color: var(--muted); }
.pin-dots { display: flex; gap: 14px; margin: 12px 0 0; height: 16px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dot.on { background: var(--accent); border-color: var(--accent); }
.lock-error { min-height: 20px; color: var(--err); font-size: 13px; text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; margin-top: 4px; }
.key { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 26px; cursor: pointer; }
.key:hover:not(:disabled) { background: var(--panel-2); border-color: var(--accent); }
.key:active:not(:disabled) { transform: scale(0.94); }
.key:disabled { opacity: 0.4; cursor: default; }
.key.back { font-size: 22px; background: none; border-color: transparent; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.lock-card.shake { animation: shake 0.4s; }

/* ---- perfil ---- */
.profile-card { flex-direction: row; align-items: center; gap: 28px; flex-wrap: wrap; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-form { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 12px; }

/* ---- menu com 8 abas ---- */
.tab { min-width: 84px; }

/* ---- feed ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.tile-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tile.ok .tile-value { color: var(--ok); }
.tile.warn .tile-value { color: var(--warn); }
.tile.err .tile-value { color: var(--err); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item { display: flex; align-items: flex-start; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.feed-badge { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: rgba(34, 197, 94, 0.14); color: var(--ok); }
.feed-item.warn .feed-badge { background: rgba(245, 158, 11, 0.14); color: var(--warn); }
.feed-item.err .feed-badge { background: rgba(239, 68, 68, 0.14); color: var(--err); }
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-weight: 600; }
.feed-detail { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed-time { color: var(--muted); font-size: 12px; white-space: nowrap; padding-top: 2px; }

/* ---- notícias ---- */
.topics { display: flex; gap: 8px; flex-wrap: wrap; }
.topic { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 5px 6px 5px 12px; }
.topic.small { padding: 2px 9px; font-size: 11.5px; color: var(--muted); }
.topic-x { border: 0; background: var(--panel-2); color: var(--muted); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; font-size: 15px; }
.topic-x:hover:not(:disabled) { color: var(--err); }
.topic-x:disabled { opacity: 0.35; cursor: default; }
.panel .row input { flex: 1; min-width: 200px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.news-card { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.news-card:hover { border-color: var(--accent); }
.news-title { font-weight: 600; line-height: 1.35; }
.news-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: auto; }

/* ---- ferramentas / diagnóstico ---- */
.diag-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.diag-line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; }
.diag-label { font-weight: 600; flex-shrink: 0; }
.diag-detail { color: var(--muted); text-align: right; }
.diag-line.ok .diag-detail { color: var(--ok); }
.diag-line.err .diag-detail { color: var(--err); }

/* ---- categorias ---- */
.cat-card { padding: 0; overflow: hidden; border-left: 3px solid var(--cat-color, var(--border)); }
.cat-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.cat-head:hover { background: var(--panel-2); }
.avatar.sm.cat-avatar { width: 44px; height: 44px; font-size: 17px; border: none; background: var(--cat-color, var(--panel-2)); color: #fff; flex-shrink: 0; }
.cat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.cat-badge.on { color: var(--ok); border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }
.cat-badge.off { opacity: 0.7; }
.cat-icon-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.cat-icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--panel-2); }
.cat-icon-btn.danger:hover { color: var(--err); border-color: var(--err); }
.cat-icon-btn.cat-toggle svg { transition: transform 0.2s; }
.cat-icon-btn.cat-toggle.open svg { transform: rotate(180deg); }

.cat-editor { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--border); margin-top: 2px; padding-top: 16px; }
.cat-tabs { display: flex; gap: 6px; }
.cat-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: none; background: var(--bg); color: var(--muted); font: inherit; cursor: pointer; }
.cat-tab.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); }
.cat-tab-panel { display: flex; flex-direction: column; gap: 6px; margin-top: -1px; }
.cat-tab-panel.hidden { display: none; }
.cat-tab-panel textarea { border-radius: 0 8px 8px 8px; }
.char-count { align-self: flex-end; font-size: 11.5px; color: var(--muted); }

/* ================= TEMAS ================= */
:root {
  color-scheme: dark;
  --accent-2: #6366f1;
  --on-accent: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --glow: #16233b;
  --shadow: rgba(0, 0, 0, 0.55);
}

/* padrão: preto e verde, as cores do ícone do DipZap */
:root[data-theme="dipzap"] {
  --bg: #070d09; --panel: #0e1712; --panel-2: #15231b; --border: #223a2c;
  --text: #e8f6ee; --muted: #86a393;
  --accent: #1fd965; --accent-2: #0ea34a; --on-accent: #04140a; --glow: #0f2a1a;
}
/* Blue Night: azul suave, mais claro que o antigo */
:root[data-theme="azul"] {
  --bg: #18202f; --panel: #212b3f; --panel-2: #2a3650; --border: #3a4863;
  --text: #eaf0fb; --muted: #9db0cd;
  --accent: #6aa7ff; --accent-2: #8b9bff; --on-accent: #0b1630; --glow: #233657;
}
:root[data-theme="roxo"] {
  --bg: #0d0a18; --panel: #161127; --panel-2: #1f1838; --border: #322857;
  --text: #ece8fa; --muted: #9a90bd;
  --accent: #8b5cf6; --accent-2: #ec4899; --on-accent: #fff; --glow: #241845;
}
/* Foco: cinza-azulado com dourado suave */
:root[data-theme="dourado"] {
  --bg: #1d2331; --panel: #262d3e; --panel-2: #2f374b; --border: #414a60;
  --text: #f3efe6; --muted: #a7adbb;
  --accent: #e3bf6a; --accent-2: #cfa24a; --on-accent: #2a2208; --glow: #2b3347;
}
/* Black Life: carvão suave (não é preto puro) com detalhe lilás-prata */
:root[data-theme="black"] {
  --bg: #17171a; --panel: #1f1f23; --panel-2: #28282d; --border: #38383f;
  --text: #eeeef2; --muted: #9d9da8;
  --accent: #b7b9e6; --accent-2: #9aa0d8; --on-accent: #14141c; --glow: #232329;
}
/* Pink Source: rosa claro e delicado */
:root[data-theme="pink"] {
  color-scheme: light;
  --bg: #fdf1f5; --panel: #ffffff; --panel-2: #fbe4ec; --border: #f1c8d7;
  --text: #3a2430; --muted: #8a6677;
  --accent: #d9608c; --accent-2: #ee8fb0; --on-accent: #fff; --glow: #fbd9e5;
  --shadow: rgba(200, 90, 130, 0.22);
}
/* Dog Pack: branco, com patinhas cinza-escuro */
:root[data-theme="dog"] {
  color-scheme: light;
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f3f4f6; --border: #dfe1e6;
  --text: #25272d; --muted: #6b6f78;
  --accent: #4b4f58; --accent-2: #6b7079; --on-accent: #fff; --glow: #f1f2f4;
  --shadow: rgba(60, 64, 72, 0.18);
  --paws: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170' viewBox='0 0 170 170'%3E%3Cg transform='translate(34 40) rotate(-20)'%3E%3Cg fill='%233f434b' fill-opacity='0.11'%3E%3Cellipse cx='0' cy='6' rx='9' ry='7.5'/%3E%3Cellipse cx='-11' cy='-5' rx='3.6' ry='4.8'/%3E%3Cellipse cx='-4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='11' cy='-5' rx='3.6' ry='4.8'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate(122 112) rotate(22)'%3E%3Cg fill='%233f434b' fill-opacity='0.11'%3E%3Cellipse cx='0' cy='6' rx='9' ry='7.5'/%3E%3Cellipse cx='-11' cy='-5' rx='3.6' ry='4.8'/%3E%3Cellipse cx='-4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='11' cy='-5' rx='3.6' ry='4.8'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="dog"] body { background: var(--paws), radial-gradient(1100px 480px at 50% -8%, var(--glow), var(--bg) 62%) fixed, var(--bg); }
:root[data-theme="dog"] .panel, :root[data-theme="dog"] .card, :root[data-theme="dog"] .tile { background-image: var(--paws); background-size: 150px; }
:root[data-theme="dog"] .brand::after { content: ""; display: inline-block; width: 22px; height: 22px; margin-left: 8px; vertical-align: middle; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-16 -18 32 32'%3E%3Cg fill='%233f434b' fill-opacity='1'%3E%3Cellipse cx='0' cy='6' rx='9' ry='7.5'/%3E%3Cellipse cx='-11' cy='-5' rx='3.6' ry='4.8'/%3E%3Cellipse cx='-4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='4' cy='-12' rx='3.8' ry='5'/%3E%3Cellipse cx='11' cy='-5' rx='3.6' ry='4.8'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
:root[data-theme="claro"] {
  color-scheme: light;
  --bg: #f2f4f8; --panel: #ffffff; --panel-2: #eaeef5; --border: #d5dce8;
  --text: #172033; --muted: #5d6a82;
  --accent: #2563eb; --accent-2: #4f46e5; --on-accent: #fff; --glow: #dbe6fb;
  --shadow: rgba(30, 50, 90, 0.22);
}

/* acabamento: profundidade e brilho suave */
body { background: radial-gradient(1100px 480px at 50% -8%, var(--glow), var(--bg) 62%) fixed, var(--bg); }
.topbar, .tabbar { background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.card, .panel, .tile, .news-card { box-shadow: 0 12px 28px -18px var(--shadow); }
.card, .news-card, .tile { transition: border-color 0.15s, transform 0.15s; }
.card:hover, .news-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.btn.primary:hover { filter: brightness(1.1); }
.tab.active .tab-icon { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent)); }
h1 { letter-spacing: -0.01em; }

/* seletor de tema (Perfil > Aparência) */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.theme-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch { position: relative; height: 62px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(128, 128, 128, 0.25); }
.theme-swatch .sw-panel { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 26px; border-radius: 6px; }
.theme-swatch .sw-accent { position: absolute; left: 14px; bottom: 14px; width: 40px; height: 14px; border-radius: 999px; }
.theme-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.theme-name .check { color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---- ícone de mensagens no topo: azul claro quando há conversa não lida ---- */
.chat-btn { position: relative; }
.chat-btn.has-unread { color: #38bdf8; border-color: #38bdf8; background: rgba(56, 189, 248, 0.14); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14); }
.chat-badge { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #38bdf8; color: #04202e; font-size: 11px; font-weight: 800; line-height: 1; display: grid; place-items: center; border: 2px solid var(--panel); }
.chat-badge.hidden { display: none; }

/* ---- tela de mensagens ---- */
#view-chats { height: 100%; flex-direction: column; }
#view-chats:not(.hidden) { display: flex; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.chat-head h1 { margin: 0; }
.chat-filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chat-filters select { width: auto; min-width: 190px; }
.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; gap: 14px; }
.chat-list-pane, .chat-thread-pane { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-list-pane { padding: 10px; gap: 10px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.chat-empty { color: var(--muted); text-align: center; padding: 28px 14px; line-height: 1.5; }
.chat-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chat-item .avatar.sm { width: 40px; height: 40px; font-size: 16px; }
.chat-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-item-top, .chat-item-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.chat-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-name { color: #38bdf8; }
.chat-item-time { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.chat-item-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-last { color: var(--text); }
.chat-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #38bdf8; color: #04202e; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.chat-chip-tag { align-self: flex-start; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.chat-thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.chat-thread-head.hidden { display: none; }
.chat-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-thread:empty::before { content: 'Escolha uma conversa à esquerda.'; color: var(--muted); margin: auto; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; margin: 8px 0; }
.bubble { max-width: min(560px, 78%); padding: 8px 12px 6px; border-radius: 14px; display: flex; flex-direction: column; gap: 2px; line-height: 1.45; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-time { align-self: flex-end; font-size: 10.5px; opacity: 0.65; }
.bubble.them { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-bottom-right-radius: 4px; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--border); }
.chat-form.hidden { display: none; }
.chat-form textarea { flex: 1; resize: none; font-family: inherit; font-size: 14px; }
.chat-thread-pane .notice { margin: 0 12px 12px; }
@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; grid-template-rows: 240px 1fr; } }

/* ---- WhatsApp Web embutido ---- */
.ww-card-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ww-card-text { flex: 1; min-width: 260px; }
.ww-card-text h2 { margin: 0 0 4px; }
.ww-card .wa-badge { width: 46px; height: 46px; }
.ww-card .wa-badge.on { background: rgba(34, 197, 94, 0.16); color: var(--ok); }
.ww-status { margin-top: 6px; font-size: 13px; color: var(--muted); }
.ww-status.ok { color: var(--ok); font-weight: 600; }
#view-whatsweb { height: 100%; flex-direction: column; }
#view-whatsweb:not(.hidden) { display: flex; }
.ww-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.ww-head h1 { margin: 0 0 2px; }
.ww-host { flex: 1; min-height: 360px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); display: grid; place-items: center; color: var(--muted); }
.chat-thread-head .btn.push { margin-left: auto; }

.call-choices { flex-wrap: wrap; justify-content: flex-end; }
#ww-call-note { margin: 6px 0 0; max-width: 760px; font-size: 13px; }

.tick { font-size: 11px; letter-spacing: -2px; margin-left: 2px; opacity: 0.75; }
.tick.read { color: #38bdf8; opacity: 1; font-weight: 700; }
.tick.err { color: var(--err); opacity: 1; font-weight: 700; letter-spacing: 0; }
.chat-item-last .tick { margin-right: 4px; }

.chat-form { position: relative; flex-wrap: wrap; }
.icon-btn { padding: 8px 10px; font-size: 18px; line-height: 1; align-self: flex-end; }
.chat-attach { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); font-size: 13px; }
.chat-attach .attach-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 15px; }
.chat-emoji { position: absolute; bottom: 100%; left: 8px; z-index: 5; width: 300px; display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.chat-emoji.hidden, .chat-attach.hidden { display: none; }
.emoji-btn { background: none; border: 0; cursor: pointer; font-size: 20px; padding: 3px 4px; border-radius: 6px; }
.emoji-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

.chat-rec { color: var(--text); }
.chat-rec .rec-dot { color: #ef4444; animation: recblink 1s infinite; }
@keyframes recblink { 50% { opacity: 0.25; } }
#chat-mic.recording { background: #ef4444; color: #fff; }
.bubble-img { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; cursor: zoom-in; }
.bubble-audio { width: 240px; max-width: 100%; height: 40px; }
.bubble-sticker { width: 150px; height: 150px; object-fit: contain; display: block; }
.bubble.sticker { background: transparent; border-color: transparent; }
.bubble-file { align-self: flex-start; text-align: left; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }

/* etiquetas e Kanban */
.tag-chip { --tag: var(--accent); display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--tag) 24%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 70%, transparent); white-space: nowrap; }
.tag-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 11px; padding: 0 0 0 2px; opacity: 0.7; }
.tag-dot { --tag: var(--accent); width: 9px; height: 9px; border-radius: 50%; background: var(--tag); display: inline-block; }
.stage-mini { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.chat-item-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.chat-crm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.chat-crm.hidden { display: none; }
.chat-crm select { max-width: 170px; }
.chat-crm-tags { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tag-add-wrap { position: relative; }
.tag-add { padding: 4px 10px; font-size: 12.5px; }
.tag-pop { position: absolute; top: 100%; right: 0; z-index: 20; width: 260px; margin-top: 6px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 10px 28px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 8px; }
.tag-pop-list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.tag-pop-row { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); padding: 5px 6px; border-radius: 8px; cursor: pointer; text-align: left; font: inherit; }
.tag-pop-row:hover { background: var(--panel-2); }
.tag-pop-manage { align-self: flex-start; font-size: 12.5px; }
.tag-dlg { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: min(460px, 92vw); }
.tag-dlg::backdrop { background: rgba(0,0,0,.6); }
.tag-dlg-body { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 50vh; overflow: auto; }
.tag-row { display: flex; gap: 8px; align-items: center; }
.tag-row input[type="text"] { flex: 1; }
.tag-row input[type="color"] { width: 38px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.kb-board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kb-col { --stage: var(--muted); flex: 0 0 248px; background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--stage); border-radius: 12px; display: flex; flex-direction: column; min-height: 260px; }
.kb-col.over { background: color-mix(in srgb, var(--stage) 14%, var(--panel)); outline: 2px dashed var(--stage); }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; }
.kb-col-title { flex: 1; }
.kb-col-head input { flex: 1; min-width: 0; }
.kb-count { font-size: 12px; background: var(--panel-2); border-radius: 999px; padding: 1px 9px; color: var(--muted); }
.kb-edit { background: none; border: 0; color: var(--muted); cursor: pointer; }
.kb-col-body { display: flex; flex-direction: column; gap: 8px; padding: 0 10px 10px; min-height: 80px; }
.kb-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 22px 6px; border: 1px dashed var(--border); border-radius: 10px; }
.kb-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 5px; cursor: grab; }
.kb-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.kb-card.dragging { opacity: 0.4; }
.kb-card.unread { border-color: #38bdf8; }
.kb-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.kb-card-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-card-phone, .kb-card-foot { font-size: 11.5px; color: var(--muted); }
.kb-card-last { font-size: 12.5px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.name-edit { background: none; border: 0; color: var(--text); font: inherit; font-weight: 700; padding: 0; cursor: pointer; text-align: left; }
.name-edit:hover { color: var(--accent); }
.name-pencil { font-size: 12px; opacity: 0.55; }
.name-stars { color: #f59e0b; font-size: 12px; margin-left: 6px; letter-spacing: 1px; }
.kb-card .name-stars { margin-left: 0; }
.contact-dlg { display: flex; flex-direction: column; gap: 12px; }
.contact-dlg[open] { display: flex; }
.contact-field { display: flex; flex-direction: column; gap: 4px; }
.contact-more { display: flex; flex-direction: column; gap: 8px; }
.contact-more.hidden { display: none; }
.contact-rows { display: flex; flex-direction: column; gap: 8px; max-height: 32vh; overflow: auto; }
.rating { display: flex; gap: 2px; }
.star { background: none; border: 0; cursor: pointer; font-size: 26px; color: var(--border); padding: 0 2px; line-height: 1; }
.star.on { color: #f59e0b; }

.rating { align-items: center; }
.rating-text { margin-left: 10px; font-size: 13px; color: var(--muted); }

.phone-link { background: none; border: 0; padding: 0; font: inherit; color: #38bdf8; text-decoration: underline; cursor: pointer; }
.phone-link:hover { color: var(--accent); }
.contact-card { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
.contact-card-icon { font-size: 26px; }
.contact-card-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.subtab { background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.quick-list { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; }
.quick-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.quick-pop { position: absolute; bottom: 100%; left: 8px; right: 8px; z-index: 6; max-height: 260px; overflow: auto; display: flex; flex-direction: column; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.quick-pop.hidden { display: none; }
.quick-item { display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.quick-item.active, .quick-item:hover { background: var(--accent-soft); }
.quick-none { padding: 10px; font-size: 13px; }

.chat-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chat-head h1 { margin: 0; }
.chat-head .chat-filters { margin-left: auto; }

.sched-dlg { width: min(560px, 94vw); max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.sched-dlg[open] { display: flex; }
.cal { display: flex; flex-direction: column; gap: 8px; }
.cal-modes { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; }
.cal-title { text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-day { aspect-ratio: 1; min-height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; }
.cal-day:hover:not(:disabled) { border-color: var(--accent); }
.cal-day:disabled { opacity: 0.3; cursor: default; }
.cal-day.today { border-color: color-mix(in srgb, var(--accent) 70%, transparent); font-weight: 700; }
.cal-day.on { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); font-weight: 700; }
.cal-summary { font-weight: 600; }
.sched-ai { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; }
.sched-ai.hidden { display: none; }
.sched-list { display: flex; flex-direction: column; gap: 10px; }
.sched-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.sched-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sched-status { font-size: 12.5px; color: var(--muted); }
.sched-status.ok { color: #22c55e; }
.sched-status.warn { color: #f59e0b; }
.sched-text { white-space: pre-wrap; }

.sched-dlg textarea { min-height: 110px; flex-shrink: 0; }
.cal-day { aspect-ratio: auto; height: 40px; min-height: 0; }
.sched-dlg > * { flex-shrink: 0; }

.sched-seq-edit { display: flex; flex-direction: column; gap: 10px; }
.sched-seq-edit.hidden, .sched-dlg textarea.hidden { display: none; }
.sched-seq { display: flex; flex-direction: column; gap: 4px; }

.sgroup { margin: 14px 0 4px; font-size: 15px; }
.sgroup.pending { color: #f59e0b; }
.sgroup.sent { color: #22c55e; }
.sgroup.other { color: var(--muted); }
.sline { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--muted); }
.sline.pending { border-left-color: #f59e0b; }
.sline.sent { border-left-color: #22c55e; }
.sline-when, .sline-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sline-who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sline-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); }
.sline-badge.pending { color: #f59e0b; background: color-mix(in srgb, #f59e0b 16%, transparent); border-color: #f59e0b; }
.sline-badge.sent { color: #22c55e; background: color-mix(in srgb, #22c55e 16%, transparent); border-color: #22c55e; }
.detail-line { display: flex; flex-direction: column; gap: 2px; }
.detail-msg { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
@media (max-width: 700px) { .sline { grid-template-columns: 1fr auto; } }

.panel.hidden { display: none; }

.contacts-list { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.contact-letter { margin-top: 10px; padding: 2px 4px; font-weight: 800; color: var(--accent); border-bottom: 1px solid var(--border); }
.contact-row { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font: inherit; cursor: pointer; }
.contact-row:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.contact-row:disabled { opacity: 0.55; cursor: default; }
.contact-row-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.contact-row-top { display: flex; align-items: center; gap: 8px; }
.contact-row-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 45%; }

.saved-check { color: #22c55e; font-weight: 800; font-size: 0.95em; }
.toast { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; align-items: center; gap: 4px; padding: 10px 18px; border-radius: 999px; background: var(--panel); color: var(--text); border: 1px solid #22c55e; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-weight: 600; animation: toastin .25s ease-out; transition: opacity .4s; }
.toast.out { opacity: 0; }
.toast-check { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #22c55e; color: #fff; font-weight: 800; font-size: 14px; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 4px; }
.radio-card div { display: flex; flex-direction: column; gap: 3px; }
.voice-bg { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: -4px 0 4px 34px; }
.voice-bg.hidden { display: none; }
.voice-bg .field { min-width: 240px; }
.voice-test-out { display: flex; flex-direction: column; gap: 6px; }

.voice-bg-file { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-basis: 100%; }

.quick-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quick-file-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--border); max-width: 100%; }
.quick-file-chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.quick-file-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.quick-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.disparo-menu { position: fixed; z-index: 50; display: flex; gap: 4px; padding: 8px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 -8px 28px rgba(0,0,0,.4); animation: dmup .14s ease-out; }
.disparo-menu.hidden { display: none; }
.sub-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; padding: 8px 12px; border: 0; border-radius: 14px; background: none; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; }
.sub-item:hover { color: var(--text); background: var(--panel-2); }
.sub-item.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.sub-item.active .tab-icon { color: var(--accent); }
@keyframes dmup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) { .disparo-menu { left: 8px !important; right: 8px; } .sub-item { min-width: 0; flex: 1; padding: 8px 4px; font-size: 10px; } }

/* ---- Maturador ---- */
.mat-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mat-big { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform .12s, border-color .12s; }
.mat-big:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 65%, transparent); }
.mat-big-icon { font-size: 28px; }
.mat-state { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mat-badge { font-weight: 700; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.mat-badge.on { color: #22c55e; border-color: #22c55e; background: color-mix(in srgb, #22c55e 14%, transparent); }
.mat-badge.done { color: #38bdf8; border-color: #38bdf8; }
.mat-count-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.mat-count { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.mat-bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.mat-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.mat-last { display: flex; flex-direction: column; gap: 4px; }
.mat-last-text { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.mat-chips { display: flex; flex-direction: column; gap: 10px; }
.mat-chip { display: grid; grid-template-columns: 1fr minmax(180px, 260px); gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); }
.mat-chip.on { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: var(--accent-soft); }
.mat-chip-pick { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.mat-chip-info { display: flex; flex-direction: column; gap: 2px; }
.mat-used { font-size: 12.5px; color: #f59e0b; }
@media (max-width: 700px) { .mat-chip { grid-template-columns: 1fr; } }

/* ---- Maturador: animação das Informações ---- */
.mat-info { gap: 22px; }
.info-step { display: flex; gap: 16px; opacity: 0; transform: translateY(14px); }
.mat-info.play .info-step { animation: infoin .6s ease-out forwards; animation-delay: calc(var(--d) * 0.9s); }
@keyframes infoin { to { opacity: 1; transform: none; } }
.info-num { flex: 0 0 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--on-accent, #fff); background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
.mat-info.play .info-num { animation: numpulse 2s ease-out calc(var(--d) * 0.9s + .5s) 1; }
@keyframes numpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 65%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.info-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.info-body h3 { margin: 4px 0 0; }
.info-body p { margin: 0; }
.info-phones, .info-people { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.info-phones .ph { display: flex; flex-direction: column; align-items: center; font-size: 34px; opacity: 0; }
.info-phones .ph small { font-size: 12px; color: var(--muted); }
.mat-info.play .info-phones .ph { animation: pop .5s ease-out forwards; animation-delay: calc(var(--d, 0) * .9s + var(--i) * .3s + .5s); }
.info-step[data-d="0"] .ph { --d: 0; }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 70% { transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }
.person { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border); opacity: 0; }
.person small { color: var(--muted); font-size: 12px; }
.avatar-dot { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #0b0b0b; background: var(--c); }
.mat-info.play .person { animation: pop .5s ease-out forwards; animation-delay: calc(1.8s + var(--i) * .35s + .5s); }
.info-chat { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border); max-width: 460px; min-height: 230px; }
.info-chat .b, .info-chat .typing { max-width: 78%; padding: 8px 12px; border-radius: 14px; opacity: 0; }
.info-chat .left { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.info-chat .right { align-self: flex-end; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-bottom-right-radius: 4px; }
.info-chat .typing { display: none; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.mat-info.play .info-chat .b1 { animation: bubble .4s ease-out 2.6s forwards; }
.mat-info.play .info-chat .typing { animation: typing 1.2s ease-out 3.3s both; }
.mat-info.play .info-chat .b2 { animation: bubble .4s ease-out 4.5s forwards; }
.mat-info.play .info-chat .b3 { animation: bubble .4s ease-out 5.6s forwards; }
.mat-info.play .info-chat .b4 { animation: bubble .4s ease-out 6.8s forwards; }
@keyframes bubble { from { opacity: 0; transform: translateY(8px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes typing { 0% { display: flex; opacity: 0; } 10%, 85% { display: flex; opacity: 1; } 100% { display: none; opacity: 0; } }
.info-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); max-width: 460px; }
.info-bars span { flex: 1; height: 0; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent)); }
.mat-info.play .info-bars span { animation: grow .7s ease-out forwards; animation-delay: calc(3.6s + var(--i) * .22s + .5s); }
@keyframes grow { to { height: var(--h); } }
.info-axis { display: flex; justify-content: space-between; max-width: 460px; color: var(--muted); font-size: 12.5px; }
.info-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.info-list li { opacity: 0; transform: translateX(-10px); }
.mat-info.play .info-step:nth-of-type(5) .info-list li { animation: slidein .45s ease-out forwards; animation-delay: calc(4.5s + var(--i) * .35s + .5s); }
.mat-info.play .info-step:nth-of-type(6) .info-list li { animation: slidein .45s ease-out forwards; animation-delay: calc(5.4s + var(--i) * .35s + .5s); }
@keyframes slidein { to { opacity: 1; transform: none; } }


.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.sound-card { display: flex; align-items: stretch; border: 2px solid var(--border); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
.sound-card.active { border-color: var(--accent); background: var(--accent-soft); }
.sound-pick { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sound-play { border-radius: 0; border: 0; border-left: 1px solid var(--border); padding: 0 14px; }
.notify-vol { flex: 0 0 220px; }

.ww-chip-name { color: var(--accent); font-weight: 600; }
.ww-chip-pick { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.ww-chip-pick select { min-width: 220px; }
.ww-chip-btn.on { color: #22c55e; border-color: #22c55e; }
.ww-chip-btn.on::after { content: " ✓"; }

.chip-pill { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 1px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); white-space: nowrap; }
.chip-pill.off { color: var(--muted); background: transparent; border-color: var(--border); }
.chat-item-namewrap { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.chat-item-namewrap .chat-item-name { min-width: 0; flex: 0 1 auto; }
.chat-item-namewrap .chip-pill { flex: 0 0 auto; }
.kb-card-name .chip-pill { margin-left: 2px; }

.quick-ai { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-ai input { flex: 1; min-width: 220px; }

.alert-btn { position: relative; }
.alert-btn.has-alerts { color: #f59e0b; border-color: #f59e0b; background: rgba(245, 158, 11, 0.14); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14); }
.alert-badge { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #f59e0b; color: #1f1300; font-size: 11px; font-weight: 800; line-height: 1; display: grid; place-items: center; border: 2px solid var(--panel); }
.alerts-pop { position: fixed; top: 64px; right: 70px; z-index: 60; width: min(440px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 14px 34px rgba(0,0,0,.4); }
.alert-title { font-size: 15px; }
.alert-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid #f59e0b; }
.alert-row.err { border-left-color: #ef4444; }
.alert-row.info { border-left-color: #38bdf8; }
.alert-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #1f1300; background: #f59e0b; }
.alert-row.err .alert-dot { background: #ef4444; color: #fff; }
.alert-row.info .alert-dot { background: #38bdf8; color: #04202e; }
.alert-text { font-size: 13px; }
.alert-ok { padding: 14px; text-align: center; color: #22c55e; font-weight: 600; }

/* aviso de conexões: vermelho */
.alert-btn.has-alerts { color: #ef4444; border-color: #ef4444; background: rgba(239, 68, 68, 0.14); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }
.alert-badge { background: #ef4444; color: #fff; }
.conn-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid #22c55e; }
.conn-row.bad { border-left-color: #ef4444; }
.conn-name { grid-column: 1 / -1; }
.conn-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.conn-pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); }
.conn-pill.good { color: #22c55e; border-color: #22c55e; background: color-mix(in srgb, #22c55e 12%, transparent); }
.conn-pill.bad { color: #ef4444; border-color: #ef4444; background: color-mix(in srgb, #ef4444 12%, transparent); }
.conn-pill.neutral { color: var(--muted); }
.conn-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.conn-head { display: flex; flex-direction: column; gap: 2px; }
.conn-row { grid-template-columns: 1fr; }
.conn-both { color: #ef4444; font-weight: 600; font-size: 12.5px; }
.conn-line { display: grid; grid-template-columns: 12px 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 0; }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.conn-line.good .conn-dot { background: #22c55e; }
.conn-line.bad .conn-dot { background: #ef4444; }
.conn-line.bad .conn-status { color: #ef4444; font-weight: 600; }
.conn-line.good .conn-status { color: #22c55e; }
.conn-line.neutral .conn-status { color: var(--muted); }

.alerts-pop { width: min(480px, calc(100vw - 24px)); }
.conn-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chat na barra de baixo: contador de não lidas e destaque em azul claro */
.tab-chat { position: relative; }
.tab-chat .chat-badge { top: 2px; right: calc(50% - 30px); border-color: var(--panel); }
.tab-chat.has-unread { color: #38bdf8; }
.tab-chat.has-unread .tab-icon { color: #38bdf8; }
.tab-chat.has-unread.active { background: rgba(56, 189, 248, 0.14); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45); }

.tag-new { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.tag-new-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag-new-row input[type="text"] { flex: 1; min-width: 220px; }
input[type="color"] { width: 42px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.tag-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swatch.on { border-color: var(--text); transform: scale(1.12); }
.swatch:hover { transform: scale(1.12); }
.tag-list { display: flex; flex-direction: column; gap: 8px; }
.tag-edit-row { display: grid; grid-template-columns: 42px minmax(160px, 1fr) auto auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.tag-used { font-size: 12.5px; white-space: nowrap; }
.tag-edit-msg { min-width: 90px; font-size: 12.5px; }
@media (max-width: 800px) { .tag-edit-row { grid-template-columns: 42px 1fr; } }

/* ---- Pós-vendas ---- */
.ps-lists { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.ps-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); border-left: 4px solid var(--muted); }
.ps-card.running { border-left-color: #22c55e; }
.ps-card.paused { border-left-color: #f59e0b; }
.ps-card.done { border-left-color: #38bdf8; }
.ps-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-kind { font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); }
.ps-kind.followup { color: #38bdf8; border-color: #38bdf8; }
.ps-kind.remarketing { color: #f59e0b; border-color: #f59e0b; }
.ps-counts { font-weight: 600; }
.ps-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--border); }
.ps-details summary { cursor: pointer; color: var(--muted); }
.ps-contact { font-size: 12.5px; padding: 2px 0; color: var(--muted); }
.ps-contact.sent { color: #22c55e; }
.ps-contact.failed { color: #ef4444; }
.ps-top { align-items: center; gap: 14px; }
.ps-top h2 { margin: 0; }
.ps-sec { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); }
.ps-sec h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.ps-sec h4 { margin: 8px 0 0; }
.ps-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent, #fff); font-size: 13px; }
.ps-choices { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ps-choice, .ps-kind-opt { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.ps-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.ps-kind-opt { border-radius: 12px; }
.ps-clients { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow: auto; }
.ps-client { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); cursor: pointer; }
.ps-client.off { opacity: 0.45; }
.ps-client-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.ps-tpls { display: flex; flex-direction: column; gap: 8px; }
.ps-tpl { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; }
.ps-tpl-n { color: var(--muted); font-weight: 700; padding-top: 8px; text-align: right; }
.ps-ai { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; }
.ps-ai-qtd { max-width: 140px; }
.ps-limits { display: flex; flex-direction: column; gap: 8px; }
.ps-limit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-limit input { width: 90px; }
.ps-actions { margin-top: 14px; gap: 10px; }

/* ---- Usuários ---- */
.user-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.user-form .field:first-child { flex: 1; min-width: 260px; }
.role-pick { display: flex; align-items: center; gap: 8px; }
.role-pick select { min-width: 150px; }
.role-badge { --role: var(--accent); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--role); background: color-mix(in srgb, var(--role) 16%, transparent); border: 1px solid color-mix(in srgb, var(--role) 55%, transparent); }
.role-badge.big { width: 46px; height: 46px; border-radius: 14px; }
.role-pill { --role: var(--accent); font-size: 12.5px; font-weight: 700; padding: 3px 12px; border-radius: 999px; color: var(--role); background: color-mix(in srgb, var(--role) 14%, transparent); border: 1px solid color-mix(in srgb, var(--role) 50%, transparent); }
.user-list { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.user-row { display: grid; grid-template-columns: 46px 1fr auto auto auto auto auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); }
.user-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-who strong { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .user-row { grid-template-columns: 46px 1fr; } }

/* ---- login e cargos ---- */
.login-form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
.login-form .lock-hello, .login-form .lock-sub { text-align: center; }
.login-logo { align-self: center; border-radius: 16px; }
.login-form input { padding: 12px 14px; font-size: 15px; }
.login-btn { padding: 12px; font-size: 15px; justify-content: center; }
.pin-box { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.lock-corner { position: absolute; right: 18px; bottom: 16px; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 8px 16px; font: inherit; cursor: pointer; }
.lock-corner:hover { color: var(--text); border-color: var(--accent); }
.lock-corner.hidden { display: none; }
html:not([data-role="master"]) .master-only { display: none !important; }
html[data-role="master"] .user-only { display: none !important; }
html[data-role="atendente"] .tab[data-view="numbers"], html[data-role="atendente"] .tab[data-view="maturador"], html[data-role="atendente"] #tab-disparo, html[data-role="atendente"] .tab[data-view="users"],
html[data-role="gerente"] .tab[data-view="maturador"], html[data-role="gerente"] .tab[data-view="users"], html[data-role="gerente"] .tab[data-view="ia"], html[data-role="atendente"] .tab[data-view="ia"],
html[data-role="gerente"] .sub-item[data-view="settings"], html[data-role="gerente"] .sub-item[data-view="tools"], html[data-role="gerente"] .sub-item[data-view="info"],
html[data-role="atendente"] #chat-settings-btn, html[data-role="gerente"] #chat-settings-btn { display: none !important; }

.user-list { max-width: 1000px; }
.view-user { white-space: nowrap; }
.user-dlg { width: min(460px, 94vw); display: flex; flex-direction: column; gap: 12px; }
.user-dlg[open] { display: flex; }
.user-dlg-head { display: flex; align-items: center; gap: 14px; }
.user-dlg-title { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.user-dlg-title h3 { margin: 0; overflow-wrap: anywhere; }
.user-dlg-fields { display: flex; flex-direction: column; gap: 8px; }
.user-dlg-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.user-dlg-row.empty strong { color: var(--muted); font-weight: 500; font-style: italic; }

.user-dlg-row { align-items: flex-start; text-align: left; }
.user-dlg { max-height: 92vh; overflow: auto; }

/* ---- Atalhos ---- */
.sc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.sc-card { position: relative; display: flex; flex-direction: column; gap: 8px; }
.sc-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px 10px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; transition: border-color .12s, transform .12s; }
.sc-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.sc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-logo { flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: #fff; border: 1px solid var(--border); font-weight: 800; color: #0b0b0b; }
.sc-logo img { width: 100%; height: 100%; object-fit: contain; padding: 15%; }
.sc-desc { margin: 0 8px; font-size: 13px; color: var(--muted); }
.sc-tools { position: absolute; top: 4px; right: 6px; display: none; gap: 4px; }
.sc-card:hover .sc-tools, .sc-card:focus-within .sc-tools { display: flex; }
.sc-tool { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; font-size: 12px; }
.sc-tool:hover { border-color: var(--accent); }
.sc-form { margin-top: 14px; }

/* cabeçalho de Mensagens: título + botões juntos; filtros à direita (e embaixo quando a janela é estreita) */
.chat-head { justify-content: flex-start; row-gap: 10px; column-gap: 14px; }
.chat-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chat-head .chat-filters { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---- planilha do disparo ---- */
.sheet-dlg { width: min(860px, 96vw); display: flex; flex-direction: column; gap: 12px; max-height: 94vh; }
.sheet-dlg[open] { display: flex; }
.sheet-totals { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-total { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.sheet-total strong { font-size: 20px; }
.sheet-wrap { overflow: auto; max-height: 46vh; border: 1px solid var(--border); border-radius: 12px; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet-table th { position: sticky; top: 0; background: var(--panel-2); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.sheet-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.sheet-chip { display: inline-block; min-width: 56px; text-align: center; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; border: 1px solid var(--border); }
.sheet-chip.ok { color: #22c55e; border-color: #22c55e; background: color-mix(in srgb, #22c55e 14%, transparent); }
.sheet-chip.bad { color: #ef4444; border-color: #ef4444; background: color-mix(in srgb, #ef4444 14%, transparent); }
.sheet-chip.run { color: #f59e0b; border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.sheet-chip.wait { color: var(--muted); }

/* ---- Informações do disparo (animação) ---- */
.dsp-tbl { max-width: 520px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
.dsp-row { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.dsp-row:last-child { border-bottom: 0; }
.dsp-head { color: var(--muted); font-weight: 700; }
.dsp-row .c-wa .sheet-chip, .dsp-row .c-en .sheet-chip { opacity: 0; }
.dsp-info.play .dsp-row[data-i] { animation: rowflash 1.3s ease-out calc(2.6s + var(--i) * 1.6s) 1; }
.dsp-info.play .dsp-row .c-wa .sheet-chip { animation: pop .45s ease-out calc(3.0s + var(--i) * 1.6s) forwards; }
.dsp-info.play .dsp-row .c-en .sheet-chip { animation: pop .45s ease-out calc(3.7s + var(--i) * 1.6s) forwards; }
@keyframes rowflash { 0%, 100% { background: transparent; } 20%, 70% { background: var(--accent-soft); } }
.dsp-wait { max-width: 520px; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.dsp-wait-label { font-size: 13px; color: var(--muted); }
.dsp-wait-bar { height: 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); overflow: hidden; }
.dsp-wait-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); }
.dsp-info.play .dsp-wait-bar i { animation: waitfill 3.2s ease-in-out 3.4s infinite; }
@keyframes waitfill { 0% { width: 0; } 85%, 100% { width: 100%; } }
.dsp-info.play .info-chat .b1 { animation-delay: 4.4s; }
.dsp-info.play .info-chat .typing { animation-delay: 5.1s; }
.dsp-info.play .info-chat .b2 { animation-delay: 6.3s; }
.dsp-info .info-chat { min-height: 150px; }
.dsp-info.play .info-step:nth-of-type(5) .info-list li { animation-delay: calc(5.4s + var(--i) * .35s + .5s); }
.dsp-info.play .info-step:nth-of-type(6) .info-list li { animation-delay: calc(6.3s + var(--i) * .35s + .5s); }
.dsp-info.play .info-phones .ph { animation-delay: calc(var(--i) * .3s + .5s); }

.chipdown { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; margin: 8px 0; border-radius: 12px; border: 1px solid #f59e0b; background: color-mix(in srgb, #f59e0b 12%, transparent); }
.chipdown-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Dog Pack: ícones de patinha/osso no lugar dos emojis dos botões, e o azul de "não lida" vira cinza-escuro */
.bi { display: none; }
:root[data-theme="dog"] .emo { display: none; }
:root[data-theme="dog"] .bi { display: inline-flex; vertical-align: middle; }
:root[data-theme="dog"] .bi svg { width: 17px; height: 17px; }
:root[data-theme="dog"] .mat-big-icon .bi svg { width: 30px; height: 30px; }
:root[data-theme="dog"] .chat-btn.has-unread { color: #3f434b; border-color: #3f434b; background: rgba(63, 67, 75, 0.1); box-shadow: 0 0 0 3px rgba(63, 67, 75, 0.1); }
:root[data-theme="dog"] .chat-badge, :root[data-theme="dog"] .chat-unread, :root[data-theme="dog"] .alert-row.info .alert-dot { background: #3f434b; color: #fff; }
:root[data-theme="dog"] .chat-item.unread .chat-item-name, :root[data-theme="dog"] .tab-chat.has-unread, :root[data-theme="dog"] .tab-chat.has-unread .tab-icon, :root[data-theme="dog"] .mat-badge.done, :root[data-theme="dog"] .ps-kind.followup { color: #3f434b; }
:root[data-theme="dog"] .mat-badge.done, :root[data-theme="dog"] .ps-kind.followup, :root[data-theme="dog"] .kb-card.unread { border-color: #3f434b; }
:root[data-theme="dog"] .alert-row.info, :root[data-theme="dog"] .ps-card.done { border-left-color: #3f434b; }
:root[data-theme="dog"] .tab-chat.has-unread.active { background: rgba(63, 67, 75, 0.1); box-shadow: inset 0 0 0 1px rgba(63, 67, 75, 0.45); }

/* ---- IA (atendimento automático) ---- */
.ai-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 14%, transparent); border: 1px solid color-mix(in srgb, #8b5cf6 55%, transparent); white-space: nowrap; }
.ai-pill.small { font-size: 10.5px; padding: 1px 7px; gap: 4px; }
.ai-pill.wait { color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); border-color: color-mix(in srgb, #f59e0b 55%, transparent); }
.ai-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 1px dashed color-mix(in srgb, #8b5cf6 55%, transparent); }
.ia-chips, .ia-channels { display: flex; flex-direction: column; gap: 10px; }
.ia-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.ia-chip-row .ia-chip-name { flex: 1 1 160px; font-weight: 700; }
.ia-chan { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.ia-chan > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.ia-chan-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.ia-chan-body textarea { min-height: 150px; }
.ia-test-out { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); white-space: pre-wrap; }
:root[data-theme="dog"] .ai-pill { color: #3f434b; background: rgba(63, 67, 75, 0.1); border-color: #3f434b; }
:root[data-theme="dog"] .ai-pill.wait { color: #b45309; border-color: #b45309; background: rgba(180, 83, 9, 0.1); }
:root[data-theme="dog"] .ai-box { border-color: #3f434b; }

/* ---- Backups das conversas ---- */
.bk-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.bk-pane { display: flex; flex-direction: column; gap: 14px; }
.bk-pane.hidden { display: none; }
.bk-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.bk-chips label { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); cursor: pointer; }
.bk-chips label small { display: block; color: var(--muted); }
.bk-txt-files { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.bk-txt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.bk-txt-row strong { flex: 1 1 200px; }
.bk-inactive-list { display: flex; flex-direction: column; gap: 10px; }
.bk-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.bk-card .bk-card-info { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.bk-viewer { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; }
.bk-viewer-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.bk-viewer-head input { flex: 1 1 240px; }
.bk-viewer-body { display: grid; grid-template-columns: 300px 1fr; height: min(62vh, 560px); }
.bk-convs { overflow-y: auto; border-right: 1px solid var(--border); }
.bk-conv { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; font: inherit; cursor: pointer; }
.bk-conv:hover, .bk-conv.active { background: var(--accent-soft); }
.bk-conv small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-thread { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.bk-hit { text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: inherit; font: inherit; cursor: pointer; }
.bk-hit small { color: var(--muted); display: block; }
@media (max-width: 800px) { .bk-viewer-body { grid-template-columns: 1fr; height: auto; } .bk-convs { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); } }

#view-backups input[type="checkbox"], #view-backups input[type="radio"] { width: auto; flex: none; margin: 0; }
#view-backups .check { display: flex; gap: 8px; align-items: center; }

.bk-bar { display: flex; flex-direction: column; gap: 6px; }
.bk-bar.hidden { display: none; }
.bk-bar progress { width: 100%; height: 16px; accent-color: var(--accent); }

/* ---- versão no navegador (servidor) ---- */
.web .desktop-only, .web #ww-sub, .web #ww-reload, .web #ww-disconnect, .web #ww-call-note { display: none !important; }
.ww-web-box { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px; max-width: 720px; }

/* ---- menu de ações da conversa ---- */
.ctx-menu { position: fixed; z-index: 60; min-width: 220px; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px var(--shadow, rgba(0, 0, 0, 0.4)); }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ctx-item:hover { background: var(--accent-soft); }
.ctx-item.danger { color: #ef4444; }
.state-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); }
.chat-more { flex: none; }

.verified-badge { vertical-align: -3px; }
.verified-note { font-size: 11.5px; color: #1d9bf0; font-weight: 700; }
.verified-toggle { font-size: 12.5px; margin: 6px 0 2px; color: var(--muted); }
.chip-pill .verified-badge { vertical-align: -2px; }
