/* ChatIQ: ferramenta de atendimento. Barra lateral grafite, superfícies neutras quentes,
   laranja da marca só para ação principal, contagens e foco; verde significa sucesso/online. */
:root {
  --ink: #182127; --text: #182127; --muted: #5b6870; --faint: #8a959c;
  --bg: #f3f2ef; --panel: #ffffff; --panel-2: #f5f4f1; --hover: #f2f1ed; --active: #ebe9e4;
  --border: #e7e5e0; --border-2: #d4d2cb;
  --rail: #1c2429; --rail-ink: #a9b4ba; --rail-hover: rgba(255,255,255,.06); --rail-active: rgba(255,255,255,.11);
  --accent: #ff8a1f; --accent-hover: #f07a0c; --on-accent: #1f1204; --accent-ink: #a84d06; --accent-soft: #fff0e1;
  --green: #1f8a4c; --green-dark: #17703c; --green-soft: #e2f2e7; --online: #2fb36d;
  --danger: #c4302b; --danger-soft: #fbe9e8; --warn: #b7791f; --warn-ink: #8a5a0f; --blue: #2f7fc1;
  --bubble-in: #ffffff; --bubble-out: #e8eef1; --bubble-edge: rgba(24,33,39,.08); --chat-bg: #f1efea;
  --system: #f4ead6; --note: #fbf3d4;
  --author: #2f3a42; --author-bot: #56659a;
  --shadow: 0 1px 2px rgba(24,33,39,.06); --shadow-pop: 0 12px 32px -8px rgba(24,33,39,.22), 0 2px 6px rgba(24,33,39,.08);
  --input: #ffffff; --modal: #ffffff; --overlay: rgba(18,24,28,.42); --pattern-opacity: 0;
  --qbar: #fbf1de; --qbar-line: #f0dfbd;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6e9eb; --text: #e6e9eb; --muted: #9aa6ad; --faint: #6f7b82;
    --bg: #0f1417; --panel: #151b1f; --panel-2: #1a2125; --hover: #1e262b; --active: #252e34;
    --border: #252e34; --border-2: #343e45;
    --rail: #0d1215; --rail-ink: #8f9aa1;
    --accent-ink: #ffa24d; --accent-soft: rgba(255,138,31,.13);
    --green: #3fbf74; --green-dark: #6fd69a; --green-soft: rgba(63,191,116,.14); --online: #3fbf74;
    --danger: #ff6b66; --danger-soft: rgba(255,107,102,.13); --warn: #e0a63d; --warn-ink: #f0c060; --blue: #6cb3ee;
    --bubble-in: #1d252a; --bubble-out: #26323a; --bubble-edge: rgba(0,0,0,.25); --chat-bg: #10161a;
    --system: #262418; --note: #302d19;
    --author: #c8d2d8; --author-bot: #a9b4e6;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-pop: 0 14px 36px -8px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.35);
    --input: #1a2125; --modal: #1b2227; --overlay: rgba(0,0,0,.6);
    --qbar: #262012; --qbar-line: #3a3018;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e6e9eb; --text: #e6e9eb; --muted: #9aa6ad; --faint: #6f7b82;
  --bg: #0f1417; --panel: #151b1f; --panel-2: #1a2125; --hover: #1e262b; --active: #252e34;
  --border: #252e34; --border-2: #343e45;
  --rail: #0d1215; --rail-ink: #8f9aa1;
  --accent-ink: #ffa24d; --accent-soft: rgba(255,138,31,.13);
  --green: #3fbf74; --green-dark: #6fd69a; --green-soft: rgba(63,191,116,.14); --online: #3fbf74;
  --danger: #ff6b66; --danger-soft: rgba(255,107,102,.13); --warn: #e0a63d; --warn-ink: #f0c060; --blue: #6cb3ee;
  --bubble-in: #1d252a; --bubble-out: #26323a; --bubble-edge: rgba(0,0,0,.25); --chat-bg: #10161a;
  --system: #262418; --note: #302d19;
  --author: #c8d2d8; --author-bot: #a9b4e6;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-pop: 0 14px 36px -8px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.35);
  --input: #1a2125; --modal: #1b2227; --overlay: rgba(0,0,0,.6);
  --qbar: #262012; --qbar-line: #3a3018;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 "Geist", "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); overflow: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 17px; height: 17px; }
svg.i.xs { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; height: 100vh; width: 100%; background: var(--panel); }

.rail { width: 60px; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 2px; flex: none; color: var(--rail-ink); }
.rail .brand { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; font-size: 15px; }
.rail-btn { position: relative; width: 40px; height: 40px; border: 0; background: none; border-radius: 9px; display: grid; place-items: center; color: var(--rail-ink); cursor: pointer;
  transition: background-color .15s ease-out, color .15s ease-out; }
.rail-btn:hover { background: var(--rail-hover); color: #fff; }
.rail-btn.active { background: var(--rail-active); color: #fff; }
.rail-btn.active::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-btn:focus-visible { outline-offset: 0; }
.rail-btn .badge { position: absolute; top: 1px; right: -2px; box-shadow: 0 0 0 2px var(--rail); }
.rail-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 50px; top: 50%; transform: translateY(-50%); background: #0b1013; color: #fff; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; z-index: 50; pointer-events: none; }
.rail .sep { width: 24px; height: 1px; background: rgba(255,255,255,.09); margin: 8px 0; }
.rail .spacer { flex: 1; }
.rail-scroll { display: flex; flex-direction: column; align-items: center; gap: 2px; overflow-y: auto; overflow-x: visible; scrollbar-width: none; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; flex: none; font-size: 14px; position: relative; text-transform: uppercase; letter-spacing: .01em; }
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.xl { width: 112px; height: 112px; font-size: 40px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); }
.rail .avatar .dot { border-color: var(--rail); }
.dot.online { background: var(--online); } .dot.away { background: var(--warn); } .dot.offline { background: var(--faint); }

.badge { background: var(--accent); color: var(--on-accent); border-radius: 9px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; line-height: 1; }
.badge.gray { background: var(--border-2); color: var(--text); }

/* ---------------------------------------------------------------- side panel */
.side { width: 30%; min-width: 340px; max-width: 440px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--panel); flex: none; }
.side-head { height: 56px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 10px 0 18px; gap: 6px; flex: none; }
.side-head h2 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; letter-spacing: -0.01em; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none;
  transition: background-color .15s ease-out, color .15s ease-out; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent-ink); }
