/* AtomicLeads — dark-first, ultraleve */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #27DABC;
  --brand-hover: #3DE8CA;
  --brand-active: #1FC5A8;
  --bg: #100F14;
  --bg-card: #18171E;
  --bg-elev: #201F28;
  --bg-hover: #282732;
  --text: #F8F8FA;
  --text-2: #8B8BA3;
  --text-3: #5C5C73;
  --success: #34D399;
  --warning: #FBBF24;
  --error: #F87171;
  --info: #60A5FA;
  --border-1: rgba(255,255,255,0.06);
  --border-2: rgba(255,255,255,0.10);
  --border-brand: rgba(39,218,188,0.35);
  --msg-out-bg: #03312E;
  --msg-out-border: rgba(39,218,188,0.35);
  --shadow: rgba(0,0,0,.35);
}

/* Tema claro — mesmo layout, paleta invertida com contraste garantido */
:root[data-theme="light"] {
  --brand: #0D9488;
  --brand-hover: #0FA898;
  --brand-active: #0B7E76;
  --bg: #F2F2F5;
  --bg-card: #FFFFFF;
  --bg-elev: #EBEBEF;
  --bg-hover: #E1E1E8;
  --text: #17171C;
  --text-2: #4E4E63;
  --text-3: #77778C;
  --success: #067647;
  --warning: #B45309;
  --error: #DC2626;
  --info: #2563EB;
  --border-1: rgba(0,0,0,0.08);
  --border-2: rgba(0,0,0,0.14);
  --border-brand: rgba(13,148,136,0.45);
  --msg-out-bg: #D9F3EE;
  --msg-out-border: rgba(13,148,136,0.35);
  --shadow: rgba(0,0,0,.12);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }
.mobile-only { display: none; }

/* ── Botões ─────────────────────────────── */
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: none; border-radius: 10px; padding: 9px 16px;
  min-height: 38px; transition: all .15s ease;
}
.btn-primary { background: var(--brand); color: var(--bg); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: 0 0 16px rgba(39,218,188,.35); }
.btn-primary:active { background: var(--brand-active); }
.btn-primary:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn-secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-secondary:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text-2); border: none; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--error); }
.btn-danger:hover { background: rgba(248,113,113,.22); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; font-size: 20px; flex-shrink: 0; }
.btn-sm { min-height: 30px; padding: 4px 12px; font-size: 12px; }

/* ── Inputs / selects ───────────────────── */
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39,218,188,.10);
}
textarea { resize: vertical; font-family: inherit; width: 100%; }
label {
  display: block; text-transform: uppercase; font-size: 11px;
  font-weight: 600; letter-spacing: .05em; color: var(--text-2);
  margin-bottom: 6px;
}
.field-error { color: var(--error); font-size: 12px; margin-top: 10px; }

/* ── Login ──────────────────────────────── */
.login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-top: 2px solid var(--brand);
  border-radius: 14px; padding: 32px;
  animation: fadeIn .3s ease-out;
}
.login-logo, .sidebar-logo { font-size: 20px; font-weight: 800; }
.login-logo span, .sidebar-logo span { color: var(--brand); }
.login-sub { color: var(--text-2); margin: 4px 0 24px; }
.login-card label { margin: 14px 0 6px; }
.login-card input { width: 100%; }
.login-card .btn { margin-top: 20px; }

/* ── Shell: sidebar + main ──────────────── */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-card);
  border-right: 1px solid var(--border-1);
  display: flex; flex-direction: column; padding: 16px 10px;
}
.sidebar-logo { padding: 4px 10px 18px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  font: inherit; font-weight: 600; color: var(--text-2);
  background: none; border: none; border-radius: 10px;
  padding: 10px 12px; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: rgba(39,218,188,.10); color: var(--brand); }
