/* NewZap — tema escuro estilo WhatsApp, responsivo (celular e computador) */
:root, [data-theme="dark"] {
  --bg: #0b141a; --panel: #111b21; --panel2: #202c33; --panel3: #2a3942; --line: #2a3942;
  --text: #e9edef; --muted: #8696a0; --green: #00a884; --green-dark: #005c4b; --blue: #53bdeb;
  --red: #f15c6d; --yellow: #f59e0b; --radius: 10px;
  --chat-bg: #0b141a; --chat-dot: %23182229; --bubble-in: #202c33; --bubble-out: #005c4b; --meta: #ffffff99;
  --quote-bg: #0003; --quote-text: #d1d7db; --day-bg: #182229; --sys-bg: #1d3a45; --sys-text: #cde3ea;
  --row-line: #1c272d; --chip-on: #0a332c; --shadow: #0008; --input: #202c33; --code-bg: #0a1014; --assume: #1c2a33;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eae6df; --panel: #ffffff; --panel2: #f0f2f5; --panel3: #e4e8eb; --line: #e1e4e7;
  --text: #111b21; --muted: #667781; --green: #00a884; --green-dark: #d9fdd3; --blue: #027eb5;
  --red: #e0245e; --yellow: #b45309;
  --chat-bg: #efeae2; --chat-dot: %23d9d2c5; --bubble-in: #ffffff; --bubble-out: #d9fdd3; --meta: #667781;
  --quote-bg: #0000000d; --quote-text: #3b4a54; --day-bg: #ffffffd9; --sys-bg: #fff5c4; --sys-text: #54656f;
  --row-line: #f0f2f5; --chip-on: #d9fdd3; --shadow: #0003; --input: #ffffff; --code-bg: #f6f8fa; --assume: #fff8e1;
  color-scheme: light;
}
:root {
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 14.5px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; } .right { text-align: right; }
.grow { flex: 1; min-width: 0; } .nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error, .err-text { color: var(--red); } .ok-text { color: var(--green); }
a { color: var(--blue); }
code { background: var(--panel3); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12px; }
h2, h3, h4 { margin: 0; } h4 { margin: 18px 0 6px; color: var(--green); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

input, select, textarea { background: var(--input); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; outline: none; width: auto; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input[type=checkbox] { accent-color: var(--green); width: 17px; height: 17px; }
input[type=color] { padding: 0; width: 26px; height: 26px; border: 0; background: none; cursor: pointer; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--text); font-size: 14.5px; }
label.check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
label.check span { display: flex; flex-direction: column; } label.check small { color: var(--muted); }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px;
  cursor: pointer; font: inherit; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:hover:not(:disabled) { filter: brightness(1.2); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.danger { color: var(--red); } .btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; } .btn.big { padding: 12px; font-size: 15px; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; }
.icon-btn:hover { background: var(--panel3); color: var(--text); }
.mini { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; font-size: 12px; }
.mini:disabled { opacity: .3; }
.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap, .toolbar.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill.on { color: var(--green); background: #00a88420; } .pill.off { color: var(--red); background: #f15c6d20; } .pill.wait { color: var(--yellow); background: #f59e0b20; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; } .status-dot.on { background: var(--green); } .status-dot.off { background: var(--muted); }
.badge { background: var(--green); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; min-width: 20px; text-align: center; }
.tag { font-size: 10.5px; padding: 1px 7px; border-radius: 4px; color: #fff; background: var(--c, #475569); white-space: nowrap; }
.tag.user { background: #334155; } .tag.inst { background: #1e3a4a; }
.big-icon { font-size: 52px; }
.empty-state { text-align: center; padding: 40px 20px; }
.loading { color: var(--muted); padding: 20px; text-align: center; }

/* switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--panel3); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--green); } .switch input:checked + i::before { transform: translateX(18px); }

/* ---------- login ---------- */
.auth { height: 100%; display: grid; place-items: center; padding: 20px; overflow: auto; }
.auth-card { background: var(--panel); padding: 32px; border-radius: 16px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin: 0; font-size: 32px; } .auth-card h1 span, .brand span { color: var(--green); }

/* ---------- estrutura ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.impersonation { background: #7c2d12; color: #fff; padding: 6px 14px; display: flex; gap: 10px; align-items: center; justify-content: center; font-size: 13px; padding-top: calc(6px + var(--safe-t)); }
.shell { flex: 1; display: flex; min-height: 0; }
.spacer { flex: 1; }
main { flex: 1; min-width: 0; display: flex; min-height: 0; }
.page { flex: 1; overflow: auto; padding: 22px 26px 40px; } .page.narrow > * { max-width: 920px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; justify-content: space-between; }
.page-head p { margin: 4px 0 0; }

/* ---------- conversas ---------- */
.chat-layout { flex: 1; display: flex; min-width: 0; }
.conv-pane { width: 380px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.conv-search { padding: 4px 12px 8px; } .conv-search input { width: 100%; background: var(--panel2); border: 0; }
.chips { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.chip { background: var(--panel2); color: var(--muted); border: 0; border-radius: 99px; padding: 6px 12px; cursor: pointer; white-space: nowrap; font: inherit; font-size: 13px; }
.chip.active { background: var(--chip-on); color: var(--green); }
.inst-filter { margin: 0 12px 8px; }
.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 12px; padding: 10px 14px; cursor: pointer; align-items: center; border-bottom: 1px solid var(--row-line); }
.conv-item:hover { background: var(--panel2); } .conv-item.active { background: var(--panel3); }
.conv-item .row1, .conv-item .row2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv-item .name { font-weight: 500; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { color: var(--muted); font-size: 11.5px; flex-shrink: 0; } .conv-item .time.unread { color: var(--green); }
.conv-item .last { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.conv-item .row3 { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; } .conv-item .row3:empty { display: none; }
.typing { color: var(--green) !important; font-style: italic; }
.empty-list { padding: 30px; text-align: center; color: var(--muted); }

.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--c, #6b7c85); display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 700; position: relative; overflow: hidden; font-size: 16px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }

.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative;
  background-color: var(--chat-bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.chat-empty { margin: auto; text-align: center; padding: 30px; max-width: 420px; } .chat-empty.small { margin: 40px auto; }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--panel2); min-height: 60px; padding-top: calc(8px + var(--safe-t)); }
.chat-head .avatar { width: 40px; height: 40px; }
.head-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-info small { color: var(--muted); font-size: 12.5px; }
.chat-tools { display: flex; gap: 6px; } .chat-tools select { padding: 6px 8px; font-size: 13px; max-width: 170px; }
.back { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 14px 7% 10px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.day { align-self: center; margin: 10px 0; } .day span { background: var(--day-bg); color: var(--muted); font-size: 12px; padding: 5px 12px; border-radius: 8px; }
.msg-row { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 2px; max-width: 72%; align-self: flex-start; }
.msg-row.me { align-items: flex-end; align-self: flex-end; }
.msg-row.flash .bubble { box-shadow: 0 0 0 3px var(--green); }
.bubble { background: var(--bubble-in); box-shadow: 0 1px .5px #0000001a; padding: 6px 8px 6px 9px; border-radius: 8px; border-top-left-radius: 2px; position: relative; min-width: 80px; max-width: 100%; }
.msg-row.me .bubble { background: var(--bubble-out); border-top-left-radius: 8px; border-top-right-radius: 2px; }
.is-sticker .bubble { background: none !important; }
.bubble .text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; padding-right: 4px; }
.bubble .text code { background: #0003; }
.bubble .meta { float: right; font-size: 11px; color: var(--meta); margin: 6px 0 -4px 10px; white-space: nowrap; }
.tick.read { color: var(--blue); }
.bubble .msg-menu { position: absolute; top: 2px; right: 2px; background: inherit; border: 0; color: var(--muted); cursor: pointer; opacity: 0; font-size: 14px; border-radius: 50%; }
.bubble:hover .msg-menu { opacity: 1; }
.media { max-width: min(330px, 100%); max-height: 360px; border-radius: 6px; display: block; cursor: pointer; margin-bottom: 3px; }
video.media { cursor: auto; }
.sticker { width: 140px; height: 140px; object-fit: contain; }
.audio { display: flex; align-items: center; gap: 6px; } .audio audio { width: 250px; max-width: 60vw; height: 40px; }
.speed { background: var(--quote-bg); color: var(--text); border: 0; border-radius: 99px; padding: 3px 8px; font-size: 11px; cursor: pointer; }
.doc { display: flex; align-items: center; gap: 10px; background: var(--quote-bg); padding: 10px; border-radius: 6px; text-decoration: none; color: var(--text); min-width: 220px; }
.doc-icon { font-size: 26px; }
.no-media { color: var(--muted); font-style: italic; }
.fwd { color: var(--muted); font-size: 12px; font-style: italic; }
.agent { color: var(--green); font-size: 12px; font-weight: 600; }
.quote { background: var(--quote-bg); border-left: 4px solid var(--green); border-radius: 5px; padding: 5px 8px; margin-bottom: 4px; font-size: 13px; color: var(--quote-text);
  cursor: pointer; max-height: 70px; overflow: hidden; }
.deleted { color: var(--muted); font-style: italic; }
.reactions { background: var(--panel); border: 2px solid var(--chat-bg); border-radius: 99px; padding: 1px 7px; margin-top: -6px; font-size: 13px; cursor: pointer; z-index: 1; }
.reactions small { color: var(--muted); margin-left: 2px; }
.drop-hint { display: none; position: absolute; inset: 60px 0 0; background: #00a88433; border: 3px dashed var(--green); z-index: 5;
  align-items: center; justify-content: center; font-size: 20px; pointer-events: none; }
.chat-pane.dragging .drop-hint { display: flex; }
.reply-bar { display: flex; gap: 8px; align-items: center; background: var(--panel2); padding: 8px 12px 0; }
.attach-bar { display: flex; gap: 8px; padding: 10px 12px 0; background: var(--panel2); overflow-x: auto; flex-wrap: wrap; }
.att { position: relative; width: 120px; background: var(--panel); border-radius: 8px; overflow: hidden; }
.att img, .att video { width: 120px; height: 90px; object-fit: cover; display: block; }
.att-icon { height: 90px; display: grid; place-items: center; font-size: 38px; }
.att-name { padding: 4px 6px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name small { display: block; color: var(--muted); }
.att-rm, .att-doc { position: absolute; top: 4px; background: #000a; color: #fff; border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 12px; }
.att-rm { right: 4px; } .att-doc { right: 32px; }
.att-hint { width: 100%; font-size: 12px; }
.composer, .recording-bar { display: flex; gap: 4px; padding: 8px 10px; background: var(--panel2); align-items: flex-end; padding-bottom: calc(8px + var(--safe-b)); }
.composer textarea { flex: 1; resize: none; max-height: 160px; background: var(--panel3); border: 0; border-radius: 10px; padding: 11px 14px; line-height: 1.35; }
.icon-btn.send { background: var(--green); color: #fff; font-size: 18px; } .icon-btn.send:hover { background: var(--green); filter: brightness(1.1); }
.recording-bar { align-items: center; gap: 10px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* menus, modais, emojis */
.ctx-menu { position: fixed; z-index: 60; background: var(--panel); border-radius: 10px; padding: 6px 0; min-width: 210px; box-shadow: 0 8px 30px var(--shadow); border: 1px solid var(--line); }
.ctx-menu > button { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: 0; color: var(--text); padding: 10px 18px; cursor: pointer; font: inherit; text-align: left; }
.ctx-menu > button:hover { background: var(--panel3); } .ctx-menu > button.danger { color: var(--red); }
.quick-react { display: flex; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.quick-react button { background: none; border: 0; font-size: 22px; cursor: pointer; border-radius: 50%; width: 38px; height: 38px; }
.quick-react button:hover, .quick-react button.on { background: var(--panel3); }
.emoji-menu { padding: 0; }
.emoji-picker { width: 320px; max-width: 92vw; height: 300px; overflow-y: auto; padding: 8px; }
.emoji-cat { color: var(--muted); font-size: 12px; margin: 6px 4px 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button { background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px; border-radius: 6px; }
.emoji-grid button:hover { background: var(--panel3); }
.modal-backdrop { position: fixed; inset: 0; background: #000a; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 17px; } .modal-back { display: none; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; }
.modal-actions.sticky { position: sticky; bottom: -18px; background: var(--panel); padding: 12px 0 4px; }
.modal-actions .muted { margin-right: auto; }
.lightbox-modal { background: none; width: auto !important; } .lightbox-modal .modal-head { border: 0; } .lightbox-modal .modal-head h3 { visibility: hidden; }
.lightbox { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lightbox img, .lightbox video { max-width: 90vw; max-height: 78vh; border-radius: 8px; }
.pick-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 50vh; overflow-y: auto; }
.pick-list label { flex-direction: row; align-items: center; gap: 10px; padding: 8px 4px; color: var(--text); cursor: pointer; border-radius: 8px; }
.pick-list label:hover { background: var(--panel2); }

/* configurações */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 10px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; font: inherit; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.setting { display: flex; flex-direction: row; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; }
.setting.col { flex-direction: column; align-items: stretch; cursor: default; }
.setting strong { display: block; font-weight: 500; } .setting small { color: var(--muted); display: block; margin-top: 2px; font-size: 12.5px; }
.setting textarea, .setting select { width: 100%; }
.help-box { margin-bottom: 14px; color: var(--muted); }
details summary { cursor: pointer; color: var(--blue); margin: 4px 0; }
.events { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.events legend { color: var(--muted); padding: 0 6px; }
.event-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; } .event-grid.disabled { opacity: .4; pointer-events: none; }
.row.hdr input { flex: 1; min-width: 0; }

/* tabelas */
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat small { color: var(--muted); display: block; } .stat b { font-size: 26px; }
.plan-info { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); }

/* conexões */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.inst-card { display: flex; flex-direction: column; gap: 14px; }
.inst-head { display: flex; gap: 12px; align-items: center; } .inst-icon { font-size: 30px; }
.qr-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.qr-box img { width: 220px; background: #fff; padding: 8px; border-radius: 10px; }
.qr-box ol { margin: 0; padding-left: 18px; color: var(--muted); flex: 1; min-width: 160px; }

/* webhooks */
.hook-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hook-info { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.secret code { word-break: break-all; }
.help { margin-top: 18px; }

/* kanban */
.view-kanban .page { display: flex; flex-direction: column; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; flex: 1; padding-bottom: 12px; }
.col { background: var(--panel); border-radius: var(--radius); width: 300px; flex-shrink: 0; display: flex; flex-direction: column; max-height: 100%; border-top: 4px solid var(--c); }
.col-head { padding: 10px 10px 8px 12px; display: flex; align-items: center; gap: 6px; }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.col-head [data-rename] { cursor: pointer; }
.col-head .count { background: var(--panel3); color: var(--muted); font-size: 12px; border-radius: 99px; padding: 0 8px; }
.col-body { padding: 0 8px 10px; overflow-y: auto; min-height: 70px; display: flex; flex-direction: column; gap: 8px; }
.col.over { outline: 2px dashed var(--green); outline-offset: -2px; }
.col-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 6px; border: 1px dashed var(--line); border-radius: 8px; }
.card { background: var(--panel2); border-radius: 8px; padding: 10px; cursor: grab; display: flex; gap: 10px; }
.card:hover { background: var(--panel3); } .card.dragging { opacity: .4; }
.card { -webkit-touch-callout: none; user-select: none; }
.card.wait { box-shadow: inset 3px 0 0 #f59e0b; }
.drop-line { height: 4px; border-radius: 2px; background: var(--green); flex: none; pointer-events: none; }
.card-top { display: flex; justify-content: space-between; gap: 6px; } .card-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; gap: 5px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.move-select { display: none; margin-top: 6px; width: 100%; padding: 5px; font-size: 12.5px; }
.more { width: 100%; }

.toast { position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel);
  padding: 11px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 6px 20px #0008; max-width: 92vw; text-align: center; }
.toast.err { background: #b91c1c; color: #fff; }

/* ================= CELULAR ================= */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { flex-direction: column-reverse; }
  .nav-bar { width: 100%; height: calc(60px + var(--safe-b)); flex-direction: row; padding: 0 4px var(--safe-b); border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; }
  .brand, .nav-bar .spacer { display: none; }
  .nav-item { width: auto; flex: 1; padding: 6px 0; font-size: 20px; border-radius: 10px; }
  .nav-item small { font-size: 10px; }
  .page { padding: 14px 12px 30px; padding-top: calc(14px + var(--safe-t)); }
  .page-head .btn.primary { width: 100%; }

  /* lista e chat em telas separadas */
  .conv-pane { width: 100%; border-right: 0; padding-top: var(--safe-t); }
  .chat-pane { display: none; }
  .chat-layout.open .conv-pane { display: none; }
  .chat-layout.open .chat-pane { display: flex; }
  body[data-route="chat"] .chat-layout.open ~ * , body[data-route="chat"]:has(.chat-layout.open) .nav-bar { display: none; }
  .back { display: inline-flex; margin-left: -6px; }
  .chat-head { flex-wrap: wrap; gap: 8px; }
  .chat-tools { order: 5; width: 100%; } .chat-tools select { flex: 1; max-width: none; }
  .messages { padding: 10px 10px; }
  .msg-row { max-width: 88%; }
  .bubble .msg-menu { display: none; }
  .media { max-width: 100%; }
  .audio audio { width: 200px; }
  .composer textarea { font-size: 16px; } /* evita zoom no iPhone */

  .modal-backdrop { padding: 0; place-items: stretch; }
  .modal, .modal.wide { width: 100%; max-height: 100%; height: 100%; border-radius: 0; padding-top: var(--safe-t); }
  .modal-back { display: inline-flex; } .modal-head [data-close]:last-child { display: none; }
  .lightbox-modal { height: 100%; background: #000; } .lightbox-modal .modal-head [data-close]:last-child { display: inline-flex; }
  .grid2, .grid3, .event-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .qr-box img { width: 100%; max-width: 280px; }

  /* kanban no celular: rolagem lateral por etapa + mover pelo seletor */
  .board { scroll-snap-type: x mandatory; }
  .col { width: 86vw; scroll-snap-align: center; }
  .card { cursor: pointer; } .move-select { display: block; }

  /* tabelas viram cartões */
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 5px 4px; text-align: right; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .table td.right { justify-content: flex-end; flex-wrap: wrap; }
  .ctx-menu { left: 8px !important; right: 8px; bottom: calc(8px + var(--safe-b)); top: auto !important; min-width: 0; }
}
@media (hover: none) { .bubble .msg-menu { display: none; } }
.setting.col { width: 100%; }

/* ---------- fila, abas e setores ---------- */
.state-tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 12px 8px; }
.state-tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 4px; cursor: pointer; font: inherit; font-size: 13.5px; border-bottom: 3px solid transparent; }
.state-tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.state-tabs b, .chip b { font-size: 11px; background: var(--panel3); border-radius: 99px; padding: 0 6px; margin-left: 2px; }
.state-tabs b:empty, .chip b:empty { display: none; }
.chips { flex-wrap: wrap; } .chip.active b { background: var(--panel); }
.mini-select { padding: 5px 8px; font-size: 12.5px; border-radius: 99px; max-width: 150px; }
.btn.xs { padding: 2px 8px; font-size: 11.5px; border-radius: 6px; }
.tag.offer { background: #b45309; } .tag.waiting { background: #92400e; } .tag.closed { background: #475569; }
.badge.muted { background: var(--muted); }
.assume-bar { background: var(--assume); padding: 8px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.sys-msg { align-self: center; margin: 6px 0; } .sys-msg span { background: var(--sys-bg); color: var(--sys-text); font-size: 12px; padding: 4px 12px; border-radius: 8px; }
.deleted-flag { color: #fca5a5; font-size: 11.5px; font-style: italic; }
.kept-deleted .bubble { opacity: .78; outline: 1px dashed #f15c6d66; }
.edited { cursor: pointer; text-decoration: underline dotted; }
.pre { white-space: pre-wrap; }
.result-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 60vh; overflow-y: auto; }
.result-list li { padding: 10px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.result-list li:hover { background: var(--panel2); }
.two-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.list-item.inactive { opacity: .55; }
.list-item .dot, .col-head .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 8px; }
.check-grid.disabled { opacity: .4; pointer-events: none; }
.queue-explain { background: var(--panel2); border-radius: 8px; padding: 4px 12px; color: var(--muted); }
.inst-icon img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; }
@media (max-width: 760px) {
  .two-cols { grid-template-columns: 1fr; }
  .chat-tools .btn.sm { flex: 1; }
  .chat-tools { flex-wrap: wrap; }
}
.sys-msg { max-width: 92%; text-align: center; } .sys-msg span { display: inline-block; line-height: 1.4; }

/* tema claro: ajustes finos */
[data-theme="light"] .conv-item.active { background: var(--panel3); }
[data-theme="light"] .tag { color: #fff; }
[data-theme="light"] .tag.user { background: #64748b; } [data-theme="light"] .tag.inst { background: #0e7490; }
[data-theme="light"] .icon-btn.send, [data-theme="light"] .btn.primary { color: #fff; }
[data-theme="light"] .modal-backdrop { background: #0006; }
[data-theme="light"] .impersonation { background: #c2410c; }
[data-theme="light"] .qr-box img { border: 1px solid var(--line); }
[data-theme="light"] .kept-deleted .bubble { outline-color: #e0245e55; }
[data-theme="light"] .deleted-flag { color: #be123c; }


/* =================================================================== DESIGN v2 */
:root { --accent-soft: #00a88422; --nav-w: 72px; }
[data-theme="light"] { --accent-soft: #00a8841a; }
* { scrollbar-width: thin; scrollbar-color: var(--panel3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 8px; } ::-webkit-scrollbar-track { background: transparent; }
.ic { display: block; flex-shrink: 0; }
.btn .ic { width: 16px; height: 16px; }

/* ---- menu lateral ---- */
.nav-bar { width: var(--nav-w); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 4px; }
.brand { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, #00a884, #017561); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; letter-spacing: -.5px; margin-bottom: 14px; box-shadow: 0 4px 14px #00a88440; }
.brand span { color: #d9fdd3; }
.nav-item { position: relative; background: none; border: 0; color: var(--muted); cursor: pointer; width: 60px; padding: 7px 0 6px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; font-family: inherit; transition: background .15s, color .15s; }
.nav-ic { width: 40px; height: 32px; display: grid; place-items: center; border-radius: 16px; transition: background .15s; }
.nav-item small { font-size: 10.5px; font-weight: 500; letter-spacing: .1px; }
.nav-item:hover { color: var(--text); } .nav-item:hover .nav-ic { background: var(--panel2); }
.nav-item.active { color: var(--green); } .nav-item.active .nav-ic { background: var(--accent-soft); }
.nav-item.active::before { content: ''; position: absolute; left: -6px; top: 12px; bottom: 26px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav-me { width: 34px; height: 34px; border-radius: 50%; background: var(--panel3); color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: 14px; margin: 6px 0 4px; }
.nav-item.logout:hover { color: var(--red); }

/* ---- lista ---- */
.pane-head h2 { font-size: 21px; font-weight: 700; }
.conv-search input { border-radius: 10px; padding-left: 14px; }
.conv-item { border-bottom: 0; margin: 0 6px; border-radius: 10px; padding: 9px 10px; }
.conv-item + .conv-item { box-shadow: 0 -1px 0 var(--row-line); }
.conv-item:hover { background: var(--panel2); box-shadow: none; } .conv-item.active { background: var(--panel3); box-shadow: none; }
.conv-item:hover + .conv-item, .conv-item.active + .conv-item { box-shadow: none; }

/* ---- cabeçalho e composer ---- */
.chat-head { border-bottom: 1px solid var(--line); background: var(--panel2); }
.composer { align-items: center; gap: 6px; padding: 8px 12px calc(8px + var(--safe-b)); }
.composer .icon-btn { color: var(--muted); }
.input-wrap { flex: 1; background: var(--input); border-radius: 22px; padding: 2px 6px; display: flex; border: 1px solid var(--line); }
[data-theme="dark"] .input-wrap { background: var(--panel3); border-color: transparent; }
.input-wrap textarea { flex: 1; background: none !important; border: 0 !important; padding: 10px 10px; max-height: 160px; }
.icon-btn.send { width: 46px; height: 46px; min-width: 46px; background: var(--green); color: #fff !important; box-shadow: 0 2px 8px #00a88455; }
.recording-bar { gap: 12px; } .rec-time { font-variant-numeric: tabular-nums; min-width: 42px; }
.rec-wave { display: flex; gap: 3px; align-items: center; height: 26px; }
.rec-wave i { width: 3px; border-radius: 3px; background: var(--green); animation: wave 1s ease-in-out infinite; height: 30%; }
.rec-wave i:nth-child(3n) { animation-delay: .15s; } .rec-wave i:nth-child(3n+1) { animation-delay: .3s; } .rec-wave i:nth-child(4n) { animation-delay: .45s; }
@keyframes wave { 50% { height: 100%; } }

/* ---- mensagens: agrupadas e com "rabinho" ---- */
.messages { gap: 0; padding-top: 18px; }
.msg-row { margin-top: 2px; }
.msg-row.first { margin-top: 10px; }
.bubble { border-radius: 9px; padding: 6px 9px 7px; }
.msg-row.first:not(.me) .bubble { border-top-left-radius: 0; }
.msg-row.first.me .bubble { border-top-right-radius: 0; }
.msg-row.first:not(.me):not(.is-sticker) .bubble::before, .msg-row.first.me:not(.is-sticker) .bubble::before {
  content: ''; position: absolute; top: 0; width: 9px; height: 13px; background: inherit; }
.msg-row.first:not(.me) .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg-row.first.me .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble .msg-menu { top: 4px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; background: linear-gradient(90deg, transparent, var(--bubble-in) 40%); border-radius: 0 8px 0 12px; }
.msg-row.me .bubble .msg-menu { background: linear-gradient(90deg, transparent, var(--bubble-out) 40%); }
.day span { font-size: 12px; padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px .5px #0000001a; text-transform: none; }
.sys-msg span { border-radius: 8px; box-shadow: 0 1px .5px #0000001a; }

/* ---- player de áudio ---- */
.is-audio .bubble { min-width: 290px; padding: 8px 10px 6px; }
.ap { display: flex; align-items: center; gap: 10px; }
.ap-avatar { width: 44px; height: 44px; border-radius: 50%; background: #6b7c85; color: #fff; position: relative; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.ap-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ap-avatar span { position: absolute; right: -2px; bottom: -2px; color: var(--green); background: var(--bubble-in); border-radius: 50%; padding: 2px; display: none; }
.ap-avatar img + span { display: block; }
.ap-avatar.me { background: var(--green); }
.ap-play { width: 34px; height: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; padding: 0; }
.ap-play:hover { color: var(--text); }
.ap-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ap-wave { display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.ap-wave i { flex: 1; max-width: 4px; min-width: 2px; border-radius: 3px; background: var(--muted); opacity: .55; transition: background .1s, opacity .1s; }
.ap-wave i.played { background: var(--blue); opacity: 1; }
.msg-row.me .ap-wave i.played { background: var(--green); }
.ap-info { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--meta); font-variant-numeric: tabular-nums; padding-right: 54px; }
.ap-speed { border: 0; background: var(--quote-bg); color: var(--text); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; cursor: pointer; }
.ap.on .ap-speed { background: var(--green); color: #fff; }
.ap audio { display: none; }
.is-audio .bubble .meta { position: absolute; right: 10px; bottom: 6px; margin: 0; }

/* ---- seletor de emojis ---- */
.emoji-pop { position: fixed; z-index: 70; width: 360px; max-width: calc(100vw - 16px); height: 400px; max-height: 60vh; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 40px var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.emoji-tabs { display: flex; justify-content: space-between; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.emoji-tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 0 9px; cursor: pointer; display: grid; place-items: center; border-bottom: 3px solid transparent; }
.emoji-tabs button:hover { color: var(--text); } .emoji-tabs button.on { color: var(--green); border-bottom-color: var(--green); }
.emoji-search { display: flex; align-items: center; gap: 8px; margin: 8px 10px 2px; background: var(--panel2); border-radius: 10px; padding: 0 10px; color: var(--muted); }
.emoji-search input { flex: 1; border: 0 !important; background: none !important; padding: 9px 0; }
.emoji-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 8px 8px; }
.emoji-scroll h5 { margin: 10px 4px 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.emoji-pop .emoji-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.emoji-pop .emoji-grid button { background: none; border: 0; font-size: 24px; line-height: 1; aspect-ratio: 1; border-radius: 8px; cursor: pointer; padding: 0; display: grid; place-items: center; transition: transform .08s, background .08s; }
.emoji-pop .emoji-grid button:hover { background: var(--panel2); transform: scale(1.15); }
.emoji-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- menus de contexto ---- */
.ctx-menu { border-radius: 12px; padding: 6px; }
.ctx-menu > button { border-radius: 8px; padding: 9px 14px; }
.quick-react { gap: 4px; padding: 4px 4px 8px; }
.quick-react button { transition: transform .1s; } .quick-react button:hover { transform: scale(1.2); }

/* ---- cartões, botões ---- */
.btn { border-radius: 10px; font-weight: 500; transition: filter .15s, background .15s; }
.btn.sm { border-radius: 8px; }
.panel { border-radius: 14px; }
.modal { border-radius: 16px; box-shadow: 0 20px 60px var(--shadow); }

@media (max-width: 760px) {
  .nav-bar { padding: 0 2px var(--safe-b); }
  .nav-item { width: auto; padding: 5px 0; } .nav-ic { width: 52px; height: 28px; }
  .nav-item.active::before, .nav-me, .theme-btn { display: none; }
  .brand { display: none; }
  .is-audio .bubble { min-width: 240px; }
  .emoji-pop { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: calc(70px + var(--safe-b)); }
}
.brand { white-space: nowrap; display: flex; align-items: center; justify-content: center; }
.is-audio .bubble { padding-bottom: 20px; }
.is-audio .bubble .meta { bottom: 4px; }
.ap-info { padding-right: 0; }
.ap-avatar span { position: static; display: grid; color: #fff; background: none; padding: 0; }
.ap-avatar img + span { position: absolute; right: -3px; bottom: -3px; display: grid; color: var(--green); background: var(--bubble-in); border-radius: 50%; padding: 2px; }
.msg-row.me .ap-avatar img + span { background: var(--bubble-out); }
/* fotos e vídeos: balão do tamanho da imagem, como no WhatsApp */
.is-media .bubble { padding: 4px 4px 6px; max-width: 340px; }
.is-media .bubble .media { width: 100%; max-width: 330px; height: auto; max-height: 420px; object-fit: cover; border-radius: 7px; margin: 0; background: var(--panel3); }
.is-media .bubble .text { padding: 4px 6px 0; }
.is-media .bubble .meta { margin-right: 4px; }
.is-media .bubble .fwd, .is-media .bubble .quote, .is-media .bubble .agent { margin: 2px 4px 4px; }
.att img { background: repeating-conic-gradient(var(--panel3) 0 25%, var(--panel) 0 50%) 0 0 / 14px 14px; }

/* celular: menu vira barra inferior (precisa vir depois do estilo do menu lateral) */
@media (max-width: 760px) {
  .nav-bar { width: 100%; height: calc(62px + var(--safe-b)); flex-direction: row; align-items: center; justify-content: space-around;
    padding: 0 4px var(--safe-b); gap: 0; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; }
  .nav-bar .spacer, .nav-bar .brand, .nav-bar .nav-me, .nav-bar .theme-btn { display: none; }
  .nav-item { flex: 1; min-width: 54px; padding: 4px 0; gap: 2px; }
  .nav-ic { width: 48px; height: 28px; }
  .nav-item small { font-size: 10px; }
  .nav-item.active::before { display: none; }
  .chips .mini-select { max-width: 46%; }
}
.install-banner { display: flex; align-items: center; gap: 10px; margin: 8px 10px 4px; padding: 10px 10px 10px 12px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid #00a88440; }
.install-banner img { width: 38px; height: 38px; border-radius: 10px; }
.install-banner strong { display: block; font-size: 14px; } .install-banner small { color: var(--muted); font-size: 12px; }
/* no app instalado, respeita a área do relógio/notch */
@media (display-mode: standalone) { .conv-pane, .page { padding-top: max(env(safe-area-inset-top), 0px); } }
.install-steps { counter-reset: st; list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { counter-increment: st; display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; }
.install-steps li::before { content: counter(st); flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; }
#instNow { width: 100%; margin-bottom: 8px; }
.install-steps li { display: block; position: relative; padding: 2px 0 0 38px; min-height: 28px; }
.install-steps li::before { position: absolute; left: 0; top: 0; }

/* logo */
.brand { background: none !important; box-shadow: none !important; padding: 0; }
.brand img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 4px 10px #00a88455); }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo img { width: 54px; height: 54px; filter: drop-shadow(0 6px 14px #00a88455); }
.m-only { display: none !important; }

/* celular: barra inferior só com Conversas e Tema */
@media (max-width: 760px) {
  .nav-bar .nav-item:not(.m-keep) { display: none; }
  .nav-bar .theme-btn.m-keep { display: flex; }
  .nav-bar { justify-content: center; gap: 40px; }
  .nav-bar .nav-item { flex: 0 0 auto; width: 110px; }
  .m-only { display: inline-flex !important; }
}
.nav-me { flex-shrink: 0; }
.empty-logo { width: 88px; height: 88px; margin-bottom: 8px; opacity: .95; filter: drop-shadow(0 10px 24px #00a88440); }
.online-tag { color: var(--green); margin-top: 2px; }

/* ===== Cobrança ===== */
.billing-bar { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 7px 14px; font-size: 13px; background: #f59e0b22; color: var(--text); border-bottom: 1px solid #f59e0b55; }
.billing-bar.overdue { background: #f15c6d26; border-color: #f15c6d66; }
.billing-bar.trial { background: #00a88418; border-color: #00a88444; }
.billing-bar .bill-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.plan-card.hl { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.plan-card.off { opacity: .6; }
.plan-card ul { margin: 0; padding-left: 18px; flex: 1; }
.plan-price { font-size: 26px; font-weight: 700; } .plan-price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.auth-card a.btn { text-align: center; text-decoration: none; }
@media (max-width: 760px) { .billing-bar { padding-top: calc(7px + var(--safe-t, 0px)); } }
.auth-card a.link { align-self: center; text-align: center; }

/* ===== Campos em grade nunca estouram o modal ===== */
.grid2 > *, .grid3 > * { min-width: 0; }
.grid2 input, .grid3 input, .grid2 select, .grid3 select { width: 100%; min-width: 0; }

/* ===== Recursos por plano ===== */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.mod-grid.disabled { opacity: .55; }
.mod-grid label.check { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; align-items: flex-start; }
.mod-grid label.check:has(input:checked) { border-color: var(--green); background: #00a8840f; }
.mod-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mod-tags span { font-size: 11px; padding: 2px 7px; border-radius: 99px; }
.mod-tags .on { color: var(--green); background: #00a8841a; } .mod-tags .off { color: var(--muted); background: var(--panel2); text-decoration: line-through; }

/* ===== Importar conversas ===== */
.import-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #f59e0b18; font-size: 13px; margin: 6px 0; }
.import-box.ok { background: #00a8841a; }
.import-box small { display: block; margin-top: 2px; }
.import-how { background: var(--panel2); border-radius: 10px; padding: 12px 14px; }
.import-how ol { margin: 6px 0; padding-left: 18px; display: grid; gap: 6px; }
.spin-sm { width: 16px; height: 16px; border: 2px solid #00a88433; border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; flex: none; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.top-marker .link { background: none; border: 0; color: var(--green); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* ===== Disparador ===== */
.cp-list { display: grid; gap: 12px; }
.cp-card { display: flex; flex-direction: column; gap: 8px; }
.cp-name { cursor: pointer; font-size: 15px; }
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #25d366); border-radius: 99px; transition: width .4s; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.cp-chips span { background: var(--panel2); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.cp-chips .bad { color: var(--red); }
.blue { color: var(--blue); }
.warn-text { color: var(--yellow, #f59e0b); }
.cp-usage { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.cp-usage .bar { margin-top: 6px; max-width: 320px; }
.cp-tips { max-width: 460px; }
.cp-editor .cp-step { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cp-step h4 { margin: 0; display: flex; align-items: center; gap: 8px; }
.cp-step h4 span { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 13px; }
.cp-msg-grid { display: grid; grid-template-columns: 1fr 260px; gap: 14px; }
.cp-variant textarea { width: 100%; resize: vertical; }
.cp-vars { gap: 4px; }
.cp-preview { display: flex; flex-direction: column; gap: 4px; }
.cp-phone { background: #0b141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23ffffff10'/%3E%3C/svg%3E"); border-radius: 14px; padding: 14px 10px; min-height: 180px; }
[data-theme="light"] .cp-phone { background-color: #efeae2; }
.cp-bubble { background: #005c4b; color: #e9edef; border-radius: 10px 0 10px 10px; padding: 8px 10px; font-size: 13.5px; line-height: 1.4; margin-left: 24px; word-break: break-word; }
[data-theme="light"] .cp-bubble { background: #d9fdd3; color: #111b21; }
.cp-att { font-size: 12px; opacity: .85; margin-bottom: 4px; border-bottom: 1px solid #ffffff22; padding-bottom: 4px; }
.cp-week { gap: 10px; }
.cp-estimate { background: #00a8841a; color: var(--text); border-radius: 8px; padding: 8px 10px; margin: 0; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.drop.over, .drop:hover { border-color: var(--green); background: #00a8840d; }
.cp-big { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.cp-big > div { background: var(--panel2); border-radius: 10px; padding: 10px; }
.cp-big b { font-size: 20px; display: block; } .cp-big small { color: var(--muted); }
.oo-list { max-height: 50vh; overflow: auto; display: grid; gap: 6px; }
@media (max-width: 760px) { .cp-msg-grid { grid-template-columns: 1fr; } }

/* ===== Mensagens um pouco maiores (leitura mais confortável) ===== */
.bubble .text { font-size: 15.5px; line-height: 1.45; }
.bubble .meta { font-size: 11.5px; }
.bubble .agent { font-size: 13px; }
.bubble { padding: 7px 10px 8px 11px; }
.day span, .sys-msg span { font-size: 12.5px; }
.cp-bubble { font-size: 14.5px; }
@media (max-width: 760px) { .bubble .text { font-size: 15.5px; } }

/* ===== Etiquetas ===== */
.lbl { --c: #00a884; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 8px 1px 7px; border-radius: 99px;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); white-space: nowrap; line-height: 1.5; }
.lbl::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.lbl.add { --c: var(--muted); border-style: dashed; cursor: pointer; font-weight: 500; }
.lbl.add::before { display: none; }
.head-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; cursor: pointer; }
.head-labels:hover .lbl { filter: brightness(1.1); }
.lbl-pop { position: fixed; z-index: 70; width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px var(--shadow, #0005); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.lbl-pop-head { display: flex; justify-content: space-between; align-items: center; }
.lbl-pop-list { max-height: 260px; overflow: auto; display: grid; gap: 4px; }
.lbl-pop-list label.check { padding: 4px 2px; }
.lbl-quick input { flex: 1; min-width: 0; padding: 6px 8px; }
.lm-list { display: grid; gap: 6px; }
.lm-row input[type=color], #lmNew input[type=color] { width: 38px; height: 34px; padding: 2px; border-radius: 8px; flex: none; }

/* ===== Respostas rápidas ===== */
.qr-list { display: grid; gap: 8px; max-height: 55vh; overflow: auto; }
.qr-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.qr-item [data-pick].grow { cursor: pointer; }
.qr-item code { font-size: 11.5px; }
.qr-body { white-space: pre-wrap; margin-top: 4px; max-height: 4.4em; overflow: hidden; }
.qr-item .col-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.composer { position: relative; }
.qr-suggest { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -8px 30px var(--shadow, #0004); overflow: hidden; z-index: 20; }
.qr-s { padding: 8px 12px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.qr-s b { color: var(--green); } .qr-s small { grid-column: 1 / -1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-s.on, .qr-s:hover { background: var(--panel2); }

/* ===== Nota interna ===== */
.composer.note-mode { background: #fef3c7; }
[data-theme="dark"] .composer.note-mode, :root:not([data-theme="light"]) .composer.note-mode { background: #3a3218; }
.composer.note-mode textarea { background: #fffbeb; border-color: #f59e0b; }
[data-theme="dark"] .composer.note-mode textarea { background: #2a2414; color: #fde68a; }
.icon-btn.active { color: #f59e0b !important; background: #f59e0b22; }
.msg-row.is-note { align-self: center; max-width: 80%; align-items: stretch; }
.is-note .bubble { background: #fef3c7 !important; color: #78350f; border: 1px dashed #f59e0b; border-radius: 10px !important; }
[data-theme="dark"] .is-note .bubble { background: #3a3218 !important; color: #fde68a; }
.is-note .bubble::before { display: none !important; }
.note-head { font-size: 12px; font-weight: 700; color: #b45309; margin-bottom: 2px; }
[data-theme="dark"] .note-head { color: #fbbf24; }
.is-note .meta { color: #b45309 !important; }
label.check span.lbl { flex-direction: row; display: inline-flex; }
.head-labels { flex-wrap: nowrap; overflow: hidden; }

/* ===== Telefone clicável e prévia de link ===== */
.phone-link { color: var(--blue); cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.menu-title { padding: 6px 12px 4px; font-weight: 700; font-size: 13px; color: var(--muted); }
.link-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: #0000000f; border-radius: 7px; overflow: hidden; margin: 0 0 6px; max-width: 360px; }
[data-theme="dark"] .link-card { background: #ffffff10; }
.link-card img { width: 100%; max-height: 180px; object-fit: cover; display: block; }
.lc-text { padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--green); }
.lc-text b { font-size: 13.5px; line-height: 1.3; }
.lc-text small { color: var(--muted); font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-text span { color: var(--muted); font-size: 11.5px; }

/* ===== Aviso de mensagem nova em outras telas ===== */
#msgToasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(340px, calc(100vw - 32px)); }
.msg-toast { text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 10px 30px var(--shadow, #0004); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; animation: toastIn .25s ease-out; }
.msg-toast span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }
@media (max-width: 760px) { #msgToasts { bottom: calc(76px + var(--safe-b, 0px)); right: 10px; left: 10px; max-width: none; } }

/* prévia do link acima da caixa de texto */
.link-bar { padding: 8px 12px 0; background: var(--panel2); }
.lb-card { display: flex; gap: 10px; align-items: center; background: var(--panel); border-radius: 10px; padding: 8px; border-left: 4px solid var(--green); }
.lb-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.lb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lb-text b { font-size: 14px; } .lb-text small { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lb-text span { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* prévia recebida com miniatura pequena: imagem ao lado, sem esticar (evita ficar borrada) */
.link-card.compact { flex-direction: row; }
.link-card.compact img { width: 84px; height: 84px; max-height: none; flex: none; }
.link-card img { image-rendering: auto; }

/* =====================================================================
   CELULAR — visual igual ao WhatsApp (lista e conversa)
   ===================================================================== */
@media (max-width: 760px) {
  /* cabeçalho da lista */
  .pane-head { padding: 8px 10px 2px 16px; }
  .pane-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
  .pane-head .icon-btn { width: 42px; height: 42px; }

  /* busca em pílula, como "Pesquisar..." do WhatsApp */
  .conv-search { padding: 6px 14px 8px; }
  .conv-search input { height: 44px; border-radius: 99px; padding-left: 44px; font-size: 16px;
    background: var(--panel2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238696a0' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") 16px center no-repeat; }

  /* Abertas / Fechadas / Arquivadas viram pílulas, igual "Tudo · Não lidas · Favoritas" */
  .state-tabs { border: 0; margin: 0; padding: 0 14px 6px; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .state-tabs button { flex: none; border: 0; border-radius: 99px; padding: 7px 14px; background: var(--panel2); color: var(--muted); font-size: 14px; font-weight: 500; }
  .state-tabs button.active { background: var(--chip-on, #00a88426); color: var(--green); border: 0; }

  /* filtros: uma linha só, rolando para o lado (nada fica para fora) */
  .chips { flex-wrap: nowrap !important; overflow-x: auto; padding: 0 14px 8px; gap: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar, .state-tabs::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 7px 14px; font-size: 14px; }
  .chips .mini-select { flex: none; max-width: none !important; width: auto; height: 34px; padding: 0 30px 0 12px; font-size: 14px; border-radius: 99px; background-color: var(--panel2); border: 0; color: var(--muted); }
  .chips .mini-select.hidden { display: none; }

  /* itens da lista */
  .conv-list { padding-bottom: 8px; }
  .conv-item { margin: 0; border-radius: 0; padding: 10px 16px; gap: 14px; box-shadow: none !important; }
  .conv-item .avatar { width: 54px; height: 54px; font-size: 17px; }
  .conv-item .grow { min-width: 0; padding: 2px 0; }
  .conv-item .name { font-size: 17px; font-weight: 600; }
  .conv-item .time { font-size: 12.5px; }
  .conv-item .last { font-size: 15px; line-height: 1.35; }
  .conv-item .row2 { margin-top: 1px; }
  .conv-item .badge { min-width: 22px; height: 22px; line-height: 22px; padding: 0 6px; border-radius: 99px; font-size: 12px; }
  .conv-item .row3 { flex-wrap: nowrap; overflow: hidden; margin-top: 4px; gap: 4px; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .conv-item .tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; }
  .conv-item .tag.inst { display: none; }
  .conv-item .lbl { font-size: 11px; }
  .conv-item.active { background: none; }
  .conv-item:active { background: var(--panel2); }

  /* conversa aberta: cabeçalho enxuto como no WhatsApp */
  .chat-head { flex-wrap: nowrap; gap: 6px; padding: 8px 6px 8px 4px; padding-top: calc(8px + var(--safe-t)); }
  .chat-head .avatar { width: 40px; height: 40px; }
  .chat-head .head-info strong { font-size: 16.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-head .head-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
  .chat-head .head-labels { display: none; }
  .chat-tools { order: 0; width: auto; flex: none; gap: 4px; }
  .chat-tools .btn { padding: 0; width: 38px; height: 38px; border-radius: 50%; justify-content: center; font-size: 0; gap: 0; }
  .chat-tools .btn svg { width: 20px; height: 20px; }
  .chat-tools .btn.primary { width: auto; padding: 0 12px; border-radius: 99px; font-size: 13px; gap: 4px; }
  .chat-tools select { display: none; }
  .chat-head #searchBtn { display: none; }

  /* caixa de mensagem */
  .composer { padding: 6px 6px calc(6px + var(--safe-b)); gap: 2px; }
  .composer .icon-btn { width: 38px; height: 38px; }
  .composer #quickBtn, .composer #noteBtn { display: none; }
  .composer textarea { border-radius: 24px; padding: 10px 16px; min-height: 44px; }
  .composer .send { width: 48px; height: 48px; }
  .assume-bar { font-size: 13px; padding: 6px 10px; }
  .messages { padding: 8px 8px; }
  .msg-row { max-width: 85%; }
}
.stage-list { display: grid; gap: 6px; }
.stage-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.stage-opt i { width: 12px; height: 12px; border-radius: 50%; }
.stage-opt.on { border-color: var(--green); color: var(--green); font-weight: 600; }
@media (max-width: 760px) {
  .lbl-pop { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: calc(10px + var(--safe-b)); }
  .lbl-pop-list label.check { padding: 8px 2px; }
}
@media (max-width: 760px) {
  .chat-tools #claimBtn { display: none; }           /* "Assumir" fica na faixa logo acima da caixa de texto */
  .composer textarea { min-width: 0; }
  .composer .send { flex: none; margin-left: 2px; }
  .composer .input-wrap { flex: 1; min-width: 0; display: flex; }
  .composer .input-wrap textarea { width: 100%; }
  .assume-bar .muted { display: none; }
  .assume-bar { display: flex; align-items: center; gap: 8px; }
  .top-marker span { display: inline-block; text-align: center; font-size: 12px; line-height: 1.5; max-width: 92%; }
  .link-card { max-width: 100%; }
  .link-card:not(.compact) img { max-height: 160px; }
}

/* contato digitando / gravando */
.typing-row .bubble { color: var(--green); font-size: 14px; font-style: italic; display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 8px 12px; }
.typing-row .dots { display: inline-flex; gap: 3px; }
.typing-row .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: tdot 1.2s infinite ease-in-out; }
.typing-row .dots i:nth-child(2) { animation-delay: .15s; } .typing-row .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.typing-row .rec-mic { animation: tdot 1.2s infinite; }

/* ===== Gravação de áudio (estilo WhatsApp) ===== */
.recording-bar { align-items: center; gap: 8px; padding: 8px 12px calc(8px + var(--safe-b)); }
.rec-box { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 99px; padding: 0 16px; height: 46px; min-width: 0; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); flex: none; animation: pulse 1s infinite; }
.rec-label { color: var(--red); font-weight: 600; font-size: 13.5px; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 40px; flex: none; }
.rec-live { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-live i { width: 3px; flex: none; border-radius: 3px; background: var(--green); min-height: 3px; transition: height .08s linear; }
.recording-bar.paused .rec-dot { animation: none; background: var(--muted); }
.recording-bar.paused .rec-label { color: var(--muted); }
.recording-bar.paused .rec-live i { background: var(--muted); }
.rec-cancel { color: var(--muted); } .rec-cancel:hover { color: var(--red); }
.rec-pause { color: var(--red); border: 2px solid currentColor; border-radius: 50%; width: 40px; height: 40px; }
.recording-bar.paused .rec-pause { color: var(--green); }
.rec-send { width: 50px !important; height: 50px !important; }
@keyframes pulse { 50% { opacity: .35; } }
/* áudio sendo enviado */
.pending-audio .bubble { min-width: 200px; }
.pa-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); padding: 4px 2px; }
.pending-audio.failed .bubble { outline: 1px solid var(--red); }
.pending-audio.failed .pa-txt { color: var(--red); }
@media (max-width: 760px) { .rec-label { display: none; } .rec-box { padding: 0 12px; gap: 8px; } }

/* grupos: nome de quem mandou (cor por pessoa, como no WhatsApp) */
.g-sender { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; font-size: 13px; line-height: 1.3; }
.g-sender b { color: var(--gc); font-weight: 600; }
.g-sender small { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* foto de perfil ampliada */
.chat-head .avatar, .conv-item .avatar img { cursor: zoom-in; }
.photo-modal { width: min(520px, 100%); }
.photo-view { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 200px; justify-content: center; position: relative; }
.photo-view img.full, .photo-view img.blur { width: 100%; max-width: 480px; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.photo-view img.blur { filter: blur(6px); opacity: .7; }
.photo-view .spin-sm { position: absolute; width: 28px; height: 28px; }
.avatar.xl { width: 160px; height: 160px; font-size: 48px; }
@media (max-width: 760px) { .photo-modal .modal-body { display: flex; align-items: center; justify-content: center; } }
.g-sender b[data-gjid] { cursor: pointer; } .g-sender b[data-gjid]:hover { text-decoration: underline; }

/* atendimento automático (IA / agente externo) */
.tag.ai { background: #7c3aed; color: #fff; }
.assume-bar.ai { background: #ede9fe; color: #4c1d95; display: flex; align-items: center; gap: 10px; }
[data-theme="dark"] .assume-bar.ai { background: #2e1065; color: #ddd6fe; }
.assume-bar.ai small { display: block; opacity: .8; font-size: 12px; }
.assume-bar.ai .ai-ico { font-size: 22px; }
.agent.bot { color: #7c3aed; } .agent.device { color: var(--muted); }
[data-theme="dark"] .agent.bot { color: #c4b5fd; }

/* áudio recebido, como no WhatsApp: verde = ainda não ouvido · azul = já ouvido (play e linha do áudio) */
.ap[data-apin="1"]:not(.played) .ap-play { color: var(--green); }
.ap[data-apin="1"]:not(.played) .ap-wave i { background: color-mix(in srgb, var(--green) 55%, transparent); }
.ap[data-apin="1"].played .ap-play { color: var(--blue); }
.ap[data-apin="1"].played .ap-wave i { background: color-mix(in srgb, var(--blue) 45%, transparent); }
.ap[data-apin="1"].played .ap-wave i.played { background: var(--blue); }
.ap[data-apin="1"]:not(.played) .ap-wave i.played { background: var(--green); }
.ap-avatar img ~ span { display: none !important; } /* com foto: só a foto, redonda */

/* cartão de contato recebido */
.vcard { min-width: 240px; max-width: 320px; margin: 2px 0 4px; }
.vc-top { display: flex; gap: 10px; align-items: center; padding: 6px 4px 10px; }
.vc-av { width: 46px; height: 46px; font-size: 16px; background: #8696a0; }
.vc-info { display: flex; flex-direction: column; min-width: 0; }
.vc-info b { font-size: 15px; }
.vc-info .phone-link { font-size: 13.5px; text-decoration: none; }
.vc-info small { color: var(--muted); font-size: 12px; }
.vc-actions { display: flex; border-top: 1px solid #0000001a; }
[data-theme="dark"] .vc-actions { border-color: #ffffff1f; }
.vc-actions button { flex: 1; background: none; border: 0; color: var(--blue); padding: 9px 4px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; }
.vc-actions button + button { border-left: 1px solid #0000001a; }
.vc-actions button:hover { background: #0000000a; }
.vc-actions small { padding: 8px; }
.vcard + .vcard { border-top: 1px solid #0000001a; padding-top: 6px; }

/* contratar adicionais */
.ex-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ex-row small { display: block; color: var(--muted); font-size: 12.5px; }
.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.stepper button { width: 38px; height: 36px; border: 0; background: var(--panel2); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper span { min-width: 36px; text-align: center; font-weight: 700; }
.ex-sum { background: var(--panel2); border-radius: 12px; padding: 10px 14px; display: grid; gap: 6px; font-size: 14px; }
.ex-sum div { display: flex; justify-content: space-between; gap: 10px; }
.ex-sum .total { border-top: 1px solid var(--line); padding-top: 6px; font-size: 15px; }
.ex-sum .now { color: var(--green); font-weight: 600; }

/* plano e pagamentos */
.sub-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.sub-hero h3 { font-size: 22px; margin: 2px 0 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sub-due { font-size: 14px; }
.sub-price { text-align: right; display: flex; flex-direction: column; }
.sub-price b { font-size: 30px; line-height: 1.1; }
.sub-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 14px 0; }
.sub-act { display: flex; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; white-space: normal; padding: 12px 14px; border-radius: 12px; min-width: 0; }
.sa-ico { font-size: 20px; line-height: 1; flex: none; }
.sa-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sa-txt b { font-size: 14px; font-weight: 600; line-height: 1.25; }
.sub-act small { font-size: 12px; font-weight: 400; color: var(--muted); }
.sub-act.primary small { color: #fff; opacity: .85; }
.btn.resend { padding: 1px 8px; font-size: 11px; margin-left: 4px; vertical-align: middle; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.sub-box { background: var(--panel2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.sub-box span { color: var(--muted); font-size: 13px; } .sub-box b { font-size: 24px; } .sub-box small { color: var(--muted); font-size: 12px; }
.sub-bill td { padding: 7px 4px; } .sub-total td { font-weight: 700; border-top: 2px solid var(--line); }
.sub-pending { padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .sub-price { text-align: left; } }

/* canais (Instagram / WhatsApp oficial) */
.inst-icon { position: relative; }
.ch-badge { position: absolute; right: -4px; bottom: -4px; font-size: 14px; background: var(--panel, #fff); border-radius: 50%; line-height: 1; padding: 1px; }
.ch-pick { display: grid; gap: 8px; }
.ch-opt { display: flex !important; flex-direction: row !important; gap: 12px; align-items: center; color: var(--text); text-align: left; padding: 12px; border: 1px solid var(--border, #ddd); border-radius: 10px; cursor: pointer; }
.ch-opt:has(input:checked) { border-color: var(--primary, #00a884); background: color-mix(in srgb, var(--primary, #00a884) 8%, transparent); }
.ch-opt input { width: auto; margin: 0; }
.ch-opt small { display: block; font-weight: normal; }
.ch-ico { font-size: 26px; }
.ch-tag { font-size: 12px; margin-left: 4px; vertical-align: middle; }
.ext-window { margin: 6px auto; padding: 6px 12px; background: #fff3cd; color: #6b5200; border-radius: 8px; font-size: 12.5px; max-width: 520px; text-align: center; }
.ch-opt.locked { opacity: .85; background: var(--bg2, #f6f7f9); cursor: default; }
.ch-opt.locked .ch-ico, .ch-opt.locked b { opacity: .7; }
.ok-text { color: #0a8f5a; }
.ext-note { background: var(--bg2, #f6f7f9); padding: 8px 12px; border-radius: 8px; }
.ext-limits { margin: 4px 0 0 18px; padding: 0; }

/* etiqueta da conexão com o canal (lista de conversas) */
.tag.inst { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.tag.inst svg { width: 11px; height: 11px; flex: none; }
.tag.inst.ch-wa, [data-theme="light"] .tag.inst.ch-wa { background: #128c7e; }
.tag.inst.ch-waof, [data-theme="light"] .tag.inst.ch-waof { background: #075e54; }
.tag.inst.ch-ig, [data-theme="light"] .tag.inst.ch-ig { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.tag.inst.ch-web, [data-theme="light"] .tag.inst.ch-web { background: #3b5bdb; }
.tag.inst .ch-ok { font-size: 8px; background: #fff; color: #075e54; border-radius: 50%; width: 10px; height: 10px; display: inline-grid; place-items: center; margin-left: -6px; margin-top: 6px; line-height: 1; }
@media (max-width: 760px) {
  .conv-item .tag.inst { display: inline-flex; padding: 2px 5px; }
  .conv-item .tag.inst .tn { display: none; }
}

/* rascunho na lista (como no WhatsApp) */
.draft-lbl { color: #00a884; font-weight: 600; }
/* respostas rápidas com arquivo */
.qr-media { margin: 6px 0 2px; }
.qr-media audio { width: 100%; max-width: 320px; height: 36px; }
.qr-media-img { max-width: 180px; max-height: 120px; border-radius: 8px; display: block; object-fit: cover; }
.qr-media-img.sm { max-width: 60px; max-height: 40px; }
.qr-media-chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; background: var(--bg2, #f0f2f5); font-size: 13px; }
.qr-file { border: 1px dashed var(--border, #ccc); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.btn.rec-on { background: #f15c6d; color: #fff; border-color: #f15c6d; }

/* automações do atendimento (configurar conexão) */
.auto-box { border-left: 3px solid var(--border, #ddd); padding: 4px 0 8px 12px; margin: 0 0 10px; display: grid; gap: 8px; }
.bh-grid { display: grid; gap: 6px; }
.bh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; }
.bh-row input[type=time] { width: auto; padding: 4px 6px; }
.bh-day { display: inline-flex !important; align-items: center; gap: 6px; min-width: 100px; flex-direction: row !important; }
.bh-day input { width: auto; margin: 0; }
.menu-opt { display: grid; grid-template-columns: 52px 1fr 1fr 1.3fr 28px; gap: 6px; margin-bottom: 6px; }
.menu-opt input, .menu-opt select { padding: 6px 8px; }
.inline-num { display: block; font-size: 13.5px; }
.inline-num input { width: 80px !important; display: inline-block; padding: 4px 6px; margin: 0 4px; }
@media (max-width: 640px) { .menu-opt { grid-template-columns: 44px 1fr 28px; } .menu-opt .mo-dep, .menu-opt .mo-reply { grid-column: 2 / 3; } }
.sched-bar { padding: 6px 14px; font-size: 13px; background: color-mix(in srgb, #00a884 10%, var(--panel, #fff)); border-top: 1px solid var(--border, #ddd); }
.sched-bar .err, .sched-item .err { color: #e5534b; }
.sched-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border, #eee); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.prof-list { display: grid; gap: 6px; font-size: 13.5px; max-height: 220px; overflow: auto; }
.prof-list a { color: inherit; }

/* relatórios */
.rp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.rp-card { background: var(--panel, #fff); border: 1px solid var(--border, #e5e5e5); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.rp-card small { color: var(--muted, #667); }
.rp-card b { font-size: 24px; }
.rp-bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 6px; }
.rp-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 4px; }
.rp-bar span { width: 100%; background: #00a884; border-radius: 4px 4px 0 0; min-height: 1px; }
.rp-bar small { font-size: 10px; color: var(--muted, #667); height: 14px; }
.rp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .rp-two { grid-template-columns: 1fr; } }
.audit-list { max-height: 60vh; overflow: auto; display: grid; gap: 2px; }
.audit-row { display: grid; grid-template-columns: 110px 140px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border, #eee); font-size: 13.5px; align-items: baseline; }
.audit-row small { grid-column: 3; }
@media (max-width: 640px) { .audit-row { grid-template-columns: 1fr; } .audit-row small { grid-column: 1; } }
/* botão de tema: mostra o tema para onde vai (lua no claro, sol no escuro) */
.theme-btn .ic-light, .theme-btn .ic-dark { display: inline-flex; }
[data-theme="light"] .theme-btn .ic-light, [data-theme="dark"] .theme-btn .ic-dark { display: none; }

/* documentação da API */
.api-docs h4 { margin: 16px 0 6px; }
.api-ep { border: 1px solid var(--border, #e3e3e3); border-radius: 8px; margin: 6px 0; padding: 0; }
.api-ep summary { display: flex; gap: 8px; align-items: center; padding: 8px 10px; cursor: pointer; flex-wrap: wrap; list-style: none; }
.api-ep summary::-webkit-details-marker { display: none; }
.api-ep[open] summary { border-bottom: 1px solid var(--border, #e3e3e3); }
.api-ep > div { padding: 6px 10px; }
.mth { font: 700 11px/1 monospace; padding: 4px 6px; border-radius: 4px; color: #fff; min-width: 46px; text-align: center; }
.mth.get { background: #1a7f37; } .mth.post { background: #0969da; } .mth.put, .mth.patch { background: #9a6700; } .mth.del { background: #cf222e; } .mth.resp { background: #6e40c9; }
.api-code { position: relative; }
.api-code pre { margin: 0; padding: 10px; background: var(--bg2, #f4f5f7); border-radius: 6px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.api-code [data-copy] { position: absolute; top: 6px; right: 6px; }
.warn-box { background: #fff4e5; color: #6b3d00; border: 1px solid #f5c27a; margin-bottom: 14px; }
[data-theme="dark"] .warn-box { background: #3a2a10; color: #ffd8a1; border-color: #7a5420; }
.pill.sleep { color: #6b7cff; background: #6b7cff22; }
.send-only-box { padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px dashed var(--border, #ddd); }
.user-off { display: none !important; }

/* fluxos (chatbot) */
.fl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fl-card { display: grid; gap: 8px; }
.fl-editor .fl-title { font-size: 20px; font-weight: 700; border: none; background: transparent; padding: 2px 0; width: 100%; color: inherit; }
.fl-used { margin: 8px 0 12px; }
.fl-step { margin-bottom: 10px; border-left: 4px solid #00a884; }
.fl-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fl-num { font: 700 12px/1 monospace; background: var(--panel2); padding: 4px 6px; border-radius: 6px; }
.fl-ic { font-size: 18px; }
.fl-name { flex: 1; min-width: 160px; font-weight: 600; border: 1px solid transparent; background: transparent; padding: 4px 6px; color: inherit; }
.fl-name:hover, .fl-name:focus { border-color: var(--line); background: var(--panel); }
.fl-step-body { display: grid; gap: 8px; margin-top: 8px; }
.fl-f { display: grid; gap: 3px; font-size: 13px; }
.fl-f > span { font-weight: 600; font-size: 12.5px; }
.fl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.fl-opts { display: grid; gap: 6px; }
.fl-opt { display: grid; grid-template-columns: 24px 1fr 1fr 28px; gap: 6px; align-items: center; }
.fl-add { margin: 6px 0 40px; }
.fl-runs ol { margin: 6px 0 0 18px; padding: 0; }
.btn.pulse { box-shadow: 0 0 0 3px color-mix(in srgb, #00a884 35%, transparent); }
@media (max-width: 640px) { .fl-opt { grid-template-columns: 22px 1fr 28px; } .fl-opt select { grid-column: 2; } }

/* editor visual de fluxos */
body.fc-open .page-content, body.fc-open main { overflow: hidden; }
.fc-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.fc-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.fc-top .fl-title { flex: 1; min-width: 160px; font-size: 17px; }
.fc-main { flex: 1; display: grid; grid-template-columns: 190px 1fr 340px; min-height: 0; }
.fc-palette { border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: grid; gap: 6px; align-content: start; background: var(--panel); }
.fc-pal { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; cursor: grab; font-size: 13px; background: var(--panel2); user-select: none; }
.fc-pal:hover { border-color: #00a884; }
.fc-canvas { position: relative; overflow: hidden; background-color: var(--panel2); background-image: radial-gradient(circle, color-mix(in srgb, currentColor 18%, transparent) 1px, transparent 1px); background-size: 22px 22px; cursor: grab; touch-action: none; }
.fc-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fc-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.fc-edge { fill: none; stroke: #8a96a3; stroke-width: 2.2; }
.fc-edge.sel { stroke: #e5534b; stroke-width: 3; }
.fc-edge.temp { stroke: #00a884; stroke-dasharray: 6 4; }
.fc-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.fc-node { position: absolute; background: var(--panel); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px #0000000f; font-size: 13px; cursor: default; user-select: none; }
.fc-node.sel { border-color: #00a884; box-shadow: 0 0 0 3px color-mix(in srgb, #00a884 25%, transparent); }
.fc-head { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: move; border-radius: 12px 12px 0 0; }
.fc-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-body { padding: 6px 12px; color: var(--muted); font-size: 12.5px; white-space: pre-wrap; max-height: 64px; overflow: hidden; }
.fc-outs { padding: 4px 0 8px; }
.fc-out { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 2px 0 2px 12px; font-size: 12px; color: var(--muted); min-height: 18px; }
.fc-end { padding: 4px 12px 8px; font-size: 12px; color: var(--muted); text-align: right; }
.fc-port { width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2.5px solid #8a96a3; display: inline-block; flex: none; }
.fc-port.out { margin-right: -8px; cursor: crosshair; }
.fc-port.out.linked { background: #00a884; border-color: #00a884; }
.fc-port.in { position: absolute; left: -8px; top: 12px; }
.fc-port:hover { transform: scale(1.25); border-color: #00a884; }
.fc-start { width: 190px; border-color: #00a884; }
.fc-start .fc-head { background: #00a884; color: #fff; }
.fc-node.t-question .fc-head, .fc-pal.t-question span { color: #0969da; }
.fc-node.t-menu .fc-head { background: color-mix(in srgb, #0969da 8%, transparent); }
.fc-node.t-condition .fc-head { background: color-mix(in srgb, #9a6700 10%, transparent); }
.fc-node.t-transfer .fc-head, .fc-node.t-close .fc-head, .fc-node.t-end .fc-head, .fc-node.t-ai .fc-head { background: color-mix(in srgb, #6e40c9 10%, transparent); }
.fc-node.t-http .fc-head { background: color-mix(in srgb, #1a7f37 10%, transparent); }
.fc-edge-del { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: none; background: #e5534b; color: #fff; font-size: 12px; cursor: pointer; z-index: 3; }
.fc-zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 4px; }
.fc-zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: inherit; font-size: 16px; cursor: pointer; }
.fc-hint { position: absolute; left: 12px; bottom: 10px; font-size: 11.5px; color: var(--muted); background: color-mix(in srgb, var(--panel) 85%, transparent); padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.fc-panel { border-left: 1px solid var(--line); padding: 12px; overflow: auto; background: var(--panel); }
.fc-panel-head { display: flex; align-items: center; gap: 8px; font-size: 20px; margin-bottom: 8px; }
.fc-panel-head .fl-name { font-size: 15px; }
.fc-panel .fl-grid { grid-template-columns: 1fr; }
.fc-panel .fl-opt { grid-template-columns: 22px 1fr 28px; }
.fc-panel-actions { margin-top: 14px; }
.fc-panel-empty ol { padding-left: 18px; }
.fl-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fl-tpl { text-align: left; display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: inherit; cursor: pointer; font: inherit; }
.fl-tpl:hover { border-color: #00a884; }
.fl-tpl-ic { font-size: 24px; }
.fl-cm-list { display: grid; gap: 4px; max-height: 200px; overflow: auto; }
.fl-cm-list .err { color: #e5534b; }
@media (max-width: 900px) { .fc-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .fc-palette { display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); } .fc-pal { white-space: nowrap; } .fc-panel { max-height: 45vh; border-left: none; border-top: 1px solid var(--line); } }

/* chat do site */
.code-box { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; resize: none; }
.web-visitor { border: 1px solid var(--border, #e3e6ea); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.web-visitor a { word-break: break-all; }
.web-visitor .btn { margin-top: 6px; }

/* fluxo: cores próprias do quadro (claro e escuro) */
.fc-wrap { --fc-canvas: #0b141a; --fc-dot: #ffffff14; --fc-node: #1b262d; --fc-node-line: #2f3f49; --fc-edge: #5d6f7b; --fc-text: #e9edef; --fc-sub: #9fb0ba; }
[data-theme="light"] .fc-wrap { --fc-canvas: #f3f4f6; --fc-dot: #00000014; --fc-node: #ffffff; --fc-node-line: #d9dde3; --fc-edge: #8a96a3; --fc-text: #111b21; --fc-sub: #5b6b75; }
.fc-canvas { background-color: var(--fc-canvas); background-image: radial-gradient(circle, var(--fc-dot) 1.2px, transparent 1.2px); }
.fc-node { background: var(--fc-node); border-color: var(--fc-node-line); color: var(--fc-text); box-shadow: 0 4px 14px #0000001f; --tc: #8696a0; }
.fc-node .fc-head { border-bottom-color: var(--fc-node-line); background: color-mix(in srgb, var(--tc) 16%, transparent); box-shadow: inset 3px 0 0 var(--tc); }
.fc-node .fc-head b { color: var(--fc-text); }
.fc-body, .fc-out, .fc-end { color: var(--fc-sub); }
.fc-edge { stroke: var(--fc-edge); }
.fc-port { background: var(--fc-node); border-color: var(--fc-edge); }
.fc-port.out.linked { background: #00a884; border-color: #00a884; }
.fc-node.sel { border-color: #00a884; }
.fc-start { border-color: #00a884; }
.fc-start .fc-head { background: #00a884; box-shadow: none; }
.fc-start .fc-head b { color: #fff; }
.fc-node.t-message { --tc: #53bdeb; }
.fc-node.t-question { --tc: #4c9aff; }
.fc-node.t-menu { --tc: #3b82f6; }
.fc-node.t-condition { --tc: #f59e0b; }
.fc-node.t-wait { --tc: #94a3b8; }
.fc-node.t-tag, .fc-node.t-stage { --tc: #eab308; }
.fc-node.t-note { --tc: #fbbf24; }
.fc-node.t-set { --tc: #f472b6; }
.fc-node.t-http { --tc: #22c55e; }
.fc-node.t-transfer { --tc: #fb923c; }
.fc-node.t-ai { --tc: #a78bfa; }
.fc-node.t-close { --tc: #10b981; }
.fc-node.t-end { --tc: #64748b; }
.fc-node.t-question .fc-head { color: inherit; }
.fc-pal { background: var(--panel2); border-color: var(--line); color: var(--text); }
.fc-pal:hover { border-color: #00a884; background: color-mix(in srgb, #00a884 10%, var(--panel2)); }
.fc-zoom button { background: var(--panel2); border-color: var(--line); color: var(--text); }
.fc-hint { background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--muted); }

/* créditos de IA */
.ai-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ai-pack { display: grid; gap: 2px; justify-items: center; padding: 14px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; }
.ai-pack:hover { border-color: var(--green); }
.ai-pack b { font-size: 22px; } .ai-pack strong { color: var(--green); font-size: 16px; margin-top: 4px; }
.ai-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; display: grid; gap: 4px; background: var(--panel2); }
.fc-node.t-agent { --tc: #c084fc; }
.ai-models { width: 100%; }
.ai-models input, .ai-models select { width: 100%; min-width: 60px; }

/* item "Suporte" no menu (chat do admin) */
.support-btn .nav-ic { position: relative; }
.nav-count { position: absolute; top: -4px; right: 6px; background: #e53935; color: #fff; font-size: 10.5px; font-weight: 700; min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; padding: 0 4px; text-align: center; }
/* menu lateral (computador): nunca maior que a tela; em telas baixas fica mais compacto e rola por dentro */
@media (min-width: 761px) {
  .nav-bar { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; min-height: 0; }
  .nav-bar::-webkit-scrollbar { display: none; }
  .nav-bar > * { flex-shrink: 0; }
}
@media (min-width: 761px) and (max-height: 900px) {
  .nav-bar { gap: 1px; padding-top: 10px; }
  .nav-item { padding: 4px 0 3px; }
  .nav-ic { height: 28px; }
  .nav-item small { font-size: 10px; }
}

/* menu lateral enxuto (computador): telas de configuração no botão "Gerenciar"; tema e sair no avatar */
@media (min-width: 761px) {
  .nav-bar .nav-grouped, .nav-bar #themeBtn, .nav-bar #logoutBtn { display: none; }
  .nav-me { border: 0; cursor: pointer; font: inherit; }
  .nav-me:hover { outline: 2px solid var(--green); outline-offset: 2px; }
}
@media (max-width: 760px) { .nav-bar .nav-more { display: none !important; } }
.ctx-menu.nav-pop { min-width: 200px; }
.ctx-menu.nav-pop button span svg { width: 18px; height: 18px; }
.ctx-menu.nav-pop button.current { color: var(--green); font-weight: 600; }
.ctx-menu.nav-pop .ctx-html { padding: 8px 12px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* tablet / telas médias: lista mais estreita e cabeçalho da conversa enxuto (botões só com ícone) */
@media (min-width: 761px) and (max-width: 1279px) {
  .conv-pane { width: clamp(280px, 34vw, 340px); }
  .chat-head { flex-wrap: nowrap; gap: 6px; }
  .chat-head .head-info { min-width: 0; }
  .chat-head .head-info strong, .chat-head .head-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-tools { flex: none; gap: 4px; flex-wrap: nowrap; }
  .chat-tools .btn { padding: 0; width: 36px; height: 36px; border-radius: 50%; justify-content: center; font-size: 0; gap: 0; }
  .chat-tools .btn svg { width: 19px; height: 19px; }
  .chat-tools .btn.primary { width: auto; padding: 0 12px; border-radius: 99px; font-size: 13px; gap: 4px; }
  .chat-tools select { max-width: 120px; }
  .conv-item .conv-tags, .conv-item .tags { flex-wrap: wrap; }
}
@media (min-width: 761px) and (max-width: 1023px) {
  .chat-tools select, .chat-head #searchBtn { display: none; }
  .chat-head .head-labels { display: none; }
  .composer #noteBtn { display: none; }
}
.composer .input-wrap { min-width: 0; }
.composer .icon-btn { flex-shrink: 0; }

/* sem internet */
.offline-bar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(8px + var(--safe-t, 0px)); z-index: 9000; background: #3b3f45; color: #fff; font-size: 13px; padding: 8px 14px; border-radius: 10px; box-shadow: 0 4px 16px #0005; max-width: calc(100vw - 24px); text-align: center; }
.push-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.push-steps { margin: 4px 0 0 18px; padding: 0; }

/* sinal de conexão */
.net-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #25d366; vertical-align: middle; margin-left: 6px; box-shadow: 0 0 0 2px var(--panel); transition: background .3s; }
body.net-bad .net-dot { background: #f5b400; animation: netpulse 1.6s ease-in-out infinite; }
@keyframes netpulse { 50% { opacity: .45; } }
.brand { position: relative; }
.brand .net-dot { position: absolute; right: -2px; bottom: -2px; margin: 0; width: 11px; height: 11px; box-shadow: 0 0 0 2px var(--side, #111b21); }
.offline-bar { display: none !important; }

/* disparos: escolha do canal e prévia do e-mail */
.cp-channels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cp-channel { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 22px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; }
.cp-channel:hover { border-color: var(--green); }
.cp-channel span { font-size: 34px; } .cp-channel b { font-size: 16px; }
.cp-mail { background: #f2f4f7; border-radius: 12px; padding: 10px; color: #1f2933; font-size: 13px; max-height: 520px; overflow: auto; }
.cp-mail-head { display: grid; gap: 2px; padding: 4px 6px 10px; }
.cp-mail-head small { color: #6b7785; }
.cp-mail-body { background: #fff; border-radius: 10px; padding: 14px 16px; line-height: 1.55; display: grid; gap: 10px; }
.cp-mail-body img { max-width: 100%; border-radius: 8px; }
.cp-mail-co { font-weight: bold; }
.cp-mail-btn { justify-self: start; color: #fff; font-weight: bold; padding: 9px 16px; border-radius: 8px; }
.cp-mail-foot { border-top: 1px solid #eef0f3; padding-top: 8px; font-size: 11px; color: #7b8794; }
.seg { display: flex; flex-wrap: wrap; gap: 8px 18px; }
@media (max-width: 560px) { .cp-channels { grid-template-columns: 1fr; } }
.seg label { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.seg label input { width: auto; margin: 0; }

/* comunicados */
.ann-card .pill .bad { color: #e53935; }
.ann-preview { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ann-list { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; max-height: 140px; overflow: auto; }
.ann-msg, .notice-body { white-space: normal; line-height: 1.55; background: var(--panel2); border-radius: 10px; padding: 12px 14px; }
.chip { border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 99px; padding: 3px 10px; cursor: pointer; font: inherit; font-size: 12px; }
.ann-opts label.check { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; }
.ann-opts label.check input { width: auto; margin-top: 3px; }
.online-now { color: #1fa463; font-weight: 600; white-space: nowrap; }

/* super admin: visão geral */
.sa-grid { gap: 14px; align-items: start; }
.sa-list { display: grid; gap: 2px; }
.sa-list a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.sa-list a:hover { background: var(--panel2); }
.sa-page a.stat { color: inherit; text-decoration: none; }
.sa-page a.stat:hover { outline: 2px solid var(--green); }
.sa-page .tabs a { text-decoration: none; color: var(--muted); padding: 10px 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.sa-page .tabs a.active { color: var(--green); border-bottom-color: var(--green); }

/* ---------- Tickets (chamados) ---------- */
.tk-page { display: flex; flex-direction: column; }
.tk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tk-stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.tk-stat b { font-size: 22px; } .tk-stat span { font-size: 12px; color: var(--muted); }
.tk-stat.click { cursor: pointer; } .tk-stat.click:hover { border-color: var(--green); }
.tk-stat.bad b { color: var(--red); }
.tk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tk-bar input[type=search] { flex: 1; min-width: 180px; width: auto; }
.tk-bar select { width: auto; max-width: 200px; }
.tk-seg { display: inline-flex; background: var(--panel2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tk-seg button { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.tk-seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px var(--shadow); }
.tk-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tk-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 140px 80px 130px 130px; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--row-line); cursor: pointer; }
.tk-row:last-child { border-bottom: 0; } .tk-row:hover { background: var(--panel2); }
.tk-row.late { box-shadow: inset 3px 0 var(--red); }
.tk-title b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-num { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-st, .t-pr, .t-cat { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; font-weight: 500; }
.t-st-open { background: #3b82f622; color: #3b82f6; } .t-st-progress { background: #f59e0b22; color: var(--yellow); }
.t-st-waiting { background: #a855f722; color: #a855f7; } .t-st-resolved { background: #00a88422; color: var(--green); } .t-st-closed { background: var(--panel3); color: var(--muted); }
.t-pr-low { color: var(--muted); } .t-pr-normal { color: var(--text); background: var(--panel2); } .t-pr-high { background: #f59e0b22; color: var(--yellow); } .t-pr-urgent { background: #f15c6d22; color: var(--red); }
.t-cat { background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.t-late { color: var(--red); font-weight: 500; } .t-soon { color: var(--yellow); }
.tk-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.tk-col { background: var(--panel2); border-radius: var(--radius); padding: 8px; min-height: 120px; border: 2px dashed transparent; }
.tk-col.over { border-color: var(--green); }
.tk-col-h { font-weight: 600; padding: 4px 6px 8px; }
.tk-col-b { display: flex; flex-direction: column; gap: 8px; }
.tk-card { background: var(--panel); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border: 1px solid var(--line); }
.tk-card.late { border-left: 3px solid var(--red); } .tk-card.drag { opacity: .5; }
.tk-card .row { gap: 6px; align-items: center; }
.tk-detail { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
.tk-desc { background: var(--panel2); border-radius: 8px; padding: 10px 12px; white-space: normal; }
.tk-timeline { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.tk-ev { display: flex; gap: 10px; }
.tk-ev-ic { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-size: 13px; }
.tk-ev-body { background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin-top: 3px; }
.tk-ev-reply .tk-ev-body { background: color-mix(in srgb, var(--green) 14%, var(--panel)); }
.tk-com textarea { min-height: 70px; }
.tk-side { background: var(--panel2); border-radius: var(--radius); padding: 12px; align-self: start; }
.tk-client { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); padding-top: 10px; }
.tk-client .btn { margin-top: 6px; align-self: flex-start; }
.tk-cat-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 90px 170px 32px; gap: 8px; align-items: center; }
.tk-cat-row input[type=color] { width: 36px; height: 32px; padding: 2px; }
.tk-sla input { width: 100%; min-width: 0; }
.tk-sla { display: flex; flex-direction: row; align-items: center; gap: 4px; margin: 0; }
.ticket-bar { background: color-mix(in srgb, #3b82f6 10%, var(--panel)); }
.ticket-bar .link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; }
@media (max-width: 900px) {
  .tk-detail { grid-template-columns: 1fr; }
  .tk-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .tk-row > :nth-child(4), .tk-row > :nth-child(5) { display: none; }
  .tk-row > :nth-child(6) { grid-column: 2 / 4; }
}
@media (max-width: 760px) {
  .tk-cat-row { grid-template-columns: 40px minmax(0, 1fr) 80px 32px; }
  .tk-cat-row select { grid-column: 2 / 4; }
  .tk-bar select { flex: 1; max-width: none; }
  #tkMode { display: none; }
  .tk-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tk-stat { padding: 8px 10px; } .tk-stat b { font-size: 18px; } .tk-stat span { font-size: 11px; }
}

/* arquivo sendo enviado (bolha com progresso) */
.pending-file .bubble { display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 340px; }
.pf-thumb { width: 54px; height: 54px; flex: none; border-radius: 6px; overflow: hidden; background: var(--panel2); display: grid; place-items: center; }
.pf-thumb img, .pf-thumb video { width: 100%; height: 100%; object-fit: cover; }
.pf-ic { font-size: 24px; }
.pf-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pf-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-bar { height: 4px; background: var(--panel3, rgba(0,0,0,.12)); border-radius: 2px; overflow: hidden; }
.pf-bar i { display: block; height: 100%; background: var(--green); transition: width .2s; }
.pending-file .pa-row { padding: 0; font-size: 12.5px; }
.pending-file.failed .pf-bar { display: none; }

/* o cliente ouviu o áudio / assistiu o vídeo */
.ap-avatar.me.heard { background: var(--blue); }
.heard-tag { font-style: normal; color: var(--blue); font-size: 11px; margin-right: 2px; }

/* fluxos: qual atende cada conexão */
.fl-summary { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.fl-sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.fl-sum-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--row-line); }
.fl-summary p { margin: 0; }
.fl-warn { color: var(--yellow); }
.fl-inst-row { display: flex; align-items: center; gap: 8px; }
.fl-inst-row .grow { flex: 1; }
.fl-sum-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 500; }
.fl-sum-row > :last-child { flex: none; }
.fc-pal-sec { margin-bottom: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.fc-pal-sec .btn { justify-content: flex-start; }
@media (max-width: 900px) { .fc-pal-sec { margin: 0; padding: 0 8px 0 0; border-bottom: 0; border-right: 1px solid var(--line); flex-direction: row; align-items: center; } }

/* modo invisível do atendente */
.inv-btn { white-space: nowrap; }
.inv-btn.active { background: #6b7280; color: #fff; border-color: #6b7280; }
@media (max-width: 760px) { .inv-btn { display: none; } }

/* modal de transferência */
.tr { gap: 14px; }
.tr-lead { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-conn { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 10px; background: var(--panel); }
.tr-conn small { font-size: 12px; line-height: 1.4; }
@media (max-width: 560px) { .tr-grid { grid-template-columns: 1fr; } }
