/* Layout: app de duas telas (Inbox e Funil). Inbox em três painéis no desktop, um painel por vez no celular. */
:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7F9;
  --ink: #14202B;
  --muted: #586774;
  --line: #DCE2E8;
  --accent: #2255D4;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EBFB;
  --good: #1B7F4B;
  --good-soft: #DDF3E6;
  --bad: #B3261E;
  --tg0-bg: #E3EBFB; --tg0-ink: #1D45B0; --tg1-bg: #DDF3E6; --tg1-ink: #17683D;
  --tg2-bg: #FBE8D6; --tg2-ink: #8A4B06; --tg3-bg: #F6E1EE; --tg3-ink: #8E2A66;
  --ai-bg: #EDE7FA;
  --ai-ink: #3F2A86;
  --ch-wa: #178A45;
  --ch-ig: #B02A78;
  --ch-ms: #0A66D6;
  --ch-em: #5B6674;
  --ch-sms: #A86100;
  --ch-tt: #0E7C86;
  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F161C; --surface: #17212A; --surface-2: #1C2832; --ink: #E7EDF2; --muted: #9DAEBB; --line: #2A3845;
    --accent: #6D95FF; --accent-ink: #0B1220; --accent-soft: #1E2D4D; --good: #5AD08F; --good-soft: #17372A; --bad: #FF8A80;
    --tg0-bg: #1E2D4D; --tg0-ink: #9DB8FF; --tg1-bg: #17372A; --tg1-ink: #7FE0A8;
    --tg2-bg: #3D2A12; --tg2-ink: #F2C07A; --tg3-bg: #3C1F31; --tg3-ink: #F2A9D1;
    --ai-bg: #2A2347; --ai-ink: #CBBBFF; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F161C; --surface: #17212A; --surface-2: #1C2832; --ink: #E7EDF2; --muted: #9DAEBB; --line: #2A3845;
  --accent: #6D95FF; --accent-ink: #0B1220; --accent-soft: #1E2D4D; --good: #5AD08F; --good-soft: #17372A; --bad: #FF8A80;
    --tg0-bg: #1E2D4D; --tg0-ink: #9DB8FF; --tg1-bg: #17372A; --tg1-ink: #7FE0A8;
    --tg2-bg: #3D2A12; --tg2-ink: #F2C07A; --tg3-bg: #3C1F31; --tg3-ink: #F2A9D1;
  --ai-bg: #2A2347; --ai-ink: #CBBBFF; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font: 700 18px/1 var(--f-display); margin: 0; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.count { min-width: 20px; padding: 0 6px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.tab[aria-selected="true"] .count { background: var(--accent-ink); color: var(--accent); }
.sample { margin-left: auto; font-size: 12px; color: var(--muted); }

main { flex: 1; min-height: 0; }