.search { padding: 10px 12px 8px; display: flex; gap: 8px; align-items: center; }
.search-box { flex: 1; display: flex; align-items: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; height: 36px; padding: 0 10px; gap: 9px; color: var(--muted);
  transition: border-color .15s ease-out, background-color .15s ease-out; }
.search-box:focus-within { border-color: var(--border-2); background: var(--panel); }
.search-box input { border: 0; background: none; outline: 0; flex: 1; min-width: 0; color: var(--text); }
.search-box input::placeholder { color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 6px 12px 10px; overflow-x: auto; scrollbar-width: none; flex: none; border-bottom: 1px solid var(--border); }
.chip { border: 1px solid transparent; background: none; color: var(--muted); border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s ease-out, color .15s ease-out; }
.chip:hover { background: var(--hover); color: var(--text); }
.chip.active { background: var(--ink); color: var(--panel); }
.chip .badge { height: 17px; min-width: 17px; font-size: 11px; }

.list { flex: 1; overflow-y: auto; }
.item { display: flex; gap: 12px; padding: 0 0 0 14px; cursor: pointer; align-items: center; height: 70px; transition: background-color .12s ease-out; }
.item:hover { background: var(--hover); }
.item.active { background: var(--active); }
.item .body { flex: 1; min-width: 0; border-bottom: 1px solid var(--border); height: 100%; display: flex; flex-direction: column; justify-content: center; padding-right: 14px; gap: 1px; }
.item .row { display: flex; align-items: center; gap: 6px; }
.item .name { flex: 1; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.005em; }
.item .time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .time.unread { color: var(--accent-ink); font-weight: 600; }
.item .preview { flex: 1; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .tags { display: flex; gap: 4px; margin-top: 3px; }
.tag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; line-height: 16px; }
.tag.q { color: #fff; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.load-more { display: block; margin: 12px auto; }

/* ---------------------------------------------------------------- main / chat */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--chat-bg); }
.welcome { flex: 1; display: grid; place-items: center; text-align: center; background: var(--panel-2); color: var(--muted); padding: 24px; }
.welcome h1 { color: var(--text); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; margin: 22px 0 8px; }
.welcome .logo { width: 96px; height: 96px; border-radius: 24px; margin: 0 auto; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 40px; font-weight: 700; }
.chat-head { height: 56px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 10px 0 16px; flex: none; z-index: 2; }
.chat-head .who { flex: 1; min-width: 0; cursor: pointer; }
.chat-head .who .n { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.005em; }
.chat-head .who .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; background: var(--panel); color: var(--text); white-space: nowrap; line-height: 20px;
  transition: background-color .15s ease-out, border-color .15s ease-out, transform .1s ease-out; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { background: none; color: var(--text); border-color: var(--border-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 4px 10px; font-size: 13px; line-height: 18px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

.messages { flex: 1; overflow-y: auto; padding: 18px 7% 10px; position: relative; }
.chat-bg::before { content: ""; position: absolute; inset: 0; opacity: var(--pattern-opacity); pointer-events: none; }
.chat-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.msg-row { display: flex; margin-bottom: 2px; position: relative; }
.msg-row.out { justify-content: flex-end; }
.msg-row.gap { margin-top: 12px; }
.bubble { max-width: 64%; padding: 7px 9px 8px 11px; border-radius: 10px; box-shadow: 0 1px 0 var(--bubble-edge); background: var(--bubble-in); position: relative; word-wrap: break-word; }
.bubble .txt, .note .txt { white-space: pre-wrap; }
.out .bubble { background: var(--bubble-out); }
.bubble .author { font-size: 12.5px; font-weight: 600; color: var(--author); margin-bottom: 2px; display: flex; align-items: center; gap: 4px; }
.bubble.bot .author { color: var(--author-bot); }
.bubble .meta { float: right; margin: 8px 0 -6px 12px; font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; position: relative; top: 3px; font-variant-numeric: tabular-nums; }
.bubble .meta .tick { width: 16px; height: 11px; }
.tick.read { color: var(--blue); }
.tick.failed { color: var(--danger); }
.bubble img.media { max-width: 330px; max-height: 330px; border-radius: 6px; display: block; margin-bottom: 4px; cursor: pointer; }
.bubble audio, .bubble video { max-width: 320px; display: block; margin-bottom: 4px; }
.bubble .doc { display: flex; gap: 10px; align-items: center; background: rgba(24,33,39,.05); padding: 10px; border-radius: 6px; margin-bottom: 4px; text-decoration: none; color: var(--text); }
.bubble .err { color: var(--danger); font-size: 12px; display: block; margin-top: 2px; }
.bubble .mact { position: absolute; top: 3px; right: 3px; opacity: 0; background: inherit; border: 0; border-radius: 6px; width: 24px; height: 24px; display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: opacity .12s ease-out; }
.bubble:hover .mact, .bubble .mact:focus-visible { opacity: 1; }
.sys { text-align: center; margin: 10px 0; }
.sys span { background: var(--system); color: var(--muted); font-size: 12px; padding: 4px 10px; border-radius: 6px; display: inline-block; max-width: 80%; }
.day { text-align: center; margin: 14px 0; position: sticky; top: 0; z-index: 1; }
.day span { background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); text-transform: uppercase; }

.banner { padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--muted); flex-wrap: wrap; z-index: 1; }
.composer { min-height: 60px; background: var(--panel); border-top: 1px solid var(--border); display: flex; align-items: flex-end; gap: 6px; padding: 9px 12px; flex: none; z-index: 1; position: relative; }
.composer textarea { flex: 1; border: 1px solid var(--border); outline: 0; border-radius: 8px; background: var(--panel-2); padding: 9px 12px; resize: none; max-height: 140px; min-height: 40px; line-height: 20px;
  transition: border-color .15s ease-out, background-color .15s ease-out; }