.sidebar-footer {
  border-top: 1px solid var(--border-1); padding-top: 12px;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
}
.footer-btn {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  background: none; border: 1px solid var(--border-2); border-radius: 8px;
  color: var(--text-2); padding: 7px 10px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.footer-btn:hover { background: var(--bg-hover); color: var(--text); }
.footer-btn.on { color: var(--brand); border-color: var(--border-brand); }
.footer-select {
  font-size: 12px; padding: 7px 10px; border-radius: 8px;
  background: var(--bg); color: var(--text-2); width: 100%;
}
.user-badge {
  background: rgba(39,218,188,.10); color: var(--brand);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12px; font-weight: 700; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; }

/* ── Atendimento: 3 colunas ─────────────── */
.inbox {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 250px;
  height: 100%;
}
.inbox-list {
  border-right: 1px solid var(--border-1); background: var(--bg-card);
  display: flex; flex-direction: column; min-height: 0;
}
.list-top { display: flex; gap: 8px; padding: 12px 12px 8px; }
.list-top input { flex: 1; min-width: 0; padding: 8px 12px; font-size: 13px; }
.tabs {
  display: flex; gap: 2px; padding: 0 8px 10px;
  border-bottom: 1px solid var(--border-1);
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font: inherit; font-size: 11px; font-weight: 700;
  background: none; border: none; color: var(--text-2);
  padding: 5px 6px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap; flex-shrink: 0;
}
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: rgba(39,218,188,.10); color: var(--brand); }
.conv-list { flex: 1; overflow-y: auto; padding: 6px; }
.conv-item {
  display: flex; gap: 10px; align-items: center;
  padding: 10px; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.selected { background: rgba(39,218,188,.10); }
.conv-item.unread {
  background: rgba(39,218,188,.08);
  border-left: 3px solid var(--brand);
}
.conv-item.unread:hover { background: rgba(39,218,188,.14); }
.conv-item.unread .conv-name { font-weight: 800; }
.conv-item.unread .conv-preview { color: var(--text); font-weight: 700; }
.unread-pill {
  background: var(--brand); color: var(--bg);
  font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; border-radius: 999px; padding: 2px 8px;
  flex-shrink: 0; animation: unreadPulse 1.6s ease-in-out infinite;
}
.card.unread {
  border-left: 3px solid var(--brand);
  background: rgba(39,218,188,.07);
}
.card.unread .card-preview { color: var(--text); font-weight: 700; }
@keyframes unreadPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(39,218,188,.5); }
  50% { box-shadow: 0 0 0 5px rgba(39,218,188,0); }
}
.conv-avatar, .contact-avatar {
  width: 38px; height: 38px; border-radius: 999px; flex-shrink: 0;
  background: var(--bg-elev); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.conv-body { flex: 1; min-width: 0; }
.conv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.conv-name {
  font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-time { font-size: 10.5px; color: var(--text-3); flex-shrink: 0; }
.conv-preview {
  color: var(--text-2); font-size: 12px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.dot-waiting { background: var(--warning); }
.dot-active { background: var(--brand); }
.dot-resolved { background: var(--success); }
.conv-tag { font-size: 10px; font-weight: 700; color: var(--text-3); }
.tag-prev {
  color: var(--warning); background: rgba(251,191,36,.10);
  border-radius: 999px; padding: 2px 7px;
}
.tag-filter {
  margin: 8px 12px 0; padding: 6px 10px; font-size: 12px; width: calc(100% - 24px);
}
.tag-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.list-empty { color: var(--text-3); text-align: center; padding: 32px 12px; font-size: 13px; }

.inbox-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; color: var(--text-3); text-align: center;
}
.chat-empty p:first-child { font-size: 40px; }
.chat-area { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border-1);
  background: var(--bg-card); min-height: 56px;
  position: relative; z-index: 2; flex-shrink: 0;
}
.chat-title { display: flex; flex-direction: column; min-width: 0; }
.chat-title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title span { font-size: 12px; color: var(--text-2); }

.badge { border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-waiting { background: rgba(251,191,36,.12); color: var(--warning); }
.badge-active { background: rgba(39,218,188,.12); color: var(--brand); }
.badge-resolved { background: rgba(52,211,153,.12); color: var(--success); }
.badge-error { background: rgba(248,113,113,.12); color: var(--error); }
.badge-muted { background: var(--bg-elev); color: var(--text-3); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 16px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; z-index: 1;
}
.msg {
  max-width: 72%; border-radius: 12px; padding: 8px 12px;
  font-size: 13.5px; line-height: 1.45; word-break: break-word;
  animation: fadeIn .2s ease-out;
}
.msg-in {
  align-self: flex-start; background: var(--bg-elev);
  border: 1px solid var(--border-1); border-bottom-left-radius: 4px;
}
.msg-out {
  align-self: flex-end; background: var(--msg-out-bg);
  border: 1px solid var(--msg-out-border); border-bottom-right-radius: 4px;
}
.msg-system {
  align-self: center; max-width: 90%;
  background: none; border: none;
  color: var(--text-3); font-size: 11.5px; font-style: italic;
  text-align: center; padding: 2px 8px;
}
.msg img { max-width: 100%; border-radius: 8px; display: block; margin-bottom: 4px; cursor: pointer; }
.msg audio { width: 240px; max-width: 100%; display: block; }
.msg video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; margin-bottom: 4px; }
.msg-meta { font-size: 10.5px; color: var(--text-3); margin-top: 4px; text-align: right; }
.msg-text { word-break: break-word; }
.msg-text s { opacity: .75; }
.msg-sender { font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }

.chat-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border-1);
  background: var(--bg-card);
  position: relative;
}
.chat-composer textarea {
  flex: 1; min-width: 0; resize: none; overflow-y: hidden;
  line-height: 1.4; max-height: 120px; min-height: 42px;
  padding: 10px 12px;
}

