:root {
  --green: #128c7e;
  --green-dark: #075e54;
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --bg-chat: #efeae2;
  --bg: #f0f2f5;
  --line: #e9edef;
  --text: #111b21;
  --muted: #667781;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
h1 span, h2 span { color: var(--green); }

/* ---- conexão ---- */
.connect { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.connect-card { background: #fff; border-radius: 16px; padding: 32px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.connect-card h1 { margin: 0 0 8px; }
.connect-card img { width: 280px; max-width: 100%; margin: 8px auto; display: block; }
.connect-card ol { text-align: left; color: var(--muted); line-height: 1.7; padding-left: 20px; }

/* ---- layout ---- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 20px; padding: 6px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 20px; }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.tab:hover { background: var(--bg); }
.tab.active { background: #d8fdd2; color: var(--green-dark); }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 380px 1fr; }
.app[data-view="board"] .workspace { display: none; }
.sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-top: 10px; }
.head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me { font-size: 12px; color: var(--muted); }
.icon-btn { border: 0; background: transparent; font-size: 18px; border-radius: 50%; width: 34px; height: 34px; color: var(--muted); }
.icon-btn:hover { background: var(--bg); }

.search { padding: 0 12px 8px; }
.search input { width: 100%; padding: 9px 14px; border: 0; background: var(--bg); border-radius: 10px; font: inherit; outline: none; }

.filters { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: thin; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { background: var(--bg); }
.chip.active { background: #d8fdd2; border-color: #d8fdd2; color: var(--green-dark); font-weight: 600; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip .count { font-size: 11px; opacity: .8; }
.chip.add { color: var(--green); border-style: dashed; }

.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 12px; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--line); }
.chat-item:hover { background: #f5f6f6; }
.chat-item.active { background: #f0f2f5; }
.avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 18px; }
.chat-main { min-width: 0; flex: 1; }
.chat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 12px; color: var(--muted); flex: none; }
.chat-time.unread { color: var(--green); }
.chat-preview { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--green); color: #fff; font-size: 12px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.chat-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; color: #fff; padding: 1px 8px; border-radius: 999px; }

/* ---- painel do chat ---- */
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-chat); }
.empty { margin: auto; text-align: center; color: var(--muted); }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.chat-title { display: flex; flex-direction: column; min-width: 0; }
.chat-title small { color: var(--muted); }
.chat-labels { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.ghost-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; }
.ghost-btn:hover { background: #f5f6f6; }
.label-menu-wrap { position: relative; }
.label-menu { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px; z-index: 10; min-width: 220px; }
.label-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.label-menu label:hover { background: var(--bg); }
.label-menu .dot { width: 10px; height: 10px; border-radius: 50%; }
.label-menu .empty-note { padding: 6px 8px; color: var(--muted); font-size: 13px; }

.messages { flex: 1; overflow-y: auto; padding: 16px 8%; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; background: #fff; color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 8px; margin: 10px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.msg { max-width: 65%; padding: 6px 9px 4px; border-radius: 8px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(0,0,0,.1); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg .who { font-size: 12px; font-weight: 600; color: var(--green); display: block; }
.msg .meta { float: right; margin: 6px 0 0 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.msg .ticks.read { color: #53bdeb; }
.msg .ticks.failed { color: #d32f2f; font-weight: 600; }

.composer { display: flex; gap: 8px; padding: 10px 16px; background: var(--bg); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 10px; padding: 10px 14px; font: inherit; max-height: 140px; outline: none; }
.send-btn { border: 0; background: var(--green); color: #fff; border-radius: 50%; width: 42px; height: 42px; font-size: 18px; }
.send-btn:hover { background: var(--green-dark); }

/* ---- mídia ---- */
.chat { position: relative; }
.msg.has-media { padding: 4px 4px 4px; }
.msg.has-media .caption { padding: 4px 6px 0; white-space: pre-wrap; }
.msg.has-media .who { padding: 2px 6px; }
.msg.has-media .meta { margin-right: 6px; }
.msg .media-img { display: block; max-width: 100%; max-height: 340px; border-radius: 6px; cursor: zoom-in; background: #00000010; }
.msg .media-video { display: block; max-width: 100%; max-height: 340px; border-radius: 6px; background: #000; }
.msg .media-audio { display: block; width: 260px; max-width: 100%; margin: 4px 2px; }
.msg.sticker { background: transparent; box-shadow: none; }
.msg .media-sticker { display: block; width: 150px; height: 150px; object-fit: contain; }
.doc { display: flex; align-items: center; gap: 10px; background: #00000010; border-radius: 6px; padding: 10px 12px; color: inherit; text-decoration: none; min-width: 220px; }
.doc:hover { background: #00000018; }
.doc .doc-ico { font-size: 26px; }
.doc .doc-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.doc small { color: var(--muted); display: block; }
.media-missing { padding: 6px 8px; color: var(--muted); font-style: italic; }

.attachment { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #e3e8eb; border-top: 1px solid var(--line); }
.attachment img { height: 56px; max-width: 90px; object-fit: cover; border-radius: 6px; }
.attachment .att-ico { font-size: 32px; }
.attachment .att-info { min-width: 0; flex: 1; }
.attachment .att-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment small { color: var(--muted); }
.attach-btn { font-size: 20px; flex: none; width: 40px; height: 40px; }
.drop-hint { position: absolute; inset: 0; background: rgba(18, 140, 126, .85); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600; z-index: 20; pointer-events: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 100; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---- bot ---- */
.bot-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; white-space: nowrap; }
.bot-btn.on { color: #1b5e20; border-color: #a5d6a7; background: #f1f8e9; }
.bot-btn.off { color: #6d4c41; background: #fff8e1; border-color: #ffe082; }
.bot-btn.alert { color: #b71c1c; background: #ffebee; border-color: #ef9a9a; font-weight: 600; }
.bot-btn:disabled, .bot-btn.static { cursor: default; color: var(--muted); }
.tag.needs-human { background: #ffebee; color: #b71c1c; font-weight: 600; }
.bot-card { max-width: 760px; }
.bot-form { display: flex; flex-direction: column; gap: 18px; padding: 16px 18px 6px; overflow-y: auto; }
.bot-section { display: flex; flex-direction: column; gap: 8px; }
.bot-section h4 { margin: 0; font-size: 14px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .03em; }
.bot-section label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
.bot-section input[type=text], .bot-section input[type=number], .bot-section input[type=time], .bot-section select, .bot-section textarea { border: 1px solid #d1d7db; border-radius: 8px; padding: 9px 10px; font: inherit; outline: none; }
.bot-section textarea { resize: vertical; min-height: 70px; }
.bot-section textarea.big { min-height: 220px; }
.bot-section small { color: var(--muted); font-weight: 400; }
.bot-section .inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { flex-direction: row; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-weight: 400; cursor: pointer; }
.banner { border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.banner.warn { background: #fff3e0; color: #7a4a00; border: 1px solid #ffcc80; }
.banner code { background: #0000000d; padding: 1px 5px; border-radius: 4px; }
.master-toggle { background: #f1f8e9; border: 1px solid #c5e1a5; border-radius: 10px; padding: 10px 12px; }
.bot-actions { display: flex; gap: 10px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; border-radius: 0 0 14px 14px; }
.bot-actions .form-error { margin: 0 auto 0 0; }
.test-box { border: 1px dashed #b0bec5; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fafafa; }
.test-log { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; min-height: 40px; }
.test-msg { max-width: 85%; padding: 6px 10px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.test-msg.user { align-self: flex-end; background: var(--bubble-out); }
.test-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.test-msg.note { align-self: center; background: #fff8e1; color: #6d5a1f; font-size: 12.5px; }
.test-msg.err { align-self: center; background: #ffebee; color: #b71c1c; font-size: 13px; }
.test-row { display: flex; gap: 8px; }
.test-row input { flex: 1; border: 1px solid #d1d7db; border-radius: 8px; padding: 9px 10px; font: inherit; }

/* ---- responsável / avisos ---- */
.tag.assignee { background: #eceff1; color: #37474f; }
.tag.assignee.mine { background: #d8fdd2; color: var(--green-dark); font-weight: 600; }
.sys-note { align-self: center; max-width: 80%; text-align: center; background: #fff8e1; color: #6d5a1f; font-size: 12.5px; padding: 4px 12px; border-radius: 8px; margin: 6px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.board-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.board-owner { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.board-owner select, #assignee-select { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 120; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: #263238; color: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.3); cursor: pointer; font-size: 14px; animation: toast-in .2s ease-out; }
.toast small { display: block; opacity: .75; margin-top: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- login / usuários ---- */
.auth-card { max-width: 400px; }
.auth-sub { color: var(--muted); margin: 0 0 12px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-form label, .modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
.auth-form input, .modal-form input, .modal-form select { border: 1px solid #d1d7db; border-radius: 8px; padding: 10px 12px; font: inherit; outline: none; }
.auth-form input:focus, .modal-form input:focus, .modal-form select:focus { border-color: var(--green); box-shadow: 0 0 0 3px #128c7e22; }
.auth-form small, .modal-form small { color: var(--muted); font-weight: 400; }
.form-error { color: #c62828; font-size: 14px; margin: 0; min-height: 1.2em; }
.primary-btn.wide { width: 100%; padding: 11px; }
.primary-btn:disabled { opacity: .6; cursor: wait; }
.head-actions .ghost-btn { padding: 4px 10px; }
.user-row { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; }
.user-row.off { opacity: .6; }
.user-row .who-info { flex: 1; min-width: 160px; }
.user-row .who-info small { color: var(--muted); display: block; }
.role-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #e8eaf6; color: #3f51b5; }
.role-badge.admin { background: #fff3e0; color: #e65100; }
.user-row .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.user-row .acts .ghost-btn { padding: 4px 9px; font-size: 13px; }
.user-row .pw-line { flex-basis: 100%; display: flex; gap: 8px; }
.user-row .pw-line input { flex: 1; border: 1px solid #d1d7db; border-radius: 8px; padding: 7px 10px; font: inherit; }
.modal-form { border-top: 1px solid var(--line); padding: 14px 18px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form .full { grid-column: 1 / -1; }
.modal-form .row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.modal-form .row .form-error { margin-right: auto; }
.pw-card { max-width: 420px; }
.msg .sent-by { display: block; font-size: 11px; font-weight: 600; color: #6a7f8a; padding: 0 2px; }
.msg.has-media .sent-by { padding: 2px 6px 0; }
@media (max-width: 760px) { .modal-form { grid-template-columns: 1fr; } .head-actions #btn-users { display: none; } }

/* ---- respostas rápidas ---- */
.composer { position: relative; }
.qr-popup { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 4px); max-width: 560px; max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.16); z-index: 15; padding: 4px; }
.qr-item { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.qr-item.active, .qr-item:hover { background: #e8f5f2; }
.qr-item .sc { font-weight: 600; color: var(--green-dark); flex: none; }
.qr-item .tx { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qr-empty { padding: 10px; color: var(--muted); font-size: 14px; }
.qr-foot { border-top: 1px solid var(--line); margin-top: 4px; padding: 8px 10px 6px; font-size: 13px; }
.qr-foot button { border: 0; background: transparent; color: var(--green); padding: 0; font-size: 13px; text-decoration: underline; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.qr-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.qr-row.editing { border-color: var(--green); background: #f3fbf9; }
.qr-row .sc { font-weight: 600; color: var(--green-dark); flex: none; min-width: 90px; }
.qr-row .tx { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #3b4a54; max-height: 5.2em; overflow: hidden; }
.qr-row .acts { display: flex; gap: 2px; flex: none; }
.qr-form { border-top: 1px solid var(--line); padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.qr-form .sc-field { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.qr-form .sc-field input { border: 0; outline: none; padding: 9px 0; flex: 1; font: inherit; }
.qr-form textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; min-height: 90px; resize: vertical; }
.qr-form .vars { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.qr-form .vars button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.qr-form .vars button:hover { background: var(--bg); }
.qr-form .row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.qr-form .err { color: #c62828; font-size: 13px; margin-right: auto; }
.primary-btn { border: 0; background: var(--green); color: #fff; border-radius: 8px; padding: 8px 16px; font-weight: 600; }
.primary-btn:hover { background: var(--green-dark); }

/* ---- campos de CRM no cabeçalho do chat ---- */
.crm-fields { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.crm-fields select, .deal { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; }
.deal { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.deal input { width: 86px; border: 0; outline: none; font: inherit; color: var(--text); }
.chat-labels { margin-left: 0; }
.back-btn { display: none; }

/* ---- funil / kanban ---- */
.board-view { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.board-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 8px; }
.board-head h3 { margin: 0; }
.board-head small { color: var(--muted); }
.board { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 8px 20px 20px; overflow-x: auto; align-items: flex-start; }
.col { flex: none; width: 290px; max-height: 100%; display: flex; flex-direction: column; background: #e6e9ec; border-radius: 12px; border-top: 4px solid var(--c, var(--green)); }
.col.over { outline: 2px dashed var(--c, var(--green)); outline-offset: -2px; background: #dde3e7; }
.col-head { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.col-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.col-title .n { background: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.col-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.col:hover .col-actions { opacity: 1; }
.col-actions button { border: 0; background: transparent; border-radius: 6px; width: 26px; height: 26px; color: var(--muted); }
.col-actions button:hover { background: #fff; }
.col-total { font-size: 12px; color: var(--muted); }
.col-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.inbox { background: #f5f6f6; border-top-color: #b0bec5; --c: #90a4ae; }
.card { background: #fff; border-radius: 10px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.1); cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.card.dragging { opacity: .4; }
.card-top { display: flex; gap: 10px; align-items: center; }
.card-top .avatar { width: 34px; height: 34px; font-size: 14px; }
.card-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.card-prev { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.card-value { color: var(--green-dark); font-weight: 600; }
.more { border: 1px dashed #b0bec5; background: transparent; border-radius: 8px; padding: 6px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .app.in-chat .sidebar { display: none; }
  .app:not(.in-chat) .chat-pane { display: none; }
  .back-btn { display: inline-block; }
  .chat-head { flex-wrap: wrap; }
  .crm-fields { margin-left: 0; }
  .messages { padding: 12px 10px; }
  .msg { max-width: 85%; }
  .col { width: 82vw; }
  .topbar { gap: 8px; }
  .me { display: none; }
}
.form-ok { color: #2e7d32; font-size: 14px; margin-right: auto; }

/* cabeçalho do chat: quebra em duas linhas quando há muitos controles (bot, responsável, etapa, valor, etiquetas) */
.chat-head { flex-wrap: wrap; row-gap: 8px; }
.chat-title { flex: 1 1 150px; }
.chat-title strong, .chat-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-fields { margin-left: 0; flex-wrap: wrap; }

/* ---- transcrição de áudio ---- */
.msg .transcript { margin: 2px 4px 0; padding: 6px 8px; font-size: 13.5px; color: #3b4a54; background: #00000008; border-radius: 6px; white-space: pre-wrap; max-width: 320px; }
.stt-status { font-size: 13px; color: var(--muted); background: #fafafa; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }

/* ---- foto de perfil ---- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* =====================================================================
   CELULAR — estilo WhatsApp: tela cheia, abas embaixo, conversa por cima da lista
   (no computador estes elementos não existem / não mudam nada)
   ===================================================================== */
.bottom-nav, .sheet { display: none; }
.chat-tools { display: contents; }  /* no computador os controles ficam soltos no cabeçalho, como antes */
.tools-btn { display: none; }

@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
  input, select, textarea { font-size: 16px !important; } /* abaixo de 16px o iPhone dá zoom ao tocar no campo */

  /* estrutura: topo (marca) + conteúdo + abas embaixo; --vvh acompanha o teclado */
  .app { height: var(--vvh, 100dvh); min-width: 0; overflow: hidden; }
  .topbar { background: var(--green); color: #fff; border: 0; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
  .topbar h2 { color: #fff; font-size: 22px; }
  .topbar h2 span { color: #b9f6ca; }
  .topbar .tabs, .topbar .head-actions { display: none; }
  .workspace { display: block; flex: 1; min-height: 0; min-width: 0; }
  .sidebar { height: 100%; min-width: 0; border-right: 0; padding-top: 0; }

  /* lista de conversas */
  .search { padding: 8px 12px 6px; }
  .search input { padding: 11px 18px; border-radius: 24px; }
  .filters { padding: 2px 12px 10px; gap: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 7px 14px; font-size: 14px; }
  .chat-item { padding: 10px 14px; gap: 14px; align-items: center; }
  .chat-item .avatar { width: 54px; height: 54px; font-size: 21px; }
  .chat-name { font-size: 17px; }
  .chat-preview { font-size: 15px; }
  .chat-time { font-size: 12px; }
  .chat-tags { margin-top: 3px; }

  /* conversa em tela cheia: o cabeçalho dela faz o papel de barra do topo */
  .app.in-chat .topbar, .app.in-chat .bottom-nav { display: none; }
  .app.in-chat .sidebar { display: none; }
  .app:not(.in-chat) .chat-pane { display: none; }
  .chat-pane, .chat { height: 100%; min-width: 0; }
  .chat-head { position: relative; flex-wrap: nowrap; gap: 6px; padding: calc(env(safe-area-inset-top) + 6px) 6px 6px; background: var(--green); color: #fff; border: 0; row-gap: 0; }
  .chat-head .icon-btn { color: #fff; font-size: 24px; width: 40px; height: 40px; flex: none; }
  .chat-head .back-btn { display: inline-grid !important; }
  .chat-head .tools-btn { display: inline-grid; font-size: 26px; }
  .chat-head .avatar { width: 40px; height: 40px; font-size: 16px; flex: none; }
  .chat-title { flex: 1 1 0; min-width: 0; }
  .chat-title strong { color: #fff; font-size: 17px; }
  .chat-title small { color: #d7f3ee; }

  /* gaveta de detalhes (responsável, etapa, valor, etiquetas, bot) */
  .chat-tools { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; flex-direction: column; gap: 12px; padding: 14px; background: #fff; color: var(--text); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(0,0,0,.2); }
  .chat.show-tools .chat-tools { display: flex; }
  .chat-tools .crm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
  .chat-tools .crm-fields select, .chat-tools .deal { width: 100%; padding: 10px; }
  .chat-tools .deal { grid-column: 1 / -1; }
  .chat-tools .deal input { width: 100%; }
  .chat-tools .bot-btn { align-self: flex-start; }
  .chat-tools .chat-labels { justify-content: flex-start; margin: 0; }
  .chat-tools .label-menu { left: 0; right: auto; }

  .messages { padding: 10px; }
  .msg { max-width: 86%; }
  .composer { gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer textarea { padding: 11px 16px; border-radius: 22px; }
  .composer .attach-btn { width: 38px; height: 38px; flex: none; }
  .send-btn { width: 46px; height: 46px; flex: none; }
  .qr-popup { left: 8px; right: 8px; max-height: 40vh; }

  /* funil: colunas que "encaixam" ao deslizar */
  .board-view { flex: 1; min-height: 0; min-width: 0; }
  .board-head { flex-wrap: wrap; gap: 8px; padding: 12px 14px 4px; }
  .board { padding: 8px 12px 14px; gap: 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .col { width: 84vw; scroll-snap-align: center; }
  .col-actions { opacity: 1; }
  .card { cursor: pointer; }

  /* abas de baixo */
  .bottom-nav { display: flex; flex: none; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bn-item { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 500; }
  .bn-item svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
  .bn-item[data-tab="more"] svg circle { fill: currentColor; stroke: none; }
  .bn-item.active { color: var(--green-dark); font-weight: 700; }
  .bn-item.active svg { fill: #d8fdd2; }
  .bn-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

  /* menu "Mais" (folha que sobe de baixo) */
  .sheet { display: flex; position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.4); align-items: flex-end; }
  .sheet-panel { width: 100%; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); }
  .sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #cfd8dc; margin: 4px auto 10px; }
  .sheet-user { display: flex; flex-direction: column; padding: 2px 8px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
  .sheet-user small { color: var(--muted); }
  .sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 8px; border: 0; border-radius: 10px; background: transparent; font-size: 17px; text-align: left; }
  .sheet-item:active { background: var(--bg); }
  .sheet-item .si-ico { width: 28px; text-align: center; font-size: 21px; }
  .sheet-item.danger { color: #c62828; }

  /* janelas (bot, usuários, respostas rápidas) em tela cheia */
  .modal { padding: 0; place-items: stretch; }
  .modal-card { max-width: none; width: 100%; height: 100%; max-height: 100dvh; border-radius: 0; }
  .modal-card.pw-card { height: auto; align-self: end; border-radius: 18px 18px 0 0; }
  .modal-head { padding-top: calc(env(safe-area-inset-top) + 12px); }
  .bot-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

  .toasts { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); max-width: none; }
  .connect { padding: 12px; }
  .connect-card { padding: 24px 18px; }
}

/* ---- ajustes do celular (2ª rodada) ---- */
.ph-ico { width: 62%; height: 62%; fill: #fff; display: block; margin: auto; }
.avatar { display: grid; place-items: center; }
.composer textarea { overflow-y: auto; scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { display: none; }
@media (max-width: 760px) {
  /* a janela é um item de grade: sem isto ela cresce até o tamanho do conteúdo e estoura a tela */
  .modal { grid-template-columns: minmax(0, 1fr); }
  .modal-card, .modal-body, .bot-form, .bot-section, .modal-form { min-width: 0; max-width: 100%; }
  .bot-card { max-width: none; }
  .bot-section input, .bot-section select, .bot-section textarea { width: 100%; min-width: 0; }
  .bot-grid { grid-template-columns: 1fr 1fr; }
  .test-msg { max-width: 92%; }
  /* funil: título e filtro numa linha só */
  .board-head h3 { font-size: 19px; }
  .board-tools { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .board-owner { flex: 1; min-width: 0; }
  .board-owner select { flex: 1; min-width: 0; }
  .board-tools .ghost-btn { flex: none; padding: 6px 10px; }
}


/* ================= ABAS (grupos de clientes) ================= */
.abas-bar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.abas-scroll { display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; padding: 3px 0; scrollbar-width: thin; }
.aba { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 500; color: #37474f; cursor: pointer; white-space: nowrap; }
.aba:hover { background: #f5f6f6; }
.aba.active { background: #e8f5f2; border-color: var(--green); color: var(--green-dark); font-weight: 600; }
.aba.drop { outline: 2px dashed var(--green); outline-offset: 2px; background: #d8fdd2; }
.aba-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.aba-count { background: var(--green); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; min-width: 22px; text-align: center; }
.aba-unread { width: 8px; height: 8px; border-radius: 50%; background: #e53935; flex: none; }
.aba-more { margin-left: 2px; padding: 0 5px; border-radius: 6px; font-weight: 700; line-height: 1.2; }
.aba-more:hover { background: #0000001a; }
.aba-add { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 20px; line-height: 1; color: var(--green); cursor: pointer; }
.aba-add:hover { background: #e8f5f2; }
.app[data-view="board"] .abas-bar { display: none; }
body.dragging-chat .abas-bar { background: #f1f8e9; }

.aba-pop { position: fixed; top: 60px; right: 16px; z-index: 80; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.aba-pop .ap-title { font-weight: 500; }
.aba-pop input { border: 2px solid var(--green); border-radius: 8px; padding: 8px 12px; font: inherit; min-width: 230px; outline: none; }
.aba-pop .ap-err { flex-basis: 100%; color: #c62828; font-size: 13px; }

.aba-menu { position: fixed; z-index: 85; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; min-width: 230px; }
.aba-menu button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font: inherit; text-align: left; cursor: pointer; }
.aba-menu button:hover:not(:disabled) { background: var(--bg); }
.aba-menu button:disabled { opacity: .4; cursor: default; }
.aba-menu .danger { color: #c62828; }
.aba-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; padding: 6px 10px 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd8dc; cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.label-menu .menu-add { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px; border-radius: 6px; color: var(--green); font: inherit; cursor: pointer; border-top: 1px solid var(--line); margin-top: 4px; }
.label-menu .menu-add:hover { background: var(--bg); }

@media (max-width: 760px) {
  .abas-bar { padding: 6px 10px; }
  .abas-scroll { scrollbar-width: none; }
  .abas-scroll::-webkit-scrollbar { display: none; }
  .app.in-chat .abas-bar { display: none; }
  .aba-pop { left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + 64px); }
  .aba-pop .ap-title { flex-basis: 100%; }
  .aba-pop input { flex: 1 1 0; min-width: 0; }
}


/* ================= CAMPANHAS (envio em massa) ================= */
.camp-card { max-width: 700px; }
.camp-body { padding: 16px 18px 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.camp-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.camp-actions .form-error { margin-right: auto; }
.risk { background: #fff3e0; border: 1px solid #ffcc80; color: #7a4a00; border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.camp-body label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.camp-body textarea { border: 1px solid #d1d7db; border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 130px; resize: vertical; outline: none; }
.camp-body textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px #128c7e22; }
.camp-body .chips-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.camp-body .chips-row button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.camp-body .chips-row button:hover { background: var(--bg); }
.camp-body label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.camp-body label.check input { margin-top: 3px; }
.camp-body small { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpi { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.kpi strong { font-size: 22px; line-height: 1.1; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi.good strong { color: #2e7d32; } .kpi.bad strong { color: #c62828; }
.sample { background: var(--bubble-out); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0,0,0,.1); }
.sample-for { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.warns { display: flex; flex-direction: column; gap: 6px; }
.warn { border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.warn.info { background: #e3f2fd; color: #0d47a1; } .warn.warn { background: #fff8e1; color: #6d4c00; } .warn.block { background: #ffebee; color: #b71c1c; font-weight: 600; }
.progress { height: 12px; background: #e0e6ea; border-radius: 6px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }
.progress .p-sent { background: var(--green); } .progress .p-fail { background: #e53935; } .progress .p-skip { background: #b0bec5; }
.camp-status { font-size: 15px; padding: 10px 12px; border-radius: 10px; background: #e8f5f2; color: var(--green-dark); }
.camp-status.paused { background: #fff3e0; color: #7a4a00; } .camp-status.done { background: #f1f8e9; color: #33691e; } .camp-status.off { background: var(--bg); color: var(--muted); }
.recent { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; max-height: 240px; overflow-y: auto; }
.recent .r { display: flex; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.recent .r:last-child { border-bottom: 0; }
.recent .r em { font-style: normal; color: var(--muted); font-size: 12.5px; margin-left: auto; text-align: right; overflow-wrap: anywhere; max-width: 55%; }
.camp-list { display: flex; flex-direction: column; gap: 8px; }
.camp-item { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font: inherit; }
.camp-item:hover { background: #f8fafb; }
.camp-item .ci-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.badge-st { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #e0e6ea; color: #455a64; white-space: nowrap; }
.badge-st.running { background: #d8fdd2; color: var(--green-dark); } .badge-st.paused { background: #fff3e0; color: #7a4a00; } .badge-st.done { background: #e8f5e9; color: #2e7d32; }
.optout-btn.on { background: #ffebee; border-color: #ef9a9a; color: #b71c1c; }
.tag.optout { background: #eceff1; color: #546e7a; }
@media (max-width: 760px) {
  .camp-card { max-width: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .recent .r em { max-width: 60%; }
}
@media (max-width: 760px) {
  .camp-card .camp-body { flex: 1 1 auto; min-height: 0; } /* os botões ficam presos no rodapé da janela */
}

/* assinatura */
.sign-btn { opacity: .45; }
.sign-btn.on { opacity: 1; background: #d9f2e6; }
.sig-card { max-width: 440px; }
.sig-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line, #e5e5e5); }
.sig-toggle small { display: block; color: var(--muted); }
.sig-preview { background: #d9fdd3; border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; font-size: 14px; }
.msg strong { font-weight: 700; }
@media (max-width: 760px) { .modal-card.sig-card { height: auto; align-self: end; border-radius: 18px 18px 0 0; } }

/* ---- barra lateral (desktop) ---- */
.rail { position: fixed; left: 0; top: 0; bottom: 0; width: 56px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; z-index: 40; }
.rail-btn { position: relative; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--green); display: grid; place-items: center; }
.rail-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: #e8f5f2; }
.rail-btn.active { background: var(--green); color: #fff; }
.rail-tip { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); background: #0b3d36; color: #fff; font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; }
.rail-btn:hover .rail-tip { opacity: 1; }
@media (min-width: 761px) {
  .app { padding-left: 56px; }
  .topbar .tabs { display: none; }
}
@media (max-width: 760px) { .rail { display: none !important; } }

/* ---- janelas: agenda, funis, follow up ---- */
.crm-card { max-width: 720px; }
.crm-card.wide { max-width: 980px; }
.crm-card > :not(.modal-head) { overflow-y: auto; min-height: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef1f3; color: #3b4a54; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.chip.ok { background: #d9f2e6; color: #0b6b3a; }
.chip.bad { background: #fde7e7; color: #b3261e; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 12px 4px; }
.agenda, .funis { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.agenda-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.agenda-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.cal { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-week span { font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell { position: relative; height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; }
.cal-cell.empty { pointer-events: none; }
.cal-cell:hover { background: var(--bg); }
.cal-cell.today { font-weight: 700; color: var(--green-dark); box-shadow: inset 0 0 0 1.5px var(--green); }
.cal-cell.sel { background: var(--green); color: #fff; }
.cal-cell .dot { position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #ff9800; }
.cal-cell.sel .dot { background: #fff; }
.agenda-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.agenda-day-head strong { text-transform: capitalize; }
.agenda-list, .funil-list, .acts-list { display: flex; flex-direction: column; gap: 8px; }
.ag-row { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ag-row.st-sent { background: #f3fbf7; }
.ag-row.st-failed { background: #fff4f3; }
.ag-time { flex: none; text-align: center; min-width: 56px; }
.ag-time strong { display: block; font-size: 16px; }
.ag-time small { color: var(--muted); }
.ag-main { flex: 1; min-width: 0; }
.ag-text { color: #3b4a54; font-size: 14px; white-space: pre-wrap; max-height: 3.9em; overflow: hidden; margin: 2px 0; }
.ag-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ag-acts .ghost-btn, .funil-acts .ghost-btn { padding: 4px 9px; font-size: 13px; text-decoration: none; display: inline-block; }
.funil-row { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; flex-wrap: wrap; }
.funil-row.off { opacity: .6; }
.funil-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.funil-main { flex: 1; min-width: 180px; }
.funil-main small { display: block; }
.funil-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.empty-state { text-align: center; padding: 26px 12px; }
.empty-state h4 { margin: 0 0 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #3b4a54; }
.modal-form input:not([type=checkbox]):not([type=radio]), .modal-form select, .modal-form textarea { border: 1px solid #d1d7db; border-radius: 8px; padding: 8px 10px; font: inherit; font-weight: 400; color: var(--text); background: #fff; width: 100%; }
.modal-form textarea { resize: vertical; }
.pick-results, .pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.pick-item, .pick-line { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 8px; font-weight: 500 !important; }
.pick-item:hover, .pick-line:hover { background: #e8f5f2; }
.pick-line { flex-direction: row !important; }
.pick-item .avatar, .pick-line .avatar { width: 28px; height: 28px; font-size: 13px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1.5px solid var(--c, #ccc); background: #fff; color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.chip-btn.on { background: var(--c, var(--green)); color: #fff; }
.fu-sec { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fafbfb; }
.fu-sec summary { cursor: pointer; padding: 11px 0; font-weight: 700; }
.fu-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.radio { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.act-row { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.act-head { display: flex; justify-content: space-between; align-items: center; }
.act-btns { display: flex; gap: 2px; }
.act-btns .icon-btn { width: 28px; height: 28px; font-size: 14px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-direction: row !important; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #c5ccd1; border-radius: 999px; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.notes-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #3b4a54; }
.notes-field textarea { border: 1px solid #d1d7db; border-radius: 8px; padding: 6px 8px; font: inherit; font-weight: 400; resize: vertical; }
.card-note { font-size: 12px; color: #6d5a00; background: #fff8dc; border-radius: 6px; padding: 2px 6px; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .agenda-grid { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr 1fr; }
  .crm-card, .crm-card.wide { max-width: none; max-height: 94vh; }
  .ag-row { flex-wrap: wrap; }
  .ag-acts { width: 100%; justify-content: flex-start; }
}

.file-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; background: #eef6f4; border: 1px solid #cfe5e0; border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 13px; font-weight: 500; max-width: 100%; }
.file-chip small { color: var(--muted); }
.file-chip .icon-btn { width: 24px; height: 24px; font-size: 13px; }
.ag-file { font-size: 13px; font-weight: 600; color: var(--green-dark); }
.act-media { display: flex; flex-direction: column; gap: 6px; }

.rail-btn.bottom { margin-top: auto; }
.settings { padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.settings h4 { margin: 12px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.set-ico { font-size: 20px; width: 28px; text-align: center; flex: none; }
.set-txt { flex: 1; min-width: 0; }
.set-txt small { display: block; }
.import-card { display: flex; flex-direction: column; gap: 10px; }
.import-card .set-row { background: #f7fbfa; }
.import-card > strong { font-size: 15px; }
.sample { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
.sample div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.howto { font-size: 13px; color: #3b4a54; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ol { margin: 6px 0; padding-left: 20px; line-height: 1.6; }
.ok-line { color: #0b6b3a; background: #e8f7ef; border-radius: 8px; padding: 8px 10px; margin: 0; font-size: 14px; }

.imp-row { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.imp-name { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; }
.imp-name label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 600; color: #3b4a54; }
.imp-name input { border: 1px solid #d1d7db; border-radius: 8px; padding: 6px 8px; font: inherit; font-weight: 400; }
.imp-stats { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- barra de ícones do cabeçalho da conversa ---- */
.chat-title { min-width: 0; flex: 1; }
.chat-title .chat-labels { margin: 2px 0 0; justify-content: flex-start; gap: 3px; }
.chat-title .chat-labels .tag { font-size: 10.5px; padding: 1px 7px; }
.tb { display: flex; align-items: center; gap: 6px; }
.tb-item { position: relative; }
.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.tb-btn { position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; color: var(--green); border-radius: 10px; padding: 0; }
.tb-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-btn:hover, .tb-item.open > .tb-btn { background: #e8f5f2; border-color: #bfe0d9; }
.tb-btn.has::before { content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #ff9800; border: 1.5px solid #fff; }
.tb-btn.danger { color: #b3261e; background: #fdecec; border-color: #f2b8b5; }
.tb-btn.bot.on { color: #1b5e20; background: #f1f8e9; border-color: #a5d6a7; }
.tb-btn.bot.off { color: #8a5a00; background: #fff8e1; border-color: #ffe082; }
.tb-btn.bot.alert { color: #b71c1c; background: #ffebee; border-color: #ef9a9a; }
.tb-btn.bot.static, .tb-btn.bot:disabled { color: var(--muted); }
.tb-count { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--green); color: #fff; font: 600 10px/16px system-ui; text-align: center; font-style: normal; }
.tb-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; background: #0b3d36; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.3; padding: 5px 9px; border-radius: 7px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; z-index: 60; pointer-events: none; }
.tb-item.open > .tb-btn::after { display: none; }
.tb-pop { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.16); padding: 12px; min-width: 250px; }
.tb-pop.wide { min-width: 320px; }
.tb-item.open > .tb-pop { display: block; }
.tb-pop label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: #3b4a54; }
.tb-pop select, .tb-pop .deal { width: 100%; }
.tb-pop .deal input { width: 100%; }
.tb-pop textarea { width: 100%; }
.label-menu { top: calc(100% + 8px); }
@media (min-width: 761px) {
  .chat-tools { display: flex; margin-left: auto; }
  .chat-head { flex-wrap: nowrap; }
}
@media (max-width: 760px) {
  .chat-tools { padding: 12px 14px; }
  .chat-tools .tb { flex-wrap: wrap; gap: 8px; }
  .chat-tools .tb-item:not(.label-menu-wrap) { display: contents; }
  .chat-tools .tb-btn { width: 46px; height: 46px; }
  .chat-tools .tb-btn svg { width: 22px; height: 22px; }
  .chat-tools .tb-pop { position: static; display: none; flex-basis: 100%; order: 10; box-shadow: none; background: #f7f9fa; }
  .chat-tools .tb-item.open > .tb-pop { display: block; }
  .tb-btn[data-tip]:hover::after { display: none; }
  .chat-head .chat-title .chat-labels { display: none; }
}

/* ---- emojis ---- */
.emoji-pop { position: absolute; left: 16px; bottom: calc(100% + 4px); width: 340px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 30; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.emoji-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; overflow-x: auto; }
.emoji-tab { flex: none; border: 0; background: transparent; font-size: 19px; width: 34px; height: 32px; border-radius: 8px; opacity: .55; }
.emoji-tab:hover { background: var(--bg); opacity: 1; }
.emoji-tab.on { background: #e8f5f2; opacity: 1; box-shadow: inset 0 -2px 0 var(--green); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 232px; overflow-y: auto; }
.emoji-cell { border: 0; background: transparent; font-size: 23px; line-height: 1; height: 38px; border-radius: 8px; }
.emoji-cell:hover { background: var(--bg); transform: scale(1.15); }
.emoji-name { display: none; }
.emoji-row { position: relative; display: flex; }
.emoji-host { position: absolute; left: 0; top: 100%; z-index: 60; }
.emoji-host .emoji-pop { position: static; margin-top: 4px; }
.with-emoji { position: relative; }
@media (max-width: 760px) { .composer .emoji-pop { left: 8px; right: 8px; width: auto; max-width: none; } .emoji-cell { height: 42px; } }

/* ---- áudio no estilo WhatsApp ---- */
.msg.audio { width: 340px; max-width: 90%; padding: 8px 10px 6px; }
.vn { display: grid; grid-template-columns: 38px minmax(0, 1fr) 56px; gap: 8px; align-items: center; }
.vn-play { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: #3b4a54; display: grid; place-items: center; padding: 0; }
.vn-play svg { width: 30px; height: 30px; }
.vn-play:hover { background: rgba(0,0,0,.06); }
.vn-wave { position: relative; height: 34px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; user-select: none; outline: none; }
.vn-wave .b { flex: 1; min-width: 2px; max-width: 4px; height: calc(var(--h, .4) * 100%); border-radius: 2px; background: #c3cbd0; transition: background .12s; }
.vn-wave .b.on { background: #7f9099; }
.msg.out .vn-wave .b { background: #a9c9b0; }
.msg.out .vn-wave .b.on { background: #5b8f6a; }
.vn-dot { position: absolute; top: 50%; left: calc(var(--p, 0) * (100% - 14px)); width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: #25d366; box-shadow: 0 1px 2px rgba(0,0,0,.25); pointer-events: none; }
.vn-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 1px; }
.vn-foot .meta { float: none; margin: 0; }
.vn-side { position: relative; width: 56px; height: 56px; }
.vn-side .avatar { width: 52px; height: 52px; font-size: 20px; }
.vn-side.speed .avatar { display: none; }
.vn-mic { position: absolute; left: -2px; bottom: 0; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px #0000001a; display: grid; place-items: center; color: #25d366; }
.vn-mic svg { width: 14px; height: 14px; }
.vn-mic.heard { color: #53bdeb; }
.vn-side.speed .vn-mic { display: none; }
.vn-rate { position: absolute; inset: 12px 0; border: 0; border-radius: 999px; background: #e2e8ea; color: #3b4a54; font-weight: 700; font-size: 13px; }
.vn-rate:hover { background: #d3dbde; }
.msg.audio .transcript { max-width: none; margin-top: 4px; }
@media (max-width: 760px) { .msg.audio { width: 330px; max-width: 88%; } }

/* ---- ícones de traço (icons.js) ---- */
.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }
.i.lead { margin-right: .4em; }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .i { width: 20px; height: 20px; margin: 0; }
.ghost-btn .i, .primary-btn .i, .tab .i { width: 17px; height: 17px; }
.ticks .i { width: 15px; height: 15px; vertical-align: -3px; margin: 0 0 0 3px; }
.ticks.failed .i { margin-right: 2px; }
.sheet-item .si-ico .i, .set-ico .i { width: 22px; height: 22px; margin: 0; }
.toast .i, .chip .i, .tag .i, .warn .i, .risk .i { width: 14px; height: 14px; }
.back-btn .i { width: 24px; height: 24px; }

/* ---- barra de escrever minimalista ---- */
.composer { margin: 0 14px 12px; padding: 5px 10px; background: #fff; border-radius: 28px; box-shadow: 0 1px 4px rgba(0,0,0,.14); align-items: center; gap: 2px; position: relative; }
.composer textarea { background: transparent; border-radius: 0; padding: 10px 8px; }
.cb { position: relative; flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: #2f3b43; display: inline-grid; place-items: center; padding: 0; }
.cb .i { width: 22px; height: 22px; margin: 0; stroke-width: 1.7; }
.cb:hover { background: #f0f2f5; }
.cb.on, .cb.sign-btn.on { color: var(--green); background: #e8f5f2; opacity: 1; }
.cb.sign-btn { opacity: 1; color: #2f3b43; }
.composer .send-btn { background: var(--green); color: #fff; width: 38px; height: 38px; }
.composer .send-btn:hover { background: var(--green-dark); }
.composer .send-btn .i { width: 19px; height: 19px; }
.composer:not(.has-content) > .send-btn { display: none; }
.composer.has-content #btn-mic { display: none; }
.cb[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 0; background: #0b3d36; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.3; padding: 5px 9px; border-radius: 7px; white-space: nowrap; z-index: 60; pointer-events: none; }
#btn-mic[data-tip]:hover::after, #btn-quick[data-tip]:hover::after, .send-btn[data-tip]:hover::after { left: auto; right: 0; }
.cb-wrap { position: relative; }
.attach-menu { position: absolute; bottom: calc(100% + 10px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 6px; min-width: 210px; z-index: 35; display: flex; flex-direction: column; }
.attach-menu > button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 12px; border-radius: 10px; text-align: left; font: inherit; color: #2f3b43; }
.attach-menu > button:hover { background: var(--bg); }
.attach-menu .m-only { display: none; }
.rec-bar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.composer:not(.recording) .rec-bar { display: none; }
.composer.recording > :not(.rec-bar):not(.qr-popup) { display: none !important; }
.composer.recording > .rec-bar .send-btn { display: inline-grid !important; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: rec-blink 1s infinite; flex: none; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; min-width: 40px; color: #e53935; font-weight: 600; }
.rec-level { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-level i { flex: none; width: 3px; border-radius: 2px; background: #8696a0; min-height: 3px; }
@media (max-width: 760px) {
  .composer { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); padding: 4px 6px; gap: 0; }
  .composer .cb-opt { display: none; }
  .composer .cb { width: 40px; height: 40px; }
  .composer .send-btn { width: 40px; height: 40px; }
  .composer textarea { padding: 11px 6px; border-radius: 0; }
  .attach-menu .m-only { display: flex; }
  .cb[data-tip]:hover::after { display: none; }
}
.chat { background: var(--bg-chat); }

/* ---- painel de respostas rápidas ---- */
.workspace.with-qr { grid-template-columns: 380px minmax(0, 1fr) 350px; }
.qr-panel { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.qr-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.qr-head-ico { color: var(--green); display: grid; place-items: center; }
.qr-head-ico .i, .qr-head .icon-btn .i { width: 20px; height: 20px; margin: 0; }
.qr-title { font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-head-acts { display: flex; align-items: center; gap: 2px; }
.qr-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.qr-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.qr-search input { flex: 1; border: 0; background: transparent; padding: 10px 0; font: inherit; color: var(--text); outline: none; min-width: 0; }
.qr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qr-chip { border: 1px solid var(--line); background: #fff; color: #3b4a54; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.qr-chip .i { width: 14px; height: 14px; margin: 0; }
.qr-chip:hover { background: var(--bg); }
.qr-chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.qr-groups { display: flex; flex-direction: column; gap: 10px; }
.qr-cat { --c: #8aa39b; background: color-mix(in srgb, var(--c) 13%, #fff); border: 1.5px solid color-mix(in srgb, var(--c) 42%, #fff); border-radius: 14px; padding: 6px 6px 8px; position: relative; }
.qr-cat.over { box-shadow: 0 0 0 2px var(--c); }
.qr-cat.dragging { opacity: .45; }
.qr-cat.drop-before::before, .qr-cat.drop-after::after { content: ''; position: absolute; left: 6px; right: 6px; height: 3px; border-radius: 2px; background: var(--green); }
.qr-cat.drop-before::before { top: -7px; }
.qr-cat.drop-after::after { bottom: -7px; }
.qr-cat-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 4px; cursor: default; }
.qr-cat-head strong { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .02em; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-cat-head .icon-btn { width: 28px; height: 28px; }
.qr-cat-head .icon-btn .i { width: 18px; height: 18px; }
.qr-grip { color: #9aa7ad; cursor: grab; display: grid; place-items: center; }
.qr-grip .i, .qr-cat-ico .i { width: 18px; height: 18px; margin: 0; }
.qr-cat-ico { display: grid; place-items: center; }
.qr-count { font-size: 11px; font-weight: 700; color: var(--muted); background: #ffffffa0; border-radius: 999px; padding: 1px 7px; }
.qr-items { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; border-top: 1px solid color-mix(in srgb, var(--c) 30%, #fff); }
.qr-vazia { margin: 6px; font-size: 12.5px; color: var(--muted); }
.qr-row { position: relative; display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 9px; }
.qr-row:hover { background: #ffffff90; }
.qr-row.dragging { opacity: .45; }
.qr-row.drop-before::before, .qr-row.drop-after::after { content: ''; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--green); }
.qr-row.drop-before::before { top: -2px; }
.qr-row.drop-after::after { bottom: -2px; }
.qr-kind { color: #55656d; display: grid; place-items: center; flex: none; }
.qr-kind .i { width: 18px; height: 18px; margin: 0; }
.qr-name { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; font: inherit; font-size: 14px; color: var(--text); padding: 6px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-row .icon-btn { width: 28px; height: 28px; flex: none; }
.qr-row .icon-btn .i { width: 18px; height: 18px; margin: 0; }
.qr-row .qr-send { color: var(--green); }
.qr-flat { display: flex; flex-direction: column; gap: 2px; }
.qr-menu { position: fixed; z-index: 120; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.2); padding: 5px; min-width: 190px; display: flex; flex-direction: column; }
.qr-menu button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; text-align: left; font: inherit; font-size: 14px; color: #2f3b43; }
.qr-menu button:hover { background: var(--bg); }
.qr-menu button.danger { color: #b3261e; }
.qr-form { gap: 12px; }
.qr-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #3b4a54; }
.qr-form input:not([type=checkbox]):not([type=color]), .qr-form select, .qr-form textarea, .qr-cats-list + * input { border: 1px solid #d1d7db; border-radius: 8px; padding: 8px 10px; font: inherit; font-weight: 400; color: var(--text); background: #fff; width: 100%; }
.qr-form textarea { resize: vertical; }
.qa-title { font-size: 13px; font-weight: 700; color: #3b4a54; margin-top: 2px; }
.qa-list { display: flex; flex-direction: column; gap: 10px; }
.qa-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fafbfb; display: flex; flex-direction: column; gap: 8px; }
.qa-head { display: flex; align-items: center; gap: 8px; }
.qa-head strong { flex: 1; font-size: 13.5px; }
.qa-ico { color: var(--green); display: grid; place-items: center; }
.qa-ico .i { width: 18px; height: 18px; margin: 0; }
.qa-btns { display: flex; }
.qa-btns .icon-btn { width: 28px; height: 28px; }
.qa-btns .icon-btn .i { width: 16px; height: 16px; }
.qa-line { flex-direction: row !important; align-items: center; gap: 6px !important; font-weight: 500 !important; font-size: 12.5px !important; color: var(--muted) !important; }
.qa-num { width: 58px !important; text-align: center; padding: 5px 6px !important; }
.qa-vars { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qa-var { border: 1px solid #cfe5e0; background: #eef6f4; color: #0b6b5a; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.qa-var:hover { background: #dcefea; }
.qa-vars .icon-btn { width: 28px; height: 28px; margin-left: auto; }
.qa-emoji-host .emoji-pop { position: static; width: 100%; max-width: none; margin-top: 4px; box-shadow: none; }
.qa-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.qa-add .ghost-btn { padding: 4px 10px; font-size: 13px; }
.qs-row { flex-direction: row; align-items: center; gap: 6px; padding: 8px; }
.qs-row select { flex: 1; min-width: 0; }
.qs-n { width: 22px; height: 22px; border-radius: 50%; background: #e8f5f2; color: var(--green-dark); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.qs-wait { flex-direction: row !important; align-items: center; gap: 4px !important; flex: none; }
.qs-title { flex: 1; min-width: 0; font-size: 13.5px; }
.qr-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.qr-actions .form-error { margin-right: auto; }
.qr-actions.pad-x { padding: 4px 18px 16px; }
.qr-sendwrap { padding: 0 0 0; overflow-y: auto; }
.qr-sendwrap .qr-form { padding: 12px 18px; }
.qr-cats-list { display: flex; flex-direction: column; gap: 6px; }
.qr-cat-line { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.qr-cat-line strong { flex: 1; min-width: 0; text-transform: uppercase; font-size: 13px; }
.qr-cat-line .icon-btn { width: 30px; height: 30px; }
.qr-cat-line .icon-btn .i { width: 17px; height: 17px; margin: 0; }
.qr-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qr-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd6d9; padding: 0; }
.qr-sw.on { box-shadow: 0 0 0 2px var(--green-dark); }
.qr-swatches input[type=color] { width: 34px; height: 30px; padding: 0; border: 0; background: transparent; }
@media (max-width: 760px) {
  .qr-panel { position: fixed; inset: 0; z-index: 70; border: 0; }
  .qr-head { padding-top: calc(env(safe-area-inset-top) + 10px); }
  .workspace.with-qr { grid-template-columns: 1fr; }
}

/* ---- avisos automáticos ---- */
.ntc-prev { display: block; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntc-form { padding: 14px 18px 18px; }
.ntc-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ntc-left, .ntc-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ntc-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ntc-range .two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 6px; }
.ntc-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ntc-presets .ghost-btn { padding: 4px 10px; font-size: 13px; }
.ntc-preview { background: var(--bg-chat); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.ntc-bubble { align-self: flex-start; max-width: 92%; background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0,0,0,.1); }
.ntc-bubble strong { font-weight: 700; }
.ntc-file { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
@media (max-width: 760px) { .ntc-cols { grid-template-columns: 1fr; } .ntc-range { grid-template-columns: 1fr; } }

/* ---- menu de atendimento ---- */
.mn-onoff { display: flex; align-items: center; gap: 8px; }
.mn-list { display: flex; flex-direction: column; gap: 8px; }
.mn-opt { border: 1px solid var(--line); border-radius: 12px; background: #fafbfb; }
.mn-opt > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; }
.mn-opt > summary::-webkit-details-marker { display: none; }
.mn-opt-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-opt-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); }
.mn-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ntc-bubble.mine { align-self: flex-end; background: var(--bubble-out); }
@media (max-width: 760px) { .mn-actions { grid-template-columns: 1fr; } }

/* ================= menu da seta / botão direito ================= */
.ctx-menu { position: fixed; z-index: 120; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; min-width: 232px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; }
.ctx-menu button { display: flex; width: 100%; gap: 12px; align-items: center; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; color: #1f2c34; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--bg); outline: 0; }
.ctx-menu button.danger { color: #c62828; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx-menu .i.lead { width: 18px; height: 18px; flex: none; margin: 0; color: #54656f; }
.ctx-menu .danger .i.lead { color: #c62828; }
.ctx-gap { width: 18px; flex: none; }
.ctx-arrow { width: 16px; height: 16px; margin-left: auto; color: #8696a0; transition: transform .15s; }
.ctx-group > button.open .ctx-arrow { transform: rotate(180deg); }
.ctx-sub { padding: 0 0 4px 30px; }
.ctx-sub button { padding: 7px 10px; }
.ctx-on { width: 16px; height: 16px; margin-left: auto; color: var(--green); }

/* seta e ícones na lista de conversas */
.chat-row { min-width: 0; }
.chat-preview { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-flags { display: flex; align-items: center; gap: 5px; flex: none; }
.chat-flags .fl { width: 14px; height: 14px; color: #8696a0; }
.badge.muted { background: #8696a0; }
.chat-more { display: none; flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #667781; place-items: center; cursor: pointer; margin-left: 2px; }
.chat-more .i { width: 18px; height: 18px; }
.chat-more:hover { background: #0000000f; }
@media (hover: hover) and (min-width: 761px) { .chat-item:hover .chat-more, .chat-item:focus-within .chat-more { display: grid; } }

/* seta na bolha da mensagem */
.msg { position: relative; }
.msg-more { position: absolute; top: 2px; right: 3px; display: none; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 6px; place-items: center; cursor: pointer; color: #54656f; background: linear-gradient(90deg, transparent, var(--bubble-in) 40%); }
.msg.out .msg-more { background: linear-gradient(90deg, transparent, var(--bubble-out) 40%); }
.msg-more .i { width: 18px; height: 18px; }
.msg.has-media .msg-more, .msg.audio .msg-more, .msg.sticker .msg-more { background: #ffffffd9; box-shadow: 0 1px 3px #0003; top: 6px; right: 6px; border-radius: 50%; width: 22px; height: 22px; }
@media (hover: hover) and (min-width: 761px) { .msg:hover .msg-more, .msg-more:focus-visible { display: grid; } }
.msg.flash { animation: msg-flash 1.6s ease-out; }
@keyframes msg-flash { 0%, 40% { box-shadow: 0 0 0 3px #53bdeb99; } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.1); } }

/* trecho respondido dentro da bolha */
.quote { display: flex; flex-direction: column; gap: 1px; margin: 0 0 4px; padding: 5px 8px; border-left: 4px solid #53bdeb; border-radius: 6px; background: #0000000d; cursor: pointer; font-size: 13px; min-width: 120px; max-width: 360px; white-space: normal; }
.quote.mine { border-left-color: var(--green); }
.quote .q-who { font-weight: 600; font-size: 12.5px; color: #027eb5; }
.quote.mine .q-who { color: var(--green-dark); }
.quote .q-text { color: #54656f; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.msg.has-media .quote { margin: 2px 2px 4px; }

/* barra "Respondendo a…" acima do campo de mensagem */
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #e9edef; border-top: 1px solid var(--line); }
.reply-bar.hidden { display: none; }
.reply-bar .rb-ico { width: 18px; height: 18px; color: #54656f; flex: none; }
.reply-bar .rb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; border-left: 4px solid var(--green); padding-left: 10px; }
.reply-bar .rb-body strong { font-size: 13px; color: var(--green-dark); }
.reply-bar .rb-body span { font-size: 13.5px; color: #54656f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* janela "Encaminhar" */
.fwd { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 16px; overflow: hidden; min-height: 0; }
.fwd-prev { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg); color: #54656f; font-size: 13.5px; }
.fwd-prev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fwd input[type="search"] { border: 1px solid #d1d7db; border-radius: 8px; padding: 9px 12px; font: inherit; outline: none; }
.fwd input[type="search"]:focus { border-color: var(--green); }
.fwd-list { overflow-y: auto; min-height: 180px; max-height: 46vh; display: flex; flex-direction: column; }
.fwd-row { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.fwd-row:hover, .fwd-row.on { background: #e8f5f2; }
.fwd-row .avatar { width: 38px; height: 38px; font-size: 16px; flex: none; }
.fwd-row input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.fwd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwd-name small { color: var(--muted); }

/* ================= painel do raio: abas Contato / Respostas rápidas ================= */
.qp-tabs { display: flex; gap: 6px; padding: 8px 10px 0; background: #fff; }
.qp-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 8px 6px; background: var(--bg); color: #54656f; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.qp-tab .i { width: 16px; height: 16px; margin: 0; }
.qp-tab:hover { background: #e4e8eb; }
.qp-tab.on { background: var(--green); color: #fff; }
.qp-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qp-pane.hidden { display: none; }
@media (max-width: 760px) {
  .qp-tabs { padding-top: calc(env(safe-area-inset-top) + 8px); }
  .qr-panel .qr-head { padding-top: 10px; }
}

/* cadastro do contato */
.cf-form { gap: 12px; }
.cf-empty { padding: 18px 6px; text-align: center; }
.cf-id { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 2px; }
.cf-id .avatar { width: 84px; height: 84px; font-size: 34px; }
.cf-phone { display: flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 500; }
.cf-phone .i.lead { width: 16px; height: 16px; color: #8696a0; margin: 0 2px 0 0; }
.cf-phone .icon-btn { width: 30px; height: 30px; }
.cf-phone .icon-btn .i { width: 16px; height: 16px; margin: 0; }
.cf-field { display: flex; flex-direction: column; gap: 5px; font-size: 14.5px; font-weight: 600; color: #1f2c34; min-width: 0; }
.cf-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1.5px solid transparent; border-radius: 10px; padding: 0 10px; min-width: 0; transition: border-color .12s, background .12s; }
.cf-box:focus-within { border-color: var(--green); background: #fff; }
.cf-box > .i { width: 17px; height: 17px; margin: 0; color: #667781; flex: none; }
.cf-box input, .cf-box select { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; font: inherit; font-weight: 400; font-size: 14.5px; color: var(--text); outline: none; }
.cf-box select { cursor: pointer; }
.cf-box input::placeholder { color: #8696a0; }
.cf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-field > textarea { border: 1.5px solid transparent; background: var(--bg); border-radius: 10px; padding: 10px 12px; font: inherit; font-weight: 400; font-size: 14.5px; resize: vertical; min-height: 100px; outline: none; }
.cf-field > textarea:focus { border-color: var(--green); background: #fff; }
.cf-add { display: flex; gap: 8px; align-items: stretch; }
.cf-add .cf-box { flex: 1; }
.cf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip { display: inline-flex; align-items: center; gap: 4px; background: #e8f5f2; color: var(--green-dark); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 13px; font-weight: 600; }
.cf-chip button { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; padding: 0; display: grid; place-items: center; color: inherit; cursor: pointer; }
.cf-chip button:hover { background: #0000001a; }
.cf-chip .i { width: 12px; height: 12px; margin: 0; }
.cf-status { font-size: 12.5px; color: var(--green); font-weight: 600; opacity: 0; transition: opacity .25s; margin-right: 4px; }
.cf-status.on { opacity: 1; }
.cf-err:empty { display: none; }

/* Recursos desligados nesta instalação (ZAPSELLER_FEATURES): some qualquer botão que sobrar */
.no-f-agenda #btn-chat-schedule, .no-f-agenda #btn-composer-schedule, .no-f-agenda #am-schedule { display: none !important; }
.no-f-bot #btn-chat-bot, .no-f-bot #btn-bot { display: none !important; }