.composer textarea:focus { border-color: var(--border-2); background: var(--panel); }
.composer .icon-btn { height: 40px; width: 40px; }
.composer #btn-send { background: var(--accent); color: var(--on-accent); }
.composer #btn-send:hover { background: var(--accent-hover); }
.qr-pop { position: absolute; bottom: 100%; left: 12px; right: 12px; background: var(--modal); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); max-height: 260px; overflow-y: auto; z-index: 5; }
.qr-pop div { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.qr-pop div.sel, .qr-pop div:hover { background: var(--hover); }
.qr-pop b { color: var(--accent-ink); margin-right: 8px; }
.attach-prev { position: absolute; bottom: 100%; left: 12px; background: var(--modal); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 10px 14px; display: flex; align-items: center; gap: 10px; z-index: 5; }

/* ---------------------------------------------------------------- drawer (info / notas) */
.drawer { width: 30%; max-width: 400px; min-width: 320px; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex: none; }
.drawer-head { height: 56px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 12px; flex: none; }
.drawer-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.drawer-tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; padding: 0 8px; }
.drawer-tabs button { flex: 1; border: 0; background: none; padding: 11px 4px 9px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; font-size: 13.5px; }
.drawer-tabs button:hover { color: var(--text); }
.drawer-tabs button.active { color: var(--text); border-color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; background: var(--panel-2); }
.card { background: var(--panel); padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card + .card { margin-top: 8px; border-top: 1px solid var(--border); }
.card h4 { margin: 0 0 12px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.note { background: var(--note); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px; position: relative; }
.note .by { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }
.timeline { font-size: 13px; }
.timeline div { padding: 6px 0 6px 14px; border-left: 1px solid var(--border-2); position: relative; }
.timeline div::before { content: ""; position: absolute; left: -4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--muted); }
.timeline small { color: var(--muted); display: block; }
.hist { padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.hist:hover { color: var(--accent-ink); }

/* ---------------------------------------------------------------- páginas admin */
.page { flex: 1; overflow-y: auto; background: var(--panel-2); }
.page-head { background: var(--panel); padding: 16px 28px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 3; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; margin: 0; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 10px; letter-spacing: -0.015em; }
.page-head h1 svg.i { color: var(--muted); }
.page-head p { width: 100%; margin: 0; color: var(--muted); font-size: 13px; max-width: 110ch; }
.page-body { padding: 22px 28px 48px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; padding: 10px 14px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .06em; background: var(--panel); }
.grid td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.click { cursor: pointer; } .grid tr.click:hover td { background: var(--hover); }
.grid .actions { text-align: right; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 500; background: var(--panel-2); color: var(--muted); line-height: 18px; border: 1px solid var(--border); }
.pill.green { background: var(--green-soft); color: var(--green-dark); border-color: transparent; }
.pill.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.yellow { background: rgba(224,166,61,.16); color: var(--warn-ink); border-color: transparent; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.panel-box { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-bottom: 18px; }
.panel-box h3 { margin: 0 0 14px; font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--author); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; opacity: .8; }
.bars .b:hover { opacity: 1; background: var(--accent); }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #0b1013; color: #fff; padding: 4px 8px; font-size: 11.5px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; z-index: 3; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13.5px; }
.hbar .n { width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .t { flex: 1; background: var(--panel-2); border-radius: 3px; height: 10px; overflow: hidden; }
.hbar .t div { height: 100%; background: var(--author); }
code, .mono { font-family: ui-monospace, "SFMono-Regular", "Geist Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.codebox { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; word-break: break-all; display: flex; gap: 8px; align-items: center; }
.codebox code { flex: 1; }
pre.codebox { white-space: pre-wrap; display: block; max-height: 300px; overflow: auto; margin: 0; }

/* ---------------------------------------------------------------- forms / modal */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--modal); border-radius: 12px; width: 560px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); border: 1px solid var(--border); }
.modal.wide { width: 820px; }
.modal-head { padding: 18px 22px 10px; display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 600; flex: 1; letter-spacing: -0.01em; }
.modal-body { padding: 6px 22px 16px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 5px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--border-2); background: var(--input); padding: 7px 10px; border-radius: 7px; outline: 0; min-height: 36px;
  transition: border-color .15s ease-out; }