/* Menu de mensagens rápidas (sobre o composer) */
.qr-menu {
  position: absolute; bottom: calc(100% + 6px); left: 16px; right: 16px;
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 6px; z-index: 20;
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 12px 32px var(--shadow);
}
.qr-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  background: none; border: none; color: var(--text);
  padding: 9px 10px; border-radius: 8px;
}
.qr-item:hover, .qr-item.active { background: var(--bg-hover); }
.qr-item.active { outline: 1px solid var(--border-brand); }
.qr-shortcut {
  font-weight: 800; color: var(--brand); font-size: 12.5px;
  flex-shrink: 0; min-width: 80px;
}
.qr-item-body { min-width: 0; flex: 1; }
.qr-item-title { font-weight: 700; font-size: 13px; }
.qr-item-preview {
  color: var(--text-2); font-size: 11.5px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qr-empty { color: var(--text-3); font-size: 12.5px; padding: 10px; text-align: center; }

/* Picker de emojis (próprio, leve) */
.emoji-panel {
  position: absolute; bottom: calc(100% + 6px); left: 16px; width: 340px; max-width: calc(100% - 32px);
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 10px; z-index: 20;
  box-shadow: 0 12px 32px var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.emoji-panel input { font-size: 13px; padding: 7px 10px; }
.emoji-cats { display: flex; gap: 2px; flex-wrap: wrap; }
.emoji-cat {
  font: inherit; font-size: 15px; background: none; border: none;
  border-radius: 8px; padding: 4px 7px; cursor: pointer;
}
.emoji-cat:hover { background: var(--bg-hover); }
.emoji-cat.active { background: rgba(39,218,188,.14); }
.emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 2px; max-height: 190px; overflow-y: auto;
}
.emoji-grid button {
  font-size: 20px; background: none; border: none; border-radius: 8px;
  padding: 4px; cursor: pointer; line-height: 1.3;
}
.emoji-grid button:hover { background: var(--bg-hover); transform: scale(1.15); }
.emoji-none { grid-column: 1/-1; color: var(--text-3); font-size: 12px; text-align: center; padding: 12px; }

/* Menu ⋮ das mensagens enviadas */
.msg { position: relative; }
.msg-dots {
  position: absolute; top: 4px; right: 4px;
  font: inherit; font-size: 14px; font-weight: 800; line-height: 1;
  background: var(--bg-elev); color: var(--text-2);
  border: 1px solid var(--border-1); border-radius: 999px;
  width: 22px; height: 22px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.msg:hover .msg-dots { opacity: 1; }
.msg-menu {
  position: absolute; top: 26px; right: 4px; z-index: 15; min-width: 170px;
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 5px;
  box-shadow: 0 12px 32px var(--shadow);
}
.msg-menu button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 12.5px;
  background: none; border: none; color: var(--text);
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.msg-menu button:hover { background: var(--bg-hover); }
.msg-menu button.danger { color: var(--error); }

.msg-deleted { font-style: italic; color: var(--text-3); }
.msg-audit { font-size: 10.5px; color: var(--text-3); margin-top: 3px; font-style: italic; }
.edited-tag { font-style: italic; opacity: .8; }

/* Página de mensagens rápidas (gerente) */
.qr-form {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 14px; padding: 20px; max-width: 640px;
  display: flex; flex-direction: column; gap: 10px;
}
.qr-form-row { display: flex; gap: 12px; }
.qr-form-row > div { display: flex; flex-direction: column; }
.qr-form-title { flex: 1; }
.qr-form input, .qr-form textarea { width: 100%; }
.qr-list { max-width: 640px; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.qr-row {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.qr-row-body { flex: 1; min-width: 0; }
.qr-row-content {
  color: var(--text-2); font-size: 12px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* v1.4: multi-seleção "pode ver leads de" */
.canview-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 160px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 8px 10px;
}
.canview-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; text-transform: none; letter-spacing: 0;
  color: var(--text); font-weight: 500; margin: 0; cursor: pointer;
}
.canview-item input { width: auto; accent-color: var(--brand); }
.user-links { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.tag-owner { color: var(--info); font-weight: 700; }

/* Ciclo de follow-up: desfecho + timeline */
.tag-outcome-check { max-width: 640px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.chip-x {
  font: inherit; font-size: 11px; font-weight: 800; cursor: pointer;
  background: none; border: none; color: var(--text-3);
  padding: 0 0 0 2px; line-height: 1;
}
.chip-x:hover { color: var(--error); }
.fu-outcome {
  font-size: 12px; color: var(--success); font-weight: 700;
  background: rgba(52,211,153,.10); border-radius: 8px; padding: 6px 10px;
}
.crm-timeline { display: flex; flex-direction: column; gap: 5px; max-height: 170px; overflow-y: auto; }
.tl-item {
  font-size: 11px; color: var(--text-2); line-height: 1.4;
  border-left: 2px solid var(--border-2); padding-left: 8px;
}
.tl-item .tl-date { color: var(--text-3); }
.tl-item .tl-by { color: var(--text-3); font-style: italic; }
.tl-empty { font-size: 11.5px; color: var(--text-3); }
/* Kanban de Implementação */
.board-3 { grid-template-columns: repeat(3, 1fr); }
.column[data-col="impl-chamado"] .column-header h2 { color: var(--warning); }
.column[data-col="impl-respondeu"] .column-header h2 { color: var(--info); }
.column[data-col="impl-fechado"] .column-header h2 { color: var(--success); }
.impl-check { margin-top: 12px; font-size: 13px; }
.impl-meta { font-size: 10.5px; color: var(--text-3); margin-top: 5px; }
.impl-actions { display: flex; gap: 6px; margin-top: 8px; }
.impl-actions .btn { flex: 1; font-size: 11.5px; padding: 5px 6px; min-height: 28px; }
.impl-back { flex: 0 0 auto !important; width: 32px; }

.tag-badge-outcome {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  background: rgba(52,211,153,.12); color: var(--success);
  border-radius: 999px; padding: 2px 7px;
}
.composer-btn {
  font-size: 18px; background: transparent; border: 1px solid var(--border-2);
  border-radius: 10px; width: 42px; height: 42px; cursor: pointer;
  flex-shrink: 0; transition: background .15s;
}
.composer-btn:hover { background: var(--bg-hover); }
.composer-btn.recording {
  background: rgba(248,113,113,.15); border-color: var(--error);
  animation: pulse 1.2s infinite;
}
.composer-lock {
  padding: 14px 16px; border-top: 1px solid var(--border-1);
  color: var(--text-2); text-align: center; font-size: 13px;
  background: var(--bg-card);
}

/* Painel do contato */
.inbox-contact {
  border-left: 1px solid var(--border-1); background: var(--bg-card);
  padding: 20px 16px; overflow-y: auto;
}
.contact-empty { color: var(--text-3); text-align: center; padding-top: 40px; font-size: 13px; }
.contact-card { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.contact-avatar { width: 56px; height: 56px; font-size: 22px; margin-bottom: 6px; }
.contact-card h3 { font-size: 16px; text-align: center; word-break: break-word; }
.contact-phone { color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.contact-field {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 9px 0; border-top: 1px solid var(--border-1);
  font-size: 12.5px;
}
.contact-field > span:first-child {
  text-transform: uppercase; font-size: 10.5px; font-weight: 600;
  letter-spacing: .05em; color: var(--text-3);
}
.contact-field strong { text-align: right; word-break: break-word; }
.contact-actions {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
  margin-top: 16px;
}
.contact-section {
  width: 100%; border-top: 1px solid var(--border-1);
  padding: 10px 0 4px; display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.contact-section-title {
  text-transform: uppercase; font-size: 10.5px; font-weight: 600;
  letter-spacing: .05em; color: var(--text-3);
  display: flex; justify-content: space-between; align-items: center;
}
.contact-section input, .contact-section textarea { font-size: 13px; padding: 8px 10px; }
.section-actions { display: flex; gap: 8px; justify-content: flex-end; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; border-radius: 999px;
  padding: 3px 9px; background: var(--bg-elev); border: 1px solid var(--border-1);
}
.chip .tag-dot { width: 7px; height: 7px; }
.chip-add {
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--bg-elev); color: var(--text-2);
  border: 1px solid var(--border-2); border-radius: 999px;
  width: 22px; height: 22px; line-height: 1;
}
.chip-add:hover { color: var(--brand); border-color: var(--border-brand); }
.tag-picker {
  position: absolute; top: 30px; right: 0; left: 0; z-index: 10;
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 6px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.tag-picker button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font: inherit; font-size: 13px; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.tag-picker button:hover { background: var(--bg-hover); }
.tag-picker .tag-on { color: var(--brand); font-weight: 700; }

/* Follow-ups na lista */
.fu-item .conv-preview { color: var(--text-2); }
.fu-date {
  font-size: 10.5px; font-weight: 700; color: var(--text-2);
  background: var(--bg-elev); border-radius: 999px; padding: 2px 8px;
  flex-shrink: 0;
}
.fu-overdue .fu-date { color: var(--warning); background: rgba(251,191,36,.12); }
.fu-nodate { color: var(--warning); background: rgba(251,191,36,.12); font-style: italic; }
.fu-overdue { border-left: 2px solid var(--warning); }
.fu-done-btn {
  font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  background: rgba(52,211,153,.12); color: var(--success);
  border: none; border-radius: 999px; padding: 4px 10px; flex-shrink: 0;
}
.fu-done-btn:hover { background: rgba(52,211,153,.25); }

/* Página de Tags (gerente) */
.tag-form {
  display: flex; gap: 10px; align-items: center; max-width: 560px;
  margin-bottom: 6px;
}
.tag-form input[type="text"] { flex: 1; }
.tag-form input[type="color"] {
  width: 46px; height: 40px; padding: 4px; cursor: pointer;
}
.tags-list { max-width: 560px; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.tag-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 10px; padding: 10px 14px;
}
.tag-row .tag-dot { width: 12px; height: 12px; }
.tag-row strong { flex: 1; }
.transfer-wrap { position: relative; width: 100%; }
.transfer-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 6px; z-index: 10;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); max-height: 240px; overflow-y: auto;
}
.transfer-menu button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 13px;
  background: none; border: none; color: var(--text);
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.transfer-menu button:hover { background: var(--bg-hover); color: var(--brand); }

/* ── Kanban ─────────────────────────────── */
.view-kanban { display: flex; flex-direction: column; }
.board-toolbar {
  max-width: 1500px; margin: 0 auto; width: 100%;
  padding: 16px 20px 0; display: flex; justify-content: flex-end;
}
.board-toolbar select { font-size: 13px; padding: 8px 12px; min-width: 220px; }
.board {
  flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; padding: 20px; overflow: hidden;
  max-width: 1500px; margin: 0 auto; width: 100%;
}
.column {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 14px; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}
.column-header { padding: 14px 16px; border-bottom: 1px solid var(--border-1); }
.column-header h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.column[data-col="waiting"] .column-header h2 { color: var(--warning); }
.column[data-col="active"] .column-header h2 { color: var(--brand); }
.column[data-col="resolved"] .column-header h2 { color: var(--success); }
.column[data-col="followups"] .column-header h2 { color: var(--info); }
.card.fu-overdue { border-left: 2px solid var(--warning); }
.card .fu-date { margin-left: auto; }
.card-note {
  color: var(--text-2); font-size: 12px; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-style: italic;
}
.count { background: var(--bg-elev); color: var(--text-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.column-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.column-empty { color: var(--text-3); text-align: center; padding: 32px 12px; font-size: 13px; }

.card {
  background: var(--bg-elev); border: 1px solid var(--border-1);
  border-radius: 10px; padding: 12px; cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
  animation: fadeIn .3s ease-out;
}
.card:hover {
  background: var(--bg-hover); transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow);
}
.fu-group {
  text-transform: uppercase; font-size: 10px; font-weight: 700;
  letter-spacing: .06em; color: var(--text-3);
  padding: 8px 2px 0;
}
.fu-group.fu-group-late { color: var(--warning); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-time { font-size: 11px; color: var(--warning); flex-shrink: 0; font-weight: 600; }
.card-preview {
  color: var(--text-2); font-size: 12.5px; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-agent {
  margin-top: 8px; font-size: 11px; font-weight: 700;
  color: var(--brand); background: rgba(39,218,188,.10);
  border-radius: 999px; padding: 3px 9px; display: inline-block;
}
.card-via { margin-top: 6px; font-size: 10.5px; color: var(--text-3); display: block; }

/* ── Páginas (instâncias / usuários / exportar) ── */
.page { padding: 24px; overflow-y: auto; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
  max-width: 1000px;
}
.page-header h1 { font-size: 20px; font-weight: 800; }
.page-actions { display: flex; gap: 10px; }

.instances-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; max-width: 1000px;
}
.instance-card {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  animation: fadeIn .3s ease-out;
}
.instance-card.instance-bad {
  border-color: rgba(248,113,113,.55);
  background: rgba(248,113,113,.05);
}
.instance-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.instance-name { font-weight: 800; font-size: 15px; }
.instance-number { color: var(--text-2); font-size: 12.5px; }
.instance-actions { display: flex; gap: 8px; margin-top: 8px; }
.instance-actions .btn { flex: 1; font-size: 12.5px; padding: 7px 8px; }

.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 14px; overflow-x: auto; max-width: 1000px;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; text-transform: uppercase; font-size: 10.5px;
  letter-spacing: .05em; color: var(--text-3); font-weight: 700;
  padding: 12px 16px; border-bottom: 1px solid var(--border-2);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border-1); }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table td .btn { margin-left: 6px; }
.row-actions { text-align: right; white-space: nowrap; }

.export-card {
  background: var(--bg-card); border: 1px solid var(--border-1);
  border-radius: 14px; padding: 24px; max-width: 640px;
}
.export-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 20px;
}
.export-grid select, .export-grid input { width: 100%; }
.export-range { display: flex; gap: 10px; }
.export-range > div { flex: 1; }

/* ── Modais ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,15,20,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 16px;
}
.modal-card {
  width: 100%; max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-top: 2px solid var(--brand);
  border-radius: 14px; padding: 24px;
  animation: fadeIn .25s ease-out;
}
.modal-card h3 { font-size: 17px; font-weight: 800; }
.modal-sub { color: var(--text-2); font-size: 13px; margin: 4px 0 16px; }
.modal-card label { margin-top: 12px; }
.modal-card input, .modal-card select { width: 100%; font-size: 15px; }
.modal-hint { color: var(--text-3); font-size: 11.5px; margin-top: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.qr-card { text-align: center; }
.qr-box {
  background: #fff; border-radius: 12px; padding: 12px;
  width: 260px; height: 260px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.qr-box img { width: 100%; height: 100%; }
.qr-box .qr-msg { color: #100F14; font-size: 13px; font-weight: 600; padding: 12px; }

/* ── Toasts / loading ───────────────────── */
.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-left: 3px solid var(--brand); border-radius: 10px;
  padding: 12px 16px; min-width: 240px; max-width: 340px;
  box-shadow: 0 12px 32px var(--shadow);
  animation: fadeIn .25s ease-out;
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
}
.toast-btn {
  font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
  background: rgba(39,218,188,.12); color: var(--brand);
  border: 1px solid var(--border-brand); border-radius: 8px;
  padding: 5px 12px; flex-shrink: 0;
}
.toast-btn:hover { background: rgba(39,218,188,.25); }
.toast-error { border-left-color: var(--error); }
.toast-success { border-left-color: var(--success); }
.skeleton {
  background: var(--bg-elev); border-radius: 10px; height: 64px;
  animation: skeletonPulse 1.5s infinite; margin: 6px;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes skeletonPulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.4); } 50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); } }