/* Inbox */
#inbox { height: 100%; display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-list { border-right: 1px solid var(--line); }
.pane-details { border-left: 1px solid var(--line); }
.pane-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.list { flex: 1; overflow-y: auto; min-height: 0; }
.conv { width: 100%; text-align: left; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; min-height: 68px; }
.conv:hover { background: var(--surface-2); }
.conv[aria-current="true"] { background: var(--accent-soft); }
.avatar { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: 0 0 auto; }
.row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row2 .preview { flex: 1; min-width: 0; }
.tops { display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; justify-content: flex-end; }
.toppill { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.stg-chip { --tbg: var(--surface-2); --tink: var(--ink); border: 1px solid var(--line); }
.chn { display: inline-flex; flex: 0 0 auto; }
.cfg-show { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 4px; font-size: 13px; }
.cfg-show label { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.row3 { flex-wrap: wrap; display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.row3 .acc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.unread { margin-left: auto; flex: 0 0 auto; }
.badge { width: 18px; height: 18px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tag-ai { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--ai-bg); color: var(--ai-ink); font-weight: 600; flex: 0 0 auto; }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }

.chat-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.icon { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.btn-sm { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 500; }
.switch { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px 4px 5px; font-size: 13px; font-weight: 600; }
.switch .track { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .track::after { left: 14px; }
.switch[aria-checked="true"] { color: var(--ai-ink); border-color: var(--ai-ink); }

.msgs { flex: 1; overflow-y: auto; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.msg { white-space: pre-line; max-width: min(78%, 460px); padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg.ai { align-self: flex-end; background: var(--ai-bg); color: var(--ai-ink); border-color: transparent; }
.msg .meta { display: block; font-size: 11px; opacity: 0.75; margin-top: 2px; }
.msg .who-ai { display: block; font-size: 11px; font-weight: 700; margin-bottom: 1px; }
.sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 999px; padding: 3px 12px; text-align: center; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer form { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.send { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 0 16px; font-weight: 600; }
.link { align-self: flex-start; border: 0; background: transparent; color: var(--accent); padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.d-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; min-height: 57px; }
.d-head h2 { margin: 0; font: 700 15px/1 var(--f-display); }
.d-body { padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.d-body .who { display: flex; gap: 10px; align-items: center; }
.d-body .who .avatar { width: 44px; height: 44px; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field .lbl { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.field select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.val { font: 700 22px/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.inline { display: flex; align-items: center; gap: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; min-height: 34px; font-size: 13px; color: var(--muted); }
.tag[aria-pressed="true"] { background: var(--tbg, var(--accent-soft)); border-color: var(--tink, var(--accent)); color: var(--tink, var(--accent)); font-weight: 600; }

.only-narrow { display: none; }

/* Funil */
#funil { height: 100%; display: flex; flex-direction: column; gap: 12px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg .hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.board { flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; }
.col { flex: 0 0 min(290px, 82vw); scroll-snap-align: start; display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.col-head .t { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.col-head .sum { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cards { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.card.drag { opacity: 0.45; }
.card .top2 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.card .meta2 { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .acts { display: flex; gap: 8px; align-items: center; }
.card select { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.mini-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--tbg, var(--accent-soft)); color: var(--tink, var(--accent)); font-weight: 600; }

/* Menu lateral */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 20, 0.5); z-index: 20; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; width: min(280px, 84vw);
  background: var(--surface); border-right: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px;
  transform: translateX(-100%); visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}
.drawer.open { transform: none; visibility: visible; transition: transform 0.2s ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.open { transition: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 4px; }
.drawer-brand { font: 700 17px/1.2 var(--f-display); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; padding: 12px; border-radius: 10px; font-weight: 600; color: var(--ink); min-height: 44px; }
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* Destaques de etapa e etiqueta, reforços e aviso */
.stg { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; min-height: 34px; font-size: 13px; color: var(--muted); }
.stg:hover { background: var(--surface-2); }
.gl.here { color: var(--accent); }
.otherf { margin-top: 2px; }
.otherf summary { cursor: pointer; color: var(--accent); font-size: 13px; min-height: 28px; display: flex; align-items: center; }
.otherf .tgroups { margin-top: 8px; }
.req { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.req.ok { color: var(--good); border-color: var(--good); }
.req.miss { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.qhint { font-size: 12px; color: var(--accent); font-weight: 600; }
#untChip { border-style: dashed; border-color: var(--accent); color: var(--accent); }
#untChip[aria-pressed="true"] { border-style: solid; }
#untChip .count { margin-left: 4px; }
.cfg-move { min-height: 34px; max-width: 130px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; padding: 0 6px; }
.rules { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rule { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.rule-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule-on { display: flex; align-items: center; gap: 8px; font-weight: 600; min-height: 32px; }
.rule-f { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
.rule-f .lbl { font-size: 12px; color: var(--muted); }
.rule-row { display: flex; flex-wrap: wrap; gap: 10px; }
.cfg-move.wide { max-width: none; width: 100%; }
.rule-test { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.cfg-card.wide { grid-column: 1 / -1; }
.cfg-tgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cfg-tg { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cfg-tg .tx { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sw-cfg[aria-checked="true"] { color: var(--accent); border-color: var(--accent); }
.cfg-req { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.cfg-req .lbl-t { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.reqs { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.reqs label { display: flex; align-items: center; gap: 8px; min-height: 32px; }
#gscrim { z-index: 39; }
.gdlg { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 16px 40px rgba(8, 14, 20, 0.3); }
.gdlg h2 { margin: 0; font: 700 17px/1.25 var(--f-display); }
.gdlg p { margin: 0; color: var(--muted); }
.gdlg { max-height: calc(100vh - 32px); overflow-y: auto; }
.gbody { display: flex; flex-direction: column; gap: 12px; }
.gbody .field { gap: 6px; }
.gbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.gbtns .btn-sm { min-height: 40px; padding: 8px 14px; }
.gbtns .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag-none { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* Classificação rápida na conversa */
.hcls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 100%; order: 5; }
@media (min-width: 1180px) { .chat-head .switch { order: 1; } }
@media (max-width: 1179px) { .chat-head .switch { order: 6; } }
[hidden] { display: none !important; }
.qg { max-width: 100%; }
.qg .gn { white-space: nowrap; }
.qg .gv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14em; }
.qg.has { background: var(--tbg, var(--accent-soft)); color: var(--tink, var(--accent)); border-color: var(--tink, var(--accent)); }
.qg.need { border: 1px dashed var(--accent); color: var(--accent); font-weight: 600; }
.qg[aria-expanded="true"], .qstage[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--accent); }
.qwrap { position: relative; border-top: 1px solid var(--line); padding: 8px 12px; background: var(--surface); }
.qwrap + .composer { border-top: 0; padding-top: 2px; }
.qbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; min-height: 34px; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.qstage { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.qadd.need { border: 1px dashed var(--accent); color: var(--accent); font-weight: 600; }
.qchip { display: inline-flex; align-items: center; gap: 2px; background: var(--tbg, var(--accent-soft)); color: var(--tink, var(--accent)); border-radius: 999px; padding: 3px 3px 3px 11px; font-size: 13px; font-weight: 600; min-height: 34px; }
.qx { border: 0; background: transparent; color: inherit; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.qx:hover { opacity: 0.65; }
.qpop { max-height: min(40vh, 300px); overflow-y: auto; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.qpop-in { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.qgrp { display: flex; flex-direction: column; gap: 6px; }
.qopts { display: flex; flex-wrap: wrap; gap: 6px; }
.qopt { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; min-height: 36px; font-size: 14px; }
.qopt:hover { background: var(--surface-2); }
.qopt[aria-pressed="true"] { background: var(--tbg, var(--accent-soft)); border-color: var(--tink, var(--accent)); color: var(--tink, var(--accent)); font-weight: 600; }
.qfoot { display: flex; justify-content: flex-end; }
.stg[aria-pressed="true"], .qst[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.stg[aria-pressed="true"]::before, .qst[aria-pressed="true"]::before, .tag[aria-pressed="true"]::before, .qtag[aria-pressed="true"]::before { content: '✓ '; }
.tag-none { font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 0 5px; white-space: nowrap; flex: 0 0 auto; }

/* Filtro de etiquetas na Inbox */
.ifilter { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.btn-sm.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.if-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); }
.if-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.if-panel .flt label { width: 112px; flex: 0 0 auto; }
.if-panel .flt select { flex: 1; min-width: 0; }

/* Grupos de etiquetas */
.tg0 { --tbg: var(--tg0-bg); --tink: var(--tg0-ink); }
.tg1 { --tbg: var(--tg1-bg); --tink: var(--tg1-ink); }
.tg2 { --tbg: var(--tg2-bg); --tink: var(--tg2-ink); }
.tg3 { --tbg: var(--tg3-bg); --tink: var(--tg3-ink); }
.gdot { width: 10px; height: 10px; border-radius: 50%; background: var(--tink, var(--accent)); flex: 0 0 auto; }
.tgroups { display: flex; flex-direction: column; gap: 12px; }
.tgroup { display: flex; flex-direction: column; gap: 6px; }
.gl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.flt-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.flt { display: flex; align-items: center; gap: 8px; }
.flt label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.flt select { padding: 6px 8px; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.flt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.cards:empty::before { content: 'Nenhum card'; color: var(--muted); font-size: 13px; padding: 4px 2px; }
.cfg-pipe .cfg-list { margin: 10px 0; }
.cfg-list:empty::before { content: 'Nenhuma etiqueta neste grupo.'; color: var(--muted); font-size: 13px; }

/* Configurações */
#respostas { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.qrbtn { white-space: nowrap; }
.qrpanel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: min(32vh, 260px); overflow-y: auto; }
.qr-list { display: flex; flex-direction: column; gap: 6px; }
.qr-item { display: flex; gap: 8px; align-items: stretch; }
.qr-use { flex: 1; min-width: 0; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; min-height: 44px; }
.qr-use:hover { border-color: var(--accent); }
.qr-t { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.qr-s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qr-slash { margin: 0; font-size: 12px; }
.short { font-size: 12px; font-weight: 600; color: var(--accent); }
.kinds { display: flex; gap: 4px; flex-wrap: wrap; }
.kind { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); align-self: flex-start; }
.msg.media { display: flex; flex-direction: column; gap: 6px; }
.msg.me .kind { background: rgba(255, 255, 255, 0.22); color: inherit; }
.qimg { width: 100%; max-width: 240px; height: auto; border-radius: 8px; display: block; }
.mfile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.08); }
.mplay { font-size: 12px; }
.mbar { flex: 1 1 60px; height: 4px; border-radius: 2px; background: currentColor; opacity: 0.4; min-width: 60px; }
.qbs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qb { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.qb-h { display: flex; justify-content: space-between; align-items: center; }
.qb-btns { display: flex; gap: 4px; }
.qtx { resize: vertical; font: inherit; }
.qb-file { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qb-prev { flex: 1 1 100%; max-width: 240px; }
.qb-pick { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; position: relative; }
.qb-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qr-cats { margin: 8px 0 12px; }
#equipe { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.drawer-foot { margin-top: auto; padding: 12px 4px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.drawer-foot p { margin: 0; font-size: 12px; }
.avatar.mini { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.own { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.eq-invite { flex-wrap: wrap; margin-bottom: 12px; }
.eq-invite .cfg-in { flex: 1 1 220px; }
.tbl-wrap { overflow-x: auto; }
.perm-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.perm-tbl th, .perm-tbl td { padding: 10px 8px; border-top: 1px solid var(--line); text-align: center; vertical-align: middle; }
.perm-tbl thead th { border-top: 0; font-size: 12px; color: var(--muted); }
.perm-tbl th[scope="row"], .perm-tbl thead th:first-child { text-align: left; }
.perm-tbl th[scope="row"] { font-weight: 400; display: table-cell; }
.perm-tbl th[scope="row"] .muted { display: block; font-size: 12px; }
.perm-tbl input[type="checkbox"] { width: 20px; height: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#ownSeg .chip { font-size: 13px; }
#canais { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; align-content: start; max-width: 880px; }
.acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.acc-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.acc-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acc-t { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-note { margin: 0; font-size: 13px; }
.acc-btns, .wiz-btns, .wiz-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.wiz-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.wiz-proto { font-size: 12px; margin: 8px 0 0; }
.wiz { display: flex; flex-direction: column; gap: 12px; border-color: var(--accent); }
.wiz h2:focus { outline: none; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--good); border-color: var(--good); }
.pill.warn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.off { color: var(--muted); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.optc { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 14px; }
.optc:hover { border-color: var(--accent); background: var(--surface-2); }
.optc .muted { font-size: 13px; }
.qrbox { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.qrimg { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; line-height: 0; }
.qrsteps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cnx-err { margin: 0; color: var(--bad); font-weight: 600; }
.btn-sm.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-sm:disabled { opacity: 0.5; }
#contatos { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ct-sub { margin: 6px 0 8px; font-size: 14px; }
.ct-row .acc-main { align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #E5484D; margin-left: 6px; vertical-align: middle; }
#interno { height: 100%; display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 12px; min-height: 0; }
.ic-list, .ic-thread { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ic-items { overflow-y: auto; }
.ic-item { display: flex; gap: 10px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; align-items: center; }
.ic-item[aria-current="true"] { background: var(--accent-soft); }
.ic-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ic-pv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ic-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ic-m { max-width: 78%; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; }
.ic-m.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ic-m .who { display: block; font-size: 11px; font-weight: 700; opacity: .8; }
.ic-m .meta { display: block; font-size: 11px; opacity: .7; text-align: right; }
.ic-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ic-form input { flex: 1; min-width: 0; }
.bottombar { display: none; }
#ownSeg { flex-wrap: wrap; }
@media (max-width: 979px) {
  #interno { grid-template-columns: minmax(0, 1fr); }
  #interno[data-pane="list"] .ic-thread, #interno[data-pane="chat"] .ic-list { display: none; }
  .bottombar { display: flex; justify-content: space-around; border-top: 1px solid var(--line); background: var(--surface); margin: 0 -16px -12px; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 11px; padding: 4px 8px; min-width: 64px; }
  .bb[aria-current="page"] { color: var(--accent); font-weight: 700; }
  .bb .count { position: absolute; top: 0; right: 10px; }
}
#auto, #chatbot, #empresa { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.me-box { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.me-t { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.me-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.me-btns .link { font-size: 12px; }
.avatar.mini.photo { padding: 0; overflow: hidden; background: var(--surface-2); }
.avatar.mini img, .own.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.own.ph { padding: 0; width: 20px; height: 20px; overflow: hidden; display: inline-flex; border-radius: 50%; }
.logo-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; flex-wrap: wrap; }
.logo-box { width: 72px; height: 72px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; color: var(--accent); overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.filebtn { position: relative; cursor: pointer; display: inline-flex; align-items: center; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg.bot { white-space: pre-line; align-self: flex-end; background: var(--surface-2); color: var(--ink); border-style: dashed; }
.simbar { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; }
.simnote { font-size: 12px; }
.bot-prev pre { margin: 4px 0 0; white-space: pre-wrap; font: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.rule.bo { background: var(--surface-2); }
#config { height: 100%; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 12px; align-content: start; }
.cfg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.cfg-card h2 { margin: 0; font: 700 16px/1.2 var(--f-display); }
.cfg-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cfg-help { margin: 4px 0 12px; font-size: 13px; }
.cfg-note { grid-column: 1 / -1; margin: 0; padding: 9px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cfg-list, .cfg-stages { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cfg-row { display: flex; align-items: center; gap: 8px; }
.cfg-in { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.cfg-in.strong { font-weight: 600; }
.cfg-n { font-size: 12px; white-space: nowrap; }
.cfg-add { display: flex; gap: 8px; }
.cfg-pipe + .cfg-pipe { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.cfg-pipe .cfg-stages { margin: 10px 0; }
.idx { width: 20px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.icon-sm { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.icon-sm:disabled { opacity: 0.35; cursor: default; }
.danger { color: var(--bad); }

@media (max-width: 979px) {
  #config { grid-template-columns: minmax(0, 1fr); }
  #inbox { grid-template-columns: minmax(0, 1fr); }
  #inbox .pane { display: none; border: 0; }
  #inbox[data-pane="list"] .pane-list,
  #inbox[data-pane="chat"] .pane-chat,
  #inbox[data-pane="details"] .pane-details { display: flex; }
  .only-narrow { display: inline-flex; }
  .sample { margin-left: 0; width: 100%; }
}
@media (min-width: 980px) { .only-wide-hide { display: none; } }

/* Janela (modal) para editar */
.mdl-back { position: fixed; inset: 0; background: rgba(10, 20, 30, .5); z-index: 60; }
.mdl { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(calc(100vw - 24px), 680px); max-height: calc(100dvh - 24px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.mdl > .cfg-card { border: 0; box-shadow: none; margin: 0; }
body:has(.mdl) { overflow: hidden; }
.tick { color: var(--muted, #6b7280); letter-spacing: -2px; }
.tick.read { color: #2b8cf0; }
.qrimg img { display: block; width: 220px; height: 220px; max-width: 100%; }
.maudio { max-width: 100%; display: block; }
.mvideo { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; }

/* IA */
.ai-prompt { width: 100%; min-height: 160px; resize: vertical; font: inherit; line-height: 1.45; }
.ai-key-state { margin: 6px 0 10px; font-weight: 600; }
.ai-test { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ai-test p { margin: 4px 0 0; white-space: pre-wrap; }
.ai-rules { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.cfg-note.bad { color: var(--bad); border-color: var(--bad); }
#aiNote:empty { display: none; }

/* Assinatura */
.bl-plans { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.bl-plan { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; align-content: start; background: var(--surface); }
.bl-plan.cur { border-color: var(--accent); background: var(--accent-soft); }
.bl-ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bl-price { font-weight: 700; }
.bl-price small { font-weight: 400; opacity: .7; }
.bl-feats { margin: 0 0 6px; padding-left: 18px; font-size: 13px; display: grid; gap: 2px; }
.bl-pays { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bl-pay { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bl-pay:last-child { border-bottom: 0; }
.bl-pm { display: grid; flex: 1; min-width: 140px; }
.bl-sbx { border-color: #E3B35A; background: #FFF1D6; color: #5C3B00; }
#assinatura .pill, .bl-wrap .pill { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
#assinatura .pill.good, .bl-wrap .pill.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
#assinatura .pill.warn, .bl-wrap .pill.warn { background: #FFF1D6; color: #5C3B00; border-color: #E3B35A; }
#assinatura .pill.bad, .bl-wrap .pill.bad { background: #FBE4E2; color: #7A1C14; border-color: #B3261E; }
#assinatura .pill.info, .bl-wrap .pill.info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.bl-wrap { width: min(760px, 100%); display: grid; gap: 12px; }

/* logo da empresa e crédito discreto */
.co-brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; margin-right: 4px; }
.co-brand[hidden] { display: none; }
.co-brand img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; background: var(--surface, #fff); }
.co-brand span { font: 600 14px/1 var(--f-display); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.drawer-brand img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.powered { margin: 10px 0 0; font-size: 11px; color: var(--muted); opacity: .75; text-align: center; letter-spacing: .02em; }
.powered strong { font-weight: 600; }
@media (max-width: 480px) { .co-brand span { display: none; } }

.powered img { height: 16px; width: auto; max-width: 110px; vertical-align: middle; margin-left: 4px; opacity: .9; }
.mp-logo { height: 36px; width: auto; max-width: 140px; object-fit: contain; margin-right: 10px; background: #fff; border-radius: 6px; padding: 2px; }

/* relatórios */
.rp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.rp-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-k { font-size: 12px; color: var(--muted); }
.rp-v { font: 700 22px/1.2 var(--f-display); }
.rp-h { font-size: 11px; }
.rp-per { margin: 10px 0 0; }
.rp-custom { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.rp-chart { display: flex; gap: 4px; align-items: stretch; height: 150px; margin-top: 10px; }
.rp-day { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.rp-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.rp-bar { width: 42%; max-width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; }
.rp-bar.in, .rp-sw.in { background: #3b82f6; }
.rp-bar.out, .rp-sw.out { background: #16a34a; }
.rp-lbl { font-size: 10px; color: var(--muted); height: 14px; white-space: nowrap; }
.rp-legend { font-size: 12px; display: flex; gap: 6px; align-items: center; margin: 6px 0 0; }
.rp-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.rp-legend .rp-sw:first-child { margin-left: 0; }
.rp-scroll { overflow-x: auto; }
.rp-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.rp-t th, .rp-t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rp-t thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.rp-t tbody th { font-weight: 600; }
.rp-note { font-size: 12px; margin: 8px 0 0; }
.rp-sub { font-size: 14px; margin: 12px 0 6px; }
.rp-fun { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rp-fun li { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.rp-fb { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.rp-fb span { display: block; height: 100%; background: #3b82f6; border-radius: 6px; }
.rp-fc { font-variant-numeric: tabular-nums; }
.rp-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
#relatorios .cfg-card { margin-bottom: 12px; }

.rp-bar.ai, .rp-sw.ai { background: #a855f7; }
.rp-bar { width: 30%; max-width: 10px; }
.rp-heat { display: grid; gap: 2px; min-width: 540px; }
.rp-hrow { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; align-items: center; }
.rp-hd { font-size: 11px; color: var(--muted); }
.rp-hc { font-size: 10px; color: var(--muted); text-align: left; min-height: 12px; }
.rp-cell { height: 20px; border-radius: 3px; background: rgba(59, 130, 246, var(--a, 0)); outline: 1px solid var(--line); outline-offset: -1px; }
.rp-best { margin: 10px 0 4px; }
.rp-ramp { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(59,130,246,.15), rgba(59,130,246,1)); vertical-align: middle; margin: 0 4px; }

/* anexos, gravação e menu da mensagem */
.msg { position: relative; }
.msg .mact { position: absolute; top: 2px; right: 4px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; }
.msg:hover .mact, .msg .mact:focus-visible { opacity: 0.85; }
@media (hover: none) { .msg .mact { opacity: 0.55; } }
.msg.del { opacity: .78; border: 1px dashed #d4574a; background-image: repeating-linear-gradient(135deg, rgba(212,87,74,.07) 0 8px, transparent 8px 16px); }
.msg.del.me, .msg.del.ai, .msg.del.bot { color: inherit; }
.msg.del > :not(.delnote):not(.meta) { text-decoration: line-through; text-decoration-color: rgba(212,87,74,.8); }
.delnote { display: block; margin-top: 4px; font-size: 11px; font-style: normal; font-weight: 600; color: #b3392d; line-height: 1.3; }
.msg.del.me .delnote, .msg.del.ai .delnote, .msg.del.bot .delnote { color: #ffd2cc; }
.msg.hasrx { margin-bottom: 12px; }
.msg .rx { position: absolute; bottom: -12px; right: 10px; padding: 0 5px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 20px; color: var(--ink); }
.msg.flash { outline: 3px solid var(--accent); outline-offset: 2px; transition: outline-color .3s; }
.pinbar { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.pinbar[hidden] { display: none; }
.pinbar button { border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.pinbar button:hover, .pinbar button:focus-visible { background: var(--accent-soft); }
.pinbar .pb-pin { flex: 1; min-width: 0; text-align: left; display: flex; gap: 4px; align-items: center; }
.pinbar .pb-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pinbar .pb-star { white-space: nowrap; }
.mmenu { position: fixed; z-index: 60; min-width: 190px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.mmenu > button { text-align: left; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.mmenu > button:hover, .mmenu > button:focus-visible { background: var(--surface-2); }
.mmenu .danger { color: var(--bad); }
.mm-emo { display: flex; gap: 2px; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.mm-emo button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; font-size: 19px; cursor: pointer; line-height: 1; }
.mm-emo button:hover, .mm-emo button:focus-visible { background: var(--surface-2); transform: scale(1.15); }
.mm-emo button.on { background: var(--accent-soft); }
.mfwd { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mfwd-box { width: min(420px, 100%); max-height: 80vh; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface); border-radius: 12px; }
.mfwd-h { display: flex; justify-content: space-between; align-items: center; }
.mfwd-act { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn-sm.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.mfwd-q { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.mfwd-l { overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.mfwd-i { text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.mfwd-i:hover, .mfwd-i:focus-visible { background: var(--surface-2); }
.replybar { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.replybar[hidden] { display: none; }
.replybar .rq { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#attBtn { font-size: 16px; }
.micbtn { flex: none; width: 40px; border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.micbtn:hover, .micbtn:focus-visible { background: var(--accent); color: var(--accent-ink); }
/* barra de gravação (estilo WhatsApp) */
.recbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); }
.recbar[hidden] { display: none; }
#form.rec > :not(.recbar) { display: none !important; }
.recbar button { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.rb-trash { border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); }
.rb-trash:hover, .rb-trash:focus-visible { background: var(--surface-2); }
.rb-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #C2185B; animation: recblink 1.2s ease-in-out infinite; }
.recbar.paused .rb-dot { animation: none; opacity: .4; }
@keyframes recblink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rb-dot { animation: none; } }
.rb-time { flex: none; font-variant-numeric: tabular-nums; min-width: 34px; }
.rb-wave { flex: 1; min-width: 0; height: 32px; color: var(--muted); }
.rb-pause { border: 0; background: transparent; color: #C2185B; }
.rb-pause:hover, .rb-pause:focus-visible { background: var(--surface-2); }
.rb-send { border: 0; background: #111; color: #fff; }
.rb-send:hover, .rb-send:focus-visible { background: #333; }

/* painel ⚡ de respostas rápidas (barra à direita) */
.pane-qr { border-left: 1px solid var(--line); background: var(--surface); }
#inbox[data-side="qr"] { grid-template-columns: 330px minmax(0, 1fr) 360px; }
#inbox[data-side="qr"] .pane-details { display: none; }
#inbox:not([data-side="qr"]) .pane-qr { display: none; }
@media (max-width: 979px) {
  #inbox[data-pane="qr"] .pane-qr { display: flex !important; }
  #inbox[data-pane="details"] .pane-details { display: flex !important; }
  #inbox[data-pane="details"] .pane-qr { display: none !important; }
}
.qside-btn { font-size: 18px; }
.qside-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.qs-tabs { flex: 1; display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.qs-tabs button { flex: 1; border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.qs-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.qs-tabs button:not([aria-selected="true"]):hover { color: var(--ink); }
.qs-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.qs-top { display: flex; gap: 8px; }
.qs-top .cfg-in { flex: 1; min-width: 0; }
.qs-to { margin: 0; font-size: 12px; }
.qs-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.qs-sel { appearance: auto; padding-right: 8px; }
.qs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qs-item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 6px 8px; }
.qs-row { display: flex; align-items: center; gap: 6px; }
.qs-t { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.qs-t strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-sub { font-size: 12px; }
.qs-btns { display: flex; gap: 2px; flex: none; }
.qs-ic { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; }
.qs-ic:hover, .qs-ic:focus-visible { background: var(--surface-2); color: var(--ink); }
.qs-ic.go { color: var(--accent); }
.qs-ic.go:hover, .qs-ic.go:focus-visible { background: var(--accent); color: var(--accent-ink); }
.qs-more { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.qs-more button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.qs-more button.danger { color: var(--bad); }
.qs-steps { margin: 6px 0 2px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.qs-steps .kind { margin-right: 4px; }
.qs-run { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.qs-empty { list-style: none; padding: 8px 2px; }
.qs-edit .cfg-card { border: 0; padding: 0; box-shadow: none; background: transparent; }
.qact .qa-f { display: flex; flex-direction: column; gap: 6px; }
.qa-sec { display: flex; align-items: center; gap: 8px; }
.qa-sec .cfg-in { width: 90px; }
.qa-note { margin: 0; font-size: 12px; }
.amenu { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface-2); }
.amenu summary { font-weight: 600; cursor: pointer; padding: 4px 0; }
.am-g { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 8px; }

/* ordenar etiquetas e grupos */
.cfg-drag{cursor:grab;color:var(--muted,#8a94a6);font-size:16px;line-height:1;padding:0 4px;user-select:none}
.cfg-drag:active{cursor:grabbing}
.cfg-row.dragging{opacity:.4}
.cfg-row.drop-before{box-shadow:0 -2px 0 0 var(--brand,#2563eb)}
.cfg-list.drop-end{box-shadow:inset 0 -2px 0 0 var(--brand,#2563eb)}
.icon-sm[disabled]{opacity:.35;cursor:default}

/* celular: campo de texto em cima, botões embaixo (o botão de áudio não corta mais) */
.composer form > input#msgInput { min-width: 0; flex: 1 1 auto; }
.micbtn { min-width: 40px; height: 40px; }
@media (max-width: 640px) {
  .composer form { flex-wrap: wrap; }
  .composer form > input#msgInput { order: -1; flex: 1 1 100%; }
  .composer form > .send { margin-left: auto; min-height: 40px; }
}

/* linha de hora e status abaixo da mensagem: uma linha só */
.msg .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
@media (max-width: 640px) { .msg .meta { font-size: 10.5px; letter-spacing: -0.1px; } }

/* celular: botões do campo de mensagem sempre numa linha só */
@media (max-width: 640px) {
  .composer form { gap: 6px; }
  .composer form > .btn-sm, .composer form > .send, .composer form > .micbtn { min-height: 38px; height: 38px; font-size: 13px; padding: 0 9px; flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .composer form > #attBtn { padding: 0 10px; }
  .composer form > .send { margin-left: auto; padding: 0 14px; }
  .composer form > .micbtn { width: 40px; padding: 0; flex: none; }
}
@media (max-width: 640px) {
  .composer form { gap: 5px; }
  .composer form > .btn-sm, .composer form > .send { font-size: 12px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; }
  .composer form > #attBtn { padding: 0; width: 36px; flex: none; }
  .composer form > .micbtn { width: 38px; }
  .composer form > .send { padding: 0 12px; }
}
@media (max-width: 640px) { .composer form > .btn-sm, .composer form > .send { display: inline-flex; align-items: center; justify-content: center; line-height: 1; } }

.msg.del .link { font-size: 11px; margin-left: 6px; }
.mfwd-box .orig { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--line, #d0d7e2); background: var(--bg-soft, #f4f6fa); white-space: pre-wrap; word-break: break-word; border-radius: 6px; }

/* nota interna, adiar, tarefas */
.ctabs { display: flex; gap: 4px; padding: 6px 12px 0; }
.ctabs button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px 8px 0 0; font: inherit; font-size: 13px; color: var(--muted, #5b6676); cursor: pointer; border-bottom: 2px solid transparent; }
.ctabs button[aria-selected="true"] { color: var(--ink, #111827); font-weight: 600; border-bottom-color: #f2b705; }
#form.note { background: #fff8db; }
#form.note #attBtn, #form.note #qrBtn, #form.note #aiBtn, #form.note #micBtn { display: none !important; }
#form.note #msgInput { background: #fffdf0; border-color: #f2b705; }
.mpop { position: relative; }
.mpop[hidden] { display: none; }
.mpop { margin: 0 12px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line, #d0d7e2); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); overflow: hidden; }
.mpop button { text-align: left; border: 0; background: transparent; padding: 8px 12px; font: inherit; cursor: pointer; }
.mpop button:hover, .mpop button:focus { background: #fff3c4; }
.msg.note { align-self: stretch; max-width: 100%; background: #fff3c4; color: #3d3200; border: 1px solid #f2d96a; border-radius: 10px; }
.msg.note .who-note { display: block; font-size: 11px; font-weight: 700; color: #7a5d00; margin-bottom: 3px; }
.msg.note .meta { color: #7a5d00; }
.mnt-in { background: #ffe27a; border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mnt { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 9px; background: #f2b705; color: #3d3200; font-size: 11px; font-weight: 700; margin-right: 4px; }
#toasts { position: fixed; right: 12px; bottom: 12px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 24px)); }
.toast { text-align: left; border: 0; background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 10px; font: inherit; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
.tk-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tk { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line, #d0d7e2); border-radius: 10px; background: #fff; }
.tk.late { border-color: #e0a39b; background: #fff4f2; }
.tk-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tk-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.tk-sec { margin-top: 10px; } .tk-sec.late > strong { color: #b3392d; }
#tkCount { background: #d4574a; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 6px 0; }
@media (max-width: 640px) { .ctabs button { padding: 4px 9px; font-size: 12.5px; } }

.wt { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; border-radius: 9px; padding: 1px 6px; margin-right: 4px; white-space: nowrap; background: #e8f3ec; color: #1f6b49; }
.wt.warn { background: #fff0c2; color: #6b4a00; }
.wt.late { background: #fde0de; color: #9b1c14; }

.gsn { font-style: normal; color: var(--accent, #2f7d5b); }
.presbar { background: #fff6d6; color: #6b4a00; font-size: 13px; padding: 6px 12px; border-bottom: 1px solid #f0dca0; }

.ins-sum { margin: 4px 0; font-size: 13px; line-height: 1.4; }
.lead { font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 8px; background: #e3eefc; color: #1b4b8f; }
.lead.morno { background: #fff0c2; color: #6b4a00; }
.lead.quente { background: #fde0de; color: #9b1c14; }

.cmp-bar { height: 8px; background: var(--line, #e5e5e5); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.cmp-bar span { display: block; height: 8px; background: #2f7d5b; }
.cmp-form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; border-top: 1px solid var(--line, #e5e5e5); padding-top: 10px; }
.cmp-form h3 { margin: 0; font-size: 15px; }

.ag-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.ag-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
.ag-day.today { border-color: #2f7d5b; box-shadow: 0 0 0 1px #2f7d5b inset; }
.ag-day h3 { margin: 0 0 6px; font-size: 14px; }
.ag-item { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.ag-item.canceled, .ag-item.noshow { opacity: .55; }
.ag-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ag-empty { margin: 4px 0; }

.ok-t { color: #1f6b49; font-weight: 600; }
.late-t { color: #9b1c14; font-weight: 600; }