.input:hover { border-color: color-mix(in srgb, var(--border-2) 60%, var(--muted)); }
.input:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; }
.input::placeholder { color: var(--faint); }
input[type="color"].input { padding: 3px; }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13.5px; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 20px; cursor: pointer; transition: background-color .18s ease-out; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .18s cubic-bezier(.16,1,.3,1); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.menu { position: fixed; background: var(--modal); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 5px; z-index: 200; min-width: 210px; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; border-radius: 6px; }
.menu button:hover { background: var(--hover); }
.menu button svg.i { color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px -5px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #182127; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 13.5px; max-width: 480px; cursor: pointer; }
.toast.err { background: var(--danger); }

/* ---------------------------------------------------------------- workflow editor */
.wf-wrap { flex: 1; display: flex; min-height: 0; }
.wf-palette { width: 210px; background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; flex: none; }
.wf-palette h5 { margin: 14px 2px 6px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; font-weight: 600; }
.wf-tool { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 7px; background: none; border: 1px solid var(--border); margin-bottom: 5px; cursor: grab; font-size: 13px; user-select: none; transition: border-color .12s ease-out, background-color .12s ease-out; }
.wf-tool:hover { border-color: var(--border-2); background: var(--hover); }
.wf-tool .ic { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: #fff; flex: none; }
.wf-canvas { flex: 1; position: relative; background: var(--panel-2); background-image: radial-gradient(var(--border-2) 1px, transparent 1px); background-size: 20px 20px; }
#drawflow { width: 100%; height: 100%; }
.wf-props { width: 340px; background: var(--panel); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px 18px; flex: none; }
.wf-props h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.wf-props .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.wf-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 4px; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 3px; box-shadow: var(--shadow); }
.wf-zoom .icon-btn { background: none; }
.opt-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.opt-row .num { width: 22px; color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.vars-help { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); padding: 9px 11px; border-radius: 7px; line-height: 1.65; }

/* Drawflow theme */
.drawflow .drawflow-node { background: var(--panel); border: 1px solid var(--border-2); border-radius: 9px; width: 230px; padding: 0; box-shadow: var(--shadow); color: var(--text); min-height: 0; }
.drawflow .drawflow-node.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); background: var(--panel); }
.drawflow .drawflow-node .drawflow_content_node { width: 100%; }
.drawflow .drawflow-node .input, .drawflow .drawflow-node .output { width: 14px; height: 14px; background: var(--panel); border: 2px solid var(--muted); padding: 0; border-radius: 50%; }
.drawflow .drawflow-node .output:hover, .drawflow .drawflow-node .input:hover { background: var(--accent); border-color: var(--accent); }
.drawflow .drawflow-node .inputs { left: -8px; } .drawflow .drawflow-node .outputs { right: -8px; }
.drawflow .connection .main-path { stroke: var(--faint); stroke-width: 2px; }
.drawflow .connection .main-path.selected, .drawflow .connection .main-path:hover { stroke: var(--accent); }
.drawflow-delete { background: var(--danger); border: 2px solid #fff; line-height: 26px; font-family: sans-serif; }
.nd-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 16px; border-radius: 8px 8px 0 0; color: #fff; font-weight: 600; font-size: 12.5px; }
.drawflow .nd-head svg.i { position: static; flex-shrink: 0; } /* o CSS do Drawflow posiciona todo svg como absoluto (é para as linhas) */
.nd-body { padding: 8px 10px 10px; font-size: 12.5px; color: var(--muted); max-height: 120px; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.nd-outs { font-size: 11.5px; padding: 0 10px 8px; color: var(--muted); }
.nd-outs div { text-align: right; height: 22px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- login (legado) */
.login-page { display: grid; place-items: center; grid-template-columns: minmax(0, 460px); justify-content: center; min-height: 100vh; background: var(--bg); padding: 16px; overflow: auto; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 48px 56px; width: 100%; }
@media (max-width: 500px) { .login-card { padding: 32px 24px; } }
.login-card h1 { font-weight: 600; font-size: 26px; margin: 18px 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 28px; }

@media (max-width: 900px) {
  .drawer { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; width: 100%; max-width: none; min-width: 0; }
  .side { width: auto; flex: 1 1 auto; max-width: none; min-width: 0; }
  .qbar { gap: 8px; padding: 8px 10px; }
  .qbar-txt small { display: none; }
  .app.chat-open .side { display: none; }
  .app:not(.chat-open) .main.chatmode { display: none; }
  .messages { padding: 12px 10px; }
  .bubble { max-width: 85%; }
  .wf-palette { width: 150px; } .wf-props { position: absolute; right: 0; top: 0; bottom: 0; z-index: 10; width: 100%; }
  .row2, .row3, .checks { grid-template-columns: 1fr; }
  .page-head, .page-body { padding-left: 16px; padding-right: 16px; }
  .rail { width: 52px; }
  .rail-btn { width: 38px; height: 38px; }
  .rail-btn.active::before { left: -7px; }
  .app { overflow: hidden; }
  .chat-head { gap: 6px; padding: 0 4px 0 6px; }
  .chat-head [data-act=notes], .chat-head [data-act=close] { display: none; }
}

/* Drawflow: entradas no topo, saídas alinhadas às legendas no rodapé do bloco */
.drawflow .drawflow-node { align-items: stretch; }
.drawflow .drawflow-node .inputs { position: absolute; left: -9px; top: 9px; width: auto; }
.drawflow .drawflow-node .outputs { position: absolute; right: -9px; bottom: 8px; width: auto; }
.drawflow .drawflow-node .input { left: 0; top: 0; margin: 0; }
.drawflow .drawflow-node .output { right: 0; top: 0; margin: 3px 0; width: 16px; height: 16px; }
.drawflow .drawflow-node .input { width: 16px; height: 16px; }

/* menu lateral expandido (ícone + nome) */
.rail .lbl { display: none; }
.rail-toggle { margin-bottom: 6px; }
.rail.expanded { width: 228px; align-items: stretch; padding: 10px 10px; }
.rail.expanded .brand-row { display: flex; align-items: center; gap: 10px; padding: 2px 2px 12px; }
.rail.expanded .brand { margin-bottom: 0; }
.rail .brand-row .brand-name { display: none; font-weight: 600; font-size: 15.5px; flex: 1; min-width: 0; }
.rail.expanded .brand-row .brand-name { display: block; }
.rail .brand-row { display: flex; flex-direction: column; align-items: center; }
.rail.expanded .brand-row { flex-direction: row; }
.rail.expanded .rail-scroll { align-items: stretch; }
.rail.expanded .rail-btn { width: 100%; height: 38px; border-radius: 8px; display: flex; align-items: center; gap: 12px; padding: 0 10px; justify-content: flex-start; }
.rail.expanded .rail-btn.active::before { left: -10px; }
.rail.expanded .rail-btn .lbl { display: block; flex: 1; text-align: left; font-size: 13.5px; font-weight: 500; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail.expanded .rail-btn .badge { position: static; box-shadow: none; }
.rail.expanded .rail-btn[data-tip]:hover::after { display: none; }
.rail.expanded .sep { width: auto; margin: 8px 6px; }
.rail.expanded #me-btn .lbl small { display: block; color: var(--rail-ink); font-size: 12px; font-weight: 400; }
.rail.expanded .rail-toggle { width: 36px !important; height: 36px !important; padding: 0 !important; justify-content: center !important; margin: 0; }
@media (max-width: 900px) { .rail.expanded { position: absolute; z-index: 60; height: 100%; box-shadow: 8px 0 24px rgba(0,0,0,.25); } }

@media (max-width: 900px) { .tpl-grid { grid-template-columns: 1fr !important; } }

.grid .actions .icon-btn { display: inline-grid; vertical-align: middle; }
.grid .actions .btn { vertical-align: middle; }
.hint { font-size: 12.5px; color: var(--muted); }

/* Configurações: lista de seções */
.cfg-group { padding: 20px 20px 6px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.cfg-item { display: flex; gap: 12px; align-items: center; width: calc(100% - 16px); margin: 0 8px; border: 0; background: none; text-align: left; padding: 8px 10px; cursor: pointer; color: var(--text); border-radius: 8px; transition: background-color .12s ease-out; }
.cfg-item:hover { background: var(--hover); }
.cfg-item.active { background: var(--active); }
.cfg-ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); flex: none; }
.cfg-item.active .cfg-ic { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.cfg-txt { display: flex; flex-direction: column; min-width: 0; }
.cfg-txt b { font-weight: 500; font-size: 14px; }
.cfg-txt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main.chatmode .page { width: 100%; }
.cfg-back { display: none; }
@media (max-width: 900px) { .cfg-back { display: grid; } }
@media (max-width: 900px) { table.grid { display: block; overflow-x: auto; } table.grid td, table.grid th { white-space: nowrap; } table.grid td small { white-space: normal; } }

.brand-co { display: block; font-weight: 400; font-size: 12px; color: var(--rail-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
#dp-stats { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.page-body { overflow-x: auto; }

/* barra de clientes aguardando (acima da lista de conversas) */
.qbar { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 10px 16px; background: var(--qbar); border-bottom: 1px solid var(--qbar-line); flex: none; }
.qbar-top { display: flex; align-items: center; gap: 12px; }
.qrows { display: flex; flex-direction: column; gap: 0; padding-left: 30px; }
.qrow { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; min-height: 30px; font-size: 13px; border-top: 1px solid var(--qbar-line); }
.qdot { width: 8px; height: 8px; border-radius: 2px; }
.qrow-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow-n { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.qrow-wait { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 9ch; }
.qrow-take { height: 26px; padding: 0 10px; font-size: 12.5px; background: var(--panel); }
.qrow-take:hover { background: var(--hover); }
.qbar.empty { flex-direction: row; align-items: center; background: none; border-bottom: 0; color: var(--muted); font-size: 12.5px; padding: 6px 16px; gap: 8px; }
.qbar.empty svg.i { color: var(--green); }
.qbar-bell { position: relative; color: var(--warn); display: grid; place-items: center; }
.qbar-bell .badge { position: absolute; top: -9px; right: -12px; background: var(--danger); color: #fff; height: 18px; min-width: 18px; font-size: 11px; }
.qbar-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.qbar-txt b { font-weight: 600; }
.qbar-txt small { color: var(--muted); font-size: 12px; }
.qbar .btn { flex: none; }

/* página Filas */
.qboard { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.qcol { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; width: 300px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 300px); }
.qcol-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.qcol-title { display: flex; align-items: center; gap: 8px; }
.qcol-title .tag { font-size: 12.5px; padding: 2px 8px; }
.qcol-title small { color: var(--muted); font-size: 12px; }
.qcol-stats { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.qcol-stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.qcol-oldest { font-size: 12.5px; color: var(--muted); }
.qcol-take { align-self: stretch; justify-content: center; }
.qcol-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.qcol-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 8px; }
.qitem { background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; font-size: 13.5px; }
.qitem-top { display: flex; align-items: center; gap: 8px; }
.qitem-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.qitem-pos { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.qitem-wait { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qitem-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.qitem-msg { margin-top: 6px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qitem-act { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.warn { color: var(--warn-ink) !important; }
.late { color: var(--danger) !important; font-weight: 600; }
.stat.warn .v { color: var(--warn-ink); } .stat.late .v { color: var(--danger); }
@media (max-width: 900px) { .qcol { width: 82vw; max-height: none; } }
.qitem .btn.ghost { background: var(--panel); }

/* marca: logo + CHAT branco / IQ laranja */
:root { --brand-orange: #ff8a1f; --brand-graphite: #2f3a42; }
.wm { font-weight: 700; letter-spacing: -0.01em; }
.wm-chat { color: #ffffff; } .wm-iq { color: var(--brand-orange); }
.rail .brand { padding: 0; overflow: hidden; background: var(--brand-graphite); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.rail .brand img { width: 28px; height: 28px; }
/* a barra é sempre escura: a marca fica direto nela, sem selo extra */
.rail.expanded .brand-row { background: none; border-radius: 0; padding: 2px 2px 12px; margin-bottom: 2px; border-bottom: 1px solid rgba(255,255,255,.07); }
.rail.expanded .brand-row .brand-co { color: var(--rail-ink); }
.rail.expanded .rail-toggle { color: var(--rail-ink); } .rail.expanded .rail-toggle:hover { background: var(--rail-hover); color: #fff; }
.welcome .logo { background: var(--brand-graphite); }
.welcome .logo img { width: 70px; height: 70px; }
.wm-lockup { display: inline-block; background: #182127; border-radius: 12px; padding: 6px 16px; font-size: 28px; }

/* Filas (monitor) */
.qchips { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex: none; }
.qchip .qsw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.qtabs { flex: none; }
.qtab-n { font-size: 11.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); border-radius: 4px; padding: 0 5px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.qtabs button.active .qtab-n { background: var(--ink); color: var(--panel); }
.item .time.warn { color: var(--warn-ink); } .item .time.late { color: var(--danger); font-weight: 600; }

.credit { font-size: 12px; color: var(--muted); margin-top: 18px; }
.credit a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.credit a:hover { color: var(--accent-ink); }

/* painel de confirmações: cores por resultado (validadas p/ daltonismo; tema escuro com passos próprios) */
:root { --o-confirmou: #0ca30c; --o-outras: #d55181; --o-remarcar: #2a78d6; --o-sem_resposta: #ec835a; --o-falhou: #d03b3b; }
:root[data-theme="dark"] { --o-remarcar: #3987e5; --o-sem_resposta: #c98500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --o-remarcar: #3987e5; --o-sem_resposta: #c98500; } }
[data-s="confirmou"] { --oc: var(--o-confirmou); } [data-s="outras"] { --oc: var(--o-outras); } [data-s="remarcar"] { --oc: var(--o-remarcar); }
[data-s="sem_resposta"] { --oc: var(--o-sem_resposta); } [data-s="falhou"] { --oc: var(--o-falhou); }
.pfilters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pfilters .input, .pfilters #pf-extra .input { width: auto; }
#pf-extra { display: contents; }
.stat[data-s] { position: relative; }
.stat[data-s]::after { content: ""; position: absolute; right: 14px; top: 16px; width: 9px; height: 9px; border-radius: 2px; background: var(--oc); }
.plegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.plegend span { display: inline-flex; align-items: center; gap: 6px; }
.psw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--oc); flex: none; }
.pchart { position: relative; display: flex; gap: 8px; height: 220px; }
.pgrid { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); padding-bottom: 22px; text-align: right; min-width: 26px; font-variant-numeric: tabular-nums; }
.pbars { flex: 1; display: flex; align-items: stretch; gap: 3px; border-bottom: 1px solid var(--border-2); min-width: 0; }
.pcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 6px; cursor: default; position: relative; }
.pcol:hover { background: var(--hover); border-radius: 4px 4px 0 0; }
.pstack { display: flex; flex-direction: column; gap: 2px; min-height: 0; max-width: 34px; width: 100%; margin: 0 auto; }
.pseg { background: var(--oc); min-height: 2px; }
.pstack .pseg:first-child { border-radius: 4px 4px 0 0; }
.pxl { height: 22px; line-height: 22px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); }
.pbars { margin-bottom: 22px; }
.ptip { position: absolute; z-index: 5; background: var(--modal); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 10px 12px; font-size: 12.5px; width: 200px; pointer-events: none; }
.ptip div { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.opill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 1px 8px; border-radius: 4px; background: color-mix(in srgb, var(--oc, var(--muted)) 14%, transparent); color: var(--text); white-space: nowrap; }
.opill svg { color: var(--oc, var(--muted)); }
#pn-body > .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* botões interativos do WhatsApp (resposta rápida, link, lista) dentro do balão */
.bubble.has-btns { min-width: 240px; }
.wa-btns { clear: both; margin: 10px -9px -8px -11px; padding-top: 0; }
.wa-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-top: 1px solid var(--wa-btn-line);
  color: var(--wa-btn); font-size: 13.5px; font-weight: 500; text-align: center; list-style: none; cursor: default; }
.wa-btn svg.i { flex-shrink: 0; }
.wa-list summary { cursor: pointer; }
.wa-list summary::-webkit-details-marker { display: none; }
.wa-list ol { margin: 0; padding: 6px 14px 10px 30px; border-top: 1px solid var(--wa-btn-line); font-size: 13.5px; color: var(--text); }
.wa-list ol li { padding: 2px 0; }
.via-btn { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
:root { --wa-btn: #1f6fa8; --wa-btn-line: rgba(24,33,39,.09); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wa-btn: #6cb3ee; --wa-btn-line: rgba(230,233,235,.1); } }
:root[data-theme="dark"] { --wa-btn: #6cb3ee; --wa-btn-line: rgba(230,233,235,.1); }

/* ajustes finos */
.composer textarea::placeholder { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td:first-child { min-width: 170px; }

/* alertas para a equipe (ex.: erro de integração no robô) */
.tag.alert { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.banner.alert { background: var(--danger-soft); color: var(--text); border-top: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); justify-content: flex-start; text-align: left; }
.banner.alert svg.i { color: var(--danger); }
.banner.alert span { flex: 1; min-width: 0; }
.banner.alert small { color: var(--muted); }

/* barra de mensagem: emojis, menu de anexos e gravação de áudio */
.pop-emoji, .pop-attach { position: absolute; bottom: calc(100% + 6px); left: 12px; z-index: 6; background: var(--modal); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); }
.pop-emoji { width: min(360px, calc(100vw - 24px)); padding: 8px; }
.pe-tabs { display: flex; gap: 4px; padding: 2px 2px 8px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.pe-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding-top: 8px; max-height: 220px; overflow-y: auto; }
.pe-grid button { border: 0; background: none; font-size: 22px; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.pe-grid button:hover, .pe-grid button:focus-visible { background: var(--hover); }
.pop-attach { left: 52px; padding: 6px; min-width: 300px; }
.pop-attach button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.pop-attach button:hover, .pop-attach button:focus-visible { background: var(--hover); }
.pop-attach .pa-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); color: var(--accent-ink); flex: none; }
.pop-attach b { display: block; font-weight: 500; font-size: 14px; }
.pop-attach small { display: block; color: var(--muted); font-size: 12px; }
.composer.recording > :not(.rec-bar):not(.pop-emoji):not(.pop-attach) { display: none; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 40px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recblink 1s ease-in-out infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.2em; }
.rec-hint { color: var(--muted); flex: 1; }
.rec-bar #rec-send { background: var(--accent); color: var(--on-accent); }
@keyframes recblink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
@media (max-width: 900px) { .pop-attach { left: 8px; right: 8px; min-width: 0; } .composer #btn-qr { display: none; } }

/* logo da empresa (cadastro de empresas) */
.logo-pick { display: flex; gap: 14px; align-items: flex-start; }
.logo-prev { width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.logo-prev span { font-size: 26px; font-weight: 700; color: #2f3a42; }
.logo-pick .btn { margin: 0 6px 6px 0; }
.logo-mini { width: 34px; height: 34px; border-radius: 9px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex: none; font-weight: 700; color: #2f3a42; }
.logo-mini img { width: 100%; height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------- loja */
.st-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 16px 28px 0; }
.st-bar + .page-body { padding-top: 14px; }
.st-bar .tabs .chip.active { background: var(--ink); color: var(--panel); }
.st-sum { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; font-size: 14px; color: var(--muted); }
.st-sum.total { color: var(--text); font-size: 16px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.st-chat { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 420px; overflow-y: auto; padding: 10px; background: var(--panel-2); border-radius: 8px; }
.st-m { align-self: flex-start; max-width: 80%; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13.5px; }
.st-m.me { align-self: flex-end; background: var(--active); }
.st-m small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.st-sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; }
.tnum { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .st-bar { padding: 12px 16px 0; } .st-bar .input { flex: 1 1 140px; } }