/* ── Responsivo ─────────────────────────── */
@media (max-width: 1200px) {
  .inbox { grid-template-columns: 270px minmax(0, 1fr) 220px; }
}
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, 1fr); overflow-y: auto; height: auto; max-height: 100%; }
  .column { min-height: 240px; max-height: 46vh; }
}
@media (max-width: 1024px) {
  .sidebar { width: 62px; padding: 16px 8px; }
  .sidebar-logo { font-size: 0; padding: 4px 6px 18px; }
  .sidebar-logo::before { content: 'AL'; font-size: 18px; font-weight: 800; color: var(--brand); }
  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .user-badge { display: none; }
  .footer-btn, .footer-select { display: none; }
  .inbox { grid-template-columns: 250px minmax(0, 1fr); }
  .inbox-contact {
    position: fixed; top: 0; right: 0; bottom: 0; width: 280px; z-index: 40;
    transform: translateX(100%); transition: transform .2s ease-out;
    box-shadow: -12px 0 32px rgba(0,0,0,.5);
  }
  .inbox.show-contact .inbox-contact { transform: none; }
  .mobile-only { display: inline-flex; }
}
@media (max-width: 768px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: 100dvh; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    padding: 6px 10px; border-right: none; border-bottom: 1px solid var(--border-1);
  }
  .sidebar-logo { padding: 0 8px 0 0; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .sidebar-footer { border: none; padding: 0; flex-direction: row; align-items: center; }
  .footer-btn, .footer-select { display: block; width: auto; }
  .inbox { grid-template-columns: 1fr; }
  .inbox-chat { display: none; }
  .inbox.show-chat .inbox-list { display: none; }
  .inbox.show-chat .inbox-chat { display: flex; }
  .board { grid-template-columns: 1fr; overflow: visible; padding: 12px; height: auto; }
  .column { min-height: 160px; max-height: 55vh; }
  .msg { max-width: 86%; }
  .export-grid { grid-template-columns: 1fr; }
  .touch-target, .tab, .nav-item, .conv-item { min-height: 44px; }
}
